parent
04eb511366
commit
e26a631318
4
gui/Cargo.lock
generated
4
gui/Cargo.lock
generated
@ -145,9 +145,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-hwi"
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5df769ed2ee66f45f290602647bfb48f7c652d6d8bb9dd8eb104fdfb0ac48919"
|
||||
checksum = "b3b6805d43fc4b11c8f2a16f0aa8dca5b8b8702c3a23aa0a1a2ec1b42c98ebb7"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64",
|
||||
|
||||
@ -14,7 +14,7 @@ name = "liana-gui"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
async-hwi = "0.0.3"
|
||||
async-hwi = "0.0.4"
|
||||
liana = { git = "https://github.com/wizardsardine/liana", branch = "master", default-features = false }
|
||||
backtrace = "0.3"
|
||||
base64 = "0.13"
|
||||
|
||||
@ -151,49 +151,58 @@ pub async fn list_hardware_wallets(
|
||||
debug!("{}", e);
|
||||
}
|
||||
}
|
||||
match ledger::Ledger::try_connect_hid() {
|
||||
Ok(mut device) => match device.get_master_fingerprint().await {
|
||||
Ok(fingerprint) => {
|
||||
if let Some((name, descriptor)) = wallet {
|
||||
device
|
||||
.load_wallet(
|
||||
name,
|
||||
descriptor,
|
||||
cfg.iter()
|
||||
.find(|cfg| cfg.fingerprint == fingerprint.to_string())
|
||||
.map(|cfg| cfg.token()),
|
||||
)
|
||||
.expect("Configuration must be correct");
|
||||
}
|
||||
|
||||
let version = device.get_version().await.ok();
|
||||
if ledger_version_supported(version.as_ref()) {
|
||||
hws.push(HardwareWallet::Supported {
|
||||
kind: device.device_kind(),
|
||||
fingerprint,
|
||||
device: Arc::new(device),
|
||||
version,
|
||||
});
|
||||
} else {
|
||||
hws.push(HardwareWallet::Unsupported {
|
||||
kind: device.device_kind(),
|
||||
version,
|
||||
message: "Minimal supported app version is 2.1.0".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
hws.push(HardwareWallet::Unsupported {
|
||||
kind: device.device_kind(),
|
||||
version: None,
|
||||
message: "Minimal supported app version is 2.1.0".to_string(),
|
||||
});
|
||||
}
|
||||
},
|
||||
Err(HWIError::DeviceNotFound) => {}
|
||||
match ledger::HidApi::new() {
|
||||
Err(e) => {
|
||||
debug!("{}", e);
|
||||
}
|
||||
Ok(api) => {
|
||||
for detected in ledger::Ledger::<ledger::TransportHID>::enumerate(&api) {
|
||||
match ledger::Ledger::<ledger::TransportHID>::connect(&api, detected) {
|
||||
Ok(mut device) => match device.get_master_fingerprint().await {
|
||||
Ok(fingerprint) => {
|
||||
if let Some((name, descriptor)) = wallet {
|
||||
device
|
||||
.load_wallet(
|
||||
name,
|
||||
descriptor,
|
||||
cfg.iter()
|
||||
.find(|cfg| cfg.fingerprint == fingerprint.to_string())
|
||||
.map(|cfg| cfg.token()),
|
||||
)
|
||||
.expect("Configuration must be correct");
|
||||
}
|
||||
|
||||
let version = device.get_version().await.ok();
|
||||
if ledger_version_supported(version.as_ref()) {
|
||||
hws.push(HardwareWallet::Supported {
|
||||
kind: device.device_kind(),
|
||||
fingerprint,
|
||||
device: Arc::new(device),
|
||||
version,
|
||||
});
|
||||
} else {
|
||||
hws.push(HardwareWallet::Unsupported {
|
||||
kind: device.device_kind(),
|
||||
version,
|
||||
message: "Minimal supported app version is 2.1.0".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
hws.push(HardwareWallet::Unsupported {
|
||||
kind: device.device_kind(),
|
||||
version: None,
|
||||
message: "Minimal supported app version is 2.1.0".to_string(),
|
||||
});
|
||||
}
|
||||
},
|
||||
Err(HWIError::DeviceNotFound) => {}
|
||||
Err(e) => {
|
||||
debug!("{}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
hws
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user