From 592fece180b7800b696de2c2dd6746355ca8ca96 Mon Sep 17 00:00:00 2001 From: Laurent Castillo Date: Tue, 24 Mar 2026 16:38:28 +0100 Subject: [PATCH] fix: make domain.name optional in v2 to legacy EIP-712 conversion Some EIP-712 contracts (e.g. Safe) do not include a `name` field in their EIP712Domain. The v2 to legacy EIP-712 converter was requiring `domain.name` to be present and failing with "Missing domain name" when it was absent. Make `dapp_name` fall back to `metadata.owner` when `domain.name` is not set, so descriptors for contracts with a minimal EIP712Domain (e.g. only chainId + verifyingContract) can still be converted. Made-with: Cursor --- .../ledger/eip712/convert_erc7730_v2_to_eip712.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/erc7730/convert/ledger/eip712/convert_erc7730_v2_to_eip712.py b/src/erc7730/convert/ledger/eip712/convert_erc7730_v2_to_eip712.py index f5dac3b..c7a2731 100644 --- a/src/erc7730/convert/ledger/eip712/convert_erc7730_v2_to_eip712.py +++ b/src/erc7730/convert/ledger/eip712/convert_erc7730_v2_to_eip712.py @@ -483,14 +483,6 @@ def _convert_resolved( domain = context.eip712.domain has_deployments = len(context.eip712.deployments) > 0 - # Get dapp name from domain - dapp_name: str | None = domain.name if domain is not None else None - if dapp_name is None: - return out.error( - title="Missing domain name", - message="EIP-712 domain name is required for legacy EIP-712 conversion.", - ) - # Get contract name from metadata contract_name = descriptor.metadata.owner if contract_name is None: @@ -499,6 +491,9 @@ def _convert_resolved( message="metadata.owner is required for legacy EIP-712 conversion.", ) + # Get dapp name: prefer domain.name, fall back to metadata.owner + dapp_name: str = (domain.name if domain is not None and domain.name is not None else None) or contract_name + # Reconstruct EIP712Domain type domain_fields = _reconstruct_eip712_domain(domain, has_deployments, out)