Table of Contents

Class BatchSession

Namespace
NArk.Core.Batches
Assembly
NArk.Core.dll

Handles participation in a batch settlement for a specific intent. Events are followed in the order the operator drives them — tree nodes, tree signing, nonce aggregation, finalization — and forfeits are only signed once the commitment transaction is shown to carry the outputs the intent asked for.

public class BatchSession
Inheritance
BatchSession
Inherited Members

Constructors

BatchSession(IClientTransport, IWalletProvider, ArkTransactionBuilder, Network, ArkIntent, ArkCoin[], BatchStartedEvent, ILogger?, BatchExpiryPolicy?)

Handles participation in a batch settlement for a specific intent. Events are followed in the order the operator drives them — tree nodes, tree signing, nonce aggregation, finalization — and forfeits are only signed once the commitment transaction is shown to carry the outputs the intent asked for.

public BatchSession(IClientTransport clientTransport, IWalletProvider walletProvider, TransactionHelpers.ArkTransactionBuilder arkTransactionBuilder, Network network, ArkIntent arkIntent, ArkCoin[] ins, BatchStartedEvent batchStartedEvent, ILogger? logger = null, BatchExpiryPolicy? batchExpiryPolicy = null)

Parameters

clientTransport IClientTransport
walletProvider IWalletProvider
arkTransactionBuilder TransactionHelpers.ArkTransactionBuilder
network Network
arkIntent ArkIntent
ins ArkCoin[]
batchStartedEvent BatchStartedEvent
logger ILogger
batchExpiryPolicy BatchExpiryPolicy

Properties

IsComplete

Whether the batch session has completed (successfully or with failure)

public bool IsComplete { get; }

Property Value

bool

Methods

InitializeAsync(CancellationToken)

Initialize the batch session (call this before processing events)

public Task InitializeAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

Remarks

Bounds the operator-declared batch expiry before deriving the sweep tap tree from it — the one place that value is checked, since later tree validation only proves the tree matches whatever expiry was supplied. Call this before confirming registration, so a rejected batch is never confirmed.

Exceptions

InvalidBatchExpiryException

The operator declared a batch expiry outside the bounds of BatchExpiryPolicy.

ProcessEventAsync(BatchEvent, CancellationToken)

Process a single event from the event stream

public Task<bool> ProcessEventAsync(BatchEvent eventResponse, CancellationToken cancellationToken = default)

Parameters

eventResponse BatchEvent
cancellationToken CancellationToken

Returns

Task<bool>

True if the batch session is complete, false otherwise