fix(eip712): drop duplicated chain name row from domain rows (WALLET-1318)#46
Merged
Merged
Conversation
…1318) The EIP-712 signing screen showed the chain name twice in the Domain section: once as the synthetic "Network" row (built by consumers from `signatureRequest.chainName`) and once as a generic "Chain Name" row in `domainRows`. `EIP712SignatureRequestDto` promotes `domain.chain_name` into the dedicated `chainName` field, but `buildTypedDataDisplayModel` still emitted it among the generic domain rows. - add optional `excludeDomainKeys` to `buildTypedDataDisplayModel` to filter domain entries out of `domainRows` - exclude `chain_name` from the DTO so it surfaces only as `chainName` - extract the shared `EIP712_CHAIN_NAME_KEY` constant to keep the promote-and-exclude sites in sync - cover the new behaviour, including a domain without `chain_name` Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: ost-ptk <ostap@make.services>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the Domain section of the EIP-712 signing screen, the chain name was shown twice:
signatureRequest.chainName.signatureRequest.domainRows.Both rendered
typedData.domain.chain_name.Root cause
EIP712SignatureRequestDtopromotesdomain.chain_nameinto a dedicatedchainNamefield, butbuildTypedDataDisplayModelalso builtdomainRowsviaObject.entries(domain), sochain_nameremained there too (labelled "Chain Name").Changes
excludeDomainKeys: readonly string[] = []parameter tobuildTypedDataDisplayModel, filtering domain keys out ofdomainRows(backwards-compatible — defaults to[]).EIP712SignatureRequestDtonow passes[EIP712_CHAIN_NAME_KEY], sochain_nameis removed fromdomainRowswhilechainNamestays for the synthetic "Network" row.EIP712_CHAIN_NAME_KEYconstant (data/dto/eip712/common.ts) to keep the promote-and-exclude sites in sync (DTO + repository).chain_nameexclusion, other domain/message rows preserved, edge case for a domain withoutchain_name.Verification
yarn test— EIP-712 suite: 69 passed.yarn code:check— types and lint clean (Prettier warnings only for unrelated files, not part of this diff).🤖 Generated with Claude Code