wevm / references

Collection of Chains & Connectors for wagmi
MIT License
99 stars 205 forks source link

bug: WalletConnectConnector shows duplicated liks for v2 and opens blank pages for v1 #133

Closed Alexandra-Popa closed 1 year ago

Alexandra-Popa commented 1 year ago

Is there an existing issue for this?

Package Version

0.11.7

Current Behavior

I have installed the following Chrome browser extensions: MetaMask, Exodus, Crypto.com, OneKey.

Checking this example https://wagmi.sh/examples/connect-wallet (and following the same steps locally), I have the following issues:

First issue: When I open WalletConnect and select Desktop, OneKey appears 3 times, and on click of one of the above (installed extensions) I get for each errors like: Failed to launch 'cryptowallet://wc?uri=wc%3A420a9173-567d-47c2-96ee-092d4d128107%401%3Fbridge%3Dhttps%253A%252F%252Ff.bridge.walletconnect.org%26key%3D2fda74876a8aac70a239f9b4119f238a0423909684623422049199c7fc963819' because the scheme does not have a registered handler.

And instead of opening the browser extension wallet, a blank page opens in a new tab.

Also, I get similar behaviour and errors as above for other wallets like: Ledger, Wallet3, Bobablocks.

Second issue In local example, I added the following config:

connectors: [
    new MetaMaskConnector({
      chains,
      options: {
        shimChainChangedDisconnect: false
      }
    }),
    new WalletConnectConnector({
      chains,
      options: {
        qrcode: true,
        version: '2',
        projectId: PROJECT_ID
      }
    })
  ],

Now, using v2 I see in the modal, as desktop wallets, only Zerion, Infinity, pier, UniPass, Fireblocks, Marble, Prema. And all these wallets are displayed multiple times. Clicking on Zerion, Infinity, Prema I get for each errors like:

Not allowed to launch 'premawallet://wc?uri=wc%3Aeca3afbc064b31f89d3799b181e20bdd278add38fb1946925a1ca65330911009%402%3Frelay-protocol%3Dirn%26symKey%3Dacc756f87a5b7ce5beffb878a583de5b8c2a48082346cc6dfcd5b38483c1f32c' because a user gesture is required.
localhost/:1 Failed to launch 'premawallet://wc?uri=wc%3Aeca3afbc064b31f89d3799b181e20bdd278add38fb1946925a1ca65330911009%402%3Frelay-protocol%3Dirn%26symKey%3Dacc756f87a5b7ce5beffb878a583de5b8c2a48082346cc6dfcd5b38483c1f32c' because the scheme does not have a registered handler.

Expected Behavior

First issue: I would expect clicking on one of the wallets to open the installed browser extension for that respective wallet.

Second issue I would expect to see all the desktop wallets showed here https://web3modal.com/. Also, to be able to scan the qr code and connect from my MetaMask mobile app, like I can do here https://web3modal.com/.

Steps To Reproduce

First issue: Install the following Chrome browser extensions: MetaMask, Exodus, Crypto.com, OneKey. Go to https://wagmi.sh/examples/connect-wallet and click on WalletConnect, then try to connect to one of the installed browser extensions. (you will get a blank page)

Second issue Keep only MetaMask browser extension. npm install @web3modal/ethereum @web3modal/react wagmi ethers@^5 Then follow this steps: https://wagmi.sh/examples/connect-wallet And use the following connectors:

connectors: [
    new MetaMaskConnector({
      chains,
      options: {
        shimChainChangedDisconnect: false
      }
    }),
    new WalletConnectConnector({
      chains,
      options: {
        qrcode: true,
        version: '2',
        projectId: PROJECT_ID
      }
    })
  ],

Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)

https://codesandbox.io/s/billowing-butterfly-8xg7yo

Anything else?

duplicated-wallets zerion

xzilja commented 1 year ago

I believe this will be solved once we release next iteration of WalletConnect connectors in wagmi. This issue did happen a while ago in older version of web3modal and was adressed 👍