Utils

The utils module houses public utility functions and classes.

ABI

utils.get_abi_input_names(abi)

Return the input names for an ABI function or event.

utils.get_abi_output_names(abi)

Return the output names an ABI function or event.

Address

utils.get_create_address(sender, nonce)

Return the checksummed contract address generated by using the CREATE opcode by a sender address with a given nonce.

utils.get_create2_address(sender, salt, init_code)

Return the checksummed contract address generated by using the CREATE2 opcode by a sender address with a given salt and contract bytecode. See EIP-1014.

Caching

class utils.SimpleCache

The main cache class being used internally by web3.py. In some cases, it may prove useful to set your own cache size and pass in your own instance of this class where supported.

Exception Handling

utils.handle_offchain_lookup(offchain_lookup_payload, transaction)

Handle OffchainLookup reverts on contract function calls manually. For an example, see CCIP Read support for offchain lookup within the examples section.

utils.async_handle_offchain_lookup(offchain_lookup_payload, transaction)

The async version of the handle_offchain_lookup() utility method described above.