Interface IArkadeIntentStorage
- Namespace
- NArk.ArkadeIntents
- Assembly
- NArk.ArkadeIntents.dll
Persistence and change-notification for non-interactive swap intents. Also the single
IActiveScriptsProvider that feeds the shared VtxoSynchronizationService the
covenant scripts of pending swaps — so their VTXOs are watched (and the watch survives a restart,
unlike in-memory tracking).
public interface IArkadeIntentStorage : IActiveScriptsProvider
- Inherited Members
- Extension Methods
Methods
GetArkadeSwapIntents(string?, ArkadeSwapIntentStatus?, ArkadeSwapIntentStatus[]?, string?, string[]?, int?, int?, CancellationToken)
Query swap intents by id, status, covenant script and/or wallet.
Task<IReadOnlyCollection<ArkadeSwapIntent>> GetArkadeSwapIntents(string? id = null, ArkadeSwapIntentStatus? status = null, ArkadeSwapIntentStatus[]? statuses = null, string? swapPkScript = null, string[]? walletIds = null, int? skip = null, int? take = null, CancellationToken cancellationToken = default)
Parameters
idstringA single intent's id.
statusArkadeSwapIntentStatus?Only intents in this status.
statusesArkadeSwapIntentStatus[]Only intents in any of these statuses. Null or empty places no constraint.
swapPkScriptstringOnly the intent on this covenant script.
walletIdsstring[]Only intents belonging to these wallets.
skipint?Rows to skip.
takeint?Rows to return.
cancellationTokenCancellationTokenCancels the query.
Returns
- Task<IReadOnlyCollection<ArkadeSwapIntent>>
The matching intents.
Remarks
Implementations must apply every filter given. A store that ignores one does not merely return too much: callers use these to identify a single swap before moving its money, so a filter quietly dropped is a caller acting on somebody else's intent.
status and statuses are separate filters and both apply
when both are given, narrowing rather than widening. The set exists so a caller wanting several
statuses asks once instead of once per status — IActiveScriptsProvider wants four
of them on every change notification, and four round-trips for one answer is a cost paid on a
hot path for nothing.
SaveArkadeSwapIntent(ArkadeSwapIntent, CancellationToken)
Insert or update a swap intent, keyed by Id.
Task SaveArkadeSwapIntent(ArkadeSwapIntent intent, CancellationToken cancellationToken = default)
Parameters
intentArkadeSwapIntentcancellationTokenCancellationToken
Returns
UpdateStatus(string, ArkadeSwapIntentStatus, string?, CancellationToken)
Transition the in-flight swap on the given covenant script to status
(recording spentTxid when spent). Only swaps that are still
Pending, Refundable
or Claimable are touched — so a swap already moved to
Cancelling is never read as a fill (the race guard).
Returns false when no in-flight swap matches.
Task<bool> UpdateStatus(string swapPkScript, ArkadeSwapIntentStatus status, string? spentTxid = null, CancellationToken cancellationToken = default)
Parameters
swapPkScriptstringstatusArkadeSwapIntentStatusspentTxidstringcancellationTokenCancellationToken
Returns
Events
SwapsChanged
Raised whenever a swap intent is saved or its status changes.
event EventHandler<ArkadeSwapIntent>? SwapsChanged