Class Wallet
Base class representing a specific wallet (i.e. anything with a WalletID)
public class Wallet
- Inheritance
-
Wallet
- Derived
- Inherited Members
- Extension Methods
Remarks
When not derived from this represents a STANDARD_WALLET
Constructors
Wallet(uint, WalletProxy)
Base class representing a specific wallet (i.e. anything with a WalletID)
public Wallet(uint walletId, WalletProxy walletProxy)
Parameters
walletIduintThe wallet_id to wrap
walletProxyWalletProxyWallet RPC proxy to use for communication
Remarks
When not derived from this represents a STANDARD_WALLET
Properties
WalletId
The id of the wallet
public uint WalletId { get; init; }
Property Value
- uint
- Base class representing a specific wallet (i.e. anything with a WalletID)
WalletProxy
Wallet RPC proxy for communication
public WalletProxy WalletProxy { get; init; }
Property Value
- WalletProxy
- Base class representing a specific wallet (i.e. anything with a WalletID)
Methods
CreateWalletDataObject()
Creates a dynamic object and sets its wallet_id property to WalletId
protected dynamic CreateWalletDataObject()
Returns
- dynamic
A dynamic object
DeleteUnconfirmedTransactions(CancellationToken)
Delete unconfirmed transactions from the wallet
public Task DeleteUnconfirmedTransactions(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
GetBalance(CancellationToken)
Get the balance of a specific wallet
public Task<WalletBalance> GetBalance(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<WalletBalance>
The wallet balance (in units of mojos)
GetNextAddress(bool, CancellationToken)
Get the last address or create a new one
public Task<string> GetNextAddress(bool newAddress, CancellationToken cancellationToken = default)
Parameters
newAddressboolWhether to generate a new address
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
GetSpendableCoins(ulong?, ulong?, IEnumerable<ulong>?, IEnumerable<Coin>?, IEnumerable<string>?, CancellationToken)
Get the list of spendable coins
public Task<(IEnumerable<CoinRecord> ConfirmedRecords, IEnumerable<CoinRecord> UnconfirmedRecords, IEnumerable<Coin> UnconfirmedAdditions)> GetSpendableCoins(ulong? minCoinAmount, ulong? maxCoinAmount, IEnumerable<ulong>? excludedCoinAmounts = null, IEnumerable<Coin>? excludedCoins = null, IEnumerable<string>? excludedCoinIds = null, CancellationToken cancellationToken = default)
Parameters
minCoinAmountulong?The minimum coin amount
maxCoinAmountulong?The maximum coin amount>
excludedCoinAmountsIEnumerable<ulong>Amounts to exclude
excludedCoinsIEnumerable<Coin>Coins to exclude
excludedCoinIdsIEnumerable<string>Coin ids to exclude
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<(IEnumerable<CoinRecord> ConfirmedRecords, IEnumerable<CoinRecord> UnconfirmedRecords, IEnumerable<Coin> UnconfirmedAdditions)>
Information about spendable coins
GetTransactionCount(TransactionTypeFilter?, CancellationToken)
Get the number of transactions
public Task<uint> GetTransactionCount(TransactionTypeFilter? typeFilter = null, CancellationToken cancellationToken = default)
Parameters
typeFilterTransactionTypeFiltercancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
GetTransactions(string?, TransactionTypeFilter?, bool, string?, uint, uint, bool?, CancellationToken)
Retrieves a list of transactions from a wallet.
public Task<IEnumerable<TransactionRecord>> GetTransactions(string? toAddress = null, TransactionTypeFilter? typeFilter = null, bool reverse = false, string? sortKey = null, uint start = 0, uint end = 50, bool? confirmed = null, CancellationToken cancellationToken = default)
Parameters
toAddressstringRestrict results only to this address
typeFilterTransactionTypeFilterreverseboolReverse the sort order of the results
sortKeystringField to sort results by
startuintthe start index of transactions (zero based)
enduintThe end index of transactions
confirmedbool?cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<TransactionRecord>>
A list of TransactionRecord
GetWalletInfo(CancellationToken)
Retrieves information about this wallet
public Task<WalletInfo> GetWalletInfo(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<WalletInfo>
WalletInfo and the wallet pubkey fingerprint
Remarks
Throws an exception if the wallet does not exist
SelectCoins(ulong, IEnumerable<Coin>?, IEnumerable<ulong>?, ulong?, ulong?, CancellationToken)
Returns a set of coins that can be used for generating a new transaction.
public Task<IEnumerable<Coin>> SelectCoins(ulong amount, IEnumerable<Coin>? excludedCoins = null, IEnumerable<ulong>? excludedCoinAmounts = null, ulong? minCoinAmount = null, ulong? maxCoinAmount = null, CancellationToken cancellationToken = default)
Parameters
amountulongAn amount
excludedCoinsIEnumerable<Coin>excludedCoinAmountsIEnumerable<ulong>minCoinAmountulong?maxCoinAmountulong?cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<Coin>>
The list of IEnumerable<T>s
SendTransaction(string, ulong, IEnumerable<string>?, IEnumerable<ulong>?, IEnumerable<string>?, ulong?, ulong?, bool, ulong, CancellationToken)
Sends a transaction
public Task<TransactionRecord> SendTransaction(string address, ulong amount, IEnumerable<string>? memos = null, IEnumerable<ulong>? excludeCoinAmounts = null, IEnumerable<string>? excludeCoinsIds = null, ulong? minCoinAmount = null, ulong? maxCoinAmount = null, bool reusePuzhash = false, ulong fee = 0, CancellationToken cancellationToken = default)
Parameters
addressstringThe receiving address
amountulongThe amount to send (in units of mojos)
memosIEnumerable<string>Memos to go along with the transaction
excludeCoinAmountsIEnumerable<ulong>excludeCoinsIdsIEnumerable<string>minCoinAmountulong?maxCoinAmountulong?reusePuzhashboolfeeulongFee (in units of mojos)
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
SendTransactionMulti(IEnumerable<Coin>, IEnumerable<Coin>?, ulong, CancellationToken)
Sends a transaction
public Task<TransactionRecord> SendTransactionMulti(IEnumerable<Coin> additions, IEnumerable<Coin>? coins = null, ulong fee = 0, CancellationToken cancellationToken = default)
Parameters
additionsIEnumerable<Coin>Additions to the block chain
coinsIEnumerable<Coin>Coins to include
feeulongFee (in units of mojos)
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
Validate(CancellationToken)
Validates that WalletId is a STANDARD_WALLET
public virtual Task Validate(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken- Base class representing a specific wallet (i.e. anything with a WalletID)
Returns
- Task
True if the wallet is of the expected type
Remarks
Intended to be overridden by derived classes of specific WalletType
Validate(WalletType, CancellationToken)
Validates that WalletId exists and is of the correct WalletType
protected Task Validate(WalletType walletType, CancellationToken cancellationToken)
Parameters
walletTypeWalletTypeThe expected type of wallet
cancellationTokenCancellationTokenA token to allow the call to be cancelled
Returns
- Task
true if the wallet is of the expected type
Remarks
Throws an exception if the wallet does not exist