watchOperations
Subscribe with immediate delivery; stale async reads cannot overwrite a newer account or revision.
Import
ts
import { watchOperations } from "@0xcurvy/curvy-sdk/actions";Usage
ts
const result = watchOperations({ onChange, onError, config });Signature
ts
function watchOperations(parameters: WatchOperationsParameters): () => voidReturns
() => void
The action resolves or returns the value shown in the signature.
Parameters
accountId
- Type:
string - Required: no
The account whose operations are watched. Defaults to the active account.
ts
const result = watchOperations({
accountId,
onChange,
onError,
});onChange
- Type:
(operations: OperationSnapshot[]) => void - Required: yes
Called immediately and on every change with the current operation snapshots.
ts
const result = watchOperations({
onChange,
onError,
});onError
- Type:
(error: unknown) => void - Required: yes
Called when a background read fails.
ts
const result = watchOperations({
onChange,
onError,
});signal
- Type:
AbortSignal - Required: no
Stops the subscription; the returned function does the same.
ts
const result = watchOperations({
onChange,
onError,
signal,
});config
- Type:
CurvyConfig - Required: no
Curvy config to use. Defaults to the ambient config.
ts
const result = watchOperations({
onChange,
onError,
config,
});Errors
Errors from config resolution and the underlying SDK operation are propagated to the caller.