[SOLVED] Get nft metadata resolves to invalid token uri for eip-1155

Getting NFT metadata incorrectly resolves the token uri for eip-1155. It passes the tokenId in decimal form, while it should convert it to hex first.

Reproduce using your example https://docs.moralis.io/web3-data-api/evm/reference/get-nft-metadata?address=0xfbfea4a683d37bf68301f6a9acf7e647bfa8e1a7&token_id=3625&chain=eth&format=decimal&normalizeMetadata=true&media_items=false

Since the contract type is eip-1155, it should convert decimal token id (ex. 3625) into hex 0000000000000000000000000000000000000000000000000000000000000e29. According to erc1155 documentation https://eips.ethereum.org/EIPS/eip-1155#metadata

Opensea does that correctly: https://opensea.io/assets/ethereum/0xfbfea4a683d37bf68301f6a9acf7e647bfa8e1a7/3625

So currently it resolves to invalid token uri https://nfts.superplastic.co/headtripz/3625 instead of the correct https://nfts.superplastic.co/headtripz/0000000000000000000000000000000000000000000000000000000000000e29

It is a critical issue.

Hi, I think that we added some optimisations that caused this issue. In the past we were checking only the hex version and some contracts were using the decimal instead of hex and now we wanted to support more cases. It looks like we found a valid token uri for the decimal version and we didn’t try the hex version of the url.