Skip to content

Commit

Permalink
Bugfix to command-line wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
jspada committed Jan 30, 2021
1 parent bd27393 commit 0680a71
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions utils/mina_ledger_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@

__version__ = "1.0.0"

def to_currency(amount):
return float(amount)/COIN

def from_currency(amount):
return int(float(amount)*COIN)

def valid_account(num):
try:
value = int(num)
Expand All @@ -40,12 +46,12 @@ def valid_account(num):

def valid_amount(amount):
try:
value = int(amount)
value = from_currency(amount)
if value < 0 or value > MAX_AMOUNT:
raise
except:
raise argparse.ArgumentTypeError("Must be in [0,{}]".format(MAX_AMOUNT))
return value
return amount

def valid_nonce(nonce):
try:
Expand Down Expand Up @@ -638,12 +644,6 @@ def print_cstruct(str):
i += 1
print("\n};", flush=True)

def to_currency(amount):
return float(amount)/COIN

def from_currency(amount):
return int(float(amount)*COIN)

def tx_type_name(op):
if op == "send-payment":
return "Payment"
Expand Down

0 comments on commit 0680a71

Please sign in to comment.