Expand description
Long-lived sync loop over
moonproof_indexer_client::subscribe_contract_actions.
Subscribes to the indexer’s contractActions(address, offset)
stream for a single contract and advances an in-memory
ContractRuntimeState each tick via
[moonproof_runtime::state::fold_contract_actions]. Exposes the latest state
to callers via a tokio::sync::watch::Receiver — the canonical
“subscribe once, observe many” pattern.
§Lifecycle
spawnreturns aWatchercarrying:- a
watch::Receiver<ContractRuntimeState>for consumers, and - a
moonproof_utils::rt::Taskfor the driver task.
- a
- The driver task runs until the subscription ends (server
complete, network error, or caller cancelling viaWatcher::abort). - Errors from the indexer subscription are surfaced via the
driver’s
Watcher::joinresult — consumers can either consult it or let the task run until it errors, whichever fits their app.
Structs§
- Watcher
- Handle returned by
spawn— consumers pull state updates viawatch()and can abort the driver viaabort().