EvmApi getWalletNFTs metadata structure with Typescript

Trying to parse the object returned by

const nfts = await Moralis.EvmApi.nft.getWalletNFTs({
        address: input.walletAddress,
        chain: input.chain,
        normalizeMetadata: true,
      });```

metadata is of type ```
MoralisDataObjectValue

Problem:

Property 'image' does not exist on type 'MoralisDataObjectValue'.

Any way to type the metadata structure to avoid TS compiler issues?

Hey @slawton3,

Iā€™m not really sure what is MoralisDataObjectValue is, I think will be helpful if you show more of your code here.

Plus for NFT metadata, you should expect it to have a generic JSON object type because NFT metadata are usually non-standardized and each NFT can have different fields depending to the creator.

1 Like

@YosephKS Thanks for your reply.

I see, good point about the metadata type being unknown. Are there required properties in the metadata? Is this documented somewhere?

Hey @slawton3,

there is none, there are standards such as OpenSea standard but it does not apply outside of OpenSea platform. It is mostly still up to how does the creator want the metadata looks like.

Essentially NFT metadata are not standardized and smart contracts have no way to make specific field required.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.