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
walletId
uintThe wallet_id to wrap
walletProxy
WalletProxyWallet 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
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationTokenA 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
newAddress
boolWhether to generate a new address
cancellationToken
CancellationTokenA 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
minCoinAmount
ulong?The minimum coin amount
maxCoinAmount
ulong?The maximum coin amount>
excludedCoinAmounts
IEnumerable<ulong>Amounts to exclude
excludedCoins
IEnumerable<Coin>Coins to exclude
excludedCoinIds
IEnumerable<string>Coin ids to exclude
cancellationToken
CancellationTokenA 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
typeFilter
TransactionTypeFiltercancellationToken
CancellationTokenA 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
toAddress
stringRestrict results only to this address
typeFilter
TransactionTypeFilterreverse
boolReverse the sort order of the results
sortKey
stringField to sort results by
start
uintthe start index of transactions (zero based)
end
uintThe end index of transactions
confirmed
bool?cancellationToken
CancellationTokenA 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
cancellationToken
CancellationTokenA 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
amount
ulongAn amount
excludedCoins
IEnumerable<Coin>excludedCoinAmounts
IEnumerable<ulong>minCoinAmount
ulong?maxCoinAmount
ulong?cancellationToken
CancellationTokenA 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
address
stringThe receiving address
amount
ulongThe amount to send (in units of mojos)
memos
IEnumerable<string>Memos to go along with the transaction
excludeCoinAmounts
IEnumerable<ulong>excludeCoinsIds
IEnumerable<string>minCoinAmount
ulong?maxCoinAmount
ulong?reusePuzhash
boolfee
ulongFee (in units of mojos)
cancellationToken
CancellationTokenA 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
additions
IEnumerable<Coin>Additions to the block chain
coins
IEnumerable<Coin>Coins to include
fee
ulongFee (in units of mojos)
cancellationToken
CancellationTokenA 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
cancellationToken
CancellationToken- 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
walletType
WalletTypeThe expected type of wallet
cancellationToken
CancellationTokenA 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