Firstly, thanks for your work on this project! π
Today I used patch-package to patch @web3-react/metamask@8.2.1 for the project I'm working on.
There is an issue with this.provider.on('connect') when both the OKX wallet extension and Metamask extension are installed.
When I connect my wallet for the first time, OKX requests that I choose between using Metamask or OKX. If I select Metamask and then switch to another network from my dapp, web3-react always switches back to the network that OKX is using. This issue also occurs on the Uniswap Interface. I have recorded a video demonstrating how to reproduce the issue on Uniswap: https://drive.google.com/file/d/1ekooojSgq0FGPH8osMRFHJ3wS7Elqtx-/view?usp=sharing
Upon investigating the library, I discovered that the chainId returned from the connect event is incorrect. I am unsure about what's causing this problem with OKX, but I believe we can ensure consistent data by querying the chainId from the provider instead of relying on the value from the connect event.
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch
@web3-react/metamask@8.2.1
for the project I'm working on.There is an issue with
this.provider.on('connect')
when both the OKX wallet extension and Metamask extension are installed. When I connect my wallet for the first time, OKX requests that I choose between using Metamask or OKX. If I select Metamask and then switch to another network from my dapp, web3-react always switches back to the network that OKX is using. This issue also occurs on the Uniswap Interface. I have recorded a video demonstrating how to reproduce the issue on Uniswap: https://drive.google.com/file/d/1ekooojSgq0FGPH8osMRFHJ3wS7Elqtx-/view?usp=sharingUpon investigating the library, I discovered that the chainId returned from the connect event is incorrect. I am unsure about what's causing this problem with OKX, but I believe we can ensure consistent data by querying the chainId from the provider instead of relying on the value from the connect event.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.