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(fromcommon.abi): reverses an encodeType string into(primaryType, types_dict)_reconstruct_eip712_domain: rebuilds theEIP712Domaintype from the v2 resolved domain and deployment informationERC7730V2toEIP712Converter: the converter class that ties everything together
- final class erc7730.convert.ledger.eip712.convert_erc7730_v2_to_eip712.ERC7730V2toEIP712Converter[source]View on GitHub
Bases:
objectConverts 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
EIP712Domainfrom domain info + deployments. 3. Parses eachdisplay.formatskey (an encodeType string) to rebuild the per-message schema. 4. Converts v2 resolved display fields toInputEIP712MapperField. 5. Produces oneInputEIP712DAppDescriptorper 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
Noneon error