Skip to content

Commit 3e4409d

Browse files
authored
fix(docs): Add proper descriptions to module READMEs (#2490)
1 parent a3774ae commit 3e4409d

File tree

14 files changed

+450
-219
lines changed

14 files changed

+450
-219
lines changed

cw_bitcoin/README.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
11
# cw_bitcoin
22

3-
A new Flutter package project.
3+
Bitcoin-family Electrum wallet implementation used by Cake Wallet (BTC, LTC and derivatives).
44

5-
## Getting Started
5+
## Features
66

7-
This project is a starting point for a Dart
8-
[package](https://flutter.dev/developing-packages/),
9-
a library module containing code that can be shared easily across
10-
multiple Flutter or Dart projects.
7+
- Electrum client and wallet with address/UTXO management and snapshots.
8+
- Derivation via BIP‑39; receive/change chains with per-coin configs.
9+
- Create/sign/broadcast transactions; PSBT helpers and payjoin support.
10+
- Transaction history, priorities, and size-based fee calculations.
11+
- Hardware wallet support for BTC/LTC.
1112

12-
For help getting started with Flutter, view our
13-
[online documentation](https://flutter.dev/docs), which offers tutorials,
14-
samples, guidance on mobile development, and a full API reference.
13+
## Getting started
14+
15+
Use the module via app services (see `bitcoin_wallet_service.dart`, `litecoin_wallet_service.dart`). Ensure Electrum nodes are configured for the target coin.
16+
17+
```dart
18+
final wallet = await BitcoinWallet.create(
19+
mnemonic: '...',
20+
password: 'secret',
21+
walletInfo: walletInfo,
22+
unspentCoinsInfo: unspentCoinsBox,
23+
encryptionFileUtils: encryption,
24+
);
25+
```
26+
27+
## Usage
28+
29+
Send BTC with medium priority:
30+
31+
```dart
32+
final feeRate = wallet.feeRate(BitcoinTransactionPriority.medium);
33+
final pending = await wallet.createTransaction(
34+
outputs: [BitcoinTransactionOutput(address: 'bc1...', amount: 50000)],
35+
feeRate: feeRate,
36+
);
37+
final txHash = await pending.commit();
38+
```
39+
40+
See `lib/` for wallet/services, PSBT, and payjoin utilities.

cw_bitcoin_cash/README.md

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,49 @@
1-
<!--
2-
This README describes the package. If you publish this package to pub.dev,
3-
this README's contents appear on the landing page for your package.
1+
## cw_bitcoin_cash
42

5-
For information about how to write a good package README, see the guide for
6-
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
3+
Bitcoin Cash wallet module using the shared Electrum implementation configured for BCH mainnet. Includes CashAddr handling and BCH-specific fee/priority presets.
74

8-
For general information about developing packages, see the Dart guide for
9-
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
10-
and the Flutter guide for
11-
[developing packages and plugins](https://flutter.dev/developing-packages).
12-
-->
5+
### Features
136

14-
TODO: Put a short description of the package here that helps potential users
15-
know whether this package might be useful for them.
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.
1613

17-
## Features
14+
### Getting started
1815

19-
TODO: List what your package can do. Maybe include images, gifs, or videos.
16+
Create/open via the app’s wallet service using `WalletType.bitcoinCash`. Ensure BCH Electrum nodes are configured.
2017

21-
## Getting started
22-
23-
TODO: List prerequisites and provide or point to information on how to
24-
start using the package.
18+
```dart
19+
final wallet = await BitcoinCashWallet.create(
20+
mnemonic: '...',
21+
password: 'secret',
22+
walletInfo: walletInfo,
23+
unspentCoinsInfo: unspentCoinsBox,
24+
encryptionFileUtils: encryption,
25+
);
26+
```
2527

26-
## Usage
28+
### Usage
2729

28-
TODO: Include short and useful examples for package users. Add longer examples
29-
to `/example` folder.
30+
Fee calculation and send:
3031

3132
```dart
32-
const like = 'sample';
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();
3344
```
3445

35-
## Additional information
46+
### Additional information
3647

37-
TODO: Tell users more about the package: where to find more information, how to
38-
contribute to the package, how to file issues, what response they can expect
39-
from the package authors, and more.
48+
- See `lib/src/` for: `BitcoinCashWallet`, `BitcoinCashWalletAddresses`, and helpers in `bitcoin_cash_base.dart`.
49+
- Snapshot migration and CashAddr normalization are handled during open.

cw_core/README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
# cw_core
22

3-
A new Flutter package project.
3+
Core abstractions and shared types for Cake Wallet modules.
44

5-
## Getting Started
5+
## Highlights
66

7-
This project is a starting point for a Dart
8-
[package](https://flutter.dev/developing-packages/),
9-
a library module containing code that can be shared easily across
10-
multiple Flutter or Dart projects.
7+
- Wallet primitives: `WalletBase`, `WalletService`, `WalletInfo`, `WalletAddresses`.
8+
- Transaction primitives: `TransactionInfo`, `TransactionHistoryBase`, directions/priorities.
9+
- Currency models: `CryptoCurrency`, `Erc20Token`, SPL/TRON token types.
10+
- Persistence helpers: Hive adapters, path helpers (`pathForWallet`), encrypted storage utils.
11+
- Node representation (`Node`) and sync status types.
1112

12-
For help getting started with Flutter, view our
13-
[online documentation](https://flutter.dev/docs), which offers tutorials,
14-
samples, guidance on mobile development, and a full API reference.
13+
## Usage
14+
15+
Extend `WalletBase` for a new chain and provide a `WalletService` implementation to create/open/restore wallets.
16+
17+
```dart
18+
class MyChainWallet extends WalletBase<MyBalance, MyHistory, MyTxInfo> { /* ... */ }
19+
class MyChainWalletService extends WalletService<New, FromSeed, FromKeys, FromHardware> { /* ... */ }
20+
```
21+
22+
See the chain modules (e.g., `cw_bitcoin`, `cw_evm`) for complete examples.

cw_decred/README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
11
# cw_decred
22

3-
TODO: Fill this out.
3+
Decred wallet module that bridges to the native `libdcrwallet` via FFI. Provides high‑level methods to create/load wallets, sync, query balances/transactions, build and broadcast transactions, and sign/verify messages.
4+
5+
## Features
6+
7+
- FFI bindings to `libdcrwallet` with an isolate‑based request/response model.
8+
- Initialize, create, load, close wallets; watch‑only creation.
9+
- Start sync with optional peer list; query sync status and best block.
10+
- Query balances, list transactions and unspents, rescan from height.
11+
- Create signed transactions and broadcast raw transactions.
12+
- Export wallet seed; change wallet password.
13+
- Address management (new external address, default pubkey, address lists).
14+
- Message signing and verification.
15+
16+
## Getting started
17+
18+
Ensure the platform library is available:
19+
20+
- Android/Linux: `libdcrwallet.so`
21+
- Apple: embedded `cw_decred.framework/cw_decred`
22+
23+
Initialize and load a wallet:
24+
25+
```dart
26+
final lib = await Libwallet.spawn();
27+
await lib.initLibdcrwallet('', 'info');
28+
await lib.loadWallet(jsonEncode({ /* libdcrwallet config */ }));
29+
await lib.startSync('wallet.db', '');
30+
final status = await lib.syncStatus('wallet.db');
31+
```
32+
33+
## Usage
34+
35+
Create, sign, and broadcast a transaction:
36+
37+
```dart
38+
final signed = await lib.createSignedTransaction('wallet.db', jsonEncode({
39+
// inputs/outputs and policy for libdcrwallet
40+
}));
41+
final txid = await lib.sendRawTransaction('wallet.db', signed);
42+
```
43+
44+
## Additional information
45+
46+
- See `lib/api/` for the isolate wrapper (`libdcrwallet.dart`) and low‑level bindings.
47+
- Errors are surfaced via the `PayloadResult` struct; some calls support `throwOnError` in higher‑level wrappers.

cw_dogecoin/README.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,48 @@
1-
<!--
2-
This README describes the package. If you publish this package to pub.dev,
3-
this README's contents appear on the landing page for your package.
1+
## cw_dogecoin
42

5-
For information about how to write a good package README, see the guide for
6-
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
3+
Dogecoin wallet module using the shared Bitcoin Electrum implementation (`cw_bitcoin`) configured for Dogecoin mainnet.
74

8-
For general information about developing packages, see the Dart guide for
9-
[creating packages](https://dart.dev/guides/libraries/create-packages)
10-
and the Flutter guide for
11-
[developing packages and plugins](https://flutter.dev/to/develop-packages).
12-
-->
5+
### Features
136

14-
TODO: Put a short description of the package here that helps potential users
15-
know whether this package might be useful for them.
7+
- Derive keys via BIP‑39; Dogecoin HD paths using `bitcoin_base`.
8+
- Connect to Electrum nodes; maintain address sets and UTXOs.
9+
- Create/sign/broadcast DOGE transactions with configurable fee rate.
10+
- Address book and index management (receive/change, auto-generate settings).
11+
- Message signing and verification.
1612

17-
## Features
13+
### Getting started
1814

19-
TODO: List what your package can do. Maybe include images, gifs, or videos.
15+
Create/open via `DogecoinWalletService` in the app using `WalletType.dogecoin`. Ensure Electrum nodes are configured for Dogecoin.
2016

21-
## Getting started
22-
23-
TODO: List prerequisites and provide or point to information on how to
24-
start using the package.
17+
```dart
18+
final wallet = await DogeCoinWallet.create(
19+
mnemonic: '...',
20+
password: 'secret',
21+
walletInfo: walletInfo,
22+
unspentCoinsInfo: unspentCoinsBox,
23+
encryptionFileUtils: encryption,
24+
);
25+
```
2526

26-
## Usage
27+
### Usage
2728

28-
TODO: Include short and useful examples for package users. Add longer examples
29-
to `/example` folder.
29+
Estimate fee and send:
3030

3131
```dart
32-
const like = 'sample';
32+
final feeRate = wallet.feeRate(BitcoinCashTransactionPriority.medium); // example priority mapping
33+
final pending = await wallet.createTransaction(
34+
outputs: [
35+
BitcoinTransactionOutput(
36+
address: 'D...',
37+
amount: 1 * 100000000, // 1 DOGE in koinu
38+
),
39+
],
40+
feeRate: feeRate,
41+
);
42+
final txHash = await pending.commit();
3343
```
3444

35-
## Additional information
45+
### Additional information
3646

37-
TODO: Tell users more about the package: where to find more information, how to
38-
contribute to the package, how to file issues, what response they can expect
39-
from the package authors, and more.
47+
- See `lib/src/` for classes: `DogeCoinWallet`, `DogeCoinWalletAddresses`.
48+
- Relies on core Electrum features in `cw_bitcoin` for UTXO selection and persistence.

cw_ethereum/README.md

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,64 @@
1-
<!--
2-
This README describes the package. If you publish this package to pub.dev,
3-
this README's contents appear on the landing page for your package.
1+
## cw_ethereum
42

5-
For information about how to write a good package README, see the guide for
6-
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
3+
Ethereum wallet module built on `cw_evm`. Supports native ETH and ERC‑20 tokens, with history fetched via Etherscan.
74

8-
For general information about developing packages, see the Dart guide for
9-
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
10-
and the Flutter guide for
11-
[developing packages and plugins](https://flutter.dev/developing-packages).
12-
-->
5+
### Features
136

14-
TODO: Put a short description of the package here that helps potential users
15-
know whether this package might be useful for them.
7+
- EVM client specialized for Ethereum mainnet (chainId 1).
8+
- Default ERC‑20 token list and wallet‑scoped token storage/migration.
9+
- History via Etherscan v2 API (external, internal, and token transfers).
10+
- EIP‑1559 fee support; gas estimation per transaction intent.
11+
- Create/sign native and ERC‑20 transfers; approvals; broadcast.
12+
- Manage ERC‑20 tokens and balances; metadata lookup when needed.
13+
- Message signing and verification.
14+
- Node health checks for native and USDC token balance.
1615

17-
## Features
16+
### Getting started
1817

19-
TODO: List what your package can do. Maybe include images, gifs, or videos.
18+
Add shared EVM secrets (see `cw_evm` README):
2019

21-
## Getting started
20+
```dart
21+
// cw_evm/lib/.secrets.g.dart (DO NOT COMMIT)
22+
const String etherScanApiKey = 'YOUR_ETHERSCAN_KEY';
23+
const String nowNodesApiKey = 'YOUR_NOWNODES_KEY'; // if using eth.nownodes.io
24+
const String moralisApiKey = 'YOUR_MORALIS_KEY'; // optional
25+
```
26+
27+
Connect and sync:
2228

23-
TODO: List prerequisites and provide or point to information on how to
24-
start using the package.
29+
```dart
30+
final service = EthereumWalletService(walletInfoBox, true, client: EthereumClient());
31+
final wallet = await service.create(EVMChainNewWalletCredentials(name: 'My ETH', password: 'secret'));
32+
await wallet.connectToNode(node: Node(uriRaw: 'eth.llamarpc.com', isSSL: true));
33+
await wallet.startSync();
34+
```
2535

26-
## Usage
36+
### Usage
37+
38+
Send ETH:
39+
40+
```dart
41+
final pending = await wallet.createTransaction(
42+
EVMChainTransactionCredentials.single(
43+
address: '0x...',
44+
cryptoAmount: '0.05',
45+
currency: CryptoCurrency.eth,
46+
priority: EVMChainTransactionPriority.medium,
47+
),
48+
);
49+
final hash = await pending.commit();
50+
```
2751

28-
TODO: Include short and useful examples for package users. Add longer examples
29-
to `/example` folder.
52+
Add an ERC‑20 token and refresh balance:
3053

3154
```dart
32-
const like = 'sample';
55+
final token = await wallet.getErc20Token('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', 'eth'); // USDC
56+
if (token != null) {
57+
await wallet.addErc20Token(token);
58+
}
3359
```
3460

35-
## Additional information
61+
### Additional information
3662

37-
TODO: Tell users more about the package: where to find more information, how to
38-
contribute to the package, how to file issues, what response they can expect
39-
from the package authors, and more.
63+
- Toggle Etherscan usage via shared preferences key `use_etherscan`.
64+
- See `lib/` for APIs: `EthereumClient`, `EthereumWallet`, `EthereumWalletService`.

0 commit comments

Comments
 (0)