Closed haotian-engineer closed 11 months ago
I finally fixed issue.
The JS SDK I was using has been deprecated and so I have switched to a new one, umi
.
Below is updated code.
const uploadMetadata = async (data) => {
const imageFile = fs.readFileSync(`./uploads/${data.imgName}.jpg`)
const [imageUri] = await umi.uploader.upload([imageFile])
const uri = await umi.uploader.uploadJson({
name: data.imgName,
symbol: data.symbol,
description: data.description,
sellerFeeBasisPoints: data.sellerFeeBasisPoints,
attributes: data.attributes,
collection: {
name: data.collectionName,
family: data.collectionFamily
},
creators: data.creators,
image: imageUri
});
return uri
};
It works fine.
I am having above error while trying to upload metadata.
Even I set the
.uploadMetadata()
to empty JSON object, it throws the same error. How to fix it?