erc7730.model.display module

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.

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.

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.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 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 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.', metadata=[MinLen(min_length=1), MaxLen(max_length=256)])] | 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.', metadata=[MinLen(min_length=1), MaxLen(max_length=32)])] | None = None

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

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

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.

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: