I am trying to pin my Metadata using Cloud Functions, but while I expected to get something like this:
https://gateway.pinata.cloud/ipfs/QmWjdMFWUVGUw5fhoCHsvjN1a2HUmyHUvx6f1XcE8iChM3
I am getting an empty sub array for my attributes:
https://gateway.pinata.cloud/ipfs/QmbV5HaTDmmC1QfZeDR17aBR6qhNDn6AbemaN8izaJn5wb
I am creating my metadata as follows:
var metadata = {
name: dataset.image[1],
image: `${IPFSBaseUrl}${dataset.image[0]}`,
tokenId: tokenId,
description:
"Planet Horse first generation horse. This is a horse that you can trade, race and breed. This is a first edition collectible and shows you are an early supporter of the Planet Horse Family!",
attributes: [
{
trait_type: "Rarity",
value: dataset.rarity,
},
{
trait_type: "Energy",
value: dataset.energy,
},
{
trait_type: "Speed",
value: dataset.speed,
max_value: 24,
},
{
trait_type: "Susten",
value: dataset.susten,
max_value: 24,
},
{
trait_type: "Power",
value: dataset.power,
max_value: 24,
},
{
trait_type: "Sprint",
value: dataset.sprint,
max_value: 24,
},
],
};
And pining to IPFS using an httpRequest:
Moralis.Cloud.httpRequest({
method: 'POST',
url: 'https://api.pinata.cloud/pinning/pinJSONToIPFS',
headers: {
'pinata_api_key': MY_API_KEY,
'pinata_secret_api_key': MY_SECRET_KEY,
},
body: metadata
}).then(function(httpResponse) {
logger.info(httpResponse.text);
}, function(httpResponse) {
logger.error('Request failed with response code' + httpResponse.status);
});
Canโt figure out what I am doing wrong.