[SOLVED] Moralis.enableWeb3();

Why do I have problems using this line of code

   const web3 = await Moralis.enableWeb3();

I have initialized, I have

import { useMoralis } from “react-moralis”;
const { Moralis } = useMoralis();

which I don’t really get why I can’t just import Moralis. but it seems to work with all the other functions, but when I do a transfer, I get error that Web3 is not enabled, but I can’t call Moralis.enableWeb3 for some reason . Any ideas ?

What is the problem that you have when calling Moralis…enableWeb3()?

property ‘enableWeb3’ does not exist on type ‘typeof Moralis’.ts(2339)

Is there a type definition for Moralis?

await (Moralis as any).enableWeb3() works?

By God, that works ! Thanks.

1 Like