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:
IntEnumVisibility of a calldata field (
VisibleTypein the FIELD struct).MUST_BEandIF_NOT_INrequire at least one constraint value; the device rejects the transaction when aMUST_BEvalue matches no constraint.
- pydantic model erc7730.model.calldata.v1.instruction.CalldataDescriptorInstructionBaseV1[source]View on GitHub
Bases:
CalldataDescriptorStructV1,ABCBase class for calldata descriptor instructions.
- Fields:
- pydantic model erc7730.model.calldata.v1.instruction.CalldataDescriptorInstructionEIP712MessageInfoV1[source]View on GitHub
Bases:
CalldataDescriptorInstructionTransactionInfoBaseV1Instruction descriptor for the EIP712_MESSAGE_INFO struct.
The OPERATION_INFO structure in the context of an EIP-712 message: it is bound to the message by its domain separator and primary type hash, and carries neither chain id, contract address nor selector on the wire (they are only kept as metadata of the deployment the domain separator was computed for). Referred to as “EIP712 v2” in the Ethereum app specifications.
- field address: validate, json_schema_input_type=PydanticUndefined)] | None = None
The verifying contract address (metadata only, not part of the struct).
- field chain_id: int | None = None
The contract deployment EIP-155 chain id (metadata only, not part of the struct).
- Constraints:
ge = 1
- field domain_separator: validate, json_schema_input_type=PydanticUndefined)] [Required]
hashStruct(domain) of the EIP-712 message domain.
- Constraints:
min_length = 66
max_length = 66
pattern = ^0x[a-f0-9]+$
func = <function ErrorTypeLabel._validator.<locals>.validate at 0x7d6433008ea0>
json_schema_input_type = PydanticUndefined
- field primary_type_hash: validate, json_schema_input_type=PydanticUndefined)] [Required]
keccak256(encodeType(primaryType)) of the EIP-712 message primary type.
- Constraints:
min_length = 66
max_length = 66
pattern = ^0x[a-f0-9]+$
func = <function ErrorTypeLabel._validator.<locals>.validate at 0x7d6433008ea0>
json_schema_input_type = PydanticUndefined
- property descriptor: ', metadata=[MinLen(min_length=8), MaxLen(max_length=32768)])]View on GitHub
- pydantic model erc7730.model.calldata.v1.instruction.CalldataDescriptorInstructionEnumValueV1[source]View on GitHub
Bases:
CalldataDescriptorInstructionBaseV1Instruction descriptor for the ENUM_VALUE struct.
- Fields:
- Validators:
_validate_context»all fields
- field address: validate, json_schema_input_type=PydanticUndefined)] | None = None
The contract deployment address (required for transactions).
- Validated by:
_validate_context
- field chain_id: int | None = None
The contract deployment EIP-155 chain id (required for transactions).
- Constraints:
ge = 1
- Validated by:
_validate_context
- field domain_separator: validate, json_schema_input_type=PydanticUndefined)] | None = None
hashStruct(domain) of the EIP-712 message this descriptor applies to (EIP-712 messages only).
- Constraints:
min_length = 66
max_length = 66
- Validated by:
_validate_context
- field enum_id: str [Required]
Source identifier of the enum (to differentiate multiple enums in one contract)
- Validated by:
_validate_context
- field id: int [Required]
Identifier of the enum (to differentiate multiple enums in one contract)
- Constraints:
ge = 0
le = 255
- Validated by:
_validate_context
- field name: str [Required]
Enum display name (ASCII)
- Constraints:
min_length = 1
- Validated by:
_validate_context
- field primary_type_hash: validate, json_schema_input_type=PydanticUndefined)] | None = None
keccak256(encodeType(primaryType)) of the EIP-712 message this descriptor applies to (EIP-712 messages only).
- Constraints:
min_length = 66
max_length = 66
- Validated by:
_validate_context
- field selector: validate, json_schema_input_type=PydanticUndefined)] | None = None
The 4-bytes function selector this descriptor applies to (transactions only).
- Validated by:
_validate_context
- field value: int [Required]
Identifier of this specific entry (ordinal of the entry, type agnostic)
- Constraints:
ge = 0
le = 255
- Validated by:
_validate_context
- field version: Literal[1] = 1
Version of the ENUM struct
- Validated by:
_validate_context
- 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:
CalldataDescriptorInstructionBaseV1Instruction 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.CalldataDescriptorInstructionMapEntryV1[source]View on GitHub
Bases:
CalldataDescriptorInstructionBaseV1Instruction descriptor for the MAP_ENTRY struct.
One struct is emitted per key of a map looked up by the device (see MAP_REF values). The wallet only provides the entry matching the key read from the transaction, after it has been signed with the calldata key.
- Fields:
- Validators:
_validate_context»all fields_validate_sizes»all fields
- field address: validate, json_schema_input_type=PydanticUndefined)] | None = None
The contract deployment address (required for transactions).
- Validated by:
_validate_context_validate_sizes
- field chain_id: int | None = None
The contract deployment EIP-155 chain id (required for transactions).
- Constraints:
ge = 1
- Validated by:
_validate_context_validate_sizes
- field domain_separator: validate, json_schema_input_type=PydanticUndefined)] | None = None
hashStruct(domain) of the EIP-712 message this descriptor applies to (EIP-712 messages only).
- Constraints:
min_length = 66
max_length = 66
- Validated by:
_validate_context_validate_sizes
- field id: int [Required]
Identifier of the map (to differentiate multiple maps in one contract)
- Constraints:
ge = 0
le = 255
- Validated by:
_validate_context_validate_sizes
- field key: validate, json_schema_input_type=PydanticUndefined)] [Required]
The map key, encoded as the device reads it from the transaction (raw bytes, hex encoded).
- Constraints:
pattern = ^0x[a-f0-9]+$
func = <function ErrorTypeLabel._validator.<locals>.validate at 0x7d6433008ea0>
json_schema_input_type = PydanticUndefined
- Validated by:
_validate_context_validate_sizes
- field key_source: str [Required]
The map key, as written in the source descriptor.
- Validated by:
_validate_context_validate_sizes
- field map: str [Required]
Path of the map in the source descriptor.
- Validated by:
_validate_context_validate_sizes
- field primary_type_hash: validate, json_schema_input_type=PydanticUndefined)] | None = None
keccak256(encodeType(primaryType)) of the EIP-712 message this descriptor applies to (EIP-712 messages only).
- Constraints:
min_length = 66
max_length = 66
- Validated by:
_validate_context_validate_sizes
- field selector: validate, json_schema_input_type=PydanticUndefined)] | None = None
The 4-bytes function selector this descriptor applies to (transactions only).
- Validated by:
_validate_context_validate_sizes
- field value: validate, json_schema_input_type=PydanticUndefined)] [Required]
The map value, encoded for the device (raw bytes, hex encoded).
- Constraints:
pattern = ^0x[a-f0-9]+$
func = <function ErrorTypeLabel._validator.<locals>.validate at 0x7d6433008ea0>
json_schema_input_type = PydanticUndefined
- Validated by:
_validate_context_validate_sizes
- field value_source: str | int | bool | float [Required]
The map value, as written in the source descriptor.
- Validated by:
_validate_context_validate_sizes
- field version: Literal[1] = 1
Version of the MAP_ENTRY struct
- Validated by:
_validate_context_validate_sizes
- property descriptor: ', metadata=[MinLen(min_length=8), MaxLen(max_length=32768)])]View on GitHub
- pydantic model erc7730.model.calldata.v1.instruction.CalldataDescriptorInstructionTransactionInfoBaseV1[source]View on GitHub
Bases:
CalldataDescriptorInstructionBaseV1,ABCCommon fields for the TRANSACTION_INFO / EIP712_MESSAGE_INFO structs.
These two structs are the OPERATION_INFO structure of the Ethereum app in two contexts: they share every tag but the ones identifying the operation (CHAIN_ID, CONTRACT_ADDR and SELECTOR for a transaction, DOMAIN_SEPARATOR and PRIMARY_TYPE_HASH for an EIP-712 message).
- Fields:
- field contract_name: str | None = None
Displayed in review first screens
- Constraints:
min_length = 1
- field creator_legal_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 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 version: Literal[1] = 1
Version of the struct
- pydantic model erc7730.model.calldata.v1.instruction.CalldataDescriptorInstructionTransactionInfoV1[source]View on GitHub
Bases:
CalldataDescriptorInstructionTransactionInfoBaseV1Instruction descriptor for the TRANSACTION_INFO struct.
- Fields:
address (Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Contract Address', description='An Ethereum contract address (normalized to lowercase).', metadata=[MinLen(min_length=42), MaxLen(max_length=42), _PydanticGeneralMetadata(pattern='^0x[a-f0-9]+$')]), pydantic.functional_validators.BeforeValidator(func=erc7730.model.types.selector (Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Selector', description='An Ethereum contract function identifier, in 4 bytes, hex encoded form.', metadata=[MinLen(min_length=10), MaxLen(max_length=10), _PydanticGeneralMetadata(pattern='^0x[a-z0-9]+$')]), erc7730.common.pydantic.ErrorTypeLabel(func=erc7730.common.pydantic.ErrorTypeLabel._validator.
- 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 0x7d6433008cc0>
json_schema_input_type = PydanticUndefined
- field chain_id: int [Required]
The contract deployment EIP-155 chain id.
- Constraints:
ge = 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 0x7d6433008d60>
json_schema_input_type = PydanticUndefined
- property descriptor: ', metadata=[MinLen(min_length=8), MaxLen(max_length=32768)])]View on GitHub