Moralis.Web3.enable() is not a function (after update)

Hi, my app was working some weeks ago, now after I created a new moralis server and moved my app on it, its not working anymore. I get this error on browser console: Moralis.Web3.enable() is not a function.

Here is my code:

$(document).ready(async function(){
  web3 = await Moralis.Web3.enable();
  TokenInstance = new web3.eth.Contract(abi.Token, TokenAddress);
  MarketplaceInstance = new web3.eth.Contract(abi.Marketplace, MarketplaceAddress);

What should I change or how can I create an older version of moralis server? Thank you for your time!

you can read here: Moralis JS SDK v1.0 (migration to Ethers.js)


Hey Iā€™m not entirely sure what version of the SDK are you using, but I think you might want to use Moralis.enableWeb3 instead of Moralis.Web3.enable. Also keep in mind that the latest version will use etherjs instead of web3js so make sure to make some further configuration to use web3 instead of ether

Also go read the post @cryptokid give right there :raised_hands:

1 Like