erc7730.model.calldata.v1.value module

Data model for calldata descriptor references to values (a.k.a., binary paths).

These model classes represent the exact same data fields that are serialized into TLV structs. See documentation in https://github.com/LedgerHQ/app-ethereum for specifications of this protocol

pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorContainerPathV1[source]View on GitHub

Bases: CalldataDescriptorStructV1

Descriptor for the CONTAINER_PATH struct.

Fields:
field type: Literal['CONTAINER'] = 'CONTAINER'

Type of the path

field value: CalldataDescriptorContainerPathValueV1 [Required]

Container field

field version: Literal[1] = 1

Version of the CONTAINER_PATH struct

class erc7730.model.calldata.v1.value.CalldataDescriptorContainerPathValueV1(*values)[source]View on GitHub

Bases: IntEnum

Type of container paths.

FROM = 0
TO = 1
VALUE = 2
pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorDataPathV1[source]View on GitHub

Bases: CalldataDescriptorStructV1

Descriptor for the DATA_PATH struct.

Fields:
field elements: list[Annotated[CalldataDescriptorPathElementTupleV1 | CalldataDescriptorPathElementArrayV1 | CalldataDescriptorPathElementRefV1 | CalldataDescriptorPathElementLeafV1 | CalldataDescriptorPathElementSliceV1, FieldInfo(annotation=NoneType, required=True, title='Path element', description='Data path element to reach the target value in the serialized transaction', discriminator='type')]] [Required]

Path element to reach the target value

Constraints:
  • min_length = 1

  • max_length = 256

field type: Literal['DATA'] = 'DATA'

Type of the path

field version: Literal[1] = 1

Version of the VALUE struct

pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorPathElementArrayV1[source]View on GitHub

Bases: CalldataDescriptorPathElementBaseV1

Descriptor for the PATH_ELEMENT struct of type ARRAY.

Fields:
field end: int | None [Required]

End offset in array (exclusive). If not provided, upper bound is array end.

field start: int | None [Required]

Start offset in array (inclusive). If not provided, lower bound is array start.

field type: Literal['ARRAY'] = 'ARRAY'

Type of the parameter

field weight: int [Required]

Size of each array element in chunks

pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorPathElementBaseV1[source]View on GitHub

Bases: Model

Descriptor for the PATH_ELEMENT payload.

pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorPathElementLeafV1[source]View on GitHub

Bases: CalldataDescriptorPathElementBaseV1

Descriptor for the PATH_ELEMENT struct of type LEAF.

Fields:
field leaf_type: CalldataDescriptorPathLeafType [Required]

Type of the leaf element

field type: Literal['LEAF'] = 'LEAF'

Type of the parameter

pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorPathElementRefV1[source]View on GitHub

Bases: CalldataDescriptorPathElementBaseV1

Descriptor for the PATH_ELEMENT struct of type REF.

Fields:
field type: Literal['REF'] = 'REF'

Type of the parameter

pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorPathElementSliceV1[source]View on GitHub

Bases: CalldataDescriptorPathElementBaseV1

Descriptor for the PATH_ELEMENT struct of type SLICE.

Fields:
field end: int | None [Required]

Slice end index (inclusive, unset = end of data)

field start: int | None [Required]

Slice start index (inclusive, unset = start of data)

field type: Literal['SLICE'] = 'SLICE'

Type of the parameter

pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorPathElementTupleV1[source]View on GitHub

Bases: CalldataDescriptorPathElementBaseV1

Descriptor for the PATH_ELEMENT struct of type TUPLE.

Fields:
field offset: int [Required]

Move by {value} slots from current slot

field type: Literal['TUPLE'] = 'TUPLE'

Type of the parameter

class erc7730.model.calldata.v1.value.CalldataDescriptorPathElementType(*values)[source]View on GitHub

Bases: IntEnum

Type of path element.

ARRAY = 2

current slot is array length, added to offset if negative. multiple by item_size and move by result slots

LEAF = 4

current slot is a leaf type, specifying the type of path end

REF = 3

read value of current slot. apply read value as offset from current slot

SLICE = 5

specify slicing to apply to final leaf value as (start, end)

TUPLE = 1

move by {value} slots from current slot

class erc7730.model.calldata.v1.value.CalldataDescriptorPathLeafType(*values)[source]View on GitHub

Bases: IntEnum

Type of path leaf element.

ARRAY_LEAF = 1

final offset is start of array encoding

DYNAMIC_LEAF = 4

final offset contains dynamic encoded value (typ length + data)

STATIC_LEAF = 3

final offset contains static encoded value (typ data on 32 bytes)

TUPLE_LEAF = 2

final offset is start of tuple encoding

class erc7730.model.calldata.v1.value.CalldataDescriptorTypeFamily(*values)[source]View on GitHub

Bases: IntEnum

Type family of a value.

ADDRESS = 5
BOOL = 6
BYTES = 7
FIXED = 4
INT = 2
STRING = 8
UFIXED = 3
UINT = 1
pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorValueBaseV1[source]View on GitHub

Bases: CalldataDescriptorStructV1

Descriptor for the VALUE struct.

Fields:
field type_family: CalldataDescriptorTypeFamily [Required]

Type family of the value

field type_size: int | None = None

Size of the type (in bytes)

Constraints:
  • ge = 0

  • le = 255

field version: Literal[1] = 1

Version of the VALUE struct

pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorValueConstantV1[source]View on GitHub

Bases: CalldataDescriptorValueBaseV1

A constant value.

Fields:
  • raw (Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Hexadecimal string', description='A byte array encoded as an hexadecimal string.', metadata=[_PydanticGeneralMetadata(pattern='^0x[a-f0-9]+$')]), pydantic.functional_validators.BeforeValidator(func=erc7730.model.types.

  • type (Literal['constant'])

  • value (str | int | bool | float)

field raw: validate, json_schema_input_type=PydanticUndefined)] [Required]

The constant value, serialized and hex encoded.

Constraints:
  • pattern = ^0x[a-f0-9]+$

  • func = <function ErrorTypeLabel._validator.<locals>.validate at 0x7fa6e3239440>

  • json_schema_input_type = PydanticUndefined

field type: Literal['constant'] = 'constant'

The value type identifier (discriminator for values discriminated union).

field value: str | int | bool | float [Required]

The constant value.

pydantic model erc7730.model.calldata.v1.value.CalldataDescriptorValuePathV1[source]View on GitHub

Bases: CalldataDescriptorValueBaseV1

A path to the field in the structured data. The path is a JSON path expression that can be used to extract the field value from the structured data.

Fields:
field abi_path: Annotated[ContainerPath | DataPath, FieldInfo(annotation=NoneType, required=True, title='Resolved Path', description='A path in the input designating value(s) either in the container of the structured data to besigned or the structured data schema (ABI path for contracts, path in the message types itself for EIP-712).', discriminator='type'), AfterValidator(func=_validate_absolute)] | None = None

Path to reach the target value in the container or serialized transaction

field binary_path: Annotated[CalldataDescriptorContainerPathV1 | CalldataDescriptorDataPathV1, FieldInfo(annotation=NoneType, required=True, title='Path', description='Data or container path to reach the target value in the serialized transaction', discriminator='type')] [Required]

Path to reach the target value in the container or serialized transaction

field type: Literal['path'] = 'path'

The value type identifier (discriminator for values discriminated union).