1

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?

2

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))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.