Skip to content
Snippets Groups Projects
Commit 3268d196 authored by Moul's avatar Moul
Browse files

[enh] #46: Add-up pubkeys amounts:

- retrieve pubkey amounts from outside display f().
- rename argument from "pubkey" –> "pubkeys".
- allows passing many pubkeys as argument.
- display pubkeys amounts in a loop.
- display add-up at the end whether several pubkeys have been specified.
parent f6a0bc57
No related branches found
No related tags found
1 merge request!68[enh] #46: Add-up pubkeys balances:
...@@ -218,21 +218,28 @@ def list_issuers(ep, nbr, last): ...@@ -218,21 +218,28 @@ def list_issuers(ep, nbr, last):
def cmd_amount(ep, c): def cmd_amount(ep, c):
if c.contains_definitions('pubkey'): if c.contains_definitions("pubkeys"):
pubkey = c.get_definition('pubkey') pubkeys = c.get_definition("pubkeys").split(":")
for pubkey in pubkeys:
pubkey = check_public_key(pubkey, True) pubkey = check_public_key(pubkey, True)
if not pubkey: if not pubkey:
return return
total = [0, 0]
for pubkey in pubkeys:
value = get_amount_from_pubkey(ep, pubkey)
show_amount_from_pubkey(ep, pubkey, value)
total[0] += value[0]
total[1] += value[1]
if (len(pubkeys) > 1):
show_amount_from_pubkey(ep, "Total", total)
else: else:
seed = auth_method(c) seed = auth_method(c)
pubkey = get_publickey_from_seed(seed) pubkey = get_publickey_from_seed(seed)
show_amount_from_pubkey(ep, pubkey, get_amount_from_pubkey(ep, pubkey))
show_amount_from_pubkey(ep, pubkey)
def show_amount_from_pubkey(ep, pubkey, value):
def show_amount_from_pubkey(ep, pubkey):
value = get_amount_from_pubkey(ep, pubkey)
totalAmountInput = value[0] totalAmountInput = value[0]
amount = value[1] amount = value[1]
# output # output
......
...@@ -19,8 +19,8 @@ def usage(): ...@@ -19,8 +19,8 @@ def usage():
\nCommands: \ \nCommands: \
\n - info: Display information about currency \ \n - info: Display information about currency \
\n \ \n \
\n - amount: Get amount of one account \ \n - amount: Get amount of accounts \
\n --pubkey=<pubkey[:checksum]>\ \n --pubkeys=<pubkey:pubkey:pubkey>\
\n --auth-scrypt [script parameters -n <N> -r <r> -p <p>] (default: 4096,16,1)\ \n --auth-scrypt [script parameters -n <N> -r <r> -p <p>] (default: 4096,16,1)\
\n --auth-seed | --auth-file [--file=<path file>] | --auth-wif\ \n --auth-seed | --auth-file [--file=<path file>] | --auth-wif\
\n \ \n \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment