diff --git a/gui/src/app/view/hw.rs b/gui/src/app/view/hw.rs index 948047562..8fcd03eb8 100644 --- a/gui/src/app/view/hw.rs +++ b/gui/src/app/view/hw.rs @@ -56,6 +56,13 @@ pub fn hw_list_view( UnsupportedReason::WrongNetwork => { hw::wrong_network_hardware_wallet(&kind.to_string(), version.as_ref()) } +UnsupportedReason::Version { + minimal_supported_version, + } => hw::unsupported_version_hardware_wallet( + &kind.to_string(), + version.as_ref(), + minimal_supported_version, + ), _ => hw::unsupported_hardware_wallet(&kind.to_string(), version.as_ref()), }, HardwareWallet::Locked { @@ -117,6 +124,13 @@ pub fn hw_list_view_for_registration( UnsupportedReason::WrongNetwork => { hw::wrong_network_hardware_wallet(&kind.to_string(), version.as_ref()) } + UnsupportedReason::Version { + minimal_supported_version, + } => hw::unsupported_version_hardware_wallet( + &kind.to_string(), + version.as_ref(), + minimal_supported_version, + ), _ => hw::unsupported_hardware_wallet(&kind.to_string(), version.as_ref()), }, HardwareWallet::Locked { @@ -189,6 +203,13 @@ pub fn hw_list_view_verify_address( UnsupportedReason::WrongNetwork => { hw::wrong_network_hardware_wallet(&kind.to_string(), version.as_ref()) } + UnsupportedReason::Version { + minimal_supported_version, + } => hw::unsupported_version_hardware_wallet( + &kind.to_string(), + version.as_ref(), + minimal_supported_version, + ), _ => hw::unsupported_hardware_wallet(&kind.to_string(), version.as_ref()), }, false, diff --git a/gui/src/hw.rs b/gui/src/hw.rs index 74bd3a25e..eb21c1a45 100644 --- a/gui/src/hw.rs +++ b/gui/src/hw.rs @@ -602,22 +602,48 @@ async fn refresh(mut state: State) -> (HardwareWalletMessage, State) { if let Ok((cc, _)) = coldcard::api::Coldcard::open(AsRefWrap { inner: api }, sn, None) { - match HardwareWallet::new( - id, - if let Some(wallet) = &state.wallet { - coldcard::Coldcard::from(cc) - .with_wallet_name(wallet.name.clone()) - .into() - } else { - coldcard::Coldcard::from(cc).into() - }, - Some(&state.keys_aliases), - ) - .await - { - Err(e) => tracing::error!("Failed to connect to coldcard: {}", e), - Ok(hw) => hws.push(hw), + let device: Arc = if let Some(wallet) = &state.wallet { + coldcard::Coldcard::from(cc) + .with_wallet_name(wallet.name.clone()) + .into() + } else { + coldcard::Coldcard::from(cc).into() }; + match ( + device.get_master_fingerprint().await, + device.get_version().await, + ) { + (Ok(fingerprint), Ok(version)) => { + if version + >= (Version { + major: 6, + minor: 2, + patch: 1, + prerelease: None, + }) + { + hws.push(HardwareWallet::Supported { + id, + device, + kind: DeviceKind::Coldcard, + fingerprint, + version: Some(version), + registered: None, + alias: state.keys_aliases.get(&fingerprint).cloned(), + }); + } else { + hws.push(HardwareWallet::Unsupported { + id, + kind: device.device_kind(), + version: Some(version), + reason: UnsupportedReason::Version { + minimal_supported_version: "Edge firmware v6.2.1", + }, + }); + } + } + _ => tracing::error!("Failed to connect to coldcard"), + } } } } diff --git a/gui/src/installer/view.rs b/gui/src/installer/view.rs index d7479ca27..1f02b371e 100644 --- a/gui/src/installer/view.rs +++ b/gui/src/installer/view.rs @@ -681,6 +681,13 @@ pub fn hardware_wallet_xpubs<'a>( UnsupportedReason::WrongNetwork => { hw::wrong_network_hardware_wallet(&kind.to_string(), version.as_ref()) } + UnsupportedReason::Version { + minimal_supported_version, + } => hw::unsupported_version_hardware_wallet( + &kind.to_string(), + version.as_ref(), + minimal_supported_version, + ), _ => hw::unsupported_hardware_wallet(&kind.to_string(), version.as_ref()), }, HardwareWallet::Locked { @@ -2120,6 +2127,13 @@ pub fn hw_list_view( UnsupportedReason::WrongNetwork => { hw::wrong_network_hardware_wallet(&kind.to_string(), version.as_ref()) } + UnsupportedReason::Version { + minimal_supported_version, + } => hw::unsupported_version_hardware_wallet( + &kind.to_string(), + version.as_ref(), + minimal_supported_version, + ), _ => hw::unsupported_hardware_wallet(&kind.to_string(), version.as_ref()), }, HardwareWallet::Locked { diff --git a/gui/ui/src/component/hw.rs b/gui/ui/src/component/hw.rs index 99c7df35c..a14681c75 100644 --- a/gui/ui/src/component/hw.rs +++ b/gui/ui/src/component/hw.rs @@ -348,6 +348,41 @@ pub fn unsupported_hardware_wallet<'a, T: 'a, K: Display, V: Display>( .padding(10) } +pub fn unsupported_version_hardware_wallet<'a, T: 'a, K: Display, V: Display, S: Display>( + kind: K, + version: Option, + requested_version: S, +) -> Container<'a, T> { + container( + row(vec![ + column(vec![ + text::p1_bold("Unsupported firmware version").into(), + text::p1_regular(format!( + "Install version superior or equal to {}", + requested_version + )) + .into(), + Row::new() + .spacing(5) + .push(text::caption(kind.to_string())) + .push_maybe(version.map(|v| text::caption(v.to_string()))) + .into(), + ]) + .width(Length::Fill) + .into(), + tooltip::Tooltip::new( + icon::warning_icon(), + "Please upgrade firmware", + tooltip::Position::Bottom, + ) + .style(theme::Container::Card(theme::Card::Simple)) + .into(), + ]) + .align_items(Alignment::Center), + ) + .padding(10) +} + pub fn sign_success_hot_signer<'a, T: 'a, F: Display>( fingerprint: F, alias: Option>>,