dev
md 49 lines 1.44 KB
Rendered Raw
1 ## cw_bitcoin_cash
2
3 Bitcoin Cash wallet module using the shared Electrum implementation configured for BCH mainnet. Includes CashAddr handling and BCH-specific fee/priority presets.
4
5 ### Features
6
7 - Derive keys via BIP‑39; maintain receive/change address chains.
8 - Load/save snapshots of addresses, indices, and balances.
9 - Electrum connectivity and UTXO management.
10 - Create/sign/broadcast BCH transactions; calculate size-based fees by priority.
11 - CashAddr compatibility for addresses; migration of legacy snapshots.
12 - Message signing and verification.
13
14 ### Getting started
15
16 Create/open via the app’s wallet service using `WalletType.bitcoinCash`. Ensure BCH Electrum nodes are configured.
17
18 ```dart
19 final wallet = await BitcoinCashWallet.create(
20 mnemonic: '...',
21 password: 'secret',
22 walletInfo: walletInfo,
23 unspentCoinsInfo: unspentCoinsBox,
24 encryptionFileUtils: encryption,
25 );
26 ```
27
28 ### Usage
29
30 Fee calculation and send:
31
32 ```dart
33 final feeRate = wallet.feeRate(BitcoinCashTransactionPriority.medium);
34 final pending = await wallet.createTransaction(
35 outputs: [
36 BitcoinTransactionOutput(
37 address: 'bitcoincash:qq...',
38 amount: 10000, // satoshis
39 ),
40 ],
41 feeRate: feeRate,
42 );
43 final txHash = await pending.commit();
44 ```
45
46 ### Additional information
47
48 - See `lib/src/` for: `BitcoinCashWallet`, `BitcoinCashWalletAddresses`, and helpers in `bitcoin_cash_base.dart`.
49 - Snapshot migration and CashAddr normalization are handled during open.