From a81c03bc76713d27b9a67df0322c055fc409c150 Mon Sep 17 00:00:00 2001 From: Alexander Kolotov Date: Thu, 31 May 2018 20:39:36 +0300 Subject: [PATCH] added support of two types of JSON files for abi a contract API will be initialized if JSON represents ABI (list of methods) or contains complete description of the contract (dictionary with abi field) --- erc20/utils/web3.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erc20/utils/web3.py b/erc20/utils/web3.py index 6a1729c..7cafbc0 100644 --- a/erc20/utils/web3.py +++ b/erc20/utils/web3.py @@ -29,6 +29,9 @@ def initContractAtAddress(_web3, _file, _address): contract_abi = jload(f) f.close() + if type(contract_abi) == dict: + contract_abi = contract_abi['abi'] + contract_factory = _web3.eth.contract( abi = contract_abi, )