I'm using Web3's allEvents()
method to get all the events on a specific contract, and it's working great, except each event pops into the callback separately.
That turns into a bit of a pain when I want to create an array of all the events, as it's hard to discern when the callback has been fired 'enough' times.
Is there a method – in Web3 or otherwise – to get all the events as one array?
Best Answer
I figured it out almost immediately. Instead of using
myContract.allEvents(filterObject, (e, res) => console.log(res))
I should have been using
myContract.allEvents(filterObject).get((e, res) => console.log(res))