Skip to content

fix(web): verify MetaMask chain switch - #138

Open
dirtybits wants to merge 1 commit into
mainfrom
fix/verify-injected-chain-switch
Open

fix(web): verify MetaMask chain switch#138
dirtybits wants to merge 1 commit into
mainfrom
fix/verify-injected-chain-switch

Conversation

@dirtybits

Copy link
Copy Markdown
Owner

Summary

  • explicitly request Base Sepolia again after wallet_addEthereumChain, because EIP-3085 does not require adding a chain to make it active
  • re-read eth_chainId after each requested switch and fail closed unless MetaMask reports Base Sepolia
  • add behavioral regressions for the add-then-switch flow and a provider that reports success without changing chains

Test plan

  • npm test --workspace @agentvouch/web -- --maxWorkers=1 --no-fileParallelism __tests__/lib/baseInjectedWallet.test.ts
  • npm run format:check
  • npm run lint --workspace @agentvouch/web
  • npm run typecheck --workspace @agentvouch/web
  • npm test --workspace @agentvouch/web -- --maxWorkers=1 --no-fileParallelism
  • npm run verify:chain-map
  • npm exec --workspace @agentvouch/web -- next build --webpack
  • git diff --check origin/main...HEAD

Not verified

  • No browser or live MetaMask/Base Sepolia transaction was run; the wallet RPC sequencing is covered by isolated behavioral tests.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

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.

1 participant