Hey, I have a question related to ERC-721 tokens.
When querying this token as an example (https://deep-index.moralis.io/api/v2/nft/0x84f4226af1eb4b5e76c5dd203eef7f1f3452fb9d/853?chain=eth&format=decimal) from the Metaverse Marauders collection, I can’t find its attributes anywhere in the response, all I get is this response body with a metadata
field set to null
:
{
"token_address": "0x84f4226af1eb4b5e76c5dd203eef7f1f3452fb9d",
"token_id": "853",
"amount": "1",
"owner_of": "0x171ab540b9cb730626db91f648e2b09eb5363484",
"block_number": "13357962",
"block_number_minted": "13357962",
"contract_type": "ERC721",
"name": "Metaverse Marauders",
"symbol": "MM",
"token_uri": null,
"metadata": null,
"is_valid": 0,
"syncing": 1,
"synced_at": null,
"frozen": 0
}
But when retrieving a token’s metadata through the tokenURI
function in the contract, I do get said attributes (https://etherscan.io/readContract?m=dark&a=0x84f4226af1eb4b5e76c5dd203eef7f1f3452fb9d&v=0x84f4226af1eb4b5e76c5dd203eef7f1f3452fb9d#readCollapse24)
The tokenURI
contract function gives me an IPFS hash : ipfs://ipfs/QmSeJ4tguCKVetptJ7Y5MoHgaZPUeXQUucacZSCdXgZaC3/853
And then, when resolving this IPFS hash with a public gateway, I get access to the token’s metadata :
{
"tokenID": 853,
"name": "Metaverse Marauders 853",
"description": "The Metaverse Marauders are from everywhere in the Galaxy of Nilmara. They are professionals marauding the Metaverse seeking for everything that could be sold at the Sandaga Central Market (SCM). They are exactly 12,000 Metaverse Marauders from 12 different species and each and everyone of them has a Licence registered by the Trade Committee of the Gassar Alliance. Every Metaverse Marauders has a huge utility, to know more about it, head to https://metaverse-marauders.com/",
"ipfs_image": "QmSjgSJ252J22V3vgDiNkEHht4FJDJ3cmGyZuTrtVeBUs8",
"image": "QmSjgSJ252J22V3vgDiNkEHht4FJDJ3cmGyZuTrtVeBUs8",
"attributes": [
{
"trait_type": "species",
"value": "Wongo"
},
...
{
"trait_type": "background",
"value": "Foorara"
}
]
}
Shouldn’t Moralis’ API be able to retrieve said tokenURI
and make it available in the response’s body when requesting a specific token ?
Because if the token_uri
sent back by Moralis’ API was the result of the tokenURI
contract function, then it would be super easy to request the token’s metadata with its IPFS hash.