Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gui: add support for tapminiscript on bitbox02 #1400

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gui/src/app/state/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: '{}'.",
Expand Down
18 changes: 14 additions & 4 deletions gui/src/hw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand All @@ -257,15 +258,15 @@ impl HardwareWallets {
kind: DeviceKind::BitBox02,
fingerprint,
device: bitbox2.into(),
version: None,
version,
registered: Some(registered),
alias: None,
})
} else {
Ok(HardwareWallet::Unsupported {
id: id.clone(),
kind: DeviceKind::BitBox02,
version: None,
version,
reason: UnsupportedReason::NotPartOfWallet(
fingerprint,
),
Expand All @@ -277,7 +278,7 @@ impl HardwareWallets {
kind: DeviceKind::BitBox02,
fingerprint,
device: bitbox2.into(),
version: None,
version,
registered: Some(registered),
alias: None,
})
Expand Down Expand Up @@ -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 {
Expand All @@ -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(
Expand Down
Loading