Table of Contents

Class VtxoSynchronizationService

Namespace
NArk.Core.Services
Assembly
NArk.Core.dll
public class VtxoSynchronizationService : IAsyncDisposable
Inheritance
VtxoSynchronizationService
Implements
Inherited Members

Constructors

VtxoSynchronizationService(IVtxoStorage, IClientTransport, IEnumerable<IActiveScriptsProvider>, IWalletStorage?)

public VtxoSynchronizationService(IVtxoStorage vtxoStorage, IClientTransport arkClientTransport, IEnumerable<IActiveScriptsProvider> activeScriptsProviders, IWalletStorage? walletStorage = null)

Parameters

vtxoStorage IVtxoStorage
arkClientTransport IClientTransport
activeScriptsProviders IEnumerable<IActiveScriptsProvider>
walletStorage IWalletStorage

VtxoSynchronizationService(IEnumerable<IActiveScriptsProvider>, IVtxoStorage, IClientTransport, ILogger<VtxoSynchronizationService>, IWalletStorage?)

public VtxoSynchronizationService(IEnumerable<IActiveScriptsProvider> activeScriptsProviders, IVtxoStorage vtxoStorage, IClientTransport arkClientTransport, ILogger<VtxoSynchronizationService> logger, IWalletStorage? walletStorage = null)

Parameters

activeScriptsProviders IEnumerable<IActiveScriptsProvider>
vtxoStorage IVtxoStorage
arkClientTransport IClientTransport
logger ILogger<VtxoSynchronizationService>
walletStorage IWalletStorage

Fields

LastFullPollAtMetadataKey

Metadata key on Metadata where the per-wallet "last successful full-set poll" timestamp is stored. Cold-start catch-up reads MIN across wallets; routine polls write the same StartedAt to every wallet on success.

public const string LastFullPollAtMetadataKey = "vtxo.lastFullPollAt"

Field Value

string

Properties

ListenedScripts

The scripts the subscription stream is currently subscribed to (for debugging/observability). The 5-second safety-net poll always operates on a freshly-derived active set, independent of this value.

public IReadOnlySet<string> ListenedScripts { get; }

Property Value

IReadOnlySet<string>

Methods

DisposeAsync()

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

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

PollScriptsForVtxos(IReadOnlySet<string>, DateTimeOffset?, CancellationToken)

On-demand polling for specific scripts, optionally restricted to VTXOs updated after the given timestamp. Use an after value with a small buffer (e.g. UtcNow - 5 minutes) for post-operation catch-up to avoid re-fetching the full VTXO history of scripts that already have many entries.

public Task<int> PollScriptsForVtxos(IReadOnlySet<string> scripts, DateTimeOffset? after, CancellationToken cancellationToken = default)

Parameters

scripts IReadOnlySet<string>

Contract scripts to poll.

after DateTimeOffset?

Optional lower bound on VTXO last-update timestamp. null returns everything.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<int>

Number of VTXOs returned by arkd (pre-upsert).

PollScriptsForVtxos(IReadOnlySet<string>, CancellationToken)

On-demand polling for specific scripts. Use this to poll inactive contract scripts or any other scripts that aren't actively tracked.

public Task<int> PollScriptsForVtxos(IReadOnlySet<string> scripts, CancellationToken cancellationToken = default)

Parameters

scripts IReadOnlySet<string>
cancellationToken CancellationToken

Returns

Task<int>

StartAsync(CancellationToken)

public Task StartAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task