Skip to content

fix(viem): omit missing typed-data chainId - #1995

Open
omerbek wants to merge 1 commit into
ProjectOpenSea:mainfrom
omerbek:fix/viem-typed-data-optional-chainid
Open

fix(viem): omit missing typed-data chainId#1995
omerbek wants to merge 1 commit into
ProjectOpenSea:mainfrom
omerbek:fix/viem-typed-data-optional-chainid

Conversation

@omerbek

@omerbek omerbek commented Aug 17, 2026

Copy link
Copy Markdown

Summary

  • avoid converting a missing typed-data domain.chainId into NaN in the viem signer adapter
  • pass undefined when chainId is absent, matching the optional handling used by the viem seaport bridge
  • add a regression test for signing typed data with no chainId in the domain

Fixes #1994.

Testing

  • npm run test -- test/provider/viem-adapter.spec.ts
  • npm run check-types
  • npx biome check src/provider/viem-adapter.ts test/provider/viem-adapter.spec.ts

Additional local notes:

  • npm ci currently fails because package.json and package-lock.json are out of sync on main (eslint@10.8.1 and transitive deps missing from the lockfile). I used npm install --package-lock=false for local verification without changing the lockfile.
  • npm run test reports 39 passed test files / 858 passed tests, then exits non-zero due to two unhandled ERR_REQUIRE_ESM errors from @asamuzakjp/css-color requiring @csstools/css-calc under the local Node v21.6.1 environment. The targeted viem adapter test passes.
  • npm run lint reports existing repository-wide CRLF formatting differences; the two changed files pass npx biome check directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Viem signer passes NaN chainId when typed-data domain omits chainId

1 participant