TransactionWatcher
Defined in: ootle-indexer/src/tx-watcher.ts:59
Subscribes to the indexer’s SSE /events stream and routes
TransactionFinalized events to waiting callers.
The stream is paused (abort + reconnect deferred) when no transactions are
being watched, and resumed on the first new watch() call.
Mirrors TransactionWatcher from the Rust ootle-rs crate.
Lifecycle: call start() once (idempotent), then obtain
PendingTransaction handles via watch(). Call stop() to shut down.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TransactionWatcher(
baseUrl):TransactionWatcher
Defined in: ootle-indexer/src/tx-watcher.ts:65
Parameters
Section titled “Parameters”baseUrl
Section titled “baseUrl”string
Returns
Section titled “Returns”TransactionWatcher
Methods
Section titled “Methods”register()
Section titled “register()”register(
txId):Promise<SseFinalizedDecision>
Defined in: ootle-indexer/src/tx-watcher.ts:105
Internal: register a waiter for a transaction ID.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<SseFinalizedDecision>
start()
Section titled “start()”start():
void
Defined in: ootle-indexer/src/tx-watcher.ts:73
Starts the background SSE loop (idempotent — safe to call multiple times).
Returns
Section titled “Returns”void
stop()
Section titled “stop()”stop():
void
Defined in: ootle-indexer/src/tx-watcher.ts:84
Stops the background loop and rejects any still-parked waiters with
IndexerClientError("TransactionWatcher stopped"). In normal use
PendingTransaction self-unregisters, so a hit here means a leaked handle.
Returns
Section titled “Returns”void
unregister()
Section titled “unregister()”unregister(
txId):void
Defined in: ootle-indexer/src/tx-watcher.ts:112
Internal: remove a pending waiter.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
watch()
Section titled “watch()”watch(
txId,client,timeoutMs?):PendingTransaction
Defined in: ootle-indexer/src/tx-watcher.ts:99
Returns a PendingTransaction that resolves when the network finalises
the given transaction ID, throwing on Reject / FeeIntentCommit / timeout.
Automatically starts the watcher loop if it isn’t running yet.
Parameters
Section titled “Parameters”string
client
Section titled “client”IndexerClient
timeoutMs?
Section titled “timeoutMs?”number = 32_000