Skip to main content
Sign in
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
Branches
Tags
1 merge request!68[enh] #46: Add-up pubkeys balances:
......@@ -218,21 +218,28 @@ def list_issuers(ep, nbr, last):
def cmd_amount(ep, c):
if c.contains_definitions('pubkey'):
pubkey = c.get_definition('pubkey')
if c.contains_definitions("pubkeys"):
pubkeys = c.get_definition("pubkeys").split(":")
for pubkey in pubkeys:
pubkey = check_public_key(pubkey, True)
if not pubkey:
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:
seed = auth_method(c)
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]
amount = value[1]
# output
......
......
......@@ -19,8 +19,8 @@ def usage():
\nCommands: \
\n - info: Display information about currency \
\n \
\n - amount: Get amount of one account \
\n --pubkey=<pubkey[:checksum]>\
\n - amount: Get amount of accounts \
\n --pubkeys=<pubkey:pubkey:pubkey>\
\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 \
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment