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.
no setter
combinedPendingTransactions Stream<List<WalletTransaction>>
public-facing stream of combined pending transactions.
no setter
combinedRecentTransactions Stream<List<WalletTransaction>>
public-facing stream of combined recent transactions.
no setter
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>>
compatibleTransferProtocol({required Wallet source, required Wallet destination}) WalletPaymentProtocol?
Returns the protocol that can transfer funds from source to destination, or null when the wallets have no compatible payment path.
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
getWallets() Future<List<Wallet>>
Get all wallets currently known to the usecase.
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
payBip321({String? walletId, required String payment, int? amountMsat, String? payerNote, Map<String, dynamic>? metadata, Duration? timeout}) Future<PayResponse>
Pays an instruction from a BIP-321 URI using the selected wallet.
receive({String? walletId, required int amountSats}) Future<String>
Create a Lightning invoice to receive funds Returns the invoice string
receiveBip321({String? walletId, int? amountMsat, String? description, Map<String, dynamic>? metadata, Duration? timeout}) Future<ReceiveResponse>
Creates a BIP-321 URI using the selected receiving wallet.
reconnectWallet(String walletId) Future<Wallet>
Re-establishes access to a wallet's remote service.
refreshBalance(String walletId) Future<List<WalletBalance>>
Fetches current balances from the wallet provider immediately.
removeWallet(String walletId) Future<void>
Remove wallet - persists on disk
send({String? walletId, required String invoice, Duration? timeout}) 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
transfer({required String sourceWalletId, required String destinationWalletId, int? amountMsat, Duration? timeout}) Future<WalletTransferResult>
Transfers funds directly between two configured wallets.
zap({required String pubkey, required int amount, String? comment}) Future<void>
todo: implement zap

Operators

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