-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
The closed issue here talks about how to obtain future events as @mrwillis previous example of getting only future events, does produce events from the past as well.
//provides events at least as far back as current block (which is not future)
const filter = contract.filters.MyEmittedEvent(arg1, arg2);
contract.on(filter, callback);
@ricmoo has pointed out a poll approach using queryFilter, but if we want to subscribe to events, and only get for future events, I don't see there is way to do that with contract.on() - is that correct? queryFilter is only going to allow for a polling approach as opposed to being notified on an emitted Solidity event.
The only way I have found for this to work, is to get the current block number getBlockNumber
and check on every fired event that I am subscribed to contract.on(filter, callback))
and react to only block number above the current block number.
Metadata
Metadata
Assignees
Labels
No labels