After I sent the image to ipfs and then sent the metadata to ipfs, the transmission succeeded and I got a response .
But when I sent the metadata to Moralis.Plugins.rarible.lazyMint I got this error :
MetaMask - RPC Error: Provided chainId β4β must match the active chainId β1β
[inpage.js:1:51626]
and I got this error :
Uncaught (in promise) Error: Provided chainId β4β must match the active chainId β1β
moralis.js:6355
tryCatch moralis.js:44099
β¦
β¦
moralis.js:6355:45
this is my code :
setTYhis()
async function setTYhis() {
const imageFile = new Moralis.File(data.custom_fields.number_photo, { base64: photo })
await imageFile.saveIPFS();
let imageHash = imageFile.hash();
console.log(imageFile.ipfs())
let metadata = {
name: data.name,
description: data.description,
image: "/ipfs/" + imageHash
}
const jsonFile = new Moralis.File("metadata.json", { base64: btoa(JSON.stringify(metadata)) });
await jsonFile.saveIPFS();
let metadataHash = jsonFile.hash();
console.log(metadataHash)
await Moralis.Plugins.rarible.lazyMint({
chain: 'rinkeby',
userAddress: '--',
tokenType: 'ERC1155',
tokenUri: 'ipfs://' + metadataHash,
supply: 1,
royaltiesAmount: 5, // 0.05% royalty. Optional
list: true, // Only if lazy listing
listTokenAmount: 1, // Only if lazy listing
listTokenValue: 10 ** 18, // Only if lazy listing
listAssetClass: 'ETH', // only if lazy listing || optional
})
resDiv.innerHTML = " done! ";
setTimeout(() => {
// next one
}, 1000)
}