Example #1
0
def test_get_contract_instance(erc1155_contract, ethereum_testnet_config):
    """Test the get contract instance method."""
    contract, contract_address = erc1155_contract
    ethereum_api = EthereumApi(**ethereum_testnet_config)
    interface = {"abi": [], "bytecode": b""}
    instance = ethereum_api.get_contract_instance(
        contract_interface=interface, contract_address=contract_address,
    )
    assert str(type(instance)) == "<class 'web3._utils.datatypes.Contract'>"
    instance = ethereum_api.get_contract_instance(contract_interface=interface,)
    assert (
        str(type(instance)) == "<class 'web3._utils.datatypes.PropertyCheckingFactory'>"
    )
Example #2
0
def test_get_contract_instance():
    """Test the get contract instance method."""
    contract_address = "0x250A2aeb3eB84782e83365b4c42dbE3CDA9920e4"
    ethereum_api = EthereumApi(**ETHEREUM_TESTNET_CONFIG)
    interface = {"abi": [], "bytecode": b""}
    instance = ethereum_api.get_contract_instance(
        contract_interface=interface, contract_address=contract_address,
    )
    assert str(type(instance)) == "<class 'web3._utils.datatypes.Contract'>"
    instance = ethereum_api.get_contract_instance(contract_interface=interface,)
    assert (
        str(type(instance)) == "<class 'web3._utils.datatypes.PropertyCheckingFactory'>"
    )