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