Calling:
moralis.Web3API.token.getAllTokenIds
original path: /nft/{address}
every 1 second and it failed after 51-53 requests (that is almost a minute).
I tried to have a 2-3 sec timeout between the calls but it still eventually failed with a rate limit error.
According to documentation, it’s a 5 weight call that means I should be able to do around 11\sec.
an example of the code running:
const collAddressSlug = '0xf1268733c6fb05ef6be9cf23d24436dcd6e0b35e',
limit = 50;
let offset = 0;
while (true) {
const nfts = (await moralis.Web3API.token.getAllTokenIds({ address: collAddress, limit, offset })).result;
// do something....
if (nfts.length < limit) {
break;
}
offset += limit;
await new Promise(f => setTimeout(f, 3000));
}