erc7730.generate.schema_tree module

class erc7730.generate.schema_tree.SchemaArray[source]View on GitHub

Bases: SchemaNode

Schema node representing an array.

component: SchemaTree
model_config = {'allow_inf_nan': False, 'arbitrary_types_allowed': False, 'extra': 'forbid', 'frozen': True, 'strict': True, 'validate_assignment': True, 'validate_default': True, 'validate_return': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class erc7730.generate.schema_tree.SchemaLeaf(*, data_type: ABIDataType)[source]View on GitHub

Bases: SchemaNode

Schema node representing a scalar type.

data_type: ABIDataType
model_config = {'allow_inf_nan': False, 'arbitrary_types_allowed': False, 'extra': 'forbid', 'frozen': True, 'strict': True, 'validate_assignment': True, 'validate_default': True, 'validate_return': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class erc7730.generate.schema_tree.SchemaNode[source]View on GitHub

Bases: Model, ABC

Represents a node in the tree defined by a function ABI / EIP-712 schema.

model_config = {'allow_inf_nan': False, 'arbitrary_types_allowed': False, 'extra': 'forbid', 'frozen': True, 'strict': True, 'validate_assignment': True, 'validate_default': True, 'validate_return': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class erc7730.generate.schema_tree.SchemaStruct[source]View on GitHub

Bases: SchemaNode

Schema node representing a function or a tuple.

components: dict[str, SchemaTree]
model_config = {'allow_inf_nan': False, 'arbitrary_types_allowed': False, 'extra': 'forbid', 'frozen': True, 'strict': True, 'validate_assignment': True, 'validate_default': True, 'validate_return': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

erc7730.generate.schema_tree.abi_function_to_tree(function: Function) SchemaStruct | SchemaArray | SchemaLeaf[source]View on GitHub

Convert a function ABI to a schema tree.

A schema tree is a tree representation of the ABI of a function inputs, enriched with some metadata to ease crafting paths to access values in the serialized calldata.

Parameters:

function – function ABI

Returns:

Schema tree

erc7730.generate.schema_tree.eip712_schema_to_tree(schema: EIP712Schema) SchemaStruct | SchemaArray | SchemaLeaf[source]View on GitHub

Convert an EIP-712 schema to a schema tree.

A schema tree is a tree representation of the EIP-712 schema, enriched with some metadata to ease crafting paths to access values in the message.

Parameters:

schema – EIP-712 schema

Returns:

Schema tree