Possible bug in Rarible lazy mint plugin

Hi all, I am not sure if the Rarible lazy minting plugin has a bug? I am able to:

a) mint single NFT’s to ERC721 with sale price and royalties set

b)Mint multiple copies of NFT to ERC1155 without sale list “true” (ie not for sale).

However when I attempt minting multiple copies to ERC1155 with a sale price listed, METAMASK is requesting a small value for gas fees.(approx $0.28-0.30). Is there perhaps another reason a gas fee is being requested? (ps. I am minting to RINKEBY for test purposes).

Another technical issue is when I mint a single NFT and try to set link to view on Rarible, error is logged to console which states that the “tokenID” and “tokenAddress” cannot be read from the “result” received from Rarible plugin. …works fine when minting multiple copies to ERC1155.

we will have to test to see if it replicates, we didn’t test yet

can you provide some code that would make that test easier?

I deleted last post…was being a bit flippant, apologies. I have posted my code below for testing purposes. This is the code that performs the minting. I have a form which the user inputs all the parameters for the NFT file and after validating runs the calls to Rarible plugin (as per the minting tutorial) You will notice that if there is only 1 copy of the file then the contract type is set to ERC721 and if more than 1 it is set to ER1155.

async function submit(){

    const input = document.getElementById('input_image');

   

    const sale_price=document.getElementById('input_price');

    const royalties=document.getElementById('input_royalties');

    const mint_copies=document.getElementById('input_copies');

    const sell_copies=document.getElementById('input_sellQty');

    const emailAdd=document.getElementById('input_email');

    let copies;

    let list_sale;

    let mintQty;

    let sellQty;

    if (validateEmail()==false){

        return;

    }

    if(validateNFT()==false){

        return;

    }

    if(validateFile()==false){

        return;

    }

    var additionalData=[];

   

       additionalData=parseAttributes();  //function which parses additional attributes input by user to metadata;

         





let sellQuantityTemp=document.querySelector('#input_sellQty');

let sellPriceTemp=document.querySelector('#input_price');

let text="Please check the details of your NFT. If the details are not correct then cancel the transaction. \n\n"

if(sellPriceTemp.value!="" && sellQuantityTemp.value==""){

    alert("You have listed your NFT for sale but have not set the number of copies you wish to sell. \n The default value has been selected and is equal to the number of copies you have chosen to mint. If you wish to set a specific number of copies to make available for sale immediately then click cancel on the next pop up window!");

   

    text+="Token name: " +document.querySelector('#input_name').value+ "\n";

    text+="Description: " + document.querySelector('#input_description').value +"\n";

    text+="Sale price(ETH): " + document.querySelector('#input_price').value +"\n";

    text+="Royalties on future sales: " + document.querySelector('#input_royalties').value +"% \n";

    if(mint_copies.value!="")

    text+="Number of copies to mint: " + document.querySelector('#input_copies').value +"\n";

    else

    text+="Number of copies to mint: 1 "  +"\n";

   

    text+="Number of copies on sale: " + document.querySelector('#input_copies').value +"\n";

   

    let email_add=document.querySelector('#input_email').value;

    if(email_add!="")

    text+="Email address: "+ email_add +"\n";

   

    text+="Attributes: " + JSON.stringify(additionalData,null,"");

}

else{

text+="Token name: " +document.querySelector('#input_name').value+ "\n";

text+="Description: " + document.querySelector('#input_description').value +"\n";

text+="Sale price(ETH): " + document.querySelector('#input_price').value +"\n";

text+="Royalties on future sales: " + document.querySelector('#input_royalties').value +"\n";

if(mint_copies.value!="")

text+="Number of copies to mint: " + document.querySelector('#input_copies').value +"\n";

else

text+="Number of copies to mint: 1 "  +"\n";

text+="Number of copies on sale: " + document.querySelector('#input_sellQty').value +"\n";

let email_add=document.querySelector('#input_email').value;

if(email_add!="")

text+="Email address: "+ email_add +"\n";

text+="Attributes: " + JSON.stringify(additionalData,null,"");

}

if ( !confirm(text))

return;

else{

    let terms="1.Terms of service \n ....(some text) \n\n 2.Service charge \n EEZIMINT takes a ....... \n\n 3.Disclaimer \n\n EEZIMINT takes no responsibility for incorrect data or NFT's... \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";

if ( confirm(terms)){     //this is a pop up alert to agree to terms of service



   if(mint_copies.value=="" ||mint_copies.value=="0" ||mint_copies.value=="1"){

   mintQty=1;

   copies="ERC721"

   }

   

    else{

         copies="ERC1155";

         mintQty=mint_copies.value;

    }

       

    if(sale_price.value!=""){

         list_sale=true;

    }

    else{ list_sale=false}

   

    if(sell_copies.value=="" && list_sale==true)

    sellQty =mintQty;

    if(sell_copies.value!="" && list_sale==false)

    sellQty=0;

    if(sell_copies.value!="" && list_sale==true)

    sellQty=sell_copies.value;

//--------------------------------------------------------------------------------

   

    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,

        attributes: JSON.stringify(additionalData,null,"")

           

}

    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());

       

    if(list_sale==true){

    let res = await Moralis.Plugins.rarible.lazyMint({

        chain: 'rinkeby',

        userAddress: user.get('ethAddress'),

        tokenType: copies,

        tokenUri: 'ipfs://' + metadataHash,

        supply: mintQty,

        royaltiesAmount: royalties.value*100, // 0.05% royalty. Optional

        list: true, // only if lazy listing

        listTokenAmount: sellQty, // only if lazy listing

        listTokenValue: sale_price.value* (10 ** 18), // only if lazy listing

        listAssetClass: 'ETH', // only if lazy listing || optional

    })

    console.log(res);

       

    document.querySelector('#success_message').innerHTML =

    `NFT minted. <a href="https://rinkeby.rarible.com/token/${res.data.result.tokenAddress}:${res.data.result.tokenId}" target="_blank" rel="noopener noreferrer">  View NFT </a>`;

   

        document.querySelector('#success_message').style.display = "block";

    //setTimeout(() => {

       // document.querySelector('#success_message').style.display = "none";

    //}, 5000)

}

else{

    let res = await Moralis.Plugins.rarible.lazyMint({

        chain: 'rinkeby',

        userAddress: user.get('ethAddress'),

        tokenType: copies,

        tokenUri: 'ipfs://' + metadataHash,

        supply: mintQty,

       

        list: false, // only if lazy listing

        //listTokenAmount: '0',

        listAssetClass: 'ETH', // only if lazy listing || optional

    })

    console.log(res);

    document.querySelector('#success_message').innerHTML =

        `NFT minted. <a href="https://rinkeby.rarible.com/token/${res.data.result.tokenAddress}:${res.data.result.tokenId}"target="_blank" rel="noopener noreferrer">  View NFT </a>`;

    document.querySelector('#success_message').style.display = "block";

   // setTimeout(() => {

        //document.querySelector('#success_message').style.display = "none";

   // }, 5000)

}

 

//-----------------------------------------------------------------------------------------

deleteFile();

removeAttributes();

removePreview();

return;

}

else

 return;

}

}

can you provide the list of parameters for when it will not work?

Perhaps try the parameters below:

thanks, that should be enough to be able to test

after signing the message, it looks like it tries to call SET APPROVAL FOR ALL where it asks to make a transaction in metamask

maybe that approve transaction is for the listing part

Ok well noted thanks. The only issue is if we switch to MAINNET then isn’t this “list:true” parameter a pre-requisite to make the item sellable? I will have to test and see if it does the same on the main network and not rinkeby.