Skip to content

Commit 60fb933

Browse files
committed
feat(hwi): set hwi as top level command
- add ledger and coldcard integration - update hwi as top level command - update CHANGELOG rebase and fix clippy issues
1 parent 5faa35d commit 60fb933

File tree

5 files changed

+67
-37
lines changed

5 files changed

+67
-37
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details.
77
- Add wallet subcommand `config` to save wallet configs
88
- Add `wallets` command to list all wallets saved configs
99

10+
- Add `hwi` top level command with subcommands: `devices`, `register`, `address` and `sign` transaction
11+
1012
## [2.0.0]
1113

1214
- Removed MSRV and bumped Rust Edition to 2024
@@ -20,6 +22,7 @@ page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details.
2022
- Renamed `BuilderError` to `KyotoBuilderError` and added `KyotoUpdateError`
2123
- Updated `bdk_electrum` to 0.23.0
2224
- Added `just` example for starting, connecting and funding a wallet in regtest
25+
- Add `--pretty` top level flag for formatting commands output in a tabular format
2326

2427
## [1.0.0]
2528

Cargo.lock

Lines changed: 35 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,23 @@ pub struct WalletOpts {
247247
pub compactfilter_opts: CompactFilterOpts,
248248
}
249249

250+
/// HWI specific options
251+
#[cfg(feature = "hwi")]
252+
#[derive(Clone, Debug, PartialEq, Eq, Args)]
253+
pub struct HwiOpts {
254+
/// Wallet name
255+
#[arg(env = "WALLET", short = 'w', long = "wallet")]
256+
pub wallet: Option<String>,
257+
258+
/// External descriptor
259+
#[arg(env = "EXT_DESCRIPTOR", short = 'e', long = "ext_descriptor")]
260+
pub ext_descriptor: Option<String>,
261+
262+
/// Database type
263+
#[arg(short = 'd', long = "database_type")]
264+
pub database_type: Option<DatabaseType>,
265+
}
266+
250267
/// Options to configure a SOCKS5 proxy for a blockchain client connection.
251268
#[cfg(any(feature = "electrum", feature = "esplora"))]
252269
#[derive(Debug, Args, Clone, PartialEq, Eq)]

src/handlers.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
13141314
&wallet_opts,
13151315
&cli_opts,
13161316
offline_subcommand.clone(),
1317-
)?
1317+
)
13181318
};
13191319
Ok(result?)
13201320
}
@@ -1424,6 +1424,15 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
14241424
let descriptor = handle_descriptor_command(cli_opts.network, desc_type, key, pretty)?;
14251425
Ok(descriptor)
14261426
}
1427+
1428+
#[cfg(feature = "hwi")]
1429+
CliSubCommand::Hwi {
1430+
hwi_opts,
1431+
subcommand,
1432+
} => {
1433+
let result = handle_hwi_subcommand(network, &hwi_opts, subcommand).await?;
1434+
Ok(serde_json::to_string_pretty(&result).map_err(|e| Error::SerdeJson(e))?)
1435+
}
14271436
};
14281437
result
14291438
}

src/utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ use bdk_wallet::{
3838
use cli_table::{Cell, CellStruct, Style, Table};
3939
#[cfg(feature = "hwi")]
4040
use {
41+
crate::commands::HwiOpts,
4142
async_hwi::jade::{self, Jade},
42-
async_hwi::ledger::{HidApi, LedgerSimulator},
43+
async_hwi::ledger::{HidApi, Ledger, LedgerSimulator, TransportHID},
4344
async_hwi::specter::{Specter, SpecterSimulator},
4445
async_hwi::{HWI, coldcard},
4546
async_hwi::{

0 commit comments

Comments
 (0)