Wallet connect takes me to trust wallet page

Ofcourse i added the new way of custom message as mentioned in the previous ticket. Rest of the code is same.

Moralis.authenticate({
        provider: walletProvider,
        chainId: 56
      }).then(function (user) {
        authenticate(user.id, user.get('ethAddress')) // what does this code do?
      });

Does TrustWallet via WalletConnect login work correctly on https://rarible.com/connect ?

Yes it does work correctly but they donā€™t do any custom message sign in.

That code makes an entry in my database and refresh the page.

This code is working perfectly fine if you select metamask from walletconnect instead of trustwallet. So the issue is with trust wallet sign in! The extra code doesnā€™t matter because treat that as refreshing on callback!

Iā€™ve just tested it on local server with walletconnect+trustwallet on Android. Everything works correctly.

Maybe you should update your trustwallet version?

Trustwallet version is latest, ios version is latest!

I already mentioned that the problem is in iOS, not in android!

Could you try to login in https://forum-tests.vercel.app/ ?

Sign in message will be fixed in next versions. Could you try login to check if it will redirect to trustwallet website

Okay, the bug is not on your side. We need time to figure it out.

@Son

Itā€™s an issue on wallet connect side. You can use solution from there:

Thanks for taking out time to figure this out, indeed the issue is with trust wallet, i made changes according to the link provided and it fixed the issue.

1 Like

What changes did you make?

Iā€™m having this same issue and canā€™t seem to solve it.

Hereā€™s my code:

try {
      setVisibleModal(true);
      setLoadingMessage("Authenticating through WalletConnect");
      Moralis.Web3.getSigningData = () => 'Welcome to SpacePath Marketplace! Please sign in to create an account.';
      await Moralis.Web3.authenticate({ provider: "walletconnect" }).then((user) => {
        try {
          window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE');
          if (user) {
            const accountStatus = user.get("accountVerified");
            setAuthenticationChecker(false);
            setAccountVerified(accountStatus);
            setVisibleModal(false);
          } else {
            setVisibleErrorModal(true);
            setVisibleModal(false);
          };

If you also know how to workaround this issue please let me know.

maybe this is the change:

For now I just remove WALLETCONNECT_DEEPLINK_CHOICE from localstorage as soon as user leaves the page to confirm the connection:

$doc.on('visibilitychange', () => {
	if (document.visibilityState === 'hidden') {
		window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE');
	}
});

there were more comments previously on that thread.

2 Likes

You should remove WALLETCONNECT_DEEPLINK_CHOICE from local storage outside the method.

So the code i used to fix in jquery/js is : in my main js file :-

document.addEventListener('visibilitychange', () => { 
    if (document.visibilityState === 'hidden') { 
        window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE'); 
    } 
});
2 Likes

Thanks for the help. This worked!

2 Likes

Hi
window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE'); works when the user chooses the wallet, but after on transaction confirm he must manually switch to the wallet. If window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE'); is not removed everything working fine except we still have ā€œtrust wallet pageā€