WalletProvider class abstract

Unified interface for wallet providers Combines factory pattern with wallet operations Each wallet type implements this interface

Implementers

Constructors

WalletProvider()

Properties

discoveredWallets Stream<List<Wallet>>
Stream of wallets discovered by this provider For auto-discovery (e.g., Cashu mints, NWC connections from events)
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type WalletType
The wallet type this provider handles
no setter

Methods

createWallet({required String id, required String name, required Set<String> supportedUnits, required Map<String, dynamic> metadata}) Wallet
Factory method: Creates a wallet instance from metadata Throws ArgumentError if required metadata is missing
getBalances(Wallet wallet) Stream<List<WalletBalance>>
Returns a stream of wallet balances Stream emits whenever balance changes
getPendingTransactions(Wallet wallet) Stream<List<WalletTransaction>>
Returns a stream of pending transactions
getRecentTransactions(Wallet wallet) Stream<List<WalletTransaction>>
Returns a stream of recent/completed transactions
initialize(Wallet wallet) Future<Wallet?>
Initializes the wallet (e.g., establishes connections) Called when wallet is first loaded or activated Returns an updated wallet if initialization resulted in changes, null otherwise
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
receive(Wallet wallet, int amountSats) Future<String>
Receive by creating a Lightning Invoice
removeWallet(Wallet wallet) Future<void>
removes the wallet (e.g., closes connections, streams)
send(Wallet wallet, String invoice) Future<PayInvoiceResponse>
Pays a Lightning invoice using this wallet Returns payment result with preimage and fees
toString() String
A string representation of this object.
inherited

Operators

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