eth_pydantic_types.hex

HexStr

class eth_pydantic_types.hex.str.BaseHexStr

Bases: str, BaseHex

class eth_pydantic_types.hex.str.BoundHexStr

Bases: BaseHexStr

A hex string value, that is required to be a specific size.

class eth_pydantic_types.hex.str.HexStr

Bases: BaseHexStr

A hex string value.

class eth_pydantic_types.hex.str.HexStr20

Bases: BoundHexStr

eth_pydantic_types.hex.str.HexStr32

alias of BoundHexStr

HexBytes

class eth_pydantic_types.hex.bytes.BoundHexBytes(val: bool | bytearray | bytes | int | str | memoryview)

Bases: HexBytes

Use when receiving hexbytes.HexBytes values and a specific size is required. Includes a pydantic validator and serializer.

class eth_pydantic_types.hex.bytes.HexBytes(val: bool | bytearray | bytes | int | str | memoryview)

Bases: HexBytes, BaseHex

Use when receiving hexbytes.HexBytes values. Includes a pydantic validator and serializer.

classmethod fromhex(hex_str: str) HexBytes

Create a bytes object from a string of hexadecimal numbers.

Spaces between two numbers are accepted. Example: bytes.fromhex(‘B9 01EF’) -> b’\xb9\x01\xef’.

class eth_pydantic_types.hex.bytes.HexBytes20(val: bool | bytearray | bytes | int | str | memoryview)

Bases: BoundHexBytes

eth_pydantic_types.hex.bytes.HexBytes32

alias of BoundHexBytes

HexInt

class eth_pydantic_types.hex.int.BaseHexInt

Bases: int, BaseHex

classmethod from_bytes(data, byteorder: str = 'big', signed: bool = False) BaseHexInt

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.

signed

Indicates whether two’s complement is used to represent the integer.

class eth_pydantic_types.hex.int.BoundHexInt

Bases: BaseHexInt

A hex string value, that is required to be a specific size.

class eth_pydantic_types.hex.int.HexInt

Bases: BaseHexInt

A hex int value.