When using the NFT Get Metadata API, the token_uri data is incorrect and therefore metadata is null for the following:
Contract: 0x22d5f9b75c524fec1d6619787e582644cd4d7422
TokenID: 202
Chain: Polygon
curl --request GET
–url ‘https://deep-index.moralis.io/api/v2/nft/0x22d5f9b75c524fec1d6619787e582644cd4d7422/202?chain=polygon&format=decimal’
–header ‘accept: application/json’
–header ‘X-API-Key: 324234’
{
"token_address": "0x22d5f9b75c524fec1d6619787e582644cd4d7422",
"token_id": "202",
"transfer_index": [
39280784,
100,
431,
2
],
"owner_of": "0xf756aaaa590534eb3bb30f3718980148c68cabcd",
"block_number": "39280784",
"block_number_minted": "25580341",
"token_hash": "c158a55894dd7bbde568d83c630d167e",
"amount": "1484540000000000000000",
"contract_type": "ERC1155",
"name": null,
"symbol": null,
"token_uri": "https://sunflower-land.com/play/erc1155/00000000000000000000000000000000000000000000000000000000000000ca.json",
"metadata": null,
"last_token_uri_sync": "2022-11-04T09:55:50.796Z",
"last_metadata_sync": "2022-11-04T09:56:06.878Z",
"minter_address": "ERC1155 tokens don't have a single minter"
}
Instead of it being
"token_uri": "https://sunflower-land.com/play/erc1155/00000000000000000000000000000000000000000000000000000000000000ca.json"
it should be
"token_uri": "https://sunflower-land.com/play/erc1155/202.json",
Moralis is interpreting the token ID as a hex value instead of decimal. I tried changing the format to hex and supplying 0xCA in the API call, but that didn’t work either.
Please note that this issue is not seen when using Alchemy which correctly grabs the metadata: