Add pre-events for chain switch events so we know when the chain switch actually started #4501
Unanswered
semsamsmore
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be nice to add in a feature where it can detect when the users STARTS the chain switch.
I can see that we can currently use the
useSwitchChain()
with mutation -onMutate()
which states:This means its currently possible to pre-check when they change chains but there is 1 issue.
If the user switches chains within their wallet, they of course do not click our button / hook and do it inside of their wallet instead.
When they do it inside of their wallet, it wouldn't run this mutate so we wouldn't know when they actually started a chain switch.
The reason i'm needing this is that sometimes the chain switch requires 2 clicks (inside of rainbowkit and web3modal) and some others. So if i was on ETH chain, and click to switch to OPT, it would change in wallet but not in browser, so i'd like to make a user modal which would show a loading state when they START the chain switch and update when chain fully switched. If it doesn't fully switch then i'd like to throw an error so i can catch and show "Chain not accepted, please try again below".
I'm sure alot of others have this issue too, i've tested on many platforms and SDKs but it seems something deeper. (walletconnect / metamask mobile issue)
This would solve my chain switching once and for all by showing users nice UI with updated elements.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions