This repository has been archived on 2020-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
py-gva/pay.py

26 lines
641 B
Python
Raw Normal View History

2020-11-13 20:18:16 +01:00
#!/usr/bin/env python3
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
# 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]
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))
sys.exit(1)
2020-11-15 09:12:37 +01:00
# Execute workflow
## 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='')
# Confirm TX document is ok, sign and send it
if docIsOK:
returnSigned = signDoc(returnGen)
sendTXDoc(returnSigned)
2020-11-13 20:18:16 +01:00