fix: infer EIP-712 primaryType in viem adapter - #2000
Open
Mabolla wants to merge 2 commits into
Open
Conversation
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.
Thanks for opening a PR!
We really appreciate you taking the time to contribute. It means a lot to the OpenSea team and the broader developer community.
A quick note about how this repo works
This repository is a read-only mirror of a package maintained in an internal monorepo. Because of that, pull requests cannot be merged directly here.
But don't worry -- your contribution won't be lost! Here's what happens next:
We'll keep you posted on the PR as things progress.
Is this a bug report?
If you're reporting a bug rather than submitting a code fix, opening an issue is usually the fastest path to a resolution. Bug report issues help us triage and prioritize effectively.
Thanks again for helping make OpenSea better for everyone!
Summary
Fixes EIP-712 signing through the SDK's standard viem wallet adapter when a dependency struct appears before the actual root struct in the
typesobject.This is the same primary-type inference issue addressed for the separate Seaport bridge path in #1998, but
src/provider/viem-adapter.tshas its ownsignTypedData()implementation and retained the same first-key heuristic.Root cause
createViemSigner().signTypedData()selected the first non-EIP712Domainkey asprimaryType.EIP-712 does not require the root struct to be declared first. For example, when
Personis declared beforeMailandMailreferencesPerson, the correct primary type isMail, but the viem adapter selectedPerson.Changes
Person[].Validation
Personis selected instead ofMail.Related
#1998 fixes the separate Seaport bridge implementation. This PR covers the standard viem adapter implementation in
src/provider/viem-adapter.ts.