Table of Contents

Class SpendingService

Namespace
NArk.Core.Services
Assembly
NArk.Core.dll
public class SpendingService : ISpendingService
Inheritance
SpendingService
Implements
Inherited Members

Constructors

SpendingService(IVtxoStorage, IContractStorage, IWalletProvider, ICoinService, IContractService, IClientTransport, ICoinSelector, ISafetyService, IIntentStorage, ILogger<SpendingService>, IVirtualTxStorage?)

public SpendingService(IVtxoStorage vtxoStorage, IContractStorage contractStorage, IWalletProvider walletProvider, ICoinService coinService, IContractService paymentService, IClientTransport transport, ICoinSelector coinSelector, ISafetyService safetyService, IIntentStorage intentStorage, ILogger<SpendingService> logger, IVirtualTxStorage? virtualTxStorage = null)

Parameters

vtxoStorage IVtxoStorage
contractStorage IContractStorage
walletProvider IWalletProvider
coinService ICoinService
paymentService IContractService
transport IClientTransport
coinSelector ICoinSelector
safetyService ISafetyService
intentStorage IIntentStorage
logger ILogger<SpendingService>
virtualTxStorage IVirtualTxStorage

SpendingService(IVtxoStorage, IContractStorage, IWalletProvider, ICoinService, IContractService, IClientTransport, ICoinSelector, ISafetyService, IIntentStorage, IVirtualTxStorage?)

public SpendingService(IVtxoStorage vtxoStorage, IContractStorage contractStorage, IWalletProvider walletProvider, ICoinService coinService, IContractService paymentService, IClientTransport transport, ICoinSelector coinSelector, ISafetyService safetyService, IIntentStorage intentStorage, IVirtualTxStorage? virtualTxStorage = null)

Parameters

vtxoStorage IVtxoStorage
contractStorage IContractStorage
walletProvider IWalletProvider
coinService ICoinService
paymentService IContractService
transport IClientTransport
coinSelector ICoinSelector
safetyService ISafetyService
intentStorage IIntentStorage
virtualTxStorage IVirtualTxStorage

SpendingService(IVtxoStorage, IContractStorage, ICoinService, IWalletProvider, IContractService, IClientTransport, ICoinSelector, ISafetyService, IIntentStorage, IEnumerable<IEventHandler<PostCoinsSpendActionEvent>>, ILogger<SpendingService>?, IVirtualTxStorage?, IEnumerable<ISpendExtensionPacketProvider>?, IEnumerable<ISpendSubmitHandler>?)

public SpendingService(IVtxoStorage vtxoStorage, IContractStorage contractStorage, ICoinService coinService, IWalletProvider walletProvider, IContractService paymentService, IClientTransport transport, ICoinSelector coinSelector, ISafetyService safetyService, IIntentStorage intentStorage, IEnumerable<IEventHandler<PostCoinsSpendActionEvent>> postSpendEventHandlers, ILogger<SpendingService>? logger = null, IVirtualTxStorage? virtualTxStorage = null, IEnumerable<ISpendExtensionPacketProvider>? extensionPacketProviders = null, IEnumerable<ISpendSubmitHandler>? submitHandlers = null)

Parameters

vtxoStorage IVtxoStorage
contractStorage IContractStorage
coinService ICoinService
walletProvider IWalletProvider
paymentService IContractService
transport IClientTransport
coinSelector ICoinSelector
safetyService ISafetyService
intentStorage IIntentStorage
postSpendEventHandlers IEnumerable<IEventHandler<PostCoinsSpendActionEvent>>
logger ILogger<SpendingService>
virtualTxStorage IVirtualTxStorage
extensionPacketProviders IEnumerable<ISpendExtensionPacketProvider>
submitHandlers IEnumerable<ISpendSubmitHandler>

Methods

GetAvailableCoins(string, CancellationToken)

Returns all spendable coins for the wallet (unspent, unlocked, and within timelock bounds).

public Task<IReadOnlySet<ArkCoin>> GetAvailableCoins(string walletId, CancellationToken cancellationToken = default)

Parameters

walletId string
cancellationToken CancellationToken

Returns

Task<IReadOnlySet<ArkCoin>>

Spend(string, ArkCoin[], ArkTxOut[], CancellationToken, IReadOnlyList<IExtensionPacket>?)

Spends specific coins to the given outputs. Returns the Ark transaction ID. extensionPackets are merged into the spend's single Extension OP_RETURN alongside the asset packet and any registered providers (e.g. an Arkade offer packet on a funding deposit).

public Task<uint256> Spend(string walletId, ArkCoin[] inputs, ArkTxOut[] outputs, CancellationToken cancellationToken = default, IReadOnlyList<IExtensionPacket>? extensionPackets = null)

Parameters

walletId string
inputs ArkCoin[]
outputs ArkTxOut[]
cancellationToken CancellationToken
extensionPackets IReadOnlyList<IExtensionPacket>

Returns

Task<uint256>

Spend(string, ArkTxOut[], CancellationToken, IReadOnlyList<IExtensionPacket>?)

Spends to the given outputs using automatic coin selection. Returns the Ark transaction ID. See the coin-specific overload for extensionPackets.

public Task<uint256> Spend(string walletId, ArkTxOut[] outputs, CancellationToken cancellationToken = default, IReadOnlyList<IExtensionPacket>? extensionPackets = null)

Parameters

walletId string
outputs ArkTxOut[]
cancellationToken CancellationToken
extensionPackets IReadOnlyList<IExtensionPacket>

Returns

Task<uint256>