You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've looked in the docs and in the discussions and can't seem to find a clear answer to the following:
I'm using an ethers.js websocket connection to listen to a set of events from a contract with a single .on() listener - with a single filter that matches the events, I'm interested in.
I'm fixing a problem in a current bit of code, and have become unsure whether I need to also handle that events may arrive out-of-order across blocks? That is, can it happen that my event-listener will be invoked with events
from block no. X,
then from block no X+1, and
then later from block no X again?
(I am, of course, assuming that my node-provider Alchemy sends all events for block X before sending event from block X+1.)
Alternatively, what I'd really like is to receive an array of all events (that match my filter) from block X, in one fell sweep. Sort of like what getLogs() does, but with a subscription rather than synchronously.
But I don't think that this is possible with the ethers.js V5?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Version: ethers.js 5.7.2
Hi,
I've looked in the docs and in the discussions and can't seem to find a clear answer to the following:
I'm using an ethers.js websocket connection to listen to a set of events from a contract with a single
.on()
listener - with a single filter that matches the events, I'm interested in.I'm fixing a problem in a current bit of code, and have become unsure whether I need to also handle that events may arrive out-of-order across blocks? That is, can it happen that my event-listener will be invoked with events
(I am, of course, assuming that my node-provider Alchemy sends all events for block X before sending event from block X+1.)
Alternatively, what I'd really like is to receive an array of all events (that match my filter) from block X, in one fell sweep. Sort of like what
getLogs()
does, but with a subscription rather than synchronously.But I don't think that this is possible with the ethers.js V5?
Beta Was this translation helpful? Give feedback.
All reactions