Skip to content
Snippets Groups Projects

Transaction confirmation chart \o/

Merged Moul requested to merge tx_confirmation into master
1 file
+ 18
3
Compare changes
  • Side-by-side
  • Inline
+ 18
3
@@ -237,10 +237,10 @@ def cmd_transaction(ep, c):
@@ -237,10 +237,10 @@ def cmd_transaction(ep, c):
print("--output is not set")
print("--output is not set")
exit()
exit()
 
du = get_last_du_value(ep)
if c.contains_definitions('amount'):
if c.contains_definitions('amount'):
amount = int(float(c.get_definition('amount')) * 100)
amount = int(float(c.get_definition('amount')) * 100)
if c.contains_definitions('amountDU'):
if c.contains_definitions('amountDU'):
du = get_last_du_value(ep)
amount = int(float(c.get_definition('amountDU')) * du)
amount = int(float(c.get_definition('amountDU')) * du)
output = c.get_definition('output')
output = c.get_definition('output')
@@ -260,9 +260,24 @@ def cmd_transaction(ep, c):
@@ -260,9 +260,24 @@ def cmd_transaction(ep, c):
else:
else:
outputBackChange = None
outputBackChange = None
 
tx = list()
 
currency_name = get_current_block(ep)["currency"]
 
tx.append(["amount (" + currency_name + ")", amount / 100])
 
tx.append(["amount (DU " + currency_name + ")", amount / du])
 
pubkey = get_publickey_from_seed(seed)
 
tx.append(["from", pubkey])
 
id_from = get_uid_from_pubkey(ep, pubkey)
 
if id_from is not NO_MATCHING_ID:
 
tx.append(["from (id)", id_from])
 
tx.append(["to", output])
 
id_to = get_uid_from_pubkey(ep, output)
 
if id_to is not NO_MATCHING_ID:
 
tx.append(["to (id)", id_to])
 
tx.append(["comment", comment])
 
if c.contains_switches('yes') or c.contains_switches('y') or \
if c.contains_switches('yes') or c.contains_switches('y') or \
input("Do you confirm sending {} {} from {} to {} with \"{}\" as comment? [yes/no]: "
input(tabulate(tx, tablefmt="fancy_grid") + \
.format(amount, get_current_block(ep)["currency"], get_publickey_from_seed(seed), output, comment)) == "yes":
"\nDo you confirm sending this transaction? [yes/no]: ") == "yes":
generate_and_send_transaction(ep, seed, amount, output, comment, allSources, outputBackChange)
generate_and_send_transaction(ep, seed, amount, output, comment, allSources, outputBackChange)
Loading