Okay Thanks
This is for curosr
async function get_metadata() {
try {
const timer = ms => new Promise(res => setTimeout(res, ms));
let allNFTs = [], cursor = null;
do {
//get the first 100 NFT
const response = await Moralis.Web3API.token.getAllTokenIds({
address: "0x02f74badce458387ecaef9b1f229afb5678e9aad",
chain: "eth",
limit: 100,
cursor: cursor,
});
allNFTs.push(...response.result);
await timer(10000);
cursor = response.cursor;
console.log(response.result)
console.log(allNFTs.length)
console.log(cursor)
} while (cursor !== "" && cursor != null);
} finally {
// Ensures that the client will close when you finish/error
await client.close();
}
}
This is for next
async function get_metadata() {
try {
const timer = ms => new Promise(res => setTimeout(res, ms));
//get metadata from the first page
let NFTs = await Moralis.Web3API.token.getAllTokenIds({
address: "0x02f74badce458387ecaef9b1f229afb5678e9aad",
chain: "eth",
limit: 100,
});
let allNFTs = NFTs.result || [];
console.log(allNFTs)
console.log(allNFTs.length)
while (NFTs.next) {
await timer(10000);
NFTs = await NFTs.next()
allNFTs.push(...NFTs.result);
console.log(allNFTs.length)
}
} finally {
// Ensures that the client will close when you finish/error
await client.close();
}
}