diff --git a/parse.py b/parse.py index fe5bdf4..2bdea53 100644 --- a/parse.py +++ b/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] @@ -404,7 +406,9 @@ def voucher_transfer_handler(cmd): acct = w3.eth.account.from_key(data["private_key"]) to = acct.address 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 = ( 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} '