Skip to content

[#625] Fix EIP-712 chainId signing failure in Farcaster miniapp#626

Merged
realproject7 merged 1 commit intomainfrom
task/625-eip712-chainid-fix
Mar 28, 2026
Merged

[#625] Fix EIP-712 chainId signing failure in Farcaster miniapp#626
realproject7 merged 1 commit intomainfrom
task/625-eip712-chainid-fix

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Change BigInt(BASE_CHAIN_ID)Number(BASE_CHAIN_ID) in EIP-712 domain config in both AgentManage.tsx and AgentRegister.tsx
  • BASE_CHAIN_ID is already a Number in constants.ts — the BigInt wrapping caused viem's stringify to serialize it as string "8453", which the Farcaster wallet rejects with "Unable to parse chainId"

Test plan

  • Open the miniapp in Farcaster and attempt setAgentWallet EIP-712 signing — should no longer error with "Unable to parse chainId"
  • Verify the typed data signature completes and the transaction succeeds on Base Sepolia

Fixes #625

🤖 Generated with Claude Code

Farcaster wallet expects chainId as a number, but BigInt(BASE_CHAIN_ID)
gets serialized to string "8453" by viem's stringify, causing "Unable to
parse chainId" errors. BASE_CHAIN_ID is already a Number, so the BigInt
wrapping was unnecessary.

Fixes #625

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored Mar 28, 2026 6:21pm

Request Review

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Verified: BASE_CHAIN_ID is already Number in lib/contracts/constants.ts (line 14: const chainId = Number(process.env.NEXT_PUBLIC_CHAIN_ID || "84532")). The BigInt() wrapping was redundant and caused viem's stringify to serialize chainId as a string, breaking Farcaster wallet's EIP-712 parser. Minimal, correct fix — two lines changed, build passes.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

This PR makes the scoped EIP-712 domain fix requested in issue #625 by changing the chainId field from BigInt(BASE_CHAIN_ID) to Number(BASE_CHAIN_ID) in both affected components.

Findings

  • No findings.

Decision

Approve. The diff is minimal, matches the issue acceptance criteria at the code level, and avoids the BigInt-to-string serialization problem described for Farcaster signing.

@realproject7 realproject7 merged commit d6565d4 into main Mar 28, 2026
5 checks passed
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.

Fix EIP-712 signing failure in Farcaster miniapp — BigInt chainId serialization

2 participants