eth-typing
Common type annotations for ethereum python packages.
Contents
Types
The following types are available from the eth_typing
module.
i.e.
from eth_typing import TypeStr
ABI
TypeStr
String representation of a data type.
TypeStr = str
Decodable
Binary data to be decoded.
Decodable = Union[bytes, bytearray]
Enumerables
ForkName
Class that contains the different names used to represent hard forks on the Ethereum network.
class ForkName:
Frontier = 'Frontier'
Homestead = 'Homestead'
EIP150 = 'EIP150'
EIP158 = 'EIP158'
Byzantium = 'Byzantium'
Constantinople = 'Constantinople'
Metropolis = 'Metropolis'
ChainId
IntEnum class defining EVM-compatible network name enums as their respective chain id 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.
class ChainId(IntEnum):
# L1 networks
ETH = 1
EXP = 2
ROP = 3
RIN = 4
GOR = 5
# L2 networks
OETH = 10
GNO = 100
Discovery
NodeID
A 32-byte identifier for a node in the Discovery DHT
NodeID = NewType('NodeID', bytes)
EthPM
ContractName
Any string conforming to the regular expression [a-zA-Z][a-zA-Z0-9_]{0,255}
.
ContractName = NewType('ContractName', str)
URI
Any string that represents a URI.
URI = NewType('URI', str)
EVM
Address
Any bytestring representing a canonical address.
Address = NewType('Address', bytes)
HexAddress
Any HexStr representing a hex encoded address.
HexAddress = NewType('HexAddress', HexStr)
ChecksumAddress
Any HexAddress that is formatted according to ERC55.
ChecksumAddress = NewType('ChecksumAddress', HexAddress)
AnyAddress
Any of Address, HexAddress, ChecksumAddress.
AnyAddress = TypeVar('AnyAddress', Address, HexAddress, ChecksumAddress)
Hash32
Any 32 byte hash.
Hash32 = NewType('Hash32', bytes)
BlockNumber
Any integer that represents a valid block number on a chain.
BlockNumber = NewType('BlockNumber', int)
BlockIdentifier
Either a 32 byte hash or an integer block number
BlockIdentifier = Union[Hash32, BlockNumber]
Encodings
HexStr
Any string that is hex encoded.
HexStr = NewType('HexStr', str)
Primitives
Any of bytes, int, or bool used as the Primitive arg for conversion utils in ETH-Utils.
Primitives = Union[bytes, int, bool]
Release Notes
eth-typing v4.1.0 (2024-04-01)
Features
Add python3.12 support (#57)
Internal Changes - for eth-typing Contributors
Merge template updates, adding build tests for all docs formats, add
blocklint
to lint tools (#57)
eth-typing v4.0.0 (2024-01-09)
Breaking changes
Drop python 3.7 support (#55)
Internal Changes - for eth-typing Contributors
eth-typing v3.5.2 (2023-11-07)
Miscellaneous Changes
eth-typing v3.5.1 (2023-10-20)
Internal Changes - for eth-typing Contributors
eth-typing v3.5.0 (2023-09-29)
Features
Internal Changes - for eth-typing Contributors
eth-typing v3.4.0 (2023-06-07)
Improved Documentation
pull in ethereum-python-project-template updates (#44)
Features
Add
Cancun
toForkName
enum. (#45)
Internal Changes - for eth-typing Contributors
v3.3.0 (2023-03-08)
Features
Internal Changes - for eth-typing Contributors
v3.2.0 (2022-09-14)
Features
Add
Merge
toForkName
enum (#34)
Bugfixes
v3.1.0 (2022-06-22)
Features
Miscellaneous changes
v3.0.0 (2021-11-15)
Update
ForkName
enum to includeBerlin
,London
, andArrowGlacier
Update Python support to include python 3.8-3.10
Remove Python 3.5 support
v2.2.0 (2019-10-31)
Update
ForkName
enum to includeConstantinopleFix
andIstanbul
v2.1.0 (2019-10-31)
Add BLS types
v2.0.0 (2019-10-31)
Expose Type Hints as per PEP 561
v1.0.0 (2018-06-08)
Added annotations from
py-evm
.
v0.3.1 (2018-06-07)
Removed
eth-utils
requirement.
v0.3.0 (2018-06-07)
Updated
eth-utils
requirement.
v0.2.0 (2018-06-07)
Launched repository, claimed names for pip, RTD, github, etc.