neu-fi / regen-bingo

Monorepo for both backend and contract developments of Regen Bingo!
https://regen.bingo
2 stars 1 forks source link

Show the network switch button on wrong networks #55

Closed hantuzun closed 1 year ago

hantuzun commented 1 year ago

On wrong networks, instead of seeing the wallet address and balance, there must be a switch network button.

hantuzun commented 1 year ago

I implemented this RainbowKit button like that previously.

hantuzun commented 1 year ago

@oytuncoban asks:

Are we going to support multiple chains at same time on a single domain (like göerli and mainnet) at the same time? Configuring chains like this prevents "Wrong Network" button if user is on Mainnet even if the deployment is on Göerli.

If I pass the chain list as only the chain is currently used, RainbowKit button will appear as "Wrong Network" on wrong networks.

We can support a single network per deployment.

regen.bingo -> ethereum 0.goerli.regen.bingo -> goerli contract a 1.goerli.regen.bingo -> goerli contract b etc.

oytuncoban commented 1 year ago

Then, changing the chain list as in the PR #60, is suitable for us, right?

This type of implementation also warns the user that the current network is wrong on the Connect button, and If the user clicks the button, it redirects the user to switch chains programmatically if the wallet supports it.

Another cool feature is that, since it uses default chain as the single chain passed into chain list, components loaded from the contract information of the correct chain. Then, if the user connects their wallet that is on the wrong network, it automatically asks for the user to switch networks.

oytuncoban commented 1 year ago

Is the idea of using single chain in the chain list passed to wagmi and rainbowkit that you don't like or just determining one in the _app.tsx @hantuzun ?

hantuzun commented 1 year ago

Fixed with https://github.com/neu-fi/regen-bingo/commit/a67e967b55fccd4d7226e0867ff9cb7f92feafd1