Sorry for stupid question, but maybe someone could help me. I need to make an API call to bscscan with ~150 contractAddreses which I have in one array, but due to bscscan limit of 5 calls/sec can't do it. So I have a question if I can shoot just with one API call with all contractAddresses except multiple calls. Are there any possibilities? I have an array:
let contractAddrs = ['contractAddress1', 'contractAddress1', 'contractAddress1',...., 'contractAddress150']
That's how API endpoint looks like
https://api.bscscan.com/api?module=stats&action=tokenCsupply&contractaddress=CONTRACTADDRESSHERE&apikey=YourApiKeyToken
So how can I put all those contractAddrs to API call and shoot once?
Thanks ^^
I don't think they have an endpoint for bulk request for addresses but you can do something like this.
const addressArr = [
// ...
];
const promise = new Promise((res, rej) => {
let i = 0;
const resolved = []
setInterval(() => {
// ... make your api request and push to resolved
i++;
if (i >= addressArr.length) {
res(resolved);
}
}, 300)
})
// ... do something when the request are done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.