petar.slovic
9 days ago  Karma: 7
Loom - Can't get past events

We have set up a Loom node, deployed the example app and it works. We see the event subscription fire as new events are emmitted. But we cannot get the past events in any way. We tried setting the node to write events in the local Redis, but that didn't help. Here is a sample of the code we tried to listen to past events:

this.simpleStoreInstance.getPastEvents('NewValueSet', (error, events) => console.log('past events', error, events))

It always logs an empty array for the events variable.

en
#loom
#loom-sdk
#loom-provider
#loom network
petar.slovic
9 days ago  Karma: 7
Loom - Can't get past events

We have set up a Loom node, deployed the example app and it works. We see the event subscription fire as new events are emmitted. But we cannot get the past events in any way. We tried setting the node to write events in the local Redis, but that didn't help. Here is a sample of the code we tried to listen to past events:

this.simpleStoreInstance.getPastEvents('NewValueSet', (error, events) => console.log('past events', error, events))

It always logs an empty array for the events variable.

en
#loom
#loom-sdk
#loom-provider
#loom network

ONE ANSWER
info73
9 days ago Karma: 25

You need to specify the filter data in getPastEvents like this:

this.simpleStoreInstance.getPastEvents('NewValueSet', {
  fromBlock: 0,
  toBlock: 'latest'
}, (error, events) => console.log('past events', error, events))

You need to specify the filter data in getPastEvents like this:

this.simpleStoreInstance.getPastEvents('NewValueSet', {
  fromBlock: 0,
  toBlock: 'latest'
}, (error, events) => console.log('past events', error, events))
Earn tokens by posting and answering questions about blockchain!
Karma to eth
YOUR ANSWER