Fix network switch bug for generic EIP-1193 providers#647
Fix network switch bug for generic EIP-1193 providers#647everdimension wants to merge 1 commit intoUniswap:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
A EIP-1193 spec does not describe an "isConnected()" method, so if this method is not found on the provider, the dapp should not assume it is not connected. Instead, only perform the check if the method is found. This fixed a bug when the UI goes into a infinite cycle of switching the network back and forth.
e44ee7c to
59459d6
Compare
|
The file you've updated is specific to MetaMask, not generic EIP-1193 providers. |
|
Hi @zzmp! Sorry for a delayed response
Kinda not true since uniswap's interface uses it for all injected wallets, not necessarily metamask
To reproduce, you need to inject an ethereum provider without an "isConnected" method Without these changes, the UI goes into an infinite cycle of switching the network back and forth |
|
Did you have time to take a look by any chance? |
|
Hi! Any updates? |
|
Hey! While your PR makes sense, I just wanted to point out that this is not EIP-1193 provider, but MetaMask provider, so it is expected to work with MetaMask. If there's a dapp that mimics MetaMask by injecting The provider that Zach was referring to is an EIP1193 package that has EIP1193 compatible provider and I guess that one does not rely on out-of-spec methods. Lastly, the code you're updating is confusing to me as I don't see:
We call the rest of the code (initialisation) regardless of whether that method was present or not. The fact that we conditionally call |
That would make sense, but I faced this by using a provider that does not mimic the In any case, you can reproduce it on your side if you wish to support EIP-1193 specification and not only metamask.
The problem with the original code is that it confuses missing |
A EIP-1193 spec does not describe an "isConnected()" method, so if this method is not found on the provider, the dapp should not assume it is not connected.
Instead, we can only perform the check if the method is found.
This fixed a bug when the UI goes into a infinite cycle of switching
the network back and forth.