Ejemplo n.º 1
0
def test_ethereum_api_get_deploy_transaction(*args):
    """Test EthereumApi.get_deploy_transaction."""
    ethereum_api = EthereumApi()
    with patch.object(ethereum_api.api.eth, "getTransactionCount", return_value=None):
        assert (
            ethereum_api.get_deploy_transaction(
                {"acc": "acc"}, "0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7"
            )
            is None
        )
Ejemplo n.º 2
0
def test_get_deploy_transaction(ethereum_testnet_config, ganache):
    """Test the get deploy transaction method."""
    ethereum_api = EthereumApi(**ethereum_testnet_config)
    ec2 = EthereumCrypto()
    interface = {"abi": [], "bytecode": b""}
    deploy_tx = ethereum_api.get_deploy_transaction(
        contract_interface=interface, deployer_address=ec2.address,
    )
    assert type(deploy_tx) == dict and len(deploy_tx) == 6
    assert all(
        key in ["from", "value", "gas", "gasPrice", "nonce", "data"]
        for key in deploy_tx.keys()
    )