helios icon indicating copy to clipboard operation
helios copied to clipboard

feat: support tracking consensus updates in helios-ts

Open rdvorkin opened this issue 1 year ago • 4 comments

Support in some way tracking and getting notified when a new update is applied. The usecase I want to implement is setting a hook on new optimistic update, to do some action (For example, re-check a list of balances) when the update is applied.

Implementing something like https://nodejs.org/api/events.html#emitteroneventname-listener would be ideal, however even a function returning the current status (latest update applied, current block etc) would be great.

rdvorkin avatar Nov 20 '23 12:11 rdvorkin

Would something that mimics the websocket block subscription api make sense here potentially?

ncitron avatar Nov 22 '23 04:11 ncitron

@ncitron Yeah I suppose so, could you link an example of how that would look like?

rdvorkin avatar Nov 22 '23 09:11 rdvorkin

The eth_subscribe rpc method with the newHeads subscription type I think would make sense. We don't support these right now, but would something sort of inspired by this where you get new head blocks as they come work?

https://docs.alchemy.com/reference/newheads

ncitron avatar Nov 22 '23 12:11 ncitron

@ncitron Yes this seems perfect!

rdvorkin avatar Nov 22 '23 12:11 rdvorkin