Table of Contents

Class EmulatorClient

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

HTTP/JSON implementation of IEmulatorProvider. Designed for DI — register via services.AddEmulatorClient(...) and inject. The HttpClient base address must be set to the emulator server root (e.g. http://localhost:7073).

public sealed class EmulatorClient : IEmulatorProvider
Inheritance
EmulatorClient
Implements
Inherited Members

Constructors

EmulatorClient(HttpClient, IOptions<EmulatorClientOptions>)

public EmulatorClient(HttpClient http, IOptions<EmulatorClientOptions> options)

Parameters

http HttpClient
options IOptions<EmulatorClientOptions>

Methods

GetInfoAsync(CancellationToken)

GET /v1/info — version and signing-key fingerprint.

public Task<EmulatorInfo> GetInfoAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<EmulatorInfo>

SubmitFinalizationAsync(string, RegisterIntentMessage, IReadOnlyList<string>, IReadOnlyList<ConnectorTreeNode>?, string, CancellationToken)

POST /v1/finalization — co-signs forfeit PSBTs and (conditionally) the commitment tx after the emulator has already co-signed the matching intent via SubmitIntentAsync(string, RegisterIntentMessage, CancellationToken).

public Task<EmulatorFinalizationResult> SubmitFinalizationAsync(string signedProof, Messages.RegisterIntentMessage message, IReadOnlyList<string> forfeits, IReadOnlyList<ConnectorTreeNode>? connectorTree, string commitmentTx, CancellationToken cancellationToken = default)

Parameters

signedProof string
message Messages.RegisterIntentMessage
forfeits IReadOnlyList<string>
connectorTree IReadOnlyList<ConnectorTreeNode>
commitmentTx string
cancellationToken CancellationToken

Returns

Task<EmulatorFinalizationResult>

SubmitIntentAsync(string, RegisterIntentMessage, CancellationToken)

POST /v1/intent — co-signs the intent registration proof so the resulting BIP-322 signature is valid for the emulator-tweaked key. Returns the co-signed proof base64.

public Task<string> SubmitIntentAsync(string proof, Messages.RegisterIntentMessage message, CancellationToken cancellationToken = default)

Parameters

proof string
message Messages.RegisterIntentMessage
cancellationToken CancellationToken

Returns

Task<string>

SubmitOnchainTxAsync(string, CancellationToken)

POST /v1/onchain-tx — co-signs a fully on-chain spend (no arkd counter-signature) whose inputs are emulator-owned Arkade tapscripts, and returns the signed PSBT base64. Inputs whose tapscript closure also contains the arkd signer pubkey are rejected by the emulator — those must go through SubmitTxAsync(string, IReadOnlyList<string>, CancellationToken) instead. Attach the previous output transaction to inputs that introspection opcodes read via SetArkFieldPrevoutTx(PSBTInput, Transaction).

public Task<string> SubmitOnchainTxAsync(string tx, CancellationToken cancellationToken = default)

Parameters

tx string
cancellationToken CancellationToken

Returns

Task<string>

SubmitTxAsync(string, IReadOnlyList<string>, CancellationToken)

POST /v1/tx — submits a partially-signed Arkade transaction plus any checkpoint PSBTs and returns the emulator's co-signed PSBTs.

public Task<EmulatorSubmitTxResult> SubmitTxAsync(string arkTx, IReadOnlyList<string> checkpointTxs, CancellationToken cancellationToken = default)

Parameters

arkTx string
checkpointTxs IReadOnlyList<string>
cancellationToken CancellationToken

Returns

Task<EmulatorSubmitTxResult>