Disable QRCode Moralis walletconnect

Hi
Each time a user loads a page, I use the following code to find out if the user is connected to their wallet.

     web3 = Moralis.enableWeb3({
            provider: "walletconnect",
        }).then(function() {}).catch(function() {
            console.log(Moralis.account);
        })

This code triggers if the user is connected to the wallet
Moralis.account
Return the userโ€™s account address
Otherwise the value of Moralis.account is equal to null

But this code pops up the QRcode walletconnect if the user is not connected to the wallet

Iโ€™m looking for a way to do one of the following
1 - Get the connected user information without re-running Moralis.enableWeb3
2 - If the user is connected, I will prevent the QrCode display and fill in Moralis.account

You can check this way. This will only run if the user is authenticated and web3 is not enabled.

!!Moralis.User.current() &&
  !!!Moralis.isWeb3Enabled() &&
  Moralis.enableWeb3({
    provider: "walletconnect",
  })

You can get the user information from Moralis.User.current().

1 Like