Bug
The viem adapter converts the typed-data domain chain id with Number(domain.chainId) unconditionally:
chainId: Number(domain.chainId),
When callers sign typed data whose domain intentionally omits chainId, this passes NaN into walletClient.signTypedData. That is different from the ethers adapter, which forwards the domain as provided, and from the seaport bridge in this repo, which already treats domain.chainId as optional.
Expected behavior
If domain.chainId is absent, the viem adapter should omit chainId / pass undefined rather than materializing NaN.
Why this matters
EIP-712 domains can omit optional fields. Passing NaN makes the viem entry point reject or sign a malformed domain for otherwise valid typed-data payloads that do not include a chain id.
Suggested fix
Use the same optional handling as src/provider/seaport-bridge.ts:
chainId: domain.chainId ? Number(domain.chainId) : undefined,
and add a regression test that calls the viem signer with a domain without chainId and asserts the forwarded domain uses chainId: undefined rather than NaN.
Bug
The viem adapter converts the typed-data domain chain id with
Number(domain.chainId)unconditionally:When callers sign typed data whose domain intentionally omits
chainId, this passesNaNintowalletClient.signTypedData. That is different from the ethers adapter, which forwards the domain as provided, and from the seaport bridge in this repo, which already treatsdomain.chainIdas optional.Expected behavior
If
domain.chainIdis absent, the viem adapter should omitchainId/ passundefinedrather than materializingNaN.Why this matters
EIP-712 domains can omit optional fields. Passing
NaNmakes the viem entry point reject or sign a malformed domain for otherwise valid typed-data payloads that do not include a chain id.Suggested fix
Use the same optional handling as
src/provider/seaport-bridge.ts:and add a regression test that calls the viem signer with a domain without
chainIdand asserts the forwarded domain useschainId: undefinedrather thanNaN.