Table of Contents

Class VtxoChainAutoFetchService

Namespace
NArk.Core.Services
Assembly
NArk.Core.dll

Background service that fetches and stores the virtual-tx chain for every new VTXO observed via VtxosChanged.

VTXOs arrive from multiple sources — batch settlement, change from a spend, incoming payment from another wallet, swap claim, sweep, etc. — and any of them can later need to be exited unilaterally. By subscribing to the storage-level event we capture them all uniformly, regardless of how they arrived.

Storage is opt-in — register via services.AddVirtualTxAutoFetch(). With the auto-fetch off, callers can still drive VirtualTxService manually (e.g. only when starting an exit) if they prefer to defer the indexer round-trips.

public class VtxoChainAutoFetchService : IHostedService, IDisposable
Inheritance
VtxoChainAutoFetchService
Implements
Inherited Members

Constructors

VtxoChainAutoFetchService(IVtxoStorage, VirtualTxService, IOptions<VirtualTxOptions>, ILogger<VtxoChainAutoFetchService>?)

Background service that fetches and stores the virtual-tx chain for every new VTXO observed via VtxosChanged.

VTXOs arrive from multiple sources — batch settlement, change from a spend, incoming payment from another wallet, swap claim, sweep, etc. — and any of them can later need to be exited unilaterally. By subscribing to the storage-level event we capture them all uniformly, regardless of how they arrived.

Storage is opt-in — register via services.AddVirtualTxAutoFetch(). With the auto-fetch off, callers can still drive VirtualTxService manually (e.g. only when starting an exit) if they prefer to defer the indexer round-trips.

public VtxoChainAutoFetchService(IVtxoStorage vtxoStorage, VirtualTxService virtualTxService, IOptions<VirtualTxOptions> options, ILogger<VtxoChainAutoFetchService>? logger = null)

Parameters

vtxoStorage IVtxoStorage
virtualTxService VirtualTxService
options IOptions<VirtualTxOptions>
logger ILogger<VtxoChainAutoFetchService>

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

StartAsync(CancellationToken)

Triggered when the application host is ready to start the service.

public Task StartAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Indicates that the start process has been aborted.

Returns

Task

A Task that represents the asynchronous Start operation.

StopAsync(CancellationToken)

Triggered when the application host is performing a graceful shutdown.

public Task StopAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Indicates that the shutdown process should no longer be graceful.

Returns

Task

A Task that represents the asynchronous Stop operation.