rainbowkit icon indicating copy to clipboard operation
rainbowkit copied to clipboard

[bug] Network Switcher doesn't show and work on Android

Open mzspcgg opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

RainbowKit Version

1.0.5

wagmi Version

1.0.9

Current Behavior

When I choose the Mumbai network on Android MetaMask and click on the ConnectButton, it connects properly. However, it does not indicate that the network is incorrect (Polygon Mainnet is the default and only network).

Sometimes when I switch back to MetaMask and reopen Chrome, it detects the wrong network, and the ConnectButton changes to red. It appears that the state of this button doesn't update when MetaMask redirects back to the app.

Moreover, when I click on the "Wrong network" button, it properly displays a modal, and I can click "Polygon." But it does not open MetaMask to change this network; in fact, nothing happens.

Expected Behavior

  1. The button status should change to "Wrong network" immediately after being redirected back from MetaMask post-connection on Android.
  2. When I click on "Polygon network" in the Switch Network modal, it should redirect me to MetaMask and change the network to the selected one. If someone doesn't have this network added to MetaMask, it should automatically add it.

Steps To Reproduce

No response

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

No response

mzspcgg avatar Jul 08 '23 11:07 mzspcgg

Hey @mzspcgg. For me the android behaviour works fine. It changes to "Wrong network" if it's unsupported right after MetaMask post connection on android + switching chains works fine even if you have them or not.

Do you have a reproducible example of this where i can test this behaviour ?

magiziz avatar Nov 13 '23 14:11 magiziz

Hello I am getting exactly the same error and ever stranger.

I'm currently working on integrating Metamask with my DApp using RainbowKit and Wagmi. I'm encountering a peculiar issue. In my configuration, I've specified only the Polygon Mumbai chain, which isn't added to my Metamask. However, after connecting through the Connect button and confirming in Metamask, my website displays a message stating that I am connected to the Mumbai network, even though it's not present in my wallet.

I'm seeking assistance to troubleshoot this problem. Can you please contact me via Telegram to talk I details about this problem, please?

My Telegram https://t.me/dmykovI

chesspolygon avatar Dec 23 '23 02:12 chesspolygon

I can replicate this issue now. This seems to be issue with walletconnect linking on mobile. Will take closer look and update once it's been resolved 🙏

magiziz avatar Jan 12 '24 17:01 magiziz

@mzspcgg Just got informed from WalletConnect that it's a normal issue from metamask. Since they are a single chain wallet they have some bugs on their end. Will keep this issue open until it's resolved on their end.

magiziz avatar Jan 21 '24 22:01 magiziz

@mzspcgg Are you able to reproduce this issue with the latest RainbowKit version ?

magiziz avatar Feb 26 '24 13:02 magiziz

@mzspcgg Any updates ?

magiziz avatar Feb 29 '24 02:02 magiziz

Sorry, I can't check, because I just use Wallet Connect now.

mzspcgg avatar Feb 29 '24 08:02 mzspcgg

@mzspcgg Can we close this issue for now ? If the issue persist we'll reopen this ?

magiziz avatar Feb 29 '24 08:02 magiziz

Still facing this issue @magiziz It directly disconnects wallet if network is not same as required

yashsisodiya avatar Jul 11 '24 07:07 yashsisodiya

@yashsisodiya Is your wallet getting disconnected when you change to the wrong network that's not supported ? Can you provide a small minimal reproducible example ?

magiziz avatar Jul 15 '24 09:07 magiziz

@yashsisodiya Is your wallet getting disconnected when you change to the wrong network that's not supported ? Can you provide a small minimal reproducible example ?

You can check below. Behaving weird on mobile, Metamask switch chain doesn't work. For iOS, the connected event comes late. https://codesandbox.io/p/devbox/rainbowkit-sign-887fq3?file=%2Fsrc%2FApp.tsx%3A151%2C39 @magiziz

yashsisodiya avatar Jul 15 '24 10:07 yashsisodiya

@yashsisodiya Heard back from the WalletConnect team and seems like MetaMask isn't working as expected in most times. It sometimes works fine and sometimes doesn't. This means you have to manually either switch the network in app, or just disconnect and connect again to the right network. Ideally you can use browser wallet which helps as well.

magiziz avatar Jul 15 '24 11:07 magiziz