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
Does provider.on() works differently with a jsonrpc and a ws provider? I've only quickly browsed the code, but it seems like in both cases, it just uses the eth_getLogs method (see code) instead of eth_subscribe.
Why doesn't provider.on() accept a fromBlock (similar to how web3js does it)? My use case for this is that I want to listen to all events starting at a given block, and then continue subscribing to the newer events. How can I go about doing this in ethersjs to receive the events chronologically (first ones first)? Since provider.on() will just start polling from the current block, I would need to also do a queryFilter from the starting block to the one when provider.on() was called. But in this case I would receive these first events potentially after some of the newer events received on provider.on()? It just seems a bit ugly... is there a cleaner way to do this?
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.
-
I have 2 related questions:
Does provider.on() works differently with a jsonrpc and a ws provider? I've only quickly browsed the code, but it seems like in both cases, it just uses the eth_getLogs method (see code) instead of eth_subscribe.
Why doesn't provider.on() accept a fromBlock (similar to how web3js does it)? My use case for this is that I want to listen to all events starting at a given block, and then continue subscribing to the newer events. How can I go about doing this in ethersjs to receive the events chronologically (first ones first)? Since provider.on() will just start polling from the current block, I would need to also do a
queryFilter
from the starting block to the one when provider.on() was called. But in this case I would receive these first events potentially after some of the newer events received on provider.on()? It just seems a bit ugly... is there a cleaner way to do this?Beta Was this translation helpful? Give feedback.
All reactions