Ask questions about this project using DeepWiki AI
Flutter bindings for the Cashu Development Kit (CDK) - build cross-platform Cashu wallets with native performance.
Add to your pubspec.yaml:
dependencies:
cdk_flutter:
git:
url: https://github.com/cashubtc/cdk_flutter.gitimport 'package:cdk_flutter/cdk_flutter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await CdkFlutter.init();
// Generate or load mnemonic
final mnemonic = generateMnemonic();
// Create database and wallet
final db = await WalletDatabase.newInstance(path: 'wallet.sqlite');
final wallet = Wallet(
mintUrl: 'https://mint.example.com',
unit: 'sat',
mnemonic: mnemonic,
db: db,
);
runApp(MyApp());
}final stream = wallet.mint(amount: BigInt.from(1000));
stream.listen((quote) {
if (quote.state == MintQuoteState.unpaid) {
print('Pay: ${quote.request}');
} else if (quote.state == MintQuoteState.issued) {
print('Minted ${quote.amount} sats');
}
});final prepared = await wallet.prepareSend(amount: BigInt.from(100));
final token = await wallet.send(
send: prepared,
memo: 'Payment to Alice',
includeMemo: true,
);
print('Token: ${token.encoded}');final token = Token.parse(encoded: 'cashuA...');
final amount = await wallet.receive(token: token);final quote = await wallet.meltQuote(request: 'lnbc...');
await wallet.melt(quote: quote);final multiWallet = await MultiMintWallet.newInstance(
unit: 'sat',
mnemonic: mnemonic,
db: db,
);
await multiWallet.addMint(mintUrl: 'https://mint1.example.com');
final total = await multiWallet.totalBalance();WalletBalanceBuilder(
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text('${snapshot.data} sats');
}
return CircularProgressIndicator();
},
)git clone https://github.com/cashubtc/cdk_flutter.git
cd cdk_flutter
flutter pub get
cd rust && cargo build && cd ..
flutter_rust_bridge_codegen generate
cd example && flutter runMIT License - see LICENSE.
Part of the Cashu Development Kit ecosystem.