Skip to content

sgns::evmwatcher::BridgeRpcWatcher

RPC-based bridge event watcher that polls eth_getLogs, verifies receipts, and produces normalized BridgeEventClaim objects. More...

#include <bridge_rpc_watcher.hpp>

Inherits from sgns::watcher::MessagingWatcher

Public Classes

Name
struct Config
Configuration structure for BridgeRpcWatcher.

Public Types

Name
using std::function< void(const eth::BridgeEventClaim &)> BridgeClaimCallback

Public Functions

Name
BridgeRpcWatcher(const Config & config, MessageCallback message_callback, BridgeClaimCallback claim_callback)
Constructs a BridgeRpcWatcher with the specified configuration and callbacks.
virtual void startWatching() override
virtual void stopWatching() override
const Config & GetConfig() const
Returns the watcher's configuration.
uint64_t GetLastProcessedBlock() const
Returns the last processed block number.

Protected Functions

Name
virtual void watch() override

Additional inherited members

Public Types inherited from sgns::watcher::MessagingWatcher

Name
using std::function< void(const std::string &)> MessageCallback

Public Functions inherited from sgns::watcher::MessagingWatcher

Name
virtual ~MessagingWatcher() =default
bool isRunning() const
void addWatcher(const std::shared_ptr< MessagingWatcher > & newWatcher)
void startAll()
void stopAll()

Protected Functions inherited from sgns::watcher::MessagingWatcher

Name
MessagingWatcher(MessageCallback callback)

Protected Attributes inherited from sgns::watcher::MessagingWatcher

Name
MessageCallback messageCallback
bool running
std::mutex running_mutex
boost::thread watcherThread

Detailed Description

class sgns::evmwatcher::BridgeRpcWatcher;

RPC-based bridge event watcher that polls eth_getLogs, verifies receipts, and produces normalized BridgeEventClaim objects.

Unlike EvmMessagingWatcher (which uses WebSocket eth_subscribe), this watcher uses eth::rpc::RpcHttpTransport for JSON-RPC over HTTP. It polls at a configurable interval, fetches logs for the bridge contract, verifies each event through eth_getTransactionReceipt, and emits eth::BridgeEventClaim objects via a typed callback.

Public Types Documentation

using BridgeClaimCallback

using sgns::evmwatcher::BridgeRpcWatcher::BridgeClaimCallback = std::function<void( const eth::BridgeEventClaim & )>;

Public Functions Documentation

function BridgeRpcWatcher

BridgeRpcWatcher(
    const Config & config,
    MessageCallback message_callback,
    BridgeClaimCallback claim_callback
)

Constructs a BridgeRpcWatcher with the specified configuration and callbacks.

Parameters:

  • config Configuration parameters for the watcher.
  • message_callback Callback for raw message handling (inherited from MessagingWatcher).
  • claim_callback Typed callback invoked with parsed BridgeEventClaim objects when events are detected.

function startWatching

virtual void startWatching() override

Reimplements: sgns::watcher::MessagingWatcher::startWatching

function stopWatching

virtual void stopWatching() override

Reimplements: sgns::watcher::MessagingWatcher::stopWatching

function GetConfig

inline const Config & GetConfig() const

Returns the watcher's configuration.

Return: Reference to the Config struct used by this watcher.

function GetLastProcessedBlock

inline uint64_t GetLastProcessedBlock() const

Returns the last processed block number.

Return: Returns the last block number that was processed by the watcher.

Protected Functions Documentation

function watch

virtual void watch() override

Reimplements: sgns::watcher::MessagingWatcher::watch


Updated on 2026-06-05 at 17:22:18 -0700