robsonsf
robsonsf

Reputation: 31

Minting with Moralis.executeFunction on Node won’t work

I have written the code below to mint NFTs using Moralis.executeFunction, but I am getting the error below.

C:\DriveD\Projects\object-to-NFT\node_modules\@ethersproject\logger\lib\index.js:233
        var error = new Error(message);
                    ^
Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.0)
  reason: 'could not detect network',
  code: 'NETWORK_ERROR',
  event: 'noNetwork'

Here is my code.

 const mintAndGo = async () => {
   // setUploading(true);
   
   await Moralis.start({
    moralisSecret: process.env.MORALIS_SECRET
  });

      await Moralis.enableWeb3({
      chainId: 0x4,  //for Rinkeby
      privateKey: process.env.RINKEBY_PRIVATE_KEY,
    })
   
    const minter = await Moralis.executeFunction({
      functionName: "mint",
      abi,
      contractAddress: "0xCdA50367a485eF74a43E2614A44aDFB47FC7E093",
      params: {
        cid,
        data: []
      }
    })

    console.log("Minter", minter)
  }

I just followed the samples that I found on the internet but I don't know why it keeps complaining that it cannot find the network. Any clues?

Upvotes: 1

Views: 119

Answers (0)

Related Questions