Understanding the NFT api

Hi there, messing around with the NFT APIโ€™s in console and seeking some insight

ParseUser {id: '6ovKQJ2fcxVwiTzSpF9BirRg', _objCount: 0, className: '_User'}
main.js:12 0x081a9a711ebeb35f115ffc7130cc80e92241c759
const options = { chain: "eth", address: "hidden", token_address: "hidden" };
undefined
await Moralis.Web3API.account.getNFTsForContract(options);
{total: 31, page: 0, page_size: 500, result: Array(31), status: 'SYNCED'}

The options variable outputs as undefined but I believe its working. Is it possible to interact with the values generated after getNFTsForContract? i.e If โ€˜totalโ€™ >= 1, then x

This could be used to give/prevent access to parts of a dapp by checking if the user either has the specified token or not (>= 1)

Do I have it correct that the first variable for options passed successfully, despite being undefined?
And when defining the options variable, the documentation says the address(owner of given token) is a required parameter, followed by the token_address.

Is it possible to use the user/session to supply the owner address?

const currentUser = Moralis.User.Current();
const options = {`chain: "eth", address: ${currentUser}, token_address: "hidden"`};

Thanks!

too many questions there, could you make forum posts for every of them separately?

1 Like