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(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]View on GitHub

Bases: IntEnum

Type of container paths.

CHAIN_ID = 3
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.CalldataDescriptorEIP712PathElementArraySliceV1[source]View on GitHub

Bases: Model

Descriptor for the EIP712_ARRAY_SLICE path element (select an array segment).

Fields:
field end: int | None = None

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

Constraints:
  • ge = -32768

  • le = 32767

field start: int | None = None

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

Constraints:
  • ge = -32768

  • le = 32767

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

Type of the EIP-712 path element

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

Bases: Model

Descriptor for the EIP712_LEAF_SLICE path element (keep some bytes of the leaf).

Only valid as last element, on a bytesN, bytes or string leaf. A negative bound counts back from the end of the leaf.

Fields:
field end: int | None = None

End of the bytes kept (exclusive). If not provided, the slice ends at the end of the leaf.

Constraints:
  • ge = -32768

  • le = 32767

field start: int | None = None

First byte kept (inclusive). If not provided, the slice starts at the first byte of the leaf.

Constraints:
  • ge = -32768

  • le = 32767

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

Type of the EIP-712 path element

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

Bases: Model

Descriptor for the EIP712_STRUCT_FIELD path element (descend into a struct field by declaration index).

Fields:
field index: int [Required]

Index of the field in the struct declaration order

Constraints:
  • ge = 0

  • le = 255

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

Type of the EIP-712 path element

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

Bases: CalldataDescriptorStructV1

Descriptor for the EIP712_PATH struct.

Path into the EIP-712 value tree, navigated by struct field index and array slices (as opposed to DATA_PATH which navigates serialized transaction calldata by byte offsets). Referred to as “EIP712 v2” in the Ethereum app specifications.

Fields:
Validators:
  • _validate_elements » all fields

field elements: list[Annotated[CalldataDescriptorEIP712PathElementStructFieldV1 | CalldataDescriptorEIP712PathElementArraySliceV1 | CalldataDescriptorEIP712PathElementLeafSliceV1, FieldInfo(annotation=NoneType, required=True, title='EIP-712 path element', description='Path element to reach the target value in the EIP-712 value tree', discriminator='type')]] [Required]

Interleaved struct field / array slice elements to reach the target value in the value tree, optionally followed by a leaf slice

Constraints:
  • min_length = 1

  • max_length = 17

Validated by:
  • _validate_elements

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

Type of the path

Validated by:
  • _validate_elements

field version: Literal[1] = 1

Version of the EIP712_PATH struct

Validated by:
  • _validate_elements

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

Bases: CalldataDescriptorStructV1

Descriptor for the MAP_REF struct.

Fields:
field id: int [Required]

Identifier of the map (references the MAP_ENTRY structs carrying its values)

Constraints:
  • ge = 0

  • le = 255

field key: CalldataDescriptorValuePathV1 [Required]

Value read from the transaction to get the key to look up in the map

field map: str [Required]

Path of the referenced map in the source descriptor (not serialized).

field version: Literal[1] = 1

Version of the MAP_REF 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(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[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(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[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(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[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 0x7d6433008ea0>

  • 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.CalldataDescriptorValueMapRefV1[source]View on GitHub

Bases: CalldataDescriptorValueBaseV1

A value looked up by the device in a map, using a key read from the transaction.

The map values are provided to the device by MAP_ENTRY structs.

Fields:
field map_ref: CalldataDescriptorMapRefV1 [Required]

Reference to the map and the key to look up in it

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

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

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 | CalldataDescriptorEIP712PathV1, FieldInfo(annotation=NoneType, required=True, title='Path', description='Data, container or EIP-712 path to reach the target value in the serialized transaction or message value tree', 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).