2020-11-13 20:18:16 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2020-11-17 03:11:07 +01:00
|
|
|
import sys
|
2020-11-17 04:15:24 +01:00
|
|
|
from libs.paylib import sendGenDoc, checkTXDoc, signDoc, sendTXDoc
|
2020-11-15 09:12:37 +01:00
|
|
|
|
2020-11-17 03:11:07 +01:00
|
|
|
# Get args
|
2020-11-14 18:47:42 +01:00
|
|
|
try:
|
2020-11-15 09:12:37 +01:00
|
|
|
recipient = sys.argv[1]
|
|
|
|
amount = int(sys.argv[2])
|
|
|
|
if len(sys.argv) > 3:
|
|
|
|
comment = sys.argv[3]
|
2020-11-17 03:11:07 +01:00
|
|
|
except Exception as e:
|
2020-11-17 03:39:13 +01:00
|
|
|
print("Please enter the recipient's public and the amount\n" + str(e))
|
2020-11-17 03:11:07 +01:00
|
|
|
sys.exit(1)
|
2020-11-15 09:12:37 +01:00
|
|
|
|
|
|
|
# Execute workflow
|
2020-11-17 03:11:07 +01:00
|
|
|
## Generate TX document from server and check it
|
2020-11-17 04:15:24 +01:00
|
|
|
returnGen = sendGenDoc(recipient, amount, comment='')
|
|
|
|
docIsOK = checkTXDoc(returnGen, recipient, amount, comment='')
|
2020-11-17 03:11:07 +01:00
|
|
|
|
|
|
|
# Confirm TX document is ok, sign and send it
|
|
|
|
if docIsOK:
|
|
|
|
returnSigned = signDoc(returnGen)
|
|
|
|
sendTXDoc(returnSigned)
|
2020-11-13 20:18:16 +01:00
|
|
|
|