eqlabs / pathfinder

A Starknet full node written in Rust
https://eqlabs.github.io/pathfinder/
Other
618 stars 227 forks source link

`starknet_subscribeEvents` #2216

Open sistemd opened 1 week ago

sistemd commented 1 week ago

The starknet_subscribeEvents websocket endpoint accepts from_address and keys filter arguments (these correspond roughly to the EventFilterParams type in our legacy websocket interface), as well as a block argument which serves as the block ID (pathfinder_common::BlockId) to start streaming from. It returns a stream of emitted events (pathfinder_storage::EmittedEvent).

The filtering code should remain the same as what we have right now in our legacy websocket interface.

In case of a reorg, this endpoint will stream a reorg message of the following format:

{
  "starting_block_hash": "the block hash from which the reorg starts",
  "starting_block_number": "the block number from which the reorg starts",
  "ending_block_hash": "the block hash at which the reorg ends",
  "ending_block_number": "the block number at which the reorg ends"
}