Class EmulatorClient
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
httpHttpClientoptionsIOptions<EmulatorClientOptions>
Methods
GetInfoAsync(CancellationToken)
GET /v1/info — version and signing-key fingerprint.
public Task<EmulatorInfo> GetInfoAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
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
signedProofstringmessageMessages.RegisterIntentMessageforfeitsIReadOnlyList<string>connectorTreeIReadOnlyList<ConnectorTreeNode>commitmentTxstringcancellationTokenCancellationToken
Returns
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
proofstringmessageMessages.RegisterIntentMessagecancellationTokenCancellationToken
Returns
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
txstringcancellationTokenCancellationToken
Returns
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
arkTxstringcheckpointTxsIReadOnlyList<string>cancellationTokenCancellationToken