erc7730.convert.ledger.eip712.convert_erc7730_v2_to_eip712 module

Conversion of v2 ERC-7730 input descriptors to Ledger legacy EIP-712 descriptors.

In v2, the EIP-712 schemas are no longer embedded in context.eip712.schemas. Instead, the display.formats keys are encodeType strings (e.g. Order(address owner,Bridge bridge)Bridge(bytes4 sel,uint256 chainId)) from which the full EIP-712 schema can be reconstructed.

This module provides:

  • parse_encode_type (from common.abi): reverses an encodeType string into (primaryType, types_dict)

  • _reconstruct_eip712_domain: rebuilds the EIP712Domain type from the v2 resolved domain and deployment information

  • ERC7730V2toEIP712Converter: the converter class that ties everything together

final class erc7730.convert.ledger.eip712.convert_erc7730_v2_to_eip712.ERC7730V2toEIP712Converter[source]View on GitHub

Bases: object

Converts a v2 ERC-7730 input descriptor with EIP-712 context to Ledger legacy EIP-712 descriptors.

The conversion: 1. Resolves the v2 input descriptor. 2. Reconstructs EIP712Domain from domain info + deployments. 3. Parses each display.formats key (an encodeType string) to rebuild the per-message schema. 4. Converts v2 resolved display fields to InputEIP712MapperField. 5. Produces one InputEIP712DAppDescriptor per chain id.

convert(input_descriptor: InputERC7730Descriptor, out: OutputAdder | None = None) dict[str, InputEIP712DAppDescriptor] | None[source]View on GitHub

Convert a v2 input descriptor to legacy EIP-712 descriptors.

Parameters:
  • input_descriptor – a deserialized v2 input ERC-7730 descriptor

  • out – error / warning handler (defaults to console)

Returns:

dict mapping chain id strings to legacy descriptors, or None on error