MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
11.97k stars 4.9k forks source link

wallet_addEthereumChain picking based on order in network tabs #11349

Open Sbphillips19 opened 3 years ago

Sbphillips19 commented 3 years ago

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

  1. Expect user to be able to click on button to select other RPC's with the name chainId

Screenshots

Screen Shot 2021-06-18 at 1 16 48 PM

Browser details (please complete the following information):

Additional context (Error Messages, etc.) This additionally picks the top RPC listed even if it is not mainnet

adonesky1 commented 3 years ago

@Sbphillips19 that Chip is not intended to be clickable. I've pushed a PR to change the styling to avoid that confusion. Thanks for pointing it out. We will also consider your suggested behavior of allowing users to select the RPC source in this prompt.