Class AssetIntentsManager
- Namespace
- NArk.ArkadeIntents.Assets
- Assembly
- NArk.ArkadeIntents.dll
The Arkade swap creation entry point: builds the covenant offer from the wallet's own receive address + signing key, funds it (attaching the offer packet so the solver can fill it), and persists the resulting ArkadeSwapIntent as pending — after which the storage-backed ArkadeSwapIntentMonitoringService drives it to a terminal status from the covenant VTXO.
public sealed class AssetIntentsManager
- Inheritance
-
AssetIntentsManager
- Inherited Members
Constructors
AssetIntentsManager(IClientTransport, IContractService, IWalletProvider, ISpendingService, IArkadeIntentStorage, IVtxoStorage, IOptions<ArkadeIntentsOptions>?)
public AssetIntentsManager(IClientTransport transport, IContractService contractService, IWalletProvider walletProvider, ISpendingService spendingService, IArkadeIntentStorage intentStorage, IVtxoStorage vtxoStorage, IOptions<ArkadeIntentsOptions>? options = null)
Parameters
transportIClientTransportcontractServiceIContractServicewalletProviderIWalletProviderspendingServiceISpendingServiceintentStorageIArkadeIntentStoragevtxoStorageIVtxoStorageoptionsIOptions<ArkadeIntentsOptions>
Methods
CancelSwap(string, CancellationToken)
Cancel a pending swap: reclaim the deposit by spending the covenant's cancel path
($user+$server) back to the wallet. The intent is moved to
Cancelling before the spend so the monitor can't read the
cancel spend as a fill; on success it becomes Cancelled, and on
failure it rolls back to Pending.
public Task<ArkadeSwapIntent> CancelSwap(string swapId, CancellationToken cancellationToken = default)
Parameters
swapIdstringcancellationTokenCancellationToken
Returns
CreateQuotedSwap(QuotedSwapRequest, IRfqTransport, SolverCard?, CancellationToken)
Agree terms with a solver, derive the offer locally, check it, and fund it.
public Task<QuotedArkadeSwap> CreateQuotedSwap(QuotedSwapRequest request, IRfqTransport rfqTransport, SolverCard? solverCard = null, CancellationToken cancellationToken = default)
Parameters
requestQuotedSwapRequestWhat to swap, and on which side the amount is fixed.
rfqTransportIRfqTransportHow to reach the solver.
solverCardSolverCardThe solver's published card, when one is known.
cancellationTokenCancellationTokenCancels before funding; after funding the swap is live regardless.
Returns
- Task<QuotedArkadeSwap>
The funded swap, the quote it was funded under, and what the deposit carried.
Remarks
The difference from CreateSwap(CreateSwapRequest, CancellationToken) is who sets the price. That one publishes a standing offer at terms the caller picked and waits for any taker; this one asks a named solver what it will pay, and funds only if the answer is acceptable. Everything after the quote is the same covenant, so the same CancelSwap(string, CancellationToken) reclaims an unfilled deposit — there is no timelock on this class, and no refund path that does not need the server.
From the quote only the binding fields are used: the two amounts and
valid_until. The offer address it publishes is compared against the client's own
derivation and never used, which is what leaves a wrong or malicious solver able to produce
only an offer this client declines.
An asset deposit rides on dust sats. The quote publishes how many as carrier_sats,
already netted into the amounts, so sending a different number is not a rounding difference —
it is funding terms the solver did not quote. When a quote omits it, the server's own dust
floor stands in: the safe direction, since a carrier below dust is refused outright.
Exceptions
- RfqRefusedException
The solver declined to quote.
- ArkadeSwapNotFundableException
A safety gate refused — nothing was funded.
- OfferAddressMismatchException
The solver's offer is not ours — nothing was funded.
CreateSwap(CreateSwapRequest, CancellationToken)
Create and fund an Arkade swap: derive a fresh receive address (payout target) and signing key (cancel signer), build the offer against the current server + emulator keys, deposit to the swap address with the offer packet attached, and store the intent as pending.
public Task<ArkadeSwapIntent> CreateSwap(CreateSwapRequest request, CancellationToken cancellationToken = default)
Parameters
requestCreateSwapRequestcancellationTokenCancellationToken