Namespace NArk.Abstractions.Settlement
Classes
- SettlementAssets
Asset identifiers the SDK itself settles.
- SettlementConfig
One settlement rule: when a wallet's available balance of
SourceAssetreachesThreshold, sweep it toDestination.
- SettlementContext
The wallet state a policy evaluates against: everything that is spendable right now, with coins locked by pending intents and coins past their expiry already removed.
BTC and Arkade-issued assets are kept apart. A coin carrying an asset holds a dust-sized satoshi amount as the asset's carrier, not as spendable BTC — moving it would move the asset — so such coins land in AssetCoins and AssetBalances, never in AvailableCoins or AvailableBalanceSats. A BTC threshold never fires on an asset carrier's dust, and an asset threshold never fires on BTC.
Use GetAvailableBalance(string) and GetAvailableCoins(string) to read either denomination through one call.
- SettlementDestination
Where a settlement moves funds to: a network, an asset on that network, and an address on it.
Network and asset are free-form strings rather than enums on purpose — an application can settle to a network the SDK has never heard of (a stablecoin chain, an exchange deposit rail) by registering its own ISettlementService for it, with no change to the SDK.
- SettlementNetworks
Network identifiers the SDK itself settles to. Any other value is a rail an application registers — an EVM chain, a stablecoin network, an exchange deposit — and needs no entry here.
- SettlementNotSupportedException
Thrown when no registered ISettlementService handles a destination, or when one is asked to settle a destination it does not support.
- SettlementPlan
A policy's decision: settle
AmountofSourceAssettoDestination.
- SettlementRequest
A single settlement execution: move
AmountofSourceAssetout ofWalletIdtoDestination.
- SettlementResult
The outcome of a completed settlement.
Interfaces
- ISettlementConfigProvider
Supplies the per-wallet settlement rules the built-in policies act on. The SDK deliberately persists nothing here — the application already owns this configuration (a store setting, a user preference, a config file) and implements this interface over it.
- ISettlementGate
A veto on settling a given wallet right now. Registered gates are consulted before any policy runs; if any gate reports blocked, the wallet is skipped until the next activity or heartbeat tick.
This is how a subsystem the settlement engine knows nothing about protects funds it has already committed — a swap package uses it to hold settlement off while a freshly created swap is still being funded, so the same VTXOs are not spent twice.
- ISettlementPolicy
Decides whether a wallet should settle right now, and how much. The policy never moves funds — it yields SettlementPlans that the settlement engine routes to an ISettlementService.
This mirrors
ISweepPolicy: register several policies to combine strategies (a balance threshold, a scheduled payout, an expiry-driven sweep) and the engine executes the union of what they yield, rather than picking one winner. A policy may yield nothing, one plan, or several — settling a balance across two destinations is just two yields.Plans are executed in the order they are yielded, policy by policy, against a balance that shrinks as each one is committed; a plan that no longer fits the remaining balance is skipped.
- ISettlementService
Executes a settlement: moves value out of a wallet to a SettlementDestination.
One implementation per rail. The SDK ships a destination sweep (Arkade address or collaborative exit) in
NArk.Coreand a BTC chain swap in a swap package; applications add their own — a stablecoin transfer, an exchange deposit — by registering another implementation whose CanSettle(SettlementDestination) accepts that network and asset.CompositeSettlementServiceroutes between them.
- ISettlementTriggerSource
Feeds wallet activity into the settlement engine from outside
NArk.Core. The engine already reacts to VTXO and intent changes; register a trigger source to add another signal — a swap package uses one to re-evaluate a wallet whenever a swap changes state.