Class CachingClientTransport
Caching decorator for IClientTransport that caches GetServerInfoAsync responses. Server info (network, dust limit, signer key) rarely changes during operation. All other methods are passed through to the underlying transport.
public class CachingClientTransport : IClientTransport, IServerInfoCacheInvalidation
- Inheritance
-
CachingClientTransport
- Implements
- Inherited Members
Constructors
CachingClientTransport(IClientTransport, ILogger<CachingClientTransport>?, TimeSpan?, TimeSpan?)
public CachingClientTransport(IClientTransport inner, ILogger<CachingClientTransport>? logger = null, TimeSpan? cacheExpiry = null, TimeSpan? fetchTimeout = null)
Parameters
innerIClientTransportloggerILogger<CachingClientTransport>cacheExpiryTimeSpan?fetchTimeoutTimeSpan?
Fields
DefaultCacheExpiry
public static readonly TimeSpan DefaultCacheExpiry
Field Value
DefaultFetchTimeout
public static readonly TimeSpan DefaultFetchTimeout
Field Value
Properties
HasValidServerInfoCache
Checks if the server info cache currently has valid data.
public bool HasValidServerInfoCache { get; }
Property Value
Methods
ConfirmRegistrationAsync(string, CancellationToken)
public Task ConfirmRegistrationAsync(string intentId, CancellationToken cancellationToken)
Parameters
intentIdstringcancellationTokenCancellationToken
Returns
DeleteIntent(ArkIntent, CancellationToken)
public Task DeleteIntent(ArkIntent intent, CancellationToken cancellationToken = default)
Parameters
intentArkIntentcancellationTokenCancellationToken
Returns
FinalizeTx(string, string[], CancellationToken)
public Task FinalizeTx(string arkTxId, string[] finalCheckpointTxs, CancellationToken cancellationToken)
Parameters
arkTxIdstringfinalCheckpointTxsstring[]cancellationTokenCancellationToken
Returns
GetAssetDetailsAsync(string, CancellationToken)
public Task<ArkAssetDetails> GetAssetDetailsAsync(string assetId, CancellationToken cancellationToken = default)
Parameters
assetIdstringcancellationTokenCancellationToken
Returns
GetEventStreamAsync(GetEventStreamRequest, CancellationToken)
public IAsyncEnumerable<BatchEvent> GetEventStreamAsync(GetEventStreamRequest req, CancellationToken cancellationToken)
Parameters
reqGetEventStreamRequestcancellationTokenCancellationToken
Returns
GetIntentsByProofAsync(string, string, CancellationToken)
Retrieves registered intents by providing a BIP-322 proof of ownership of any input.
public Task<ArkIntent[]> GetIntentsByProofAsync(string proof, string message, CancellationToken cancellationToken = default)
Parameters
proofstringmessagestringcancellationTokenCancellationToken
Returns
GetPendingTxAsync(string, string, CancellationToken)
Retrieves Arkade transactions the server has registered as pending — i.e. the user called SubmitTx(string, string[], CancellationToken) (server locked the inputs as in-flight) but FinalizeTx(string, string[], CancellationToken) never followed. The server enforces "you must finalize that exact pending tx; you cannot spend those inputs another way", so this endpoint is the only way to recover stranded VTXOs after a crash between Submit and Finalize. Authentication uses a BIP-322-style proof of ownership over any input the SDK believes belongs to the wallet — same shape as GetIntentsByProofAsync(string, string, CancellationToken).
public Task<PendingArkTransaction[]> GetPendingTxAsync(string proof, string message, CancellationToken cancellationToken = default)
Parameters
proofstringmessagestringcancellationTokenCancellationToken
Returns
GetServerInfoAsync(CancellationToken)
Gets server info with caching. Returns cached value if valid, otherwise fetches from server.
public Task<ArkServerInfo> GetServerInfoAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
GetVirtualTxsAsync(IReadOnlyList<string>, CancellationToken)
Returns raw tx hex for the given virtual transaction IDs.
public Task<IReadOnlyList<string>> GetVirtualTxsAsync(IReadOnlyList<string> txids, CancellationToken cancellationToken = default)
Parameters
txidsIReadOnlyList<string>cancellationTokenCancellationToken
Returns
GetVtxoByScriptsAsSnapshot(IReadOnlySet<string>, DateTimeOffset?, DateTimeOffset?, CancellationToken)
Queries arkd indexer for VTXOs by scripts, filtered to those updated within the given time range.
public IAsyncEnumerable<ArkVtxo> GetVtxoByScriptsAsSnapshot(IReadOnlySet<string> scripts, DateTimeOffset? after, DateTimeOffset? before, CancellationToken cancellationToken = default)
Parameters
scriptsIReadOnlySet<string>afterDateTimeOffset?beforeDateTimeOffset?cancellationTokenCancellationToken
Returns
GetVtxoByScriptsAsSnapshot(IReadOnlySet<string>, CancellationToken)
public IAsyncEnumerable<ArkVtxo> GetVtxoByScriptsAsSnapshot(IReadOnlySet<string> scripts, CancellationToken cancellationToken = default)
Parameters
scriptsIReadOnlySet<string>cancellationTokenCancellationToken
Returns
GetVtxoChainAsync(OutPoint, string?, string?, CancellationToken)
Returns the chain of virtual txs for the given VTXO, ordered leaf→root: the VTXO's own tx first, then each ancestor in turn, ending at the on-chain Commitment anchor.
When intentProof and intentMessage are supplied
(a BIP-322-style ownership proof built by
CreateGetVtxoChainOwnershipProofAsync(ArkCoin, IArkadeWalletSigner, Network, CancellationToken)), the call
authenticates against the Arkade indexer: on servers running with withheld/private tx
exposure this is what makes the indexer return the chain (and, for withheld, the
fully-signed virtual txs) instead of stripping it. The proof is presented on the first
page; the server issues an auth token that transparently drives cursor pagination for the
remaining pages.
When the proof is omitted the call uses the legacy anonymous outpoint lookup, which only returns data on servers configured with public tx exposure.
public Task<IReadOnlyList<VtxoChainEntry>> GetVtxoChainAsync(OutPoint vtxoOutpoint, string? intentProof = null, string? intentMessage = null, CancellationToken cancellationToken = default)
Parameters
vtxoOutpointOutPointintentProofstringintentMessagestringcancellationTokenCancellationToken
Returns
GetVtxoTreeAsync(OutPoint, CancellationToken)
Returns the full VTXO tree structure for a batch outpoint.
public Task<IReadOnlyList<VtxoTreeNode>> GetVtxoTreeAsync(OutPoint batchOutpoint, CancellationToken cancellationToken = default)
Parameters
batchOutpointOutPointcancellationTokenCancellationToken
Returns
GetVtxosByOutpoints(IReadOnlyCollection<OutPoint>, bool, CancellationToken)
Queries arkd indexer for VTXOs by outpoints, optionally filtering by spent status.
public IAsyncEnumerable<ArkVtxo> GetVtxosByOutpoints(IReadOnlyCollection<OutPoint> outpoints, bool spentOnly = false, CancellationToken cancellationToken = default)
Parameters
outpointsIReadOnlyCollection<OutPoint>spentOnlyboolcancellationTokenCancellationToken
Returns
InvalidateServerInfoCache(ServerInfoChangedEventArgs?)
Invalidates the server info cache, forcing the next call to fetch fresh data. Call this on wallet setup/clear or when connection errors occur. Raises ServerInfoChanged so consumers can react (e.g. signer rotation).
public void InvalidateServerInfoCache(ServerInfoChangedEventArgs? args = null)
Parameters
OpenSubscriptionStreamAsync(IReadOnlySet<string>?, string?, CancellationToken)
Opens a server-streaming subscription for VTXO script events.
When existingSubscriptionId is null, the server creates a new
subscription. The first yielded event is always VtxoSubscriptionStarted
carrying the server-assigned ID. Pass initialScripts to register the
initial watched set at stream-open time (only honoured on new subscriptions).
When existingSubscriptionId is provided, the server reconnects to an
existing subscription. If the subscription was GC'd the stream throws a NotFound
error; the caller should retry with a null ID to open a fresh subscription.
public IAsyncEnumerable<VtxoSubscriptionEvent> OpenSubscriptionStreamAsync(IReadOnlySet<string>? initialScripts, string? existingSubscriptionId, CancellationToken cancellationToken = default)
Parameters
initialScriptsIReadOnlySet<string>existingSubscriptionIdstringcancellationTokenCancellationToken
Returns
RegisterIntent(ArkIntent, CancellationToken)
public Task<string> RegisterIntent(ArkIntent intent, CancellationToken cancellationToken = default)
Parameters
intentArkIntentcancellationTokenCancellationToken
Returns
SubmitSignedForfeitTxsAsync(SubmitSignedForfeitTxsRequest, CancellationToken)
public Task SubmitSignedForfeitTxsAsync(SubmitSignedForfeitTxsRequest req, CancellationToken cancellationToken)
Parameters
reqSubmitSignedForfeitTxsRequestcancellationTokenCancellationToken
Returns
SubmitTreeNoncesAsync(SubmitTreeNoncesRequest, CancellationToken)
public Task SubmitTreeNoncesAsync(SubmitTreeNoncesRequest treeNonces, CancellationToken cancellationToken)
Parameters
treeNoncesSubmitTreeNoncesRequestcancellationTokenCancellationToken
Returns
SubmitTreeSignaturesRequest(SubmitTreeSignaturesRequest, CancellationToken)
public Task SubmitTreeSignaturesRequest(SubmitTreeSignaturesRequest treeSigs, CancellationToken cancellationToken)
Parameters
treeSigsSubmitTreeSignaturesRequestcancellationTokenCancellationToken
Returns
SubmitTx(string, string[], CancellationToken)
public Task<SubmitTxResponse> SubmitTx(string signedArkTx, string[] checkpointTxs, CancellationToken cancellationToken = default)
Parameters
signedArkTxstringcheckpointTxsstring[]cancellationTokenCancellationToken
Returns
UpdateStreamTopicsAsync(string, string[]?, string[]?, CancellationToken)
public Task UpdateStreamTopicsAsync(string streamId, string[]? addTopics, string[]? removeTopics, CancellationToken cancellationToken = default)
Parameters
streamIdstringaddTopicsstring[]removeTopicsstring[]cancellationTokenCancellationToken
Returns
UpdateSubscriptionScriptsAsync(string, IReadOnlySet<string>?, IReadOnlySet<string>?, CancellationToken)
Updates the script set of an existing subscription in place without tearing the stream down.
Both add and remove are optional; when both are null
or empty the call is a no-op. Throws NotFound when the subscription was GC'd.
public Task UpdateSubscriptionScriptsAsync(string subscriptionId, IReadOnlySet<string>? add, IReadOnlySet<string>? remove, CancellationToken cancellationToken = default)
Parameters
subscriptionIdstringaddIReadOnlySet<string>removeIReadOnlySet<string>cancellationTokenCancellationToken
Returns
Events
ServerInfoChanged
public event EventHandler<ServerInfoChangedEventArgs>? ServerInfoChanged