Web3 API /{address}/nft does not return ERC1155 NFTS

When querying for a wallet’s NFTs, the service sometimes returns ERC1155 metadata as “null”
Example address: 0x99BC02c239025E431D5741cC1DbA8CE77fc51CE3

Example Query: /0x99BC02c239025E431D5741cC1DbA8CE77fc51CE3/nft

Payload Example

    {
      "token_address": "0x1e52f7a450b08b1b249a4f4f54518fc5278c2285",
      "token_id": "1",
      "amount": "1",
      "owner_of": "0x99bc02c239025e431d5741cc1dba8ce77fc51ce3",
      "token_hash": "5aba571299be11ec28c481591e2040a6",
      "block_number_minted": "14813706",
      "block_number": "14813756",
      "updated_at": "1653086828.003",
      "contract_type": "ERC1155",
      "name": "Twin Tigers",
      "symbol": "TIGER",
      "token_uri": "https://ipfs.moralis.io:2053/ipfs/QmVFxJrbtKJ7iEtpBSXZQyUDqFfB15DZ46HVymA2XAR37u/0000000000000000000000000000000000000000000000000000000000000001",
      "metadata": null,
      "last_token_uri_sync": "2022-07-18T08:55:15.396Z",
      "last_metadata_sync": "2022-07-21T07:15:25.272Z"
    },

What is the nft that it is missing? Can you access that nft with getTokenIdMetadata?
What is the chai?

I have updated the question. Thank you for your prompt reply.

Is this url accessible and returns valid metadata?

The URI has padding. As it currently is it does not work. But, if the padding is removed then it returns the metadata. But, presently, why is the service returning the metadata as null? It doesn’t return null for other ERC-721 and ERC-1155.

it depends from contract to contract, based on what token_uri they use, in this case if the token_uri is invalid, that is the reason of metadata being null

To clarify, the token_uri is only invalid in the version that is returned from Moralis. The token_uri that is returned from the contract is fine. The token_uri in Moralis is adding padded 0’s which make it invalid.

Nonetheless, this seems to be an issue outside of token_uri(s) being “invalid” / having padding.

For example, when querying for this wallet address: 0x9023ef16968ffea318838a223ef2a79bd9f99f88, which has over 13,000 NFT,
more than half of the pages being paginated return "metadata": null, even when the token_uri is valid. Below is an example.

    {
      "token_address": "0x8bf3837753f805fe712c21d6a3d25a032277863f",
      "token_id": "2923",
      "amount": "1",
      "owner_of": "0x9023ef16968ffea318838a223ef2a79bd9f99f88",
      "token_hash": "885d4d273f1a792f17e2def4ec195a5f",
      "block_number_minted": "14938943",
      "block_number": "14942590",
      "updated_at": "1654925700.744",
      "contract_type": "ERC721",
      "name": "Abstractars",
      "symbol": "ABS",
      "token_uri": "https://assets.chromaworld.io/abstractars/metadata/2923",
      "metadata": null,
      "last_token_uri_sync": "2022-06-11T10:57:09.342Z",
      "last_metadata_sync": "2022-06-11T12:52:15.335Z"
    }

To clarify, the token_uri is only invalid in the version that is returned from Moralis. The token_uri that is returned from the contract is fine. The token_uri in Moralis is adding padded 0’s which make it invalid.

This is part of the standard, you can read about that here. You can have each filename padded with zeroes (to 64 hex characters).

For example, when querying for this wallet address: 0x9023ef16968ffea318838a223ef2a79bd9f99f88 , which has over 13,000 NFT,
more than half of the pages being paginated return "metadata": null , even when the token_uri is valid. Below is an example.

If an NFT has null metadata but its token_uri is valid, you can use reSyncMetadata on each tokenId. For now you will have to do this if the token_uri does not point to IPFS
.

it could have happened that the token_uri didn’t work when we tried to access it to get the metadata

if the token uri points to IPFS (it doesn’t in this case) then we also automatically try to refresh the metadata when the token id is accessed

Thank you for your @alex, and the reference to padding.
reSyncMetadata on each tokenId is not the most optimal approach for us when you consider a wallet with 2K NFTs and half of them returning "metadata": null.
We’ll try to find a work around!

Got it! Thank you @cryptokid. Yeah, we did a bit of research on those non-IPFS URIs – it’s sad that there a lot of NFTs with metadata linked to dead URIs from centralized websites.