erc7730.model.display module

pydantic model erc7730.model.display.AddressNameParameters[source]View on GitHub

Bases: Model

Address Names Formatting Parameters.

Fields:
field sources: list[AddressNameSources] | None = None

Trusted Sources for names, in order of preferences. See specification for more details on sourcesvalues.

field type: AddressNameType | None = None

The type of address to display. Restrict allowable sources of names and MAY lead to additionalchecks from wallets.

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

Bases: str, Enum

Trusted Source for names.

ENS = 'ens'

Address MAY be replaced with an associated ENS domain.

LOCAL = 'local'

Address MAY be replaced with a local name trusted by user. Wallets MAY consider that local setting for sources is always valid.

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

Bases: str, Enum

The type of address to display. Restrict allowable sources of names and MAY lead to additional checks from wallets.

COLLECTION = 'collection'

Address is a well known NFT collection.

CONTRACT = 'contract'

Address is a well known smartcontract.

EOA = 'eoa'

Address is an Externally Owned Account.

TOKEN = 'token'

Address is a well known ERC-20 token.

WALLET = 'wallet'

Address is an account controlled by the wallet.

pydantic model erc7730.model.display.CallDataParameters[source]View on GitHub

Bases: Model

Embedded Calldata Formatting Parameters.

Fields:
field calleePath: str | None = None

The path to the address of the contract being called by this embedded calldata.

field selector: str | None = None

The selector being called, if not contained in the calldata. Hex string representation.

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

Bases: str, Enum

The encoding for a date.

BLOCKHEIGHT = 'blockheight'

The date is encoded as a block height.

TIMESTAMP = 'timestamp'

The date is encoded as a timestamp.

pydantic model erc7730.model.display.DateParameters[source]View on GitHub

Bases: Model

Date Formatting Parameters

Fields:
field encoding: DateEncoding [Required]

The encoding of the date.

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

Bases: str, Enum

The format of the field, that will be used to format the field value in a human readable way.

ADDRESS_NAME = 'addressName'

The field should be displayed as a trusted name, or as a raw address if no names are found in trusted sources. List of trusted sources can be optionally specified in parameters.

AMOUNT = 'amount'

The field should be displayed as an amount in underlying currency, converted using the best magnitude / ticker available.

CALL_DATA = 'calldata'

The field is itself a calldata embedded in main call. Another ERC 7730 should be used to parse this field. If not available or not supported, the wallet MAY display a hash of the embedded calldata instead.

DATE = 'date'

The field should be displayed as a date. Suggested RFC3339 representation. Parameter specifies the encoding of the date.

DURATION = 'duration'

The field should be displayed as a duration in HH:MM:ss form. Value is interpreted as a number of seconds.

ENUM = 'enum'

The field should be displayed as a human readable string by converting the value using the enum referenced in parameters.

NFT_NAME = 'nftName'

The field should be displayed as a single NFT names, or as a raw token Id if a specific name is not found. Collection is specified by the collectionPath parameter.

RAW = 'raw'

The field should be displayed as the natural representation of the underlying structured data type.

TOKEN_AMOUNT = 'tokenAmount'

The field should be displayed as an amount, preceded by the ticker. The magnitude and ticker should be derived from the tokenPath parameter corresponding metadata.

UNIT = 'unit'

The field should be displayed as a percentage. Magnitude of the percentage encoding is specified as a parameter. Example: a value of 3000 with magnitude 4 is displayed as 0.3%.

pydantic model erc7730.model.display.FieldsBase[source]View on GitHub

Bases: Model

A field formatter, containing formatting information of a single field in a message.

Fields:
field path: str [Required]

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

pydantic model erc7730.model.display.FormatBase[source]View on GitHub

Bases: Model

A structured data format specification, containing formatting information of fields in a single type of message.

Fields:
field excluded: list[str] | None = None

Intentionally excluded fields, as an array of paths referring to specific fields. A field that has no formatter and is not declared in this list MAY be considered as an error by the wallet wheninterpreting the descriptor.

field id: Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Id', description='An internal identifier that can be used either for clarity specifying what the element is or as areference in device specific sections.', metadata=[MinLen(min_length=1)])] | None = None (alias '$id')

An internal identifier that can be used either for clarity specifying what the element is or as areference in device specific sections.

field intent: Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Simple Intent', description='A description of the intent of the structured data signing, that will be displayed to the user.')] | Annotated[dict[str, str], FieldInfo(annotation=NoneType, required=True, title='Complex Intent', description='A description of the intent of the structured data signing, that will be displayed to the user.')] | None = None

A description of the intent of the structured data signing, that will be displayed to the user.

field required: list[str] | None = None

A list of fields that are required to be displayed to the user. A field that has a formatter andis not in this list is optional. A field that does not have a formatter should be silent, ie notshown.

field screens: dict[str, list[Screen]] | None = None

Screens section is used to group multiple fields to display into screens. Each key is a wallettype name. The format of the screens is wallet type dependent, as well as what can be done (reorderingfields, max number of screens, etc…). See each wallet manufacturer documentation for moreinformation.

pydantic model erc7730.model.display.NftNameParameters[source]View on GitHub

Bases: Model

NFT Names Formatting Parameters.

Fields:
field collectionPath: str [Required]

The path to the collection in the structured data.

pydantic model erc7730.model.display.Screen[source]View on GitHub

Bases: RootModel[dict[str, Any]]

Screens section is used to group multiple fields to display into screens. Each key is a wallet type name. The format of the screens is wallet type dependent, as well as what can be done (reordering fields, max number of screens, etc…). See each wallet manufacturer documentation for more information.

Fields:

pydantic model erc7730.model.display.TokenAmountParameters[source]View on GitHub

Bases: Model

Token Amount Formatting Parameters.

Fields:
field message: str | None = None

The message to display when the amount is above the threshold.

field nativeCurrencyAddress: str | list[str] | None = None

An address or array of addresses, any of which are interpreted as an amount in native currencyrather than a token.

field threshold: str | None = None

The threshold above which the amount should be displayed using the message parameter rather thanthe real amount.

field tokenPath: str | None [Required]

Path reference to the address of the token contract. Used to associate correct ticker. If tickeris not found or tokenPath is not set, the wallet SHOULD display the raw value instead with an”Unknown token” warning.

pydantic model erc7730.model.display.UnitParameters[source]View on GitHub

Bases: Model

Unit Formatting Parameters.

Fields:
field base: str [Required]

The base symbol of the unit, displayed after the converted value. It can be an SI unit symbol oracceptable dimensionless symbols like % or bps.

field decimals: int | None = None

The number of decimals of the value, used to convert to a float.

field prefix: bool | None = None

Whether the value should be converted to a prefixed unit, like k, M, G, etc.