NFT Metadata not returned for Sunflower contract, works with Alchemy

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:

Old topic for reference

how did you do this?

that

is a domain that you control?

Like so via the docs

curl --request GET
–url ‘https://deep-index.moralis.io/api/v2/nft/0x22d5f9b75c524fec1d6619787e582644cd4d7422/0xCA?chain=polygon&normalizeMetadata=true&format=hex
–header ‘accept: application/json’
–header ‘X-API-Key: 123456’

I changed the token ID to 0xCA, and format to hex and get the following message

{
  "message": "No metadata found! Try again later"
}

sunflower-land.com - we do not control this domain

I sent this as a feature request to the team, we only handle the token uris that follow the erc1155 standard now (that one in hex and with 64 leading zeroes)

1 Like