Problem with Migration from WalletConnect V1 to WalletConnect V2

Hello, everybody.

As WalletConnect V1 is already deprecated and does not function properly I have decided to implement the new WalletConnect V2 and migrate my dApps to it.

I have a Reusable Component Library that is feeding my dApps with all the different structure components like wallet connect buttons, banners, sections e.t.c.

I spoke to one of your customer supports and he helped me to properly invoke the WalletConnect V2 modal, but sadly now I am getting a bunch of errors in the console log after I connect with WalletConenct V2.

Here is how I replicate the issue:

  1. I open my dApp (locally)
  2. I am clicking on Connect Wallet button
  3. Then I choose to connect with WalletConnect
  4. I am scanning the QR code with my phone MetaMask app
  5. Metamask prompts me to sign and it says I have connected
  6. Then in my dApp the wallet address is showing correctly, but I am having bunch of errors in the console log which causes my dApp to do not actually obtain the wallet that is being connected.

Here are some screenshots:

When the modal pops up, it gives these errors:

After I try to connect it through the QR code it gives these errors:

Here is a replication of the problem on video: https://we.tl/t-ONmSGSKkuM

Here is the code for the ConnecWallet button component: https://we.tl/t-vZZnJDIwOa

Thank you!

Hi @MDimow

Regarding the error, there seems to be no solution as per the wallet-connected GitHub. And they just mentioned to disregard this error as it is not breaking anything related to walletconnect functions. You could also try some fixed that were mentioned on github.

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://verify.walletconnect.com') does not match the recipient window's origin ('http://localhost:3000').

regarding this error, I am unable to reproduce it using your code on my end. So it is possible that some other code is causing this error. I recommend checking if any part of your code is using e.send function.
image

When I tried to authenticate with your code, I was able to get the user session using Moralis.User so I have to conclude that the walletconnect v2 auth is working.