Skip to content

fix: handle MetaMask Mobile network switch fallback#1670

Open
sirakinb wants to merge 1 commit into
etherisc:developfrom
sirakinb:codex/fix-metamask-mobile-network-switch
Open

fix: handle MetaMask Mobile network switch fallback#1670
sirakinb wants to merge 1 commit into
etherisc:developfrom
sirakinb:codex/fix-metamask-mobile-network-switch

Conversation

@sirakinb

Copy link
Copy Markdown

Fixes #215.

Summary

  • Handle MetaMask Mobile's wrapped unknown-chain error (data.originalError.code === 4902) when switching networks.
  • Await the wallet_addEthereumChain fallback so the button actually opens the add-network flow when Polygon Mumbai is missing.
  • Show a wallet error message instead of failing silently, and disable the button while the wallet request is pending.

Testing

  • Not run locally: this environment does not have npm/yarn/pnpm available and the fresh clone has no node_modules.

Notes

This keeps the existing HTTPS-RPC guard before attempting wallet_addEthereumChain.

@sirakinb

Copy link
Copy Markdown
Author

Small CI note: the CLA Assistant check appears to be failing before it can post the usual signature prompt.

The check annotation says:

Could not retrieve repository contents. Status: 401

From .github/workflows/cla.yml, this workflow reads signatures from etherisc/cla-signatures via PERSONAL_ACCESS_TOKEN, so this looks like a CLA workflow credential/access issue rather than a code/test failure in this PR. Happy to complete the CLA step once the workflow can prompt/check it.

@sirakinb

Copy link
Copy Markdown
Author

Maintainer note: the CLA Assistant check is failing before it can evaluate the PR. The workflow reports that it could not retrieve repository contents with status 401, which looks like a CLA Assistant token/app permission issue on the repository side rather than a code failure in this PR.

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.

[MetaMask Mobile] "Switch to network Polygon mumbai" button does nothing

2 participants