ENS token not returning image data (via NFTs-for-owner API)

Hi,

I’m noticing that my ENS ERC721 doesn’t contain any meta data in my call to the “Gets NFTs owned by the given address” end point. The entity is in the results but its token_uri and metadat fields are empty:

   {
      "token_address": "0x.....",
      "token_id": "....",
      "amount": "1",
      "owner_of": "0x....",
      "block_number": "...",
      "block_number_minted": "...",
      "contract_type": "ERC721",
      "token_uri": null,
      "metadata": null,
      "synced_at": null,
      "name": "",
      "symbol": ""
    },

I think this is because their token doesn’t adhere to the standard, instead ENS seems to have their own metadata platform (referenced here: https://medium.com/the-ethereum-name-service/major-refresh-of-nft-images-metadata-for-ens-names-963090b21b23)

Is that the case? They render on OpenSea, for example, but i guess that’s because they developed their own custom display logic just for the ENS case?

Thank you!

can you give example or a random ENS ERC721 token?

Sure, try this ID: 0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9: https://deep-index.moralis.io/api/v2/0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9/nft?chain=eth&format=decimal

That’s the owner of ens.eth.

You can see it owns three NFTs, one is empty, like the example I provided in my original post.

Thank you!
Doug

1 Like

adding this only for reference as example of queries:

await Moralis.Web3API.account.getNFTs({address: '0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9', chain: 'eth'})
=>
{
    "total": 3,
    "page": 0,
    "page_size": 500,
    "result": [
        {
            "token_address": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
            "token_id": "42033647921836720708986079437023664695436352815832009766988496528855301124570",
            "amount": "1",
            "owner_of": "0xb6e040c9ecaae172a89bd561c5f73e1c48d28cd9",
            "block_number": "9411665",
            "block_number_minted": "9411665",
            "contract_type": "ERC721",
            "token_uri": null,
            "metadata": null,
            "synced_at": null,
            "name": "",
            "symbol": ""
        },
        [2 more NFTs here]
    ],
    "status": "SYNCED"
}
await Moralis.Web3API.token.getTokenIdMetadata({address:"0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", token_id: "42033647921836720708986079437023664695436352815832009766988496528855301124570", chain: "eth"})

=>

{
    "token_address": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
    "token_id": "42033647921836720708986079437023664695436352815832009766988496528855301124570",
    "contract_type": "ERC721",
    "token_uri": null,
    "metadata": null,
    "synced_at": null,
    "amount": "1",
    "name": "",
    "symbol": ""
}

Still no metadata returned. Shouldn’t be that hard to fix/reindex since ENS has its own metadata API.

Workaround atm is to use ENS metadata API to fetch the metadata as outlined here: https://github.com/ensdomains/ens-metadata-service

https://metadata.ens.domains/mainnet/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85/42033647921836720708986079437023664695436352815832009766988496528855301124570
{
  "name": "ens.eth",
  "description": "ens.eth, an ENS name.",
  "attributes": [
    {
      "trait_type": "Created Date",
      "display_type": "date",
      "value": null
    },
    {
      "trait_type": "Registration Date",
      "display_type": "date",
      "value": 1580760321000
    },
    {
      "trait_type": "Expiration Date",
      "display_type": "date",
      "value": 1913901661000
    }
  ],
  "name_length": 7,
  "short_name": null,
  "length": 0,
  "url": "https://app.ens.domains/name/ens.eth",
  "version": 0,
  "background_image": "https://metadata.ens.domains/mainnet/avatar/ens.eth",
  "image_url": "https://metadata.ens.domains/mainnet/0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85/0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da/image"
}
1 Like

thanks for this example, it looks like we are not processing this metadata yet, but it should not be complicated to do it

now it returns metadata for that particular token_id, we will process the other token_ids too

1 Like