Create and register a new contract.
Implementations may validate that:
params.typeparams.script matches the script derived from params.paramsThe contract script is used as the unique identifier.
Delete a contract by script and stop watching it. This — not retiring via setContractState — is the stop-watching path.
Release resources (stop watching, clear listeners).
Get all possible spending paths for a contract.
Returns an empty array if the contract or its handler cannot be found.
List contracts with optional filters.
Optionalfilter: ContractFilterList contracts and their current virtual outputs.
If no filter is provided, returns all contracts with their virtual outputs.
Optionalfilter: ContractFilterGet all currently spendable paths for a contract.
Returns an empty array if the contract or its handler cannot be found.
Latest provider-sync health (online vs. degraded to repository data). See ContractSyncState.
Whether the underlying watcher is currently active.
Subscribe to contract events.
Unsubscribe function
Rebuild the HD look-ahead watch window around the current allocation
watermark. No-op when the manager was configured without lookAhead.
Call after anything that moves the watermark (restore, boarding allocation, receive rotation, server-signer rotation). Concurrent calls coalesce into a single drain.
Reconcile specific outpoints with the indexer's authoritative state and upsert the result into the wallet repository.
The cursor-derived delta sync filters by created_at, so a VTXO that
was created before the cursor but spent recently won't surface in a
standard refreshVtxos() call. This method is the surgical recovery
path for that case: when something hands us a stale outpoint (e.g. the
server returns VTXO_ALREADY_SPENT with a vtxo_outpoint in its
error metadata), call this to pull the latest state and unblock the
caller — no full re-scan, no cursor change.
Outpoints not owned by any tracked contract are silently dropped.
Force a virtual output refresh from the indexer.
Without options, refreshes all contracts from scratch. With options, narrows the refresh to specific scripts and/or a time window.
Optionalopts: RefreshVtxosOptionsExplicit, gap-limit contract discovery used by wallet.restore().
Walks HD indices from 0, asking every registered Discoverable
handler whether it owns a contract anchored at that index, and
registers each find via the idempotent createContract. A hit
at index i (by any handler, including an injected swap handler)
resets the gap counter, so swap discovery keeps the HD window open.
Error contract (safety-critical — see spec §4):
handlerErrors
and makes its index indeterminate: it never advances the gap
counter, and the scan stops verifying there rather than closing a
window it never observed close. A batched
Discoverable.discoverRange failure makes its whole requested
range indeterminate. It still never throws.materialize() throwing, or
createContract rejecting — propagates out of scanContracts
(it invalidates the gap-window signal, so a silent truncation
would risk hiding user funds).See ScanContractsOptions.
See ScanResult. The caller surfaces truncatedAt /
handlerErrors after the inline VTXO pull.
Convenience helper to update only the contract state. Note
inactive does not stop watching; see ContractState and
deleteContract.
Stamp raw virtual outputs with the correct per-contract tapscripts (forfeit, intent, tap tree).
Resolves each vtxo's
scriptto its owning contract via the contract repository and attaches the matching tapscripts. Throws when any vtxo references a script with no registered contract — callers are expected to register the contract before asking for annotation. This is the single shared path that replaces scatteredextendVirtualCoin*calls in wallet/handler code, and keeps the wallet from silently stamping the default tapscript onto a non-default vtxo.