Create an unroll session from a virtual output outpoint and its dependency chain.
OptionalvirtualTxRepository: VirtualTxRepositoryOptional virtual-tx repository. When provided, each step's raw tx is read from the repo first and fetched from the indexer on a miss, then cached best-effort for later exits. Omitted ⇒ exact previous behaviour (indexer only).
OptionalonExitObserved: OnExitObservedFired once the chain is fully onchain (StepType.DONE), so a
wallet repository can be prompted to re-read the outpoint —
delta sync never would, filtering as it does on creation time.
Fired ONCE, so an observer that reads a lagging indexer gets no
second chance; see exitObserverFor. Best-effort — a
rejection never reaches the exit. Prefer sessionFor,
which wires it from the wallet.
ReadonlybumperReadonlyexplorerReadonlyindexerOptional ReadonlyonFired once the chain is fully onchain (StepType.DONE), so a
wallet repository can be prompted to re-read the outpoint —
delta sync never would, filtering as it does on creation time.
Fired ONCE, so an observer that reads a lagging indexer gets no
second chance; see exitObserverFor. Best-effort — a
rejection never reaches the exit. Prefer sessionFor,
which wires it from the wallet.
ReadonlytoOptional ReadonlyvirtualOptional virtual-tx repository. When provided, each step's raw tx is read from the repo first and fetched from the indexer on a miss, then cached best-effort for later exits. Omitted ⇒ exact previous behaviour (indexer only).
Iterate over the steps to be executed and execute them
An async iterator over the executed steps
Get the next step to be executed
The next step to be executed + the function to execute it
do() is the step, not a formality: every effect lives there, and at
StepType.DONE that includes firing onExitObserved. A caller
driving next() by hand must always await it — the async iterator
below does. Reading type and skipping do() leaves the exit
unobserved, and on the other step kinds unbroadcast.
StaticcreateCreate an unroll session by loading the virtual output chain from the indexer.
OptionalvirtualTxRepository: VirtualTxRepositoryOptionalonExitObserved: OnExitObserved
Manages the unrolling process of a virtual output back to the Bitcoin blockchain.
The Session class implements an async iterator that processes the unrolling steps:
The unrolling process works by traversing the transaction chain from the root (most recent) to the leaf (oldest), broadcasting each transaction that isn't already onchain.
Example