I use react moralis, and only use enableWeb3() to connect web3
I want to terminate current web3 session and connect with other wallet.
Please help.
No, because I not login. Only enableWeb3. I want disable web3 and enable again.
You can still try to logout even if you didn’t log in
That’s weird.
I click
<button className="button-disconnect" onClick={() => logout()}>Disconnect</button>
but when
console.log(isWeb3Enabled);
It’s still return true.
if you try to enableWeb3 again with new parameters it doesn’t work?
we may not have this functionality now
can you give more details on how you want to use it?
and maybe some simple code example?
we found out that this functionality is present in vanilla js this way:
await Moralis.enableWeb3();
console.log("ENABLED", Moralis.isWeb3Enabled());
await Moralis.deactivateWeb3();
console.log("DISABLED", Moralis.isWeb3Enabled());
Thank you, can it use for react moralis?
you could try to call it in react directly with Moralis.deactivateWeb3(), and import Moralis for useMoralis()
I have tried it. Return error: TypeError: Moralis.deactivateWeb3 is not a function. So sad
What version of Moralis sdk?
react-moralis :0.2.8
moralis: 0.0.104
That is a super old version, a lot of things may not be present there. You can try at least 0.0.184 (latest one pre ethers). Or directly latest version of Moralis sdk
You can get const { deactivateWeb3 } = useMoralis()