0

I can read events as they happen with:

const eventsWatch = myContract.allEvents();
    eventsWatch.watch((err, res) => {
      if (err) return;
      console.log("Event:", res.event, res.args);
    });

This even shows the last event after I refresh the page, but I would like a list of all the past events.

Anyone know how to get this?

I've tried changing watch to get but then i get undefined objects back...

Thanks!

Shane Fontaine
  • 18,036
  • 20
  • 54
  • 82
Richard Garfield
  • 1,017
  • 2
  • 10
  • 14

1 Answers1

1

Create your filter by:

const eventsWatch = myContract.allEvents({fromBlock: 0, toBlock: 'latest'});
lunr
  • 808
  • 8
  • 13