[SOLVED] Unusual error in Moralis NPM package

I’m using the following NPM package for fetching all NFTs owned by an address: https://www.npmjs.com/package/moralis

My code:

const moralisNfts = await Moralis.EvmApi.nft.getWalletNFTs({
        address,
        chain: "1",
      });

When I destructure moralisNfts.result, I’m able to destructure all properties except tokenId. I get the following error:

Property 'tokenId' does not exist on type 'EvmNft'

I inspected the type definition file and tokenId is clearly included:

        tokenAddress: string;
        chain: string | number;
        ownerOf: string | undefined;
        blockNumberMinted: string | undefined;
        blockNumber: string | undefined;
        tokenId: string | number;
        ...etc

Any idea why I’m getting the error above?

I don’t know exactly, what version of the sdk. you are using?
did you try with token_id too?

you can also get the raw results Restructure JS SDK API result, from 28 November 2022

1 Like

I tried token_id also but it doesn’t work, I get the same error.

The version is 2.8.1.

Thanks, looks like I’m able to extract tokenId with format()

Nvm the old comments, problem solved (I used internal property names instead of what Moralis uses) :+1:
Still unable to get tokenId directly, but format() works.

1 Like