fix no constructor

pull/14/head
yhtiyar 2021-11-09 12:44:24 +03:00
rodzic d8322c2a39
commit 808acda954
1 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -96,10 +96,10 @@ def generate_contract_class(
]
),
)
contract_constructor = [c for c in abi if c["type"] == "constructor"]
if len(contract_constructor) == 1:
contract_constructor = contract_constructor[0]
elif len(contract_constructor) == 0:
contract_constructors = [c for c in abi if c["type"] == "constructor"]
if len(contract_constructors) == 1:
contract_constructor = contract_constructors[0]
elif len(contract_constructors) == 0:
contract_constructor = {"inputs": []}
else:
raise ValueError("Multiple constructors found in ABI")
@ -268,10 +268,10 @@ def generate_argument_parser_function(abi: List[Dict[str, Any]]) -> cst.Function
subparsers.extend(generate_function_subparser(function_abi, "description"))
# Deploy argparser:
contract_constructor = [item for item in abi if item["type"] == "constructor"]
if len(contract_constructor) == 1:
contract_constructor = contract_constructor[0]
elif len(contract_constructor) == 0:
contract_constructors = [item for item in abi if item["type"] == "constructor"]
if len(contract_constructors) == 1:
contract_constructor = contract_constructors[0]
elif len(contract_constructors) == 0:
contract_constructor = {"inputs": []}
else:
raise Exception("Multiple constructors found")