Hello,
I am reading the NFTs using web3api in a react project. I get the correct result back. But the problem is that when I use .next() to get the next 100 results, it just skips the last page.
for example, if I have 130 in total and the limit is 100, it doesn’t go through the loop to get the next page.
this is my code:
const options = {
address: '0x2cdfc342877b19e9385f72408de34d2c5fd06dfc',
chain: 'mumbai',
token_address: '0xa5ce390be1d19cc41ecb26c3174e99ead3a3e45a',
limit: 100,
};
let result = await Web3Api.account.getNFTsForContract(options);
const total = result.total;
let totalNFTs = result.result ?? [];
while ((result as any).next) {
result = await (result as any).next();
result.result && (totalNFTs = [...totalNFTs, ...result.result]);
}
console.log('total in response',total)
console.log('total after calling next',totalNFTs.length)
I don’t know what I did wrong here