Types
The following types are available from the eth_typing
module.
i.e.
from eth_typing import TypeStr
Application Binary Interface
Types for Contract ABIs and related components.
- eth_typing.abi.ABI
List of components representing function and event interfaces (elements of an ABI).
alias of
Sequence
[Union
[ABIFunction
,ABIConstructor
,ABIFallback
,ABIReceive
,ABIEvent
,ABIError
]]
- eth_typing.abi.ABICallable
A Union type consisting of ABIFunction, ABIConstructor, ABIFallback and ABIReceive types.
alias of
Union
[ABIFunction
,ABIConstructor
,ABIFallback
,ABIReceive
]
- class eth_typing.abi.ABIComponent(*args, **kwargs)
TypedDict representing an ABIElement component.
- components: typing_extensions.NotRequired[Sequence[ABIComponent]]
List of nested ABI components for ABI types.
- class eth_typing.abi.ABIComponentIndexed(*args, **kwargs)
TypedDict representing an indexed ABIElement component.
- components: typing_extensions.NotRequired[Sequence[ABIComponent]]
- class eth_typing.abi.ABIConstructor(*args, **kwargs)
TypedDict representing the ABI for a constructor function.
- inputs: typing_extensions.NotRequired[Sequence[ABIComponent]]
Function input components.
- eth_typing.abi.ABIElement
A Union type consisting of ABICallable, ABIEvent, and ABIError types.
alias of
Union
[ABIFunction
,ABIConstructor
,ABIFallback
,ABIReceive
,ABIEvent
,ABIError
]
- class eth_typing.abi.ABIElementInfo(*args, **kwargs)
TypedDict to represent properties of an ABIElement, including the abi, selector and arguments.
- abi: ABIFunction | ABIConstructor | ABIFallback | ABIReceive | ABIEvent | ABIError
ABI for any ABIElement type.
- class eth_typing.abi.ABIError(*args, **kwargs)
TypedDict representing the ABI for an error.
- inputs: typing_extensions.NotRequired[Sequence[ABIComponent]]
Error input components.
- class eth_typing.abi.ABIEvent(*args, **kwargs)
TypedDict to represent the ABI for an event.
- anonymous: typing_extensions.NotRequired[bool]
If True, event is anonymous. Cannot filter the event by name.
- inputs: typing_extensions.NotRequired[Sequence[ABIComponentIndexed]]
Input components for the event.
- class eth_typing.abi.ABIFallback(*args, **kwargs)
TypedDict representing the ABI for a fallback function.
- class eth_typing.abi.ABIFunction(*args, **kwargs)
TypedDict representing the ABI for a function.
- inputs: typing_extensions.NotRequired[Sequence[ABIComponent]]
Function input components.
- outputs: typing_extensions.NotRequired[Sequence[ABIComponent]]
Function output components.
- class eth_typing.abi.ABIFunctionType(*args, **kwargs)
TypedDict representing the ABI for all function types.
This is the base type for functions. Please use ABIFunction, ABIConstructor, ABIFallback or ABIReceive instead.
- constant: bool
Function is constant and does not change state. Deprecated in favor of stateMutability pure and view.
- class eth_typing.abi.ABIReceive(*args, **kwargs)
TypedDict representing the ABI for a receive function.
- eth_typing.abi.TypeStr
String representation of a data type.
BLS
Types used for BLS Signatures.
Discovery
Types for the Discovery Protocol.
Encoding
Types for encoding and decoding data.
Enums
Fork names for Ethereum network upgrades.
- class eth_typing.enums.ForkName
Constants for each fork name.
>>> from eth_typing import ForkName >>> ForkName.Frontier 'Frontier'
- ArrowGlacier = 'ArrowGlacier'
- Berlin = 'Berlin'
- Byzantium = 'Byzantium'
- Cancun = 'Cancun'
- Constantinople = 'Constantinople'
- ConstantinopleFix = 'ConstantinopleFix'
- EIP150 = 'EIP150'
- EIP158 = 'EIP158'
- Frontier = 'Frontier'
- GrayGlacier = 'GrayGlacier'
- Homestead = 'Homestead'
- Istanbul = 'Istanbul'
- London = 'London'
- Metropolis = 'Metropolis'
- Paris = 'Paris'
- Shanghai = 'Shanghai'
EVM
Type definitions for the Ethereum Virtual Machine (EVM).
- class eth_typing.evm.AnyAddress
A type that represents any type of address.
alias of TypeVar(‘AnyAddress’, Address, HexAddress, ChecksumAddress)
- eth_typing.evm.BlockIdentifier
A type that represents a block identifier value.
BlockParams
: A block reference parameter.BlockNumber
: A block number integer value.Hash32
: A 32-byte hash value.HexStr
: A string that represents a hex value.int
: An integer value.
alias of
Union
[Literal
[‘latest’, ‘earliest’, ‘pending’, ‘safe’, ‘finalized’],BlockNumber
,Hash32
,HexStr
,int
]
- class eth_typing.evm.BlockNumber
Any integer that represents a valid block number on a chain.
alias of
int
- eth_typing.evm.BlockParams
A type which specifies the block reference parameter.
"latest"
: The latest block."earliest"
: The earliest block."pending"
: The pending block."safe"
: The safe block."finalized"
: The finalized block.
alias of
Literal
[‘latest’, ‘earliest’, ‘pending’, ‘safe’, ‘finalized’]
- class eth_typing.evm.ChecksumAddress
A type that contains a eth_typing.evm.HexAddress that is formatted according to ERC55. This is a 40 character hex string with a prefix of “0x” and mixed case letters.
alias of
HexAddress
- class eth_typing.evm.HexAddress
A type that contains a hex encoded address. This is a 32-byte hex string with a prefix of “0x”.
alias of
HexStr
Exceptions
Exception types raised in web3’s libraries.
- exception eth_typing.exceptions.MismatchedABI
Raised when an ABI does not match with supplied parameters, or when an attempt is made to access a function/event that does not exist in the ABI.
- exception eth_typing.exceptions.ValidationError
Raised when something does not pass a validation check.
Networks
Types for Ethereum network identifiers.
- class eth_typing.networks.ChainId(value)
IntEnum class defining EVM-compatible network name enums as their respective
ChainID
int values.To learn more about chain ids, see CAIP-2 for details.
The list of chain ids is available from the ethereum-lists/chains repository.
For a complete list of supported enums, see eth_typing/networks.py.
>>> from eth_typing import ChainId >>> ChainId(1) <ChainId.ETH: 1> >>> ChainId(10) <ChainId.OETH: 10>
- ETH = 1
Ethereum Mainnet
- EXP = 2
Expanse
- GNO = 100
Gnosis
- GOR = 5
Görli
- OETH = 10
OP Mainnet
- RIN = 4
Rinkeby
- ROP = 3
Ropsten