[SOLVED] How to get all NFTs in a particular smart contract

I’m trying to get all the NFT’s in a particular contract, is this code all i need ?

const userEthNFTs = await Moralis.Web3.getNFTs();

Not sure if you want this https://docs.moralis.io/moralis-server/web3-sdk/account#getnfts
or https://docs.moralis.io/moralis-server/web3-sdk/account#getnftsforcontract or something else.

I have similar use case. i am using getNFTOwners. It returns me:

“total”: 144822,
“page”: 76,
“page_size”: 500,
“result”: [{

So the result contains only 500 objects. I need to iterate all 76 pages.

Please help me with this.

Hi @rahuaura

You can use pagination to get the rest of the NFTs

Example: you can get the last 500 of those 10000:

options = {address: “0x1” , offset: 9500}

You will have to make 20 requests in order to get all those 10000, and increasing offset with 500 every time

2 Likes

thanks @Yomoo, Got it. I will check that. Really helpful…

Hi Yomoo,
How can I check which contract Nft belongs to in cloud function?
Thanks.

you can create a separate thread for that question, you will have to know the smart contract for an nft, as the nft is specific to a smart contract