erc7730.model.input.v2.display module
Object model for ERC-7730 v2 descriptors display section.
Specification: https://github.com/LedgerHQ/clear-signing-erc7730-registry/tree/master/specs JSON schema: https://github.com/LedgerHQ/clear-signing-erc7730-registry/blob/master/specs/erc7730-v2.schema.json
- pydantic model erc7730.model.input.v2.display.InputAddressNameParameters[source]View on GitHub
Bases:
ModelAddress Names Formatting Parameters.
- Fields:
- field senderAddress: InputMapReference | None = None
Either a string or an array of strings. If the address pointed to by addressName is equal to one of the addresses in senderAddress, the addressName is interpreted as the sender referenced by @.from
- field sources: list[str] | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | None = None
An array of acceptable sources for names. If set, the wallet SHOULD restrict name lookup to relevant sources.
- Constraints:
min_length = 1
- field types: list[~erc7730.model.display.AddressNameType] | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | None = None
An array of expected types of the address. If set, the wallet SHOULD check that the address matches one of the types provided.
- Constraints:
min_length = 1
- pydantic model erc7730.model.input.v2.display.InputCallDataParameters[source]View on GitHub
Bases:
ModelEmbedded Calldata Formatting Parameters.
- Fields:
- Validators:
_validate_mutually_exclusive_path_or_value»all fields_validate_one_of_callee_path_or_value»all fields
- field amount: int | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | ~erc7730.model.input.v2.display.InputMapReference | None = None
The amount being transferred, if not contained in the calldata or as map reference. Only one of “amountPath” or “amount” must be set.
- Validated by:
_validate_mutually_exclusive_path_or_value_validate_one_of_callee_path_or_value
- field amountPath: validate, json_schema_input_type=PydanticUndefined)] | None = None
The path to the amount being transferred, if not contained in the calldata. Only one of “amountPath” or “amount” must be set.
- Validated by:
_validate_mutually_exclusive_path_or_value_validate_one_of_callee_path_or_value
- field callee: InputMapReference | None = None
The address of the contract being called by this embedded calldata, as a constant value or map reference. Exactly one of “calleePath” or “callee” must be set.
- Validated by:
_validate_mutually_exclusive_path_or_value_validate_one_of_callee_path_or_value
- field calleePath: validate, json_schema_input_type=PydanticUndefined)] | None = None
The path to the address of the contract being called by this embedded calldata. Exactly one of “calleePath” or “callee” must be set.
- Validated by:
_validate_mutually_exclusive_path_or_value_validate_one_of_callee_path_or_value
- field selector: InputMapReference | None = None
The selector being called, if not contained in the calldata or provided as a map reference. Hex string representation. Only one of “selectorPath” or “selector” must be set.
- Validated by:
_validate_mutually_exclusive_path_or_value_validate_one_of_callee_path_or_value
- field selectorPath: validate, json_schema_input_type=PydanticUndefined)] | None = None
The path to selector being called, if not contained in the calldata. Only one of “selectorPath” or “selector” must be set.
- Validated by:
_validate_mutually_exclusive_path_or_value_validate_one_of_callee_path_or_value
- pydantic model erc7730.model.input.v2.display.InputDateParameters[source]View on GitHub
Bases:
ModelDate Formatting Parameters
- pydantic model erc7730.model.input.v2.display.InputDisplay[source]View on GitHub
Bases:
ModelDisplay Formatting Info Section (v2).
- Fields:
- field definitions: dict[str, InputFieldDefinition] | None = None
A set of definitions that can be used to share formatting information between multiple messages / functions. The definitions can be referenced by the key name in an internal path.
- field formats: dict[str, InputFormat] [Required]
The list includes formatting info for each field of a structure. This list is indexed by a key identifying uniquely the message’s type in the abi. For smartcontracts, it is the selector of the function or its signature; and for EIP712 messages it is the primaryType of the message.
- pydantic model erc7730.model.input.v2.display.InputEncryptionParameters[source]View on GitHub
Bases:
ModelEncrypted Value Parameters.
- field fallbackLabel: str | None = None
Optional label to display when decryption is not possible. Defaults to “[Encrypted]”.
- field plaintextType: str | None = None
Solidity type of the decrypted value (the handle does not encode this).
- field scheme: str [Required]
The encryption scheme used to produce the handle.
- pydantic model erc7730.model.input.v2.display.InputEnumParameters[source]View on GitHub
Bases:
ModelEnum Formatting Parameters.
- field ref: validate, json_schema_input_type=PydanticUndefined)] [Required] (alias '$ref')
The internal path to the enum definition used to convert this value.
- Constraints:
get_pydantic_core_schema = <function <lambda> at 0x7fb0a74502c0>
func = <function ErrorTypeLabel._validator.<locals>.validate at 0x7fb0a7450400>
json_schema_input_type = PydanticUndefined
- pydantic model erc7730.model.input.v2.display.InputFieldBase[source]View on GitHub
Bases:
ModelA field formatter, containing formatting information of a single field in a message.
- Fields:
- Validators:
_validate_one_of_path_or_value»all fields
- field path: validate, json_schema_input_type=PydanticUndefined)] | None = None
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. Exactly one of “path” or “value” must be set.
- Validated by:
_validate_one_of_path_or_value
- field value: validate, json_schema_input_type=PydanticUndefined)] | str | int | bool | float | None = None
A literal value on which the format should be applied instead of looking up a field in the structured data. Exactly one of “path” or “value” must be set.
- Validated by:
_validate_one_of_path_or_value
- pydantic model erc7730.model.input.v2.display.InputFieldDefinition[source]View on GitHub
Bases:
ModelA field formatter, containing formatting information of a single field in a message.
- field encryption: InputEncryptionParameters | None = None
If present, the field value is encrypted. The format specifies how to display the decrypted value.
- field format: FieldFormat | None = None
The format of the field, that will be used to format the field value in a human readable way.
- field id: validate, json_schema_input_type=PydanticUndefined)] | None = None (alias '$id')
An internal identifier that can be used either for clarity specifying what the element is or as a reference in device specific sections.
- field label: validate, json_schema_input_type=PydanticUndefined)] | str [Required]
The label of the field, that will be displayed to the user in front of the formatted field value.
- field params: Annotated[Annotated[InputAddressNameParameters, Tag(tag=address_name)] | Annotated[InputInteroperableAddressNameParameters, Tag(tag=interoperable_address_name)] | Annotated[InputCallDataParameters, Tag(tag=call_data)] | Annotated[InputTokenAmountParameters, Tag(tag=token_amount)] | Annotated[InputTokenTickerParameters, Tag(tag=token_ticker)] | Annotated[InputNftNameParameters, Tag(tag=nft_name)] | Annotated[InputDateParameters, Tag(tag=date)] | Annotated[InputUnitParameters, Tag(tag=unit)] | Annotated[InputEnumParameters, Tag(tag=enum)], Discriminator(discriminator=field_parameters_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)] | None = None
Format specific parameters that are used to format the field value in a human readable way.
- pydantic model erc7730.model.input.v2.display.InputFieldDescription[source]View on GitHub
Bases:
InputFieldBase,InputFieldDefinitionA field formatter, containing formatting information of a single field in a message.
- Fields:
- Validators:
- field encryption: InputEncryptionParameters | None = None
If present, the field value is encrypted. The format specifies how to display the decrypted value.
- Validated by:
_validate_one_of_path_or_value
- field separator: str | None = None
Optional separator for array values with {index} interpolation support.
- Validated by:
_validate_one_of_path_or_value
- field visible: Annotated[Annotated[str, Tag(tag=simple)] | Annotated[InputVisibilityConditions, Tag(tag=conditions)], Discriminator(discriminator=visibility_rules_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)] | None = None
Specifies when a field should be displayed based on its value or context. Defaults to ‘always’ if not specified.
- Validated by:
_validate_one_of_path_or_value
- pydantic model erc7730.model.input.v2.display.InputFieldGroup[source]View on GitHub
Bases:
ModelA group of field formats, allowing recursivity in the schema and control over grouping and iteration.
Used to group whole definitions for structures for instance. This allows nesting definitions of formats, but note that support for deep nesting will be device dependent.
Unlike InputFieldBase, field groups do not require path or value (per v2 schema). The path is optional and there is no value field — field groups scope their children under the given path, or act as logical groupings when no path is provided.
- Fields:
- field fields: list[InputField] [Required]
Group of field formats.
- field id: validate, json_schema_input_type=PydanticUndefined)] | None = None (alias '$id')
An internal identifier that can be used either for clarity specifying what the element is or as a reference in device specific sections.
- pydantic model erc7730.model.input.v2.display.InputFormat[source]View on GitHub
Bases:
FormatBaseA structured data format specification containing formatting information of fields in a single type of message (v2).
- Fields:
- field fields: list[Annotated[Annotated[InputReference, Tag(tag=reference)] | Annotated[InputFieldDescription, Tag(tag=field_description)] | Annotated[InputFieldGroup, Tag(tag=field_group)], Discriminator(discriminator=field_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] [Required]
An array containing the ordered definitions of fields formats.
- pydantic model erc7730.model.input.v2.display.InputInteroperableAddressNameParameters[source]View on GitHub
Bases:
ModelInteroperable Address Names Formatting Parameters.
- Fields:
- field senderAddress: InputMapReference | None = None
Either a string or an array of strings for sender address matching.
- field sources: list[str] | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | None = None
An array of acceptable sources for names.
- Constraints:
min_length = 1
- field types: list[str] | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | None = None
An array of expected types of the address (wallet, eoa, contract, token, collection).
- Constraints:
min_length = 1
- pydantic model erc7730.model.input.v2.display.InputMapReference[source]View on GitHub
Bases:
ModelA reference to a map for dynamic value resolution.
- Fields:
- field keyPath: validate, json_schema_input_type=PydanticUndefined)] [Required]
The path to the key used to resolve a value in the referenced map.
- field map: validate, json_schema_input_type=PydanticUndefined)] [Required]
The path to the referenced map.
- Constraints:
get_pydantic_core_schema = <function <lambda> at 0x7fb0a74502c0>
func = <function ErrorTypeLabel._validator.<locals>.validate at 0x7fb0a7450400>
json_schema_input_type = PydanticUndefined
- pydantic model erc7730.model.input.v2.display.InputNftNameParameters[source]View on GitHub
Bases:
ModelNFT Names Formatting Parameters.
- Fields:
- Validators:
_validate_one_of_collection_path_or_value»all fields
- pydantic model erc7730.model.input.v2.display.InputReference[source]View on GitHub
Bases:
InputFieldBaseA reference to a shared definition that should be used as the field formatting definition.
The value is the key in the display definitions section, as a path expression $.display.definitions.DEFINITION_NAME. It is used to share definitions between multiple messages / functions.
- Fields:
ref (Annotated[erc7730.model.paths.DescriptorPath, pydantic.types.GetPydanticSchema(get_pydantic_core_schema=erc7730.model.input.path.
- Validators:
- field params: dict[str, Any] | None = None
Parameters override. These values takes precedence over the ones in the definition itself.
- Validated by:
_validate_one_of_path_or_value
- field ref: validate, json_schema_input_type=PydanticUndefined)] [Required] (alias '$ref')
An internal definition that should be used as the field formatting definition. The value is the key in the display definitions section, as a path expression $.display.definitions.DEFINITION_NAME.
- Constraints:
get_pydantic_core_schema = <function <lambda> at 0x7fb0a74502c0>
func = <function ErrorTypeLabel._validator.<locals>.validate at 0x7fb0a7450400>
json_schema_input_type = PydanticUndefined
- Validated by:
_validate_one_of_path_or_value
- pydantic model erc7730.model.input.v2.display.InputTokenAmountParameters[source]View on GitHub
Bases:
ModelToken Amount Formatting Parameters.
- Fields:
- Validators:
_validate_one_of_token_path_or_value»all fields
- field chainId: int | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | ~erc7730.model.input.v2.display.InputMapReference | None = None
Optional. The chain on which the token is deployed (constant, or a map reference). When present, the wallet SHOULD resolve token metadata (ticker, decimals) for this chain. Useful for cross-chain swap clear signing where the same token address may refer to different chains.
- Validated by:
_validate_one_of_token_path_or_value
- field chainIdPath: validate, json_schema_input_type=PydanticUndefined)] | None = None
Optional. Path to the chain ID in the structured data. When present, the wallet SHOULD resolve token metadata for the chain at this path. Useful for cross-chain swap clear signing.
- Validated by:
_validate_one_of_token_path_or_value
- field message: validate, json_schema_input_type=PydanticUndefined)] | str | None = None
The message to display when the amount is above the threshold.
- Validated by:
_validate_one_of_token_path_or_value
- field nativeCurrencyAddress: list[~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | ~typing.Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Contract Address', description='An Ethereum contract address, can be lowercase or EIP-55.', metadata=[MinLen(min_length=42), MaxLen(max_length=42), _PydanticGeneralMetadata(pattern='^0x[a-fA-F0-9]+$')]), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)]] | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | ~typing.Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Contract Address', description='An Ethereum contract address, can be lowercase or EIP-55.', metadata=[MinLen(min_length=42), MaxLen(max_length=42), _PydanticGeneralMetadata(pattern='^0x[a-fA-F0-9]+$')]), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | None = None
An address or array of addresses, any of which are interpreted as an amount in native currency rather than a token.
- Validated by:
_validate_one_of_token_path_or_value
- field threshold: validate, json_schema_input_type=PydanticUndefined)] | int | None = None
The threshold above which the amount should be displayed using the message parameter rather than the real amount (encoded as an int or byte array).
- Validated by:
_validate_one_of_token_path_or_value
- field token: InputMapReference | None = None
The address of the token contract, as constant value or map reference. Used to associate the correct ticker. If the ticker is not found or the value is not set, the wallet SHOULD display the raw value instead with an “Unknown token” warning. Exactly one of “tokenPath” or “token” must be set.
- Validated by:
_validate_one_of_token_path_or_value
- field tokenPath: validate, json_schema_input_type=PydanticUndefined)] | None = None
Path reference to the address of the token contract. Used to associate correct ticker. If ticker is not found or tokenPath is not set, the wallet SHOULD display the raw value instead with an”Unknown token” warning. Exactly one of “tokenPath” or “token” must be set.
- Validated by:
_validate_one_of_token_path_or_value
- pydantic model erc7730.model.input.v2.display.InputTokenTickerParameters[source]View on GitHub
Bases:
ModelToken Ticker Formatting Parameters.
- Fields:
- Validators:
_validate_chainid_mutually_exclusive»all fields
- field chainId: int | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | ~erc7730.model.input.v2.display.InputMapReference | None = None
Optional. The chain on which the token is deployed (constant, or a map reference). When present, the wallet SHOULD resolve the token ticker for this chain. Useful for cross-chain swap clear signing.
- Validated by:
_validate_chainid_mutually_exclusive
- field chainIdPath: validate, json_schema_input_type=PydanticUndefined)] | None = None
Optional. Path to the chain ID in the structured data. When present, the wallet SHOULD resolve the token ticker for the chain at this path. Useful for cross-chain swap clear signing.
- Validated by:
_validate_chainid_mutually_exclusive
- pydantic model erc7730.model.input.v2.display.InputUnitParameters[source]View on GitHub
Bases:
ModelUnit Formatting Parameters.
- Fields:
- field base: validate, json_schema_input_type=PydanticUndefined)] | str [Required]
The base symbol of the unit, displayed after the converted value. It can be an SI unit symbol or acceptable dimensionless symbols like % or bps.
- field decimals: int | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | None = None
The number of decimals of the value, used to convert to a float.
- field prefix: bool | ~typing.Annotated[~erc7730.model.paths.DescriptorPath, ~pydantic.types.GetPydanticSchema(get_pydantic_core_schema=~erc7730.model.input.path.<lambda>, get_pydantic_json_schema=None), FieldInfo(annotation=NoneType, required=True, title='Descriptor Path', description='A path applying to the current file describing the structured data formatting, after merging with includes. A descriptor path can only reference a single value in the document. Such paths are prefixed with "$".', examples=['$.foo.bar']), ~erc7730.common.pydantic.ErrorTypeLabel(func=~erc7730.common.pydantic.ErrorTypeLabel._validator.<locals>.validate, json_schema_input_type=PydanticUndefined)] | None = None
Whether the value should be converted to a prefixed unit, like k, M, G, etc.
- pydantic model erc7730.model.input.v2.display.InputVisibilityConditions[source]View on GitHub
Bases:
ModelComplex visibility conditions for field display rules.
- Fields:
- Validators:
_validate_at_least_one_condition»all fields