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

29 lines
641 B
Python
Executable File

#!/usr/bin/env python3
import sys
sys.path.insert(1, 'libs')
from paylib import *
# Get args
try:
recipient = sys.argv[1]
amount = int(sys.argv[2])
if len(sys.argv) > 3:
comment = sys.argv[3]
else:
comment = ""
except Exception as e:
print("Please enter the recipient's public and the amount\n" + str(e))
sys.exit(1)
# Execute workflow
## Generate TX document from server and check it
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)