Interface IBatchSessionExtension
- Namespace
- NArk.Abstractions.Batches
- Assembly
- NArk.Abstractions.dll
Plug-point invoked by BatchSession at PSBT-emitting points in the
batch flow. Lets extensions co-sign / mutate the PSBTs without
BatchSession needing to know about specific co-signers (emulator,
future custody services, etc.).
public interface IBatchSessionExtension
Remarks
Extensions are stateless across batches — they receive the current spending coins on every call so they can decide per-batch whether to engage (most often "are any of these coins arkade-bound?").
Registered extensions are invoked in DI registration order. An extension
that has nothing to do for a given batch should return the input PSBTs
unchanged from CoSignAsync(BatchExtensionPhase, IReadOnlyList<PSBT>, IReadOnlyList<ArkCoin>, CancellationToken) (and false from
ShouldHandleAsync(IReadOnlyList<ArkCoin>, CancellationToken) if the whole batch is irrelevant — that
short-circuits per-phase calls).
Methods
CoSignAsync(BatchExtensionPhase, IReadOnlyList<PSBT>, IReadOnlyList<ArkCoin>, CancellationToken)
Co-sign / mutate the supplied PSBTs at the given phase of the batch flow. The returned list replaces the input (same length, same order); extensions can pass through unchanged when there's nothing to do.
Task<IReadOnlyList<PSBT>> CoSignAsync(BatchExtensionPhase phase, IReadOnlyList<PSBT> psbts, IReadOnlyList<ArkCoin> spendingCoins, CancellationToken cancellationToken)
Parameters
phaseBatchExtensionPhasepsbtsIReadOnlyList<PSBT>spendingCoinsIReadOnlyList<ArkCoin>cancellationTokenCancellationToken
Returns
- Task<IReadOnlyList<PSBT>>
ShouldHandleAsync(IReadOnlyList<ArkCoin>, CancellationToken)
Cheap "is this batch relevant to me?" check, called once at batch
session initialization. BatchSession skips invoking
CoSignAsync(BatchExtensionPhase, IReadOnlyList<PSBT>, IReadOnlyList<ArkCoin>, CancellationToken) on this extension for the rest of the
batch when this returns false.
Task<bool> ShouldHandleAsync(IReadOnlyList<ArkCoin> spendingCoins, CancellationToken cancellationToken)
Parameters
spendingCoinsIReadOnlyList<ArkCoin>cancellationTokenCancellationToken