We’re using the Web3API function getTokenTransfers to fetch transfers. It works fine for small wallets. For bigger ones, we’re hitting error 141. More precisely:
{
code: 141,
error: 'This Moralis Server is rate-limited because of the plan restrictions. See the details about the current rate and throttle limits: {"x-rate-limit-limit":"1500","x-rate-limit-remaining":"60","x-rate-limit-remaining-ttl":"60","x-rate-limit-throttle-limit":"60","x-rate-limit-throttle-remaining":"5","x-rate-limit-throttle-remaining-ttl":"5","x-rate-limit-throttle-used":"212","x-rate-limit-used":"26"}'
}
Here’s the sample code:
const Moralis = require('moralis/node');
const moralisConfig = {
"appId": "",
"masterKey": "",
"serverUrl": ""
}
Moralis.start(moralisConfig);
const chain = 'bsc';
const address = '0xc2aeac4502c9a55ea5e229ac26d481e7300f2516';
const offsets = [0, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500];
(async () => {
for (const offset of offsets) {
await Moralis.Web3API.account
.getTokenTransfers({
chain,
address,
offset,
}).then((res) => {
console.log(`Done processing offset ${offset}, result length = ${res.result.length}`);
}).catch(console.log);
}
})();
This fails at the 7000 offset request. How is the rate limit processed in the backend? Is it really per minute? Or is it more per second, (for pro servers 5000/3600 => 1.38 req/s)? Adding a local rate limiter alleviates the problem, but we’re looking for a more concrete answer, if available.
A close look at the error code, there’s two separate variables being tracked. That’s the rate-limit-throttle and rate-limit, with ttl and remaining/used variants. We could guess what they mean, but again, any official word would be appreciated.
Thanks!