From: Vihiga Tyonum Date: Mon, 3 Aug 2026 16:38:10 +0000 (+0100) Subject: feat(hwi): Add hidapi to workflows X-Git-Url: http://internal-gitweb-vhost/-client-interface/%22https:/encode/struct.CommandStringError.html?a=commitdiff_plain;h=25b60b6293180b2bff59340dbabce44597d23d18;p=bdk-cli feat(hwi): Add hidapi to workflows - add hidapi dependencies to workflows to fix failing compilation --- diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index 55e9dfd..1624053 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -16,6 +16,10 @@ jobs: uses: actions/checkout@v7 with: persist-credentials: false + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libudev-dev libusb-1.0-0-dev pkg-config - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v2 with: diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index cf29940..b87c7e5 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -22,6 +22,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v7 + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libudev-dev libusb-1.0-0-dev pkg-config - name: Setup Rust Toolchain uses: actions-rust-lang/setup-rust-toolchain@v2 with: @@ -45,7 +49,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v7 - + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libudev-dev libusb-1.0-0-dev pkg-config - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v2 with: diff --git a/Cargo.lock b/Cargo.lock index 5c55509..25baa30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3447,7 +3447,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls 0.23.45", - "socket2", + "socket2 0.5.10", "thiserror 2.0.18", "tokio", "tracing", diff --git a/Cargo.toml b/Cargo.toml index ab7118e..d5f3768 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ reqwest = { version = "0.13.2", default-features = false, features = ["rustls"], url = { version = "2.5.8", optional = true } bdk_message_signer = { version = "0.2.0", optional = true } bitcoin-payment-instructions = { version = "0.7.0", optional = true} -async-hwi = { version = "0.0.32", features = ["specter", "coldcard", "ledger", "jade", "bitbox", "services"], optional = true} +async-hwi = { version = "0.0.32", features = ["specter", "coldcard", "ledger", "jade", "bitbox", "service"], optional = true} [features] default = ["repl", "sqlite"] diff --git a/src/handlers/offline.rs b/src/handlers/offline.rs index 6f86ca3..971d68e 100644 --- a/src/handlers/offline.rs +++ b/src/handlers/offline.rs @@ -42,7 +42,6 @@ const DEFAULT_OFFLINE_SIGNER: bool = true; #[cfg(not(feature = "hwi"))] const DEFAULT_OFFLINE_SIGNER: bool = false; - impl OfflineWalletSubCommand { pub fn execute(&self, ctx: &mut AppContext>) -> Result<(), Error> { match self { @@ -551,7 +550,7 @@ pub struct BumpFeeCommand { pub shrink_address: Option
, /// Make a PSBT that can be signed by offline signers and hardware wallets. Forces the addition of `non_witness_utxo` and more details to let the signer identify the change output. - #[arg(long = "offline_signer", default_value_t = DEFAULT_OFFLINE_SIGNER))] + #[arg(long = "offline_signer", default_value_t = DEFAULT_OFFLINE_SIGNER)] pub offline_signer: bool, /// Selects which utxos *must* be added to the tx. Unconfirmed utxos cannot be used. diff --git a/src/utils/hwi.rs b/src/utils/hwi.rs index 81e48c2..9877845 100644 --- a/src/utils/hwi.rs +++ b/src/utils/hwi.rs @@ -57,11 +57,11 @@ pub async fn enumerate_hwi_devices( let device = device.with_network(network); match device.get_info().await { Ok(info) => { - if info.jade_state == jade::api::JadeState::Locked { - if let Err(e) = device.auth().await { - warn!("Jade authentication failed: {e:?}"); - continue; - } + if info.jade_state == jade::api::JadeState::Locked + && let Err(e) = device.auth().await + { + warn!("Jade authentication failed: {e:?}"); + continue; } devices.push(device.into()); } @@ -82,38 +82,33 @@ pub async fn enumerate_hwi_devices( for device_info in api.device_list() { // BitBox02 - if async_hwi::bitbox::is_bitbox02(device_info) { - if let Ok(handle) = device_info.open_device(&api) { - if let Ok(pairing) = - PairingBitbox02WithLocalCache::::connect(handle, None) - .await - { - if let Ok((device, _)) = pairing.wait_confirm().await { - let mut bb02 = BitBox02::from(device).with_network(network); - if let Some(policy) = wallet.policy { - bb02 = bb02.with_policy(policy).map_err(map_device_err)?; - } - devices.push(bb02.into()); - } - } + if async_hwi::bitbox::is_bitbox02(device_info) + && let Ok(handle) = device_info.open_device(&api) + && let Ok(pairing) = + PairingBitbox02WithLocalCache::::connect(handle, None).await + && let Ok((device, _)) = pairing.wait_confirm().await + { + let mut bb02 = BitBox02::from(device).with_network(network); + if let Some(policy) = wallet.policy { + bb02 = bb02.with_policy(policy).map_err(map_device_err)?; } + devices.push(bb02.into()); } // Coldcard if device_info.vendor_id() == coldcard::api::COINKITE_VID && device_info.product_id() == coldcard::api::CKCC_PID + && let Some(sn) = device_info.serial_number() { - if let Some(sn) = device_info.serial_number() { - match coldcard::api::Coldcard::open(&api, sn, None) { - Ok((cc, _)) => { - let mut hw = coldcard::Coldcard::from(cc); - if let Some(name) = wallet.name { - hw = hw.with_wallet_name(name.to_string()); - } - devices.push(hw.into()); + match coldcard::api::Coldcard::open(&api, sn, None) { + Ok((cc, _)) => { + let mut hw = coldcard::Coldcard::from(cc); + if let Some(name) = wallet.name { + hw = hw.with_wallet_name(name.to_string()); } - Err(e) => warn!("Failed to open Coldcard (SN {sn}): {e:?}"), + devices.push(hw.into()); } + Err(e) => warn!("Failed to open Coldcard (SN {sn}): {e:?}"), } } }