gui: add support for tapminiscript on bitbox02

This commit is contained in:
pythcoiner 2024-10-30 11:30:16 +01:00
parent 472b070002
commit 01f6d2b769
2 changed files with 20 additions and 4 deletions

View File

@ -617,6 +617,12 @@ async fn sign_psbt(
psbt_in
.partial_sigs
.append(&mut pruned_psbt_in.partial_sigs);
if let Some(tap_key_sig) = pruned_psbt_in.tap_key_sig {
psbt_in.tap_key_sig = Some(tap_key_sig);
}
psbt_in
.tap_script_sigs
.append(&mut pruned_psbt_in.tap_script_sigs);
} else {
log::error!(
"Not all PSBT inputs are present in the pruned psbt. Pruned psbt: '{}'.",

View File

@ -246,6 +246,7 @@ impl HardwareWallets {
let fingerprint =
bitbox2.get_master_fingerprint().await?;
let mut registered = false;
let version = bitbox2.get_version().await.ok();
if let Some(wallet) = &wallet {
let desc = wallet.main_descriptor.to_string();
bitbox2 = bitbox2.with_policy(&desc)?;
@ -257,7 +258,7 @@ impl HardwareWallets {
kind: DeviceKind::BitBox02,
fingerprint,
device: bitbox2.into(),
version: None,
version,
registered: Some(registered),
alias: None,
})
@ -265,7 +266,7 @@ impl HardwareWallets {
Ok(HardwareWallet::Unsupported {
id: id.clone(),
kind: DeviceKind::BitBox02,
version: None,
version,
reason: UnsupportedReason::NotPartOfWallet(
fingerprint,
),
@ -277,7 +278,7 @@ impl HardwareWallets {
kind: DeviceKind::BitBox02,
fingerprint,
device: bitbox2.into(),
version: None,
version,
registered: Some(registered),
alias: None,
})
@ -851,7 +852,7 @@ fn ledger_version_supported(version: &Version) -> bool {
// Kind and minimal version of devices supporting tapminiscript.
// We cannot use a lazy_static HashMap yet, because DeviceKind does not implement Hash.
const DEVICES_COMPATIBLE_WITH_TAPMINISCRIPT: [(DeviceKind, Option<Version>); 4] = [
const DEVICES_COMPATIBLE_WITH_TAPMINISCRIPT: [(DeviceKind, Option<Version>); 5] = [
(
DeviceKind::Ledger,
Some(Version {
@ -872,6 +873,15 @@ const DEVICES_COMPATIBLE_WITH_TAPMINISCRIPT: [(DeviceKind, Option<Version>); 4]
prerelease: None,
}),
),
(
DeviceKind::BitBox02,
Some(Version {
major: 9,
minor: 21,
patch: 0,
prerelease: None,
}),
),
];
pub fn is_compatible_with_tapminiscript(