Giveth / giveth-dapps-v2

This project is the aggregation of GIVeconomy and Giveth.io DApps in a single repo
https://staging.giveth.io
GNU General Public License v3.0
61 stars 34 forks source link

Why am I forced to switch to polygon when connecting a new wallet? (bug fix) #4377

Closed laurenluz closed 1 month ago

laurenluz commented 3 months ago

I tried connecting my metamask to Giveth with my wallet on gnosis chain. to connect, I had to sign a message... but then it was trying to make me switch to polygon... I rejected the network switch... but then it said the connect wallet failed.

It basically didn't allow me to connect my wallet until I allowed giveth to switch the network... and then I could switch back to gnosis to actually make the donation.

Weird bug.

@divine-comedian who is the right person to address this?

image

divine-comedian commented 3 months ago

I tested this out a bit more and was able to reproduce this issue, in order to repro:

  1. Sign into Giveth with Ethereum on any given network that we support
  2. Sign out on Giveth, switch network on metamask
  3. Sign into Giveth again
  4. See prompt from MM for you to switch network (this is the bug)

The expected behaviour is that if you connect to giveth from any network we support you are not prompted to switch to a specific network, unless on some certain conditions - such as the donate page to switch network when a project doesn't accept donations from your currently connected network.

As a side note, some users might be getting signed out automatically because of this other bug related to QF page #4379

laurenluz commented 3 months ago

Thanks @divine-comedian! so much more clear <3

divine-comedian commented 2 months ago

@mateodaza says it is related to #4401 and could be solved when the PR is merged

maryjaf commented 2 months ago
  • Sign into Giveth with Ethereum on any given network that we support
  • Sign out on Giveth, switch network on metamask
  • Sign into Giveth again
  • See prompt from MM for you to switch network (this is the bug)

Based on these steps I couldn't reproduce it Did I follow the steps correctly? @divine-comedian

https://github.com/Giveth/giveth-dapps-v2/assets/111529185/2f20c10c-858c-4a22-9adc-506f5fd71262

divine-comedian commented 2 months ago

That isn't the right flow to test it unfortunately - here is a quick video to show the error, which still persists.

https://github.com/Giveth/giveth-dapps-v2/assets/67759413/8e09e878-edf3-4368-8f36-dcb3d86d06e2

maryjaf commented 2 months ago

Thanks @divine-comedian I've also seen the same error on production now that I'm forced to switch from Celo to OP

divine-comedian commented 2 months ago

@mateodaza - please take a look at this

mateodaza commented 2 months ago

@divine-comedian @laurenluz @maryjaf I looked everywhere to find a configuration but seems like the default behavior goes like...

The solution I suggest is to always ask for a network before picking the wallet on the first sign-ups, showing this modal initially image

do you like this ux? I have a branch set with this config explained so you can check it out here

ps: I believe it's a feature and not a bug from web3modal to be "smart" and always remember to go back to your last session, tried this with other connectors (rainbowkit) and the behavior is different, anyway they do have a config to always default a singular chain but we're multi-chain so it doesn't help us

divine-comedian commented 2 months ago

@mateodaza thanks! I tested it out and I think it's okay... one more change while you're in there...

from the navbar when a user clicks "Switch Network" we should also show the same "choose network" view like the one you've shown above. when a user requests to switch network on our app we should avoid showing this modal:

image

here's a short video showing the current flow, from your feature branch:

https://github.com/user-attachments/assets/1e04bd77-fdb9-4f8b-baaa-69db416998b3