I have imorted Moralis with
import Moralis from 'moralis
.
My pages/api/moralis/moralis.js file contains the following code:
import { MoralisNextApi } from "@moralisweb3/next";
export default MoralisNextApi({
apiKey: process.env.moralisApi,
});
This is what I use to start Web3:
let web3
async function startWeb3() {
web3 = await Moralis.enableWeb3();
}
startWeb3()
When the startWeb3() function is run, I get this error:
TypeError: moralis__WEBPACK_IMPORTED_MODULE_5__.default.enableWeb3 is not a function
Here is my package.json dependencies
"dependencies": {
"@apollo/client": "^3.7.10",
"@ethereumjs/common": "^3.1.1",
"@lens-protocol/client": "^0.3.0",
"@moralisweb3/common-core": "^2.18.0",
"@moralisweb3/common-evm-utils": "^2.18.0",
"@moralisweb3/next": "^2.18.0",
"@walletconnect/web3-provider": "^1.8.0",
"@web3auth/web3auth": "^2.1.3",
"antd": "^5.3.2",
"babel-preset-next": "^1.4.0",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"ethers": "5.7.2",
"graphql": "^16.6.0",
"magic-sdk": "^14.0.0",
"moralis": "^2.18.0",
"moralis-v1": "^1.12.0",
"next": "^13.2.4",
"next-auth": "^4.20.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-moralis": "^1.3.5",
"web3uikit": "^1.0.4"
},
Is enableWeb3() not a function? And if not, what should I use?