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 taproot #986

Merged
merged 6 commits into from
Mar 20, 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
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
Loading