Stamp raw virtual outputs with the correct per-contract tapscripts (forfeit, intent, tap tree).
Resolves each vtxo's script to 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 scattered extendVirtualCoin* calls
in wallet/handler code, and keeps the wallet from silently stamping the
default tapscript onto a non-default vtxo.
Create and register a new contract.
Contract parameters
The created contract
Delete a contract.
Contract script
Dispose of the ContractManager and release all resources.
Stops the watcher, clears callbacks, and marks the manager as uninitialized.
Implements the disposable pattern for cleanup.
Get every currently valid spending path for a contract.
Options for getting spending paths
Get contracts with optional filters.
Optionalfilter: ContractFilterOptional filter criteria
Filtered contracts TODO: filter spent/unspent
List contracts and their current virtual outputs.
If no filter is provided, returns all contracts with their virtual outputs.
Optionalfilter: ContractFilterOptionalpageSize: numberGet currently spendable paths for a contract.
Options for getting spendable paths
Check if currently watching.
Register a callback for contract events.
The manager automatically watches after initialize(). This method
allows registering callbacks to receive events.
Event callback
Unsubscribe function to remove this callback
Force refresh virtual outputs from the indexer.
Without options, re-fetches every contract and advances the global cursor. With options, narrows the refresh to specific scripts and/or a time window. Subset refreshes (scripts filter) intentionally do not advance the cursor.
Optionalopts: RefreshVtxosOptionsUpdate a contract's params. This method preserves existing params by merging the provided values.
Contract script
The new values to merge with existing params
StaticcreateStatic factory method for creating a new ContractManager. Initialize the manager by loading persisted contracts and starting to watch.
After initialization, the manager automatically watches all active contracts
and contracts with virtual outputs. Use onContractEvent() to register event callbacks.
ContractManagerConfig
Central manager for contract lifecycle and operations.
Responsibilities:
Notes:
onContractEvent()is just for subscribing).Example