assets-sdk
assets-sdk copied to clipboard
Cannot load metadata of NFT item when use deployNftCollection with not empty commonContent
I have a problem with commonContent. I cannot load metadata of NFT item when use deployNftCollection with NOT empty commonContent, but it work when commonContent = ''.
Can you guy help me explain about this case? Many thanks :)
Here is my code:
Deploy NFT Collection
...
const commonContent = await sdk.storage.uploadFile(
Buffer.from(JSON.stringify(content), "utf-8")
);
const collection = await sdk.deployNftCollection(
{
collectionContent: content,
commonContent: commonContent, // Issue here
},
{
adminAddress: adminAddress,
}
);
...
Deploy NFT Item:
...
const collection = sdk.openNftCollection(Address.parse(COLLECTION));
const content = Buffer.from(
JSON.stringify({
name: "Test NFT 1",
description: "This is a test NFT 1",
image: uploadedImageURL,
"attributes":[{"trait_type":"Awesomeness","value":"Super cool"}],
}), "utf-8"
);
const metadataURL = await sdk.storage.uploadFile(content);
const { nextItemIndex: index } = await collection.getData();
await collection.sendMint(sender, {
index: index,
owner: sdk.sender?.address!,
individualContent: metadataURL,
});
...
hi ser any solution?
my solution is: leave commonContent empty and add option param onchainContent: true when deployNftCollection
const collection = await sdk.deployNftCollection(
{
collectionContent: content,
commonContent: ''
},
{
adminAddress: adminAddress,
onchainContent: true
}
);