gnosis.eth package
Subpackages
Submodules
gnosis.eth.constants module
gnosis.eth.ethereum_client module
- class gnosis.eth.ethereum_client.BatchCallManager(ethereum_client: EthereumClient)
Bases:
EthereumClientManager
- batch_call(contract_functions: Iterable[ContractFunction], from_address: Optional[ChecksumAddress] = None, raise_exception: bool = True, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = 'latest') List[Optional[Any]]
Do batch requests of multiple contract calls
- Parameters
contract_functions – Iterable of contract functions using web3.py contracts. For instance, a valid argument would be [erc20_contract.functions.balanceOf(address), erc20_contract.functions.decimals()]
from_address – Use this address as from in every call if provided
block_identifier – latest by default
raise_exception – If False, exception will not be raised if there’s any problem and instead None will be returned as the value.
- Returns
List with the ABI decoded return values
- batch_call_custom(payloads: Iterable[Dict[str, Any]], raise_exception: bool = True, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = 'latest') List[Optional[Any]]
Do batch requests of multiple contract calls
- Parameters
payloads – Iterable of Dictionaries with at least {‘data’: ‘<hex-string>’, ‘output_type’: <solidity-output-type>, ‘to’: ‘<checksummed-address>’}. from can also be provided and if fn_name is provided it will be used for debugging purposes
raise_exception – If False, exception will not be raised if there’s any problem and instead None will be returned as the value
block_identifier – latest by default
- Returns
List with the ABI decoded return values
- Raises
ValueError if raise_exception=True
- batch_call_same_function(contract_function: ContractFunction, contract_addresses: Sequence[ChecksumAddress], from_address: Optional[ChecksumAddress] = None, raise_exception: bool = True, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = 'latest') List[Optional[Any]]
Do batch requests using the same function to multiple address.
batch_call
could be used to achieve that, but generating the ContractFunction is slow, so this function allows to use the same contract_function for multiple addresses- Parameters
contract_function –
contract_addresses –
from_address –
raise_exception –
block_identifier –
- Returns
- class gnosis.eth.ethereum_client.Erc20Info(name, symbol, decimals)
Bases:
tuple
- decimals: int
Alias for field number 2
- name: str
Alias for field number 0
- symbol: str
Alias for field number 1
- class gnosis.eth.ethereum_client.Erc20Manager(ethereum_client: EthereumClient)
Bases:
EthereumClientManager
Manager for ERC20 operations
- TRANSFER_TOPIC = HexBytes('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef')
- decode_logs(logs: List[LogReceipt])
- get_balance(address: str, token_address: str) int
Get balance of address for erc20_address
- Parameters
address – owner address
token_address – erc20 token address
- Returns
balance
- get_balances(address: str, token_addresses: List[str]) List[BalanceDict]
Get balances for Ether and tokens for an address
- Parameters
address – Owner address checksummed
token_addresses – token addresses to check
- Returns
List[BalanceDict]
- get_decimals(erc20_address: str) int
- get_info(erc20_address: str) Erc20Info
Get erc20 information (name, symbol and decimals). Use batching to get all info in the same request.
- Parameters
erc20_address –
- Returns
Erc20Info
- Raises
InvalidERC20Info
- get_name(erc20_address: str) str
- get_symbol(erc20_address: str) str
- get_total_transfer_history(addresses: Optional[Sequence[ChecksumAddress]] = None, from_block: Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int] = 0, to_block: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = None, token_address: Optional[ChecksumAddress] = None) List[Dict[str, Any]]
Get events for erc20 and erc721 transfers from and to an address. We decode it manually. Example of an erc20 event:
{'logIndex': 0, 'transactionIndex': 0, 'transactionHash': HexBytes('0x4d0f25313603e554e3b040667f7f391982babbd195c7ae57a8c84048189f7794'), 'blockHash': HexBytes('0x90fa67d848a0eaf3be625235dae28815389f5292d4465c48d1139f0c207f8d42'), 'blockNumber': 791, 'address': '0xf7d0Bd47BF3214494E7F5B40E392A25cb4788620', 'data': '0x000000000000000000000000000000000000000000000000002001f716742000', 'topics': [HexBytes('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'), HexBytes('0x000000000000000000000000f5984365fca2e3bc7d2e020abb2c701df9070eb7'), HexBytes('0x0000000000000000000000001df62f291b2e969fb0849d99d9ce41e2f137006e')], 'type': 'mined' 'args': {'from': '0xf5984365FcA2e3bc7D2E020AbB2c701DF9070eB7', 'to': '0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e', 'value': 9009360000000000 } } An example of an erc721 event {'address': '0x6631FcbB50677DfC6c02CCDcc03a8f68Db427a64', 'blockHash': HexBytes('0x95c71c6c9373e9a8ca2c767dda1cd5083eb6addcce36fc216c9e1f458d6970f9'), 'blockNumber': 5341681, 'data': '0x', 'logIndex': 0, 'removed': False, 'topics': [HexBytes('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'), HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), HexBytes('0x000000000000000000000000b5239c032ab9fb5abfc3903e770a4b6a9095542c'), HexBytes('0x0000000000000000000000000000000000000000000000000000000000000063')], 'transactionHash': HexBytes('0xce8c8af0503e6f8a421345c10cdf92834c95186916a3f5b1437d2bba63d2db9e'), 'transactionIndex': 0, 'transactionLogIndex': '0x0', 'type': 'mined', 'args': {'from': '0x0000000000000000000000000000000000000000', 'to': '0xb5239C032AB9fB5aBFc3903e770A4B6a9095542C', 'tokenId': 99 } } An example of unknown transfer event (no indexed parts), could be a ERC20 or ERC721 transfer: {'address': '0x6631FcbB50677DfC6c02CCDcc03a8f68Db427a64', 'blockHash': HexBytes('0x95c71c6c9373e9a8ca2c767dda1cd5083eb6addcce36fc216c9e1f458d6970f9'), 'blockNumber': 5341681, 'data': '0x', 'logIndex': 0, 'removed': False, 'topics': [HexBytes('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'), HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), HexBytes('0x000000000000000000000000b5239c032ab9fb5abfc3903e770a4b6a9095542c'), HexBytes('0x0000000000000000000000000000000000000000000000000000000000000063')], 'transactionHash': HexBytes('0xce8c8af0503e6f8a421345c10cdf92834c95186916a3f5b1437d2bba63d2db9e'), 'transactionIndex': 0, 'transactionLogIndex': '0x0', 'type': 'mined', 'args': {'from': '0x0000000000000000000000000000000000000000', 'to': '0xb5239C032AB9fB5aBFc3903e770A4B6a9095542C', 'unknown': 99 } }
- Parameters
addresses – Search events from and to these addresses. If not, every transfer event within the range will be retrieved
from_block – Block to start querying from
to_block – Block to stop querying from
token_address – Address of the token
- Returns
List of events sorted by blockNumber
- get_transfer_history(from_block: int, to_block: Optional[int] = None, from_address: Optional[str] = None, to_address: Optional[str] = None, token_address: Optional[str] = None) List[Dict[str, Any]]
DON’T USE, it will fail in some cases until they fix https://github.com/ethereum/web3.py/issues/1351 Get events for erc20/erc721 transfers. At least one of from_address, to_address or token_address must be defined. Example of decoded event:
{ "args": { "from": "0x1Ce67Ea59377A163D47DFFc9BaAB99423BE6EcF1", "to": "0xaE9E15896fd32E59C7d89ce7a95a9352D6ebD70E", "value": 15000000000000000 }, "event": "Transfer", "logIndex": 42, "transactionIndex": 60, "transactionHash": "0x71d6d83fef3347bad848e83dfa0ab28296e2953de946ee152ea81c6dfb42d2b3", "address": "0xfecA834E7da9D437645b474450688DA9327112a5", "blockHash": "0x054de9a496fc7d10303068cbc7ee3e25181a3b26640497859a5e49f0342e7db2", "blockNumber": 7265022 }
- Parameters
from_block – Block to start querying from
to_block – Block to stop querying from
from_address – Address sending the erc20 transfer
to_address – Address receiving the erc20 transfer
token_address – Address of the token
- Returns
List of events (decoded)
- Throws
ReadTimeout
- send_tokens(to: str, amount: int, erc20_address: str, private_key: str, nonce: Optional[int] = None, gas_price: Optional[int] = None, gas: Optional[int] = None) bytes
Send tokens to address
- Parameters
to –
amount –
erc20_address –
private_key –
nonce –
gas_price –
gas –
- Returns
tx_hash
- class gnosis.eth.ethereum_client.Erc721Info(name, symbol)
Bases:
tuple
- name: str
Alias for field number 0
- symbol: str
Alias for field number 1
- class gnosis.eth.ethereum_client.Erc721Manager(ethereum_client: EthereumClient)
Bases:
EthereumClientManager
- TRANSFER_TOPIC = HexBytes('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef')
- get_balance(address: str, token_address: str) int
Get balance of address for erc20_address
- Parameters
address – owner address
token_address – erc721 token address
- Returns
balance
- get_balances(address: str, token_addresses: List[str]) List[TokenBalance]
Get balances for tokens for an address. If there’s a problem with a token_address 0 will be returned for balance
- Parameters
address – Owner address checksummed
token_addresses – token addresses to check
- Returns
- get_info(token_address: str) Erc721Info
Get erc721 information (name, symbol). Use batching to get all info in the same request.
- Parameters
token_address –
- Returns
Erc721Info
- get_owners(token_addresses_with_token_ids: Sequence[Tuple[str, int]]) List[Optional[ChecksumAddress]]
- Parameters
token_addresses_with_token_ids – Tuple(token_address: str, token_id: int)
- Returns
List of owner addresses, None if not found
- get_token_uris(token_addresses_with_token_ids: Sequence[Tuple[str, int]]) List[Optional[str]]
- Parameters
token_addresses_with_token_ids – Tuple(token_address: str, token_id: int)
- Returns
List of token_uris, None if not found
- class gnosis.eth.ethereum_client.EthereumClient(ethereum_node_url: URI = 'http://localhost:8545', provider_timeout: int = 15, slow_provider_timeout: int = 60, retry_count: int = 3, use_caching_middleware: bool = True)
Bases:
object
Manage ethereum operations. Uses web3 for the most part, but some other stuff is implemented from scratch. Note: If you want to use pending state with Parity, it must be run with –pruning=archive or –force-sealing
- NULL_ADDRESS = '0x0000000000000000000000000000000000000000'
- batch_call(contract_functions: Iterable[ContractFunction], from_address: Optional[ChecksumAddress] = None, raise_exception: bool = True, force_batch_call: bool = False, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = 'latest') List[Optional[Union[bytes, Any]]]
Call multiple functions. Multicall contract by MakerDAO will be used by default if available
- Parameters
contract_functions –
from_address – Only available when
Multicall
is not usedraise_exception – If
True
, raiseBatchCallException
if one of the calls failsforce_batch_call – If
True
, ignore multicall and always use batch calls to get the result (less optimal). IfFalse
, more optimal way will be tried.block_identifier –
- Returns
List of elements decoded to their types,
None
if they cannot be decoded and bytes if a revert error is returned andraise_exception=False
- Raises
BatchCallException
- batch_call_same_function(contract_function: ContractFunction, contract_addresses: Sequence[ChecksumAddress], from_address: Optional[ChecksumAddress] = None, raise_exception: bool = True, force_batch_call: bool = False, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = 'latest') List[Optional[Union[bytes, Any]]]
Call the same function in multiple contracts. Way more optimal than using batch_call generating multiple
ContractFunction
objects.- Parameters
contract_function –
contract_addresses –
from_address – Only available when
Multicall
is not usedraise_exception – If
True
, raiseBatchCallException
if one of the calls failsforce_batch_call – If
True
, ignore multicall and always use batch calls to get the result (less optimal). IfFalse
, more optimal way will be tried.block_identifier –
- Returns
List of elements decoded to the same type,
None
if they cannot be decoded and bytes if a revert error is returned andraise_exception=False
- Raises
BatchCallException
- check_tx_with_confirmations(tx_hash: Union[Hash32, HexBytes, HexStr], confirmations: int) bool
Check tx hash and make sure it has the confirmations required
- Parameters
tx_hash – Hash of the tx
confirmations – Minimum number of confirmations required
- Returns
True if tx was mined with the number of confirmations required, False otherwise
- property current_block_number
- deploy_and_initialize_contract(deployer_account: LocalAccount, constructor_data: bytes, initializer_data: bytes = b'', check_receipt: bool = True)
- static estimate_data_gas(data: bytes)
- estimate_fee_eip1559(tx_speed: TxSpeed = TxSpeed.NORMAL) Tuple[int, int]
Check https://github.com/ethereum/execution-apis/blob/main/src/eth/fee_market.json#L15
- Returns
Tuple[BaseFeePerGas, MaxPriorityFeePerGas]
- Raises
ValueError if not supported on the network
- estimate_gas(to: str, from_: Optional[str] = None, value: Optional[int] = None, data: Optional[Union[bytes, HexStr]] = None, gas: Optional[int] = None, gas_price: Optional[int] = None, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = None) int
Estimate gas calling eth_estimateGas
- Parameters
from –
to –
value –
data –
gas –
gas_price –
block_identifier – Be careful, Geth does not support pending when estimating
- Returns
Amount of gas needed for transaction
- Raises
ValueError
- get_balance(address: ChecksumAddress, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = None)
- get_block(block_identifier: Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int], full_transactions: bool = False) Optional[BlockData]
- get_blocks(block_identifiers: Iterable[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]], full_transactions: bool = False) List[Optional[BlockData]]
- get_chain_id() int
- Returns
ChainId returned by the RPC eth_chainId method. It should never change, so it’s cached.
- get_client_version() str
- Returns
RPC version information
- get_network() EthereumNetwork
Get network name based on the chainId
- Returns
EthereumNetwork based on the chainId. If network is not on our list, EthereumNetwork.UNKOWN is returned
- get_nonce_for_account(address: ChecksumAddress, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = 'latest')
Get nonce for account. getTransactionCount is the only method for what pending is currently working (Geth and Parity)
- Parameters
address –
block_identifier –
- Returns
- get_transaction(tx_hash: Union[Hash32, HexBytes, HexStr]) Optional[TxData]
- get_transaction_receipt(tx_hash: Union[Hash32, HexBytes, HexStr], timeout=None) Optional[TxReceipt]
- get_transaction_receipts(tx_hashes: Sequence[Union[bytes, HexStr]]) List[Optional[TxReceipt]]
- get_transactions(tx_hashes: List[Union[Hash32, HexBytes, HexStr]]) List[Optional[TxData]]
- is_contract(contract_address: ChecksumAddress) bool
- is_eip1559_supported() EthereumNetwork
- Returns
True if EIP1559 is supported by the node, False otherwise
- property multicall: Multicall
- static private_key_to_address(private_key)
- send_eth_to(private_key: str, to: str, gas_price: int, value: Wei, gas: Optional[int] = None, nonce: Optional[int] = None, retry: bool = False, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = 'pending') bytes
Send ether using configured account
- Parameters
private_key – to
to – to
gas_price – gas_price
value – value(wei)
gas – gas, defaults to 22000
retry – Retry if a problem is found
nonce – Nonce of sender account
block_identifier – Block identifier for nonce calculation
- Returns
tx_hash
- send_raw_transaction(raw_transaction: Union[bytes, HexStr]) HexBytes
- send_transaction(transaction_dict: TxParams) HexBytes
- send_unsigned_transaction(tx: TxParams, private_key: Optional[str] = None, public_key: Optional[str] = None, retry: bool = False, block_identifier: Optional[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]] = 'pending') HexBytes
Send a tx using an unlocked public key in the node or a private key. Both public_key and private_key cannot be None
- Parameters
tx –
private_key –
public_key –
retry – Retry if a problem with nonce is found
block_identifier – For nonce calculation, recommended is pending
- Returns
tx hash
- class gnosis.eth.ethereum_client.EthereumClientManager(ethereum_client: EthereumClient)
Bases:
object
- class gnosis.eth.ethereum_client.EthereumClientProvider
Bases:
object
- class gnosis.eth.ethereum_client.EthereumTxSent(tx_hash, tx, contract_address)
Bases:
tuple
- contract_address: Optional[str]
Alias for field number 2
- tx: TxParams
Alias for field number 1
- tx_hash: bytes
Alias for field number 0
- class gnosis.eth.ethereum_client.ParityManager(ethereum_client: EthereumClient)
Bases:
EthereumClientManager
- filter_out_errored_traces(internal_txs: Sequence[Dict[str, Any]]) Sequence[Dict[str, Any]]
Filter out errored transactions (traces that are errored or that have an errored parent)
- Parameters
internal_txs – Traces for the SAME ethereum tx, sorted ascending by trace_address sorted(t, key = lambda i: i[‘traceAddress’]). It’s the default output from methods returning traces like trace_block or trace_transaction
- Returns
List of not errored traces
- get_next_traces(tx_hash: Union[Hash32, HexBytes, HexStr], trace_address: Sequence[int], remove_delegate_calls: bool = False, remove_calls: bool = False) List[Dict[str, Any]]
- Parameters
tx_hash –
trace_address –
remove_delegate_calls – If True remove delegate calls from result
remove_calls – If True remove calls from result
- Returns
Children for a trace, E.g. if address is [0, 1] and number_traces = 1, it will return [0, 1, x]
- Raises
ValueError
if tracing is not supported
- get_previous_trace(tx_hash: Union[Hash32, HexBytes, HexStr], trace_address: Sequence[int], number_traces: int = 1, skip_delegate_calls: bool = False) Optional[Dict[str, Any]]
- Parameters
tx_hash –
trace_address –
number_traces – Number of traces to skip, by default get the immediately previous one
skip_delegate_calls – If True filter out delegate calls
- Returns
Parent trace for a trace
- Raises
ValueError
if tracing is not supported
- trace_block(block_identifier: Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]) List[Dict[str, Any]]
- trace_blocks(block_identifiers: List[Union[Literal['latest', 'earliest', 'pending'], BlockNumber, Hash32, HexStr, HexBytes, int]]) List[List[Dict[str, Any]]]
- trace_filter(from_block: int = 1, to_block: Optional[int] = None, from_address: Optional[Sequence[ChecksumAddress]] = None, to_address: Optional[Sequence[ChecksumAddress]] = None, after: Optional[int] = None, count: Optional[int] = None) List[Dict[str, Any]]
Get events using
trace_filter
method- Parameters
from_block – Quantity or Tag - (optional) From this block. 0 is not working, it needs to be >= 1
to_block – Quantity or Tag - (optional) To this block.
from_address – Array - (optional) Sent from these addresses.
to_address – Address - (optional) Sent to these addresses.
after – Quantity - (optional) The offset trace number
count – Quantity - (optional) Integer number of traces to display in a batch.
- Returns
[ { "action": { "callType": "call", "from": "0x32be343b94f860124dc4fee278fdcbd38c102d88", "gas": "0x4c40d", "input": "0x", "to": "0x8bbb73bcb5d553b5a556358d27625323fd781d37", "value": "0x3f0650ec47fd240000" }, "blockHash": "0x86df301bcdd8248d982dbf039f09faf792684e1aeee99d5b58b77d620008b80f", "blockNumber": 3068183, "result": { "gasUsed": "0x0", "output": "0x" }, "subtraces": 0, "traceAddress": [], "transactionHash": "0x3321a7708b1083130bd78da0d62ead9f6683033231617c9d268e2c7e3fa6c104", "transactionPosition": 3, "type": "call" }, { "action": { "from": "0x3b169a0fb55ea0b6bafe54c272b1fe4983742bf7", "gas": "0x49b0b", "init": "0x608060405234801561001057600080fd5b5060405161060a38038061060a833981018060405281019080805190602001909291908051820192919060200180519060200190929190805190602001909291908051906020019092919050505084848160008173ffffffffffffffffffffffffffffffffffffffff1614151515610116576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f496e76616c6964206d617374657220636f707920616464726573732070726f7681526020017f696465640000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000815111156101a35773ffffffffffffffffffffffffffffffffffffffff60005416600080835160208501846127105a03f46040513d6000823e600082141561019f573d81fd5b5050505b5050600081111561036d57600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156102b7578273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156102b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f436f756c64206e6f74207061792073616665206372656174696f6e207769746881526020017f206574686572000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b61036c565b6102d1828483610377640100000000026401000000009004565b151561036b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f436f756c64206e6f74207061792073616665206372656174696f6e207769746881526020017f20746f6b656e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b5b5b5050505050610490565b600060608383604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808251602084016000896127105a03f16040513d6000823e3d60008114610473576020811461047b5760009450610485565b829450610485565b8151158315171594505b505050509392505050565b61016b8061049f6000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634555d5c91461008b5780635c60da1b146100b6575b73ffffffffffffffffffffffffffffffffffffffff600054163660008037600080366000845af43d6000803e6000811415610086573d6000fd5b3d6000f35b34801561009757600080fd5b506100a061010d565b6040518082815260200191505060405180910390f35b3480156100c257600080fd5b506100cb610116565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006002905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050905600a165627a7a7230582007fffd557dfc8c4d2fdf56ba6381a6ce5b65b6260e1492d87f26c6d4f1d0410800290000000000000000000000008942595a2dc5181df0465af0d7be08c8f23c93af00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000d9e09beaeb338d81a7c5688358df0071d498811500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b15f91a8c35300000000000000000000000000000000000000000000000000000000000001640ec78d9e00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000f763ea5fbb191d47dc4b083dcdc3cdfb586468f8000000000000000000000000ad25c9717d04c0a12086a1d352c1ccf4bf5fcbf80000000000000000000000000da7155692446c80a4e7ad72018e586f20fa3bfe000000000000000000000000bce0cc48ce44e0ac9ee38df4d586afbacef191fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "value": "0x0" }, "blockHash": "0x03f9f64dfeb7807b5df608e6957dd4d521fd71685aac5533451d27f0abe03660", "blockNumber": 3793534, "result": { "address": "0x61a7cc907c47c133d5ff5b685407201951fcbd08", "code": "0x60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634555d5c91461008b5780635c60da1b146100b6575b73ffffffffffffffffffffffffffffffffffffffff600054163660008037600080366000845af43d6000803e6000811415610086573d6000fd5b3d6000f35b34801561009757600080fd5b506100a061010d565b6040518082815260200191505060405180910390f35b3480156100c257600080fd5b506100cb610116565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006002905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050905600a165627a7a7230582007fffd557dfc8c4d2fdf56ba6381a6ce5b65b6260e1492d87f26c6d4f1d041080029", "gasUsed": "0x4683f" }, "subtraces": 2, "traceAddress": [], "transactionHash": "0x6c7e8f8778d33d81b29c4bd7526ee50a4cea340d69eed6c89ada4e6fab731789", "transactionPosition": 1, "type": "create" }, { 'action': { 'address': '0x4440adafbc6c4e45c299451c0eedc7c8b98c14ac', 'balance': '0x0', 'refundAddress': '0x0000000000000000000000000000000000000000' }, 'blockHash': '0x8512d367492371edf44ebcbbbd935bc434946dddc2b126cb558df5906012186c', 'blockNumber': 7829689, 'result': None, 'subtraces': 0, 'traceAddress': [0, 0, 0, 0, 0, 0], 'transactionHash': '0x5f7af6aa390f9f8dd79ee692c37cbde76bb7869768b1bac438b6d176c94f637d', 'transactionPosition': 35, 'type': 'suicide' } ]
- trace_transaction(tx_hash: Union[Hash32, HexBytes, HexStr]) List[Dict[str, Any]]
- Parameters
tx_hash –
- Returns
List of internal txs for tx_hash
- trace_transactions(tx_hashes: Sequence[Union[Hash32, HexBytes, HexStr]]) List[List[Dict[str, Any]]]
- Parameters
tx_hashes –
- Returns
For every tx_hash a list of internal txs (in the same order as the tx_hashes were provided)
- class gnosis.eth.ethereum_client.TokenBalance(token_address, balance)
Bases:
tuple
- balance: int
Alias for field number 1
- token_address: str
Alias for field number 0
- class gnosis.eth.ethereum_client.TxSpeed(value)
Bases:
Enum
An enumeration.
- FAST = 4
- FASTEST = 6
- NORMAL = 3
- SLOW = 2
- SLOWEST = 0
- VERY_FAST = 5
- VERY_SLOW = 1
- gnosis.eth.ethereum_client.tx_with_exception_handling(func)
- Parity
- Geth
- Comparison
- Parameters
func –
- Returns
gnosis.eth.typing module
gnosis.eth.utils module
- gnosis.eth.utils.compare_byte_code(code_1: bytes, code_2: bytes) bool
Compare code, removing swarm metadata if necessary
- Parameters
code_1 –
code_2 –
- Returns
True if same code, False otherwise
- gnosis.eth.utils.decode_string_or_bytes32(data: bytes) str
- gnosis.eth.utils.generate_address_2(from_: Union[str, bytes], salt: Union[str, bytes], init_code: Union[str, bytes]) str
Generates an address for a contract created using CREATE2.
- Parameters
from – The address which is creating this new address (need to be 20 bytes)
salt – A salt (32 bytes)
init_code – A init code of the contract being created
- Returns
Address of the new contract
- gnosis.eth.utils.get_eth_address_with_invalid_checksum() str
- gnosis.eth.utils.get_eth_address_with_key() Tuple[str, bytes]
- gnosis.eth.utils.mk_contract_address(address: Union[str, bytes], nonce: int) str
- gnosis.eth.utils.remove_swarm_metadata(code: bytes) bytes
Remove swarm metadata from Solidity bytecode
- Parameters
code –
- Returns
Code without metadata