raise error on invalid input
This commit is contained in:
parent
4da0e5812f
commit
71d157a482
8
parse.py
8
parse.py
@ -396,6 +396,8 @@ def voucher_transfer_handler(cmd):
|
||||
s = data[voucher_name]
|
||||
elif str(cmd.a).startswith("AddressAgent"):
|
||||
s = "0x" + str(cmd.a).split(":")[1]
|
||||
else:
|
||||
raise ValueError(f"Invalid command: {cmd.t}. Expected 'NameAgent' or 'AddressAgent'.")
|
||||
|
||||
if str(cmd.t).startswith("NameAgent"):
|
||||
key_name = str(cmd.t).split(":")[1]
|
||||
@ -405,6 +407,8 @@ def voucher_transfer_handler(cmd):
|
||||
to = acct.address
|
||||
elif str(cmd.t).startswith("AddressAgent"):
|
||||
to = "0x" + str(cmd.t).split(":")[1]
|
||||
else:
|
||||
raise ValueError(f"Invalid command: {cmd.t}. Expected 'NameAgent' or 'AddressAgent'.")
|
||||
|
||||
command = (
|
||||
f'cast send --private-key {privatekey} '
|
||||
@ -432,6 +436,8 @@ def voucher_mint_handler(cmd):
|
||||
to = acct.address
|
||||
elif str(cmd.t).startswith("AddressAgent"):
|
||||
to = "0x" + str(cmd.t).split(":")[1]
|
||||
else:
|
||||
raise ValueError(f"Invalid command: {cmd.t}. Expected 'NameAgent' or 'AddressAgent'.")
|
||||
|
||||
if str(cmd.a).startswith("NameAgent"):
|
||||
voucher_name = str(cmd.a).split(":")[1]
|
||||
@ -441,6 +447,8 @@ def voucher_mint_handler(cmd):
|
||||
privatekey = data["owner"]
|
||||
elif str(cmd.a).startswith("AddressAgent"):
|
||||
s = "0x" + str(cmd.a).split(":")[1]
|
||||
else:
|
||||
raise ValueError(f"Invalid command: {cmd.t}. Expected 'NameAgent' or 'AddressAgent'.")
|
||||
|
||||
command = (
|
||||
f'cast send --private-key {privatekey} '
|
||||
|
Loading…
Reference in New Issue
Block a user