rainbow-me / rainbowkit

The best way to connect a wallet 🌈 🧰
https://rainbowkit.com
MIT License
2.38k stars 625 forks source link

Not getting wrong network button on changing the network #1066

Closed sanjaybip closed 1 year ago

sanjaybip commented 1 year ago

Is there an existing issue for this?

RainbowKit Version

^0.11.0

wagmi Version

^0.11.7

Current Behavior

When I change the network or chain from metamask, I get connect button. So I am using BSC testnet as my chain, But once I change it to Mumbai for example I am expecting to see wrong network but instead I am seeing connect button. I changed back to BSC testnet again but I can still see connect button. Below is my wagmi setup.

const { chains, provider } = configureChains(
  [bscTestnet],
  [
    jsonRpcProvider({
      rpc: () => ({
        http: "https://data-seed-prebsc-2-s1.binance.org:8545",
      }),
    }),
    jsonRpcProvider({
      rpc: () => ({ http: "https://bsc-testnet.public.blastapi.io" }),
    }),
    publicProvider(),
  ]
);

const connectors = connectorsForWallets([
  {
    groupName: "Recommended",
    wallets: [
      injectedWallet({
        chains,
        shimDisconnect: true,
      }),
      metaMaskWallet({
        chains,
        shimDisconnect: true,
      }),
      rainbowWallet({ chains }),
      walletConnectWallet({ chains }),
    ],
  },
]);

const wagmiClient = createClient({
  autoConnect: true,
  connectors,
  provider,
});

metamaskissue-op

Expected Behavior

I am expecting I should see Wrong Network button. I think setting shimDisconnect: true is causing disconnection when changing the network.

Steps To Reproduce

No response

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

No response

Anything else?

No response

DanielSinclair commented 1 year ago

@sanjaydefidev Can't replicate this behavior. If you try the same chain switch approach on the rainbowkit.com docs site, do you see the same issue? Please send over a CodeSandbox/StackBlitz example; will see if I can reproduce with that.

sanjaybip commented 1 year ago

Yes I can see the same behaviour on rainbowkit.com. But then I realize this is common in all dapp using any type of wallet connector. I guess some kind of bug specific to Metamask Injected wallet.
So when we switch to a network which is not supported, we get connect wallet button instead of wrong network. Once I click the button, it popup to change the network.

DanielSinclair commented 1 year ago

@sanjaydefidev Interesting. I wasn't able to replicate this on my MetaMask instance. Do you have any additional extensions installed, like Stelo?

sanjaybip commented 1 year ago

I don't think so, I am testing it on brave, which has have a very few extensions, also I noticed same with chrome. Let me create a GIF again for to show you.

sanjaybip commented 1 year ago

@DanielSinclair mmissue(1)

DanielSinclair commented 1 year ago

I believe this issue has since been resolved in a Wagmi 0.12.x release. Have confirmed that the behavior is working as expected with RainbowKit v1 and Wagmi v1 in Brave. Can reopen if you're still seeing this problem.