question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WalletConnect Session Fails to Reconnect

See original GitHub issue

Has anyone had WalletConnect session issues with the Unity Boilerplate?

If I start the app and authorize via QR with MetaMask, all operations including ETH/Token sending work fine.

But if I close the app and re-open it, the WalletConnect session almost never reconnects successfully. I can tell when it fails because it is supposed to ask the wallet to sign when the application launches afaik, and it does “rarely”, but most of the time restarting the game does not send a sign request to the wallet, causing the WalletConnect session to be invalid/non-working.

It has forced me to modify the boilerplate to force it to clear the WalletConnect session OnApplicationQuit, so that each time the game is launched the User is prompted to re-scan the QR code aka restart the session. Otherwise, the User is given an experience where they have a Moralis User Session but DO NOT have a valid WalletConnect Session. This means that wallet balances show, but operations like Send ETH/Token do not work. The only way I found to fix this was to clear the session when the game quits and re-authorize via QR scan each time it starts…

Trashing the WalletConnect session OnApplicationQuit by running MainMenuScript.Quit a total of 10 times seems to be a consistent workaround for now. It also prevents a ton of extra MetaMask WalletConnect Sessions from existing. Before I did this, my MM app showed like 50 open sessions to my game. Now, once I close my game, I always have zero open sessions to my game.

The big downside with this is that it forces the player to re-scan their QR code each time they launch. For a VR game, this is more complicated to do…requires us to email them the QR code 🐒 Ideally it would only ask their wallet to sign, of course.

Thank you all for this glorious boilerplate!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
0xPr0fcommented, Apr 12, 2022

This is regrading to the inconsistency of wallet connect

0reactions
schwindycommented, May 20, 2022

@KoenRijpstra YAY! This is massive, we will test this ASAP tyvm!

Read more comments on GitHub >

github_iconTop Results From Across the Web

WalletConnect Session was Disconnected – How to Fix
“WalletConnect session was disconnected” occurs usually when Walletconnect does not stay connected. It keeps disconnecting just a while ...
Read more >
Walletconnect does not stay connected : r/trustapp
The only way to get Walletconnect to work again is to rescan the QR code so that it will connect again. This is...
Read more >
Can't reconnect with stale localStorage.walletconnect data
Open the page again; Try to connect. Connection is established (or looks established) for a brief moment and then disconnect event happens as ......
Read more >
flutter - Walletconnect does not stay connected
I used walletconnect_secure_storage package to overcome this issue. first, initialize the wallet connect storage
Read more >
WalletConnect and TrustWallet Fail - English
I have tried to connect to several Dapps like uniswap, pancakeswap, dextools and it's more miss than hits on getting it to connect....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found