Skip to content

eth::EventWatcher

Registers filters and dispatches matching logs to callbacks. More...

#include <event_filter.hpp>

Public Functions

Name
EventWatcher() =default
~EventWatcher() =default
EventWatcher(const EventWatcher & ) =delete
EventWatcher & operator=(const EventWatcher & ) =delete
EventWatcher(EventWatcher && ) =default
EventWatcher & operator=(EventWatcher && ) =default
WatchId watch(EventFilter filter, EventCallback callback)
Register a new filter+callback pair.
void unwatch(WatchId id)
Remove a previously registered subscription.
void process_block_logs(const std::vector< codec::LogEntry > & logs, uint64_t block_number, const codec::Hash256 & block_hash)
Process a slice of logs from a single block and trigger callbacks.
void process_receipt(const codec::Receipt & receipt, const codec::Hash256 & tx_hash, uint64_t block_number, const codec::Hash256 & block_hash)
Process a single receipt and trigger callbacks for matching logs.
size_t subscription_count() const
Return the number of active subscriptions.

Detailed Description

class eth::EventWatcher;

Registers filters and dispatches matching logs to callbacks.

Thread-safety: not thread-safe. All calls must be made from the same thread (or externally synchronised).

Public Functions Documentation

function EventWatcher

EventWatcher() =default

function ~EventWatcher

~EventWatcher() =default

function EventWatcher

EventWatcher(
    const EventWatcher & 
) =delete

function operator=

EventWatcher & operator=(
    const EventWatcher & 
) =delete

function EventWatcher

EventWatcher(
    EventWatcher && 
) =default

function operator=

EventWatcher & operator=(
    EventWatcher && 
) =default

function watch

WatchId watch(
    EventFilter filter,
    EventCallback callback
)

Register a new filter+callback pair.

Parameters:

  • filter The EventFilter describing which logs to accept.
  • callback Function called for every matching log.

Return: A WatchId that can later be passed to unwatch().

function unwatch

void unwatch(
    WatchId id
)

Remove a previously registered subscription.

Parameters:

function process_block_logs

void process_block_logs(
    const std::vector< codec::LogEntry > & logs,
    uint64_t block_number,
    const codec::Hash256 & block_hash
)

Process a slice of logs from a single block and trigger callbacks.

Parameters:

  • logs Logs to process.
  • block_number Block number the logs belong to.
  • block_hash Hash of that block.

function process_receipt

void process_receipt(
    const codec::Receipt & receipt,
    const codec::Hash256 & tx_hash,
    uint64_t block_number,
    const codec::Hash256 & block_hash
)

Process a single receipt and trigger callbacks for matching logs.

Parameters:

  • receipt The transaction receipt containing logs.
  • tx_hash Hash of the transaction that generated the receipt.
  • block_number Block number the receipt belongs to.
  • block_hash Hash of that block.

function subscription_count

inline size_t subscription_count() const

Return the number of active subscriptions.


Updated on 2026-04-13 at 23:22:46 -0700