NFT Minter Program: "The parameter `chain` is not present: mainnet

Hi,

I followed the tutorial for the NFT minter program. Now I have changed the chain to mainnet and the url to the rarible website (so not on rinkeby anymore. Except I get the following error:

moralis.js:5602 Uncaught (in promise) Error: Something went wrong
[
  {
    "code": 400005,
    "message": "The parameter `chain` is not present"
  }
]
    at moralis.js:5602
    at tryCatch (moralis.js:28070)
    at Generator.invoke [as _invoke] (moralis.js:28300)
    at Generator.next (moralis.js:28125)
    at asyncGeneratorStep (moralis.js:27579)
    at _next (moralis.js:27601)
(anonymous) @ moralis.js:5602
tryCatch @ moralis.js:28070
invoke @ moralis.js:28300
(anonymous) @ moralis.js:28125
asyncGeneratorStep @ moralis.js:27579
_next @ moralis.js:27601
async function (async)
submit @ main.js:32

I used the templates provided here: https://github.com/MoralisWeb3/youtube-tutorials/tree/main/nft-minter

Any idea what is wrong?
Thanks!

what is on that line in main.js?

1 Like

await imageFile.saveIPFS();

were you authenticated when it tried to save to IPFS?

Where can I check this?
Look, it worked on the rinkeby test network. So the only thing I changed in main.js was rinkeby to mainnet

Where did you change that mainnet? On what line? You can also use eth instead of mainnet.

I changed the chain to eth (line 47) but now I get other errors. My metamask is connected to the site of the app

> MetaMask - RPC Error: Invalid parameters: must provide an Ethereum address.
> 
> 1. {code: -32602, message: 'Invalid parameters: must provide an Ethereum address.'}
> 
> ||(anonymous)|@|inpage.js:1|
> | --- | --- | --- | --- |
> ||(anonymous)|@|inpage.js:17|
> ||_runReturnHandlers|@|inpage.js:17|
> ||_processRequest|@|inpage.js:17|
> ||async function (async)|||
> ||_processRequest|@|inpage.js:17|
> ||_handle|@|inpage.js:17|
> ||handle|@|inpage.js:17|
> ||_rpcRequest|@|inpage.js:1|
> ||send|@|inpage.js:1|
> ||(anonymous)|@|moralis.js:5938|
> ||tryCatch|@|moralis.js:28070|
> ||invoke|@|moralis.js:28300|
> ||(anonymous)|@|moralis.js:28125|
> ||tryCatch|@|moralis.js:28070|
> ||maybeInvokeDelegate|@|moralis.js:28363|
> ||invoke|@|moralis.js:28274|
> ||(anonymous)|@|moralis.js:28125|
> ||asyncGeneratorStep|@|moralis.js:27579|
> ||_next|@|moralis.js:27601|
> ||(anonymous)|@|moralis.js:27608|
> ||Wrapper|@|moralis.js:32482|
> ||(anonymous)|@|moralis.js:27597|
> ||(anonymous)|@|moralis.js:6103|
> ||(anonymous)|@|moralis.js:5611|
> ||tryCatch|@|moralis.js:28070|
> ||invoke|@|moralis.js:28300|
> ||(anonymous)|@|moralis.js:28125|
> ||asyncGeneratorStep|@|moralis.js:27579|
> ||_next|@|moralis.js:27601|
> ||Promise.then (async)|||
> ||asyncGeneratorStep|@|moralis.js:27589|
> ||_next|@|moralis.js:27601|
> ||(anonymous)|@|moralis.js:27608|
> ||Wrapper|@|moralis.js:32482|
> ||(anonymous)|@|moralis.js:27597|
> ||(anonymous)|@|moralis.js:5635|
> ||submit|@|main.js:46|
> ||async function (async)|||
> ||submit|@|main.js:32|
moralis.js:5958 Uncaught (in promise) Error: Invalid parameters: must provide an Ethereum address. at moralis.js:5958 at tryCatch (moralis.js:28070) at Generator.invoke [as _invoke] (moralis.js:28300) at Generator.next (moralis.js:28125) at asyncGeneratorStep (moralis.js:27579) at _next (moralis.js:27601) at moralis.js:27608 at new Promise (<anonymous>) at new Wrapper (moralis.js:32482) at moralis.js:27597

||(anonymous)|@|moralis.js:5958|
| --- | --- | --- | --- |
||tryCatch|@|moralis.js:28070|
||invoke|@|moralis.js:28300|
||(anonymous)|@|moralis.js:28125|
||asyncGeneratorStep|@|moralis.js:27579|
||_next|@|moralis.js:27601|
||(anonymous)|@|moralis.js:27608|
||Wrapper|@|moralis.js:32482|
||(anonymous)|@|moralis.js:27597|
||(anonymous)|@|moralis.js:5974|
||_handle|@|inpage.js:17|
||async function (async)|||
||submit|@|main.js:32|

Where from it comes that error? From what line?

I think main.js:32

code: -32602, message: ‘Invalid parameters: must provide an Ethereum address.’

what do you have in main.js at line 32?

await imageFile.saveIPFS();

how does that main.js look like?

/** Connect to Moralis server */
const serverUrl = "https://ddheorrptrpz.usemoralis.com:2053/server";
const appId = "1lGIb4gerfkrybWOCZWAfL9e3qXkoiwoZrNmsvJL";
Moralis.start({ serverUrl, appId });
let user = Moralis.User.current();

/** Add from here down */
async function login() {
  if (!user) {
   try {
      user = await Moralis.authenticate({ signingMessage: "Hello World!" })
      initApp();
   } catch(error) {
     console.log(error)
   }
  }
  else{
    Moralis.enableWeb3();
    initApp();
  }
}

function initApp(){
    document.querySelector("#app").style.display = "block";
    document.querySelector("#submit_button").onclick = submit;
}

async function submit(){
    const input = document.querySelector('#input_image');
    let data = input.files[0]
    const imageFile = new Moralis.File(data.name, data)
    await imageFile.saveIPFS();
    let imageHash = imageFile.hash();

    let metadata = {
        name: document.querySelector('#input_name').value,
        description: document.querySelector('#input_description').value,
        image: "/ipfs/" + imageHash
    }
    console.log(metadata);
    const jsonFile = new Moralis.File("metadata.json", {base64 : btoa(JSON.stringify(metadata))});
    await jsonFile.saveIPFS();

    let metadataHash = jsonFile.hash();
    console.log(jsonFile.ipfs())
    let res = await Moralis.Plugins.rarible.lazyMint({
        chain: 'eth',
        userAddress: user.get('ethAddress'),
        tokenType: 'ERC721',
        tokenUri: 'ipfs://' + metadataHash,
        royaltiesAmount: 5, // 0.05% royalty. Optional
    })
    console.log(res);
    document.querySelector('#success_message').innerHTML = 
        `NFT minted. <a href="https://rarible.com/token/${res.data.result.tokenAddress}:${res.data.result.tokenId}">View NFT`;
    document.querySelector('#success_message').style.display = "block";
    setTimeout(() => {
        document.querySelector('#success_message').style.display = "none";
    }, 10000)
}

login();
/** Useful Resources  */

// https://docs.moralis.io/moralis-server/users/crypto-login
// https://docs.moralis.io/moralis-server/getting-started/quick-start#user
// https://docs.moralis.io/moralis-server/users/crypto-login#metamask

/** Moralis Forum */

// https://forum.moralis.io/ 

Comes from here: https://github.com/MoralisWeb3/youtube-tutorials/tree/main/nft-minter

so, this code should execute
but it shouldn’t look for an address
can you add a console.log(“before saveIPFS”) before saving to IPFS to see if it gets there?

Sorry for I’m being a noob at this :expressionless:

I added a line with console.log(jsonFile.saveIPFS)

ƒ (options
    /*:: ?: FullOptions*/
    ) {
      return this.save(_objectSpread(_objectSpread({}, options), {}, {
        ipfs: true
      }));
    }

that doesn’t help, you could add a line with console.log(“asdfasdf”) before that line with imageFile.saveIPFS()

1 Like

I get the same result.
Has anyone have this NFT minter working on the eth mainnet ?
On rinkeby testnet it worked just fine.

Can you test again on rinkeby?

Now I get the same issue on rinkeby.
from the moralis server dashboard error log:
“Cannot lazy mint the token”

I might just start over from scratch…