Table of Contents

Class ArkadeBatchSessionExtension

Namespace
NArk.Arkade.Emulator
Assembly
NArk.Arkade.dll

IBatchSessionExtension that drives emulator co-signing at the PSBT-emitting points of a batch flow. Idempotent — passes PSBTs through unchanged when no input in the batch is arkade-bound.

public sealed class ArkadeBatchSessionExtension : IBatchSessionExtension
Inheritance
ArkadeBatchSessionExtension
Implements
Inherited Members

Remarks

PostTreeSigning is deliberately not implemented and throws. It routed through the emulator's POST /v1/tx endpoint with an empty checkpoint list, which emulator v0.0.7+ rejects outright: that endpoint requires exactly one checkpoint per input, plus the prevarktx field on every input, before it inspects anything else. Neither is available at this phase — tree transactions have no checkpoints — so the hop needs a checkpoint-carrying shape or an endpoint of its own. Until then, failing here beats sending the emulator a submission it cannot accept.

PreForfeitFinalization is deliberately not implemented and throws. Forfeits are signed by the emulator's dedicated POST /v1/finalization endpoint, which "only signs if the signer's signature is found in the intent proof" and additionally requires the connector tree and commitment tx. POST /v1/tx carries none of that and does not sign forfeits, so routing this phase there would yield forfeits with an incomplete witness rather than an error. Wiring it up means threading the emulator-co-signed intent proof from intent-registration time, which lives upstream of BatchSession; until then, failing loudly beats silently producing unspendable forfeits.

Constructors

ArkadeBatchSessionExtension(IEmulatorProvider, ILogger<ArkadeBatchSessionExtension>?)

Creates the extension over an emulator provider.

public ArkadeBatchSessionExtension(IEmulatorProvider emulator, ILogger<ArkadeBatchSessionExtension>? logger = null)

Parameters

emulator IEmulatorProvider

The emulator co-signing client.

logger ILogger<ArkadeBatchSessionExtension>

Optional logger; co-signing is silent when omitted.

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.

public Task<IReadOnlyList<PSBT>> CoSignAsync(BatchExtensionPhase phase, IReadOnlyList<PSBT> psbts, IReadOnlyList<ArkCoin> spendingCoins, CancellationToken cancellationToken)

Parameters

phase BatchExtensionPhase
psbts IReadOnlyList<PSBT>
spendingCoins IReadOnlyList<ArkCoin>
cancellationToken CancellationToken

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.

public Task<bool> ShouldHandleAsync(IReadOnlyList<ArkCoin> spendingCoins, CancellationToken cancellationToken)

Parameters

spendingCoins IReadOnlyList<ArkCoin>
cancellationToken CancellationToken

Returns

Task<bool>