Appearance
RpcManager
Provides EVM JSON-RPC access for fetching block numbers and event logs from supported chains.
Purpose
RpcManager encapsulates all direct blockchain RPC communication for the SubscriptionEventWatcher. It exposes two methods: one to fetch the latest block number and one to fetch filtered event logs within a block range.
RPC endpoint URLs are resolved per-chain from environment variables via getEvmRpcUrlFromEnv(). This keeps chain configuration centralized in the constants layer rather than hardcoded in the watcher.
The manager is intentionally thin -- it handles serialization of JSON-RPC requests and basic error propagation, leaving retry logic and block range management to the parent alarm loop.
Edge Cases & Error Handling
- RPC errors (node-level) throw with the error message from the response, propagating to the alarm loop for retry.
- Network-level fetch failures (timeouts, DNS) throw standard fetch errors.
- If
eth_getLogsreturns noresultfield, an empty array is returned (data.result ?? []). - No built-in retry or rate limiting -- the caller is responsible for retry strategy.
- Block range parameters are hex-encoded as required by the JSON-RPC spec.
See Also
- CursorStateManager
- DeduplicationManager
- EventHandlerManager
- Parent DO:
SubscriptionEventWatcher