MetaMask / MetaMask/metamask-extension
wallet_addEthereumChain picking based on order in network tabs
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
**Describe the bug**
When you call the method `requests.wallet_addEthereumChain` it will pick the top one in your networks based on chain. It appears clickable with pointer, so I believe the intended action would be to change between networks with that chainId.
Underneath the following text:
`This will switch the selected network within MetaMask to a previously added network:`
There is a button that is clickable, but nothing happens/ it doesn't allow you to select another network that you have with the same chain. onClick does nothing with this button.
**Steps to reproduce (REQUIRED)**
Steps to reproduce the behavior, libraries used with version number, and/or any setup information to easily reproduce:
1. Any site currently using this method- pancake, sushi, etc- have the wrong network in place and
2. Have the network that you should switch to with multiple options with the same chainId
3. Connect to metamask
4. See popup with un clickable button
**Expected behavior**
5. Expect user to be able to click on button to select other RPC's with the name chainId
**Screenshots**

**Browser details (please complete the following information):**
- OS: OS X- Big Sur- 11.0
- Browser: Version 91.0.4472.106 (Official Build) (arm64)
- MetaMask Version: 9.6.1
**Additional context (Error Messages, etc.)**
This additionally picks the top RPC listed even if it is not mainnet
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the wallet_addEthereumChain flow with multiple networks sharing a chainId and inspect the popup shown under the network-switching message. Done means the clickable control lets users select the intended matching network or RPC instead of always choosing the first listed option, including when the first RPC is not mainnet.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100