Skip to content

Commit

Permalink
Merge #986: Gui taproot
Browse files Browse the repository at this point in the history
b7f35c0 Add installer dropdown for advanced settings (edouardparis)
59a4b18 fix: merge tap_script_sigs from signed psbt (edouardparis)
02a52b9 add ledger version support for tapminiscript (edouardparis)
2debb32 Add taproot support to installer descriptor editor step (edouardparis)
8bc0cac gui: async-hwi:0.0.16 (edouardparis)
4a4c78d bump liana:master (edouardparis)

Pull request description:

  based on #985

ACKs for top commit:
  darosior:
    tACK b7f35c0 -- i've lightly tested this a couple times. It's good enough to get in and get tested along with the other changes.

Tree-SHA512: 4481be4797cf6fa901de9fec989837381c7817d18dd2c9a45ff1802a15982d1251696e577fb23da2d4ca9f0ed27044dade28f0e7b56703594dae4b3a5065306b
  • Loading branch information
darosior committed Mar 20, 2024
2 parents d7b8f53 + b7f35c0 commit 4f78d3b
Show file tree
Hide file tree
Showing 12 changed files with 338 additions and 117 deletions.
92 changes: 22 additions & 70 deletions gui/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name = "liana-gui"
path = "src/main.rs"

[dependencies]
async-hwi = "0.0.14"
async-hwi = "0.0.16"
liana = { git = "https://github.com/wizardsardine/liana", branch = "master", default-features = false, features = ["nonblocking_shutdown"] }
liana_ui = { path = "ui" }
backtrace = "0.3"
Expand Down
6 changes: 6 additions & 0 deletions gui/src/app/state/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,12 @@ fn merge_signatures(psbt: &mut Psbt, signed_psbt: &Psbt) {
psbtin
.partial_sigs
.extend(&mut signed_psbtin.partial_sigs.iter());
psbtin
.tap_script_sigs
.extend(&mut signed_psbtin.tap_script_sigs.iter());
if let Some(sig) = signed_psbtin.tap_key_sig {
psbtin.tap_key_sig = Some(sig);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion gui/src/app/view/hw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ pub fn hw_list_view(
alias.as_ref(),
)
} else if *registered == Some(false) {
hw::unregistered_hardware_wallet(
hw::warning_hardware_wallet(
kind,
version.as_ref(),
fingerprint,
alias.as_ref(),
"The wallet descriptor is not registered on the device.\n You can register it in the settings.",
)
} else {
hw::supported_hardware_wallet(kind, version.as_ref(), fingerprint, alias.as_ref())
Expand Down
29 changes: 29 additions & 0 deletions gui/src/hw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,3 +673,32 @@ fn ledger_version_supported(version: Option<&Version>) -> bool {
false
}
}

// 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>); 1] = [(
DeviceKind::Ledger,
Some(Version {
major: 2,
minor: 2,
patch: 0,
prerelease: None,
}),
)];

pub fn is_compatible_with_tapminiscript(
device_kind: &DeviceKind,
version: Option<&Version>,
) -> bool {
DEVICES_COMPATIBLE_WITH_TAPMINISCRIPT
.iter()
.any(|(kind, minimal_version)| {
device_kind == kind
&& match (version, minimal_version) {
(Some(v1), Some(v2)) => v1 >= v2,
(None, Some(_)) => false,
(Some(_), None) => true,
(None, None) => true,
}
})
}
11 changes: 9 additions & 2 deletions gui/src/installer/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
download::Progress,
hw::HardwareWalletMessage,
};
use async_hwi::DeviceKind;
use async_hwi::{DeviceKind, Version};

#[derive(Debug, Clone)]
pub enum Message {
Expand All @@ -30,6 +30,7 @@ pub enum Message {
UseHotSigner,
Installed(Result<PathBuf, Error>),
Network(Network),
CreateTaprootDescriptor(bool),
SelectBitcoindType(SelectBitcoindTypeMsg),
InternalBitcoind(InternalBitcoindMsg),
DefineBitcoind(DefineBitcoind),
Expand Down Expand Up @@ -85,12 +86,18 @@ pub enum DefinePath {
EditSequence,
}

#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone)]
pub enum DefineKey {
Delete,
Edit,
Clipboard(String),
Edited(String, DescriptorPublicKey, Option<DeviceKind>),
Edited(
String,
DescriptorPublicKey,
Option<DeviceKind>,
Option<Version>,
),
}

#[derive(Debug, Clone)]
Expand Down
Loading

0 comments on commit 4f78d3b

Please sign in to comment.