parent
47fb6efb3b
commit
7124e09b75
@ -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,
|
||||
|
||||
@ -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<dyn HWI + Send + Sync> = 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"),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -348,6 +348,37 @@ 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<V>,
|
||||
requested_version: S,
|
||||
) -> Container<'a, T> {
|
||||
container(
|
||||
row(vec![
|
||||
column(vec![
|
||||
text::p1_bold("Unsupported firmware version").into(),
|
||||
text::p1_regular(format!("Install version {} or later", 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<impl Into<Cow<'a, str>>>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user