Wallets class

Unified wallet system that handles multiple wallet types (NWC, Cashu, etc.) Uses WalletProvider pattern for pluggability

Constructors

Wallets({required List<WalletProvider> providers, required WalletsRepo repository, int latestTransactionCount = 10})

Properties

combinedBalances Stream<List<WalletBalance>>
public-facing stream of combined balances, grouped by currency.
latefinal
combinedPendingTransactions Stream<List<WalletTransaction>>
public-facing stream of combined pending transactions.
latefinal
combinedRecentTransactions Stream<List<WalletTransaction>>
public-facing stream of combined recent transactions.
latefinal
defaultWalletForReceiving Wallet?
Get default wallet for receiving
no setter
defaultWalletForSending Wallet?
Get default wallet for sending
no setter
hashCode int
The hash code for this object.
no setterinherited
latestTransactionCount int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
walletsStream Stream<List<Wallet>>
stream of all wallets
no setter

Methods

addWallet(Wallet wallet) Future<void>
Add a new wallet to the system
combinedTransactions({int? limit, int? offset, String? walletId, String? unit, WalletType? walletType}) Future<List<WalletTransaction>>
createWallet({required String id, required String name, required WalletType type, required Set<String> supportedUnits, required Map<String, dynamic> metadata}) Wallet
Create a new wallet using the appropriate provider
dispose() Future<void>
getBalance(String walletId, String unit) int
getBalancesStream(String walletId) Stream<List<WalletBalance>>
getCombinedBalance(String unit) int
Calculate combined balance for a specific currency
getPendingTransactionsStream(String walletId) Stream<List<WalletTransaction>>
getRecentTransactionsStream(String walletId) Stream<List<WalletTransaction>>
getTransactions({int? limit, int? offset, String? walletId, String? unit, WalletType? walletType}) Future<List<WalletTransaction>>
Get transactions from storage
getWalletsForUnit(String unit) List<Wallet>
Get wallets that support a specific currency
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
receive({String? walletId, required int amountSats}) Future<String>
Create a Lightning invoice to receive funds Returns the invoice string
removeWallet(String walletId) Future<void>
Remove wallet - persists on disk
send({String? walletId, required String invoice}) Future<PayInvoiceResponse>
Send payment
setDefaultWallet(String walletId) → void
Set the default wallet to use by common operations
setDefaultWalletForReceiving(String walletId) → void
Set default wallet for receiving funds (e.g. for generating invoices)
setDefaultWalletForSending(String walletId) → void
Set default wallet for sending funds (e.g. for paying invoices)
toString() String
A string representation of this object.
inherited
zap({required String pubkey, required int amount, String? comment}) Future<void>
todo: implement zap

Operators

operator ==(Object other) bool
The equality operator.
inherited