I have an array with a bunch of events. I get the block number from these events but I also need the block.timestamp which isnt returned in the event object, its returned by getting the block. So I am looking to do something like this:
const getTimestamps = async (events) => {
const ethcallProvider = new Provider(provider);
await ethcallProvider.init();
const contractCalls = events.map((event) =>
provider.getBlock(event.blockNumber)
);
console.log(contractCalls);
const results = await ethcallProvider.all(contractCalls);
//console.log(results);
return results;
};
I have hundreds of events so It would be helpful to be able to use something like multicall to be able to run all the getBlock functions in a single call. Or if theres a multicall libary out there that can do this that would also work. Thanks!