erc7730.model.calldata.v1.instruction module

Data model for calldata descriptor instructions.

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

class erc7730.model.calldata.v1.instruction.CalldataDescriptorFieldVisibilityV1(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]View on GitHub

Bases: IntEnum

Visibility of a calldata field (VisibleType in the FIELD struct).

MUST_BE and IF_NOT_IN require at least one constraint value; the device rejects the transaction when a MUST_BE value matches no constraint.

ALWAYS = 0
IF_NOT_IN = 2
MUST_BE = 1
pydantic model erc7730.model.calldata.v1.instruction.CalldataDescriptorInstructionBaseV1[source]View on GitHub

Bases: CalldataDescriptorStructV1, ABC

Base class for calldata descriptor instructions.

Fields:

pydantic model erc7730.model.calldata.v1.instruction.CalldataDescriptorInstructionEnumValueV1[source]View on GitHub

Bases: CalldataDescriptorInstructionBaseV1

Instruction descriptor for the ENUM_VALUE struct.

Fields:
field address: validate, json_schema_input_type=PydanticUndefined)] [Required]

The contract deployment address.

Constraints:
  • min_length = 42

  • max_length = 42

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

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

  • json_schema_input_type = PydanticUndefined

field chain_id: int [Required]

The contract deployment EIP-155 chain id.

Constraints:
  • ge = 1

field enum_id: str [Required]

Source identifier of the enum (to differentiate multiple enums in one contract)

field id: int [Required]

Identifier of the enum (to differentiate multiple enums in one contract)

Constraints:
  • ge = 0

  • le = 255

field name: str [Required]

Enum display name (ASCII)

Constraints:
  • min_length = 1

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

The 4-bytes function selector this descriptor applies to.

Constraints:
  • min_length = 10

  • max_length = 10

  • pattern = ^0x[a-z0-9]+$

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

  • json_schema_input_type = PydanticUndefined

field value: int [Required]

Identifier of this specific entry (ordinal of the entry, type agnostic)

Constraints:
  • ge = 0

  • le = 255

field version: Literal[1] = 1

Version of the ENUM struct

property descriptor: ', metadata=[MinLen(min_length=8), MaxLen(max_length=32768)])]View on GitHub
pydantic model erc7730.model.calldata.v1.instruction.CalldataDescriptorInstructionFieldV1[source]View on GitHub

Bases: CalldataDescriptorInstructionBaseV1

Instruction descriptor for the FIELD struct.

Fields:
Validators:
  • _validate_constraints » all fields

field constraints: list[~typing.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.<lambda>, json_schema_input_type=PydanticUndefined), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)]] | None = None

Constraint values (raw bytes, hex encoded) checked against the field value, with OR semantics. Only meaningful when visibility is MUST_BE or IF_NOT_IN.

Validated by:
  • _validate_constraints

field name: str [Required]

Field display name (ASCII)

Constraints:
  • min_length = 1

Validated by:
  • _validate_constraints

field param: Annotated[CalldataDescriptorParamRawV1 | CalldataDescriptorParamAmountV1 | CalldataDescriptorParamTokenAmountV1 | CalldataDescriptorParamNFTV1 | CalldataDescriptorParamDatetimeV1 | CalldataDescriptorParamDurationV1 | CalldataDescriptorParamUnitV1 | CalldataDescriptorParamEnumV1 | CalldataDescriptorParamTrustedNameV1 | CalldataDescriptorParamCalldataV1 | CalldataDescriptorParamTokenV1 | CalldataDescriptorParamNetworkV1, FieldInfo(annotation=NoneType, required=True, title='Field parameter', description='Format specific parameters for a calldata descriptor field.', discriminator='type')] [Required]

Parameter of the field

Validated by:
  • _validate_constraints

field version: Literal[1] = 1

Version of the FIELD struct

Validated by:
  • _validate_constraints

field visibility: CalldataDescriptorFieldVisibilityV1 = CalldataDescriptorFieldVisibilityV1.ALWAYS

Whether the field is displayed, and whether its value is constrained

Validated by:
  • _validate_constraints

property descriptor: ', metadata=[MinLen(min_length=8), MaxLen(max_length=32768)])]View on GitHub
pydantic model erc7730.model.calldata.v1.instruction.CalldataDescriptorInstructionTransactionInfoV1[source]View on GitHub

Bases: CalldataDescriptorInstructionBaseV1

Instruction descriptor for the TRANSACTION_INFO struct.

Fields:
field address: validate, json_schema_input_type=PydanticUndefined)] [Required]

The contract deployment address.

Constraints:
  • min_length = 42

  • max_length = 42

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

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

  • json_schema_input_type = PydanticUndefined

field chain_id: int [Required]

The contract deployment EIP-155 chain id.

Constraints:
  • ge = 1

field contract_name: str | None = None

Displayed in review first screens

Constraints:
  • min_length = 1

Displayed in review first screens

Constraints:
  • min_length = 1

field creator_name: str | None = None

Displayed in review first screens

Constraints:
  • min_length = 1

field creator_url: HttpUrl | None = None

Displayed in review first screens

Constraints:
  • min_length = 1

field deploy_date: str | None = None

Displayed in review first screens

field hash: str [Required]

Hash of all the FIELD structs

Constraints:
  • min_length = 64

  • max_length = 64

  • pattern = ^[a-f0-9]+$

field operation_type: str [Required]

Displayed in review first screens

Constraints:
  • min_length = 1

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

The 4-bytes function selector this descriptor applies to.

Constraints:
  • min_length = 10

  • max_length = 10

  • pattern = ^0x[a-z0-9]+$

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

  • json_schema_input_type = PydanticUndefined

field version: Literal[1] = 1

Version of the TRANSACTION_INFO struct

property descriptor: ', metadata=[MinLen(min_length=8), MaxLen(max_length=32768)])]View on GitHub