From 89d8e660beb2b4fee13effefdc32daf6341a2728 Mon Sep 17 00:00:00 2001 From: edouard Date: Thu, 25 May 2023 10:05:49 +0200 Subject: [PATCH] gui: update async-hwi 0.0.7 --- gui/Cargo.lock | 4 ++-- gui/Cargo.toml | 2 +- gui/src/hw.rs | 41 +++++++++++++++++++++-------------------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/gui/Cargo.lock b/gui/Cargo.lock index 393e2149..3b6366d6 100644 --- a/gui/Cargo.lock +++ b/gui/Cargo.lock @@ -139,9 +139,9 @@ dependencies = [ [[package]] name = "async-hwi" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09be30d154c732f398ebe57645f2074c1993fb88b7a457dc41c73487737fcfc6" +checksum = "fd74315dfee3384712b3f22849db68c6f4e77b86a483c57630abcd05eaba9a62" dependencies = [ "async-trait", "base64", diff --git a/gui/Cargo.toml b/gui/Cargo.toml index 6444d973..7a46a7ec 100644 --- a/gui/Cargo.toml +++ b/gui/Cargo.toml @@ -14,7 +14,7 @@ name = "liana-gui" path = "src/main.rs" [dependencies] -async-hwi = "0.0.6" +async-hwi = "0.0.7" liana = { git = "https://github.com/wizardsardine/liana", branch = "master", default-features = false } liana_ui = { path = "ui" } backtrace = "0.3" diff --git a/gui/src/hw.rs b/gui/src/hw.rs index d6ad3c47..a8d98a7d 100644 --- a/gui/src/hw.rs +++ b/gui/src/hw.rs @@ -7,7 +7,7 @@ use liana::miniscript::bitcoin::{ util::bip32::Fingerprint, }; use serde::{Deserialize, Serialize}; -use tracing::debug; +use tracing::{debug, warn}; #[derive(Debug, Clone)] pub enum HardwareWallet { @@ -102,18 +102,18 @@ pub async fn list_hardware_wallets(wallet: &Wallet) -> Vec { debug!("{}", e); } } - match specter::Specter::try_connect_serial().await { - Ok(device) => match HardwareWallet::new(Arc::new(device), Some(&wallet.keys_aliases)).await - { - Ok(hw) => hws.push(hw), - Err(e) => { - debug!("{}", e); + match specter::Specter::enumerate().await { + Ok(devices) => { + for device in devices { + match HardwareWallet::new(Arc::new(device), Some(&wallet.keys_aliases)).await { + Ok(hw) => hws.push(hw), + Err(e) => { + debug!("{}", e); + } + } } - }, - Err(HWIError::DeviceNotFound) => {} - Err(e) => { - debug!("{}", e); } + Err(e) => warn!("Error while listing specter wallets: {}", e), } match ledger::LedgerSimulator::try_connect().await { Ok(mut device) => match device.get_master_fingerprint().await { @@ -249,17 +249,18 @@ pub async fn list_unregistered_hardware_wallets( debug!("{}", e); } } - match specter::Specter::try_connect_serial().await { - Ok(device) => match HardwareWallet::new(Arc::new(device), aliases).await { - Ok(hw) => hws.push(hw), - Err(e) => { - debug!("{}", e); + match specter::Specter::enumerate().await { + Ok(devices) => { + for device in devices { + match HardwareWallet::new(Arc::new(device), aliases).await { + Ok(hw) => hws.push(hw), + Err(e) => { + debug!("{}", e); + } + } } - }, - Err(HWIError::DeviceNotFound) => {} - Err(e) => { - debug!("{}", e); } + Err(e) => warn!("Error while listing specter wallets: {}", e), } match ledger::LedgerSimulator::try_connect().await { Ok(device) => match device.get_master_fingerprint().await {