Skip to content
Draft
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
68 changes: 55 additions & 13 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions liana-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ fs2 = "0.4.3"
# Used for opening URLs in browser
open = "5.3"

encrypted_backup = { git = "https://github.com/pythcoiner/encrypted_backup.git", rev= "df395ee", features = ["miniscript_12_0"]}

[target.'cfg(windows)'.dependencies]
zip = { version = "0.6", default-features=false, features = ["bzip2", "deflate"] }

Expand Down
17 changes: 8 additions & 9 deletions liana-gui/src/app/state/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,14 @@ impl ExportModal {
ImportExportType::ExportPsbt(_) => "Export PSBT",
ImportExportType::ExportXpub(_) => "Export Xpub",
ImportExportType::ImportXpub(_) => "Import Xpub",
ImportExportType::ExportProcessBackup(..) | ImportExportType::ExportBackup(_) => {
"Export Backup"
}
ImportExportType::ExportProcessBackup(..) => "Export Backup",
ImportExportType::ExportEncryptedDescriptor(_) => "Export Encrypted Descriptor",
ImportExportType::Descriptor(_) => "Export Descriptor",
ImportExportType::ExportLabels => "Export Labels",
ImportExportType::ImportPsbt(_) => "Import PSBT",
ImportExportType::ImportDescriptor => "Import Descriptor",
ImportExportType::ImportBackup { .. } => "Restore Backup",
ImportExportType::WalletFromBackup => "Import existing wallet from backup",
ImportExportType::FromBackup => "Import existing wallet from backup",
}
}

Expand All @@ -105,13 +104,14 @@ impl ExportModal {
.to_string();
format!("liana-{}.txt", checksum)
}
ImportExportType::ExportEncryptedDescriptor(_) => "liana.bed".into(),
ImportExportType::ImportPsbt(_) => "psbt.psbt".into(),
ImportExportType::ImportDescriptor => "descriptor.txt".into(),
ImportExportType::ExportLabels => format!("liana-labels-{date}.jsonl"),
ImportExportType::ExportBackup(_) | ImportExportType::ExportProcessBackup(..) => {
format!("liana-backup-{date}.json")
ImportExportType::ExportProcessBackup(..) => {
format!("liana-backup-{date}.beb")
}
ImportExportType::WalletFromBackup | ImportExportType::ImportBackup { .. } => {
ImportExportType::FromBackup | ImportExportType::ImportBackup { .. } => {
"liana-backup.json".to_string()
}
}
Expand Down Expand Up @@ -191,8 +191,7 @@ impl ExportModal {
ImportExportMessage::UpdateAliases(map.clone()).into()
});
}
Progress::WalletFromBackup(_) => {}
Progress::Psbt(_) => {}
Progress::WalletFromBackup(_) | Progress::EncryptedFile(_) | Progress::Psbt(_) => {}
},
ImportExportMessage::TimedOut => {
self.stop(ImportExportState::TimedOut);
Expand Down
4 changes: 3 additions & 1 deletion liana-gui/src/app/state/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ impl State for ImportExportSettingsState {
return modal.update(m);
};
}
Message::View(view::Message::Settings(view::SettingsMessage::ExportDescriptor)) => {
Message::View(view::Message::Settings(
view::SettingsMessage::ExportEncryptedDescriptor,
)) => {
if self.modal.is_none() {
let modal = ExportModal::new(
Some(daemon),
Expand Down
39 changes: 9 additions & 30 deletions liana-gui/src/app/state/settings/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct WalletSettingsState {
modal: Modal,
processing: bool,
updated: bool,
config: Arc<Config>,
_config: Arc<Config>,
}

impl WalletSettingsState {
Expand All @@ -73,7 +73,7 @@ impl WalletSettingsState {
modal: Modal::None,
processing: false,
updated: false,
config,
_config: config,
}
}

Expand Down Expand Up @@ -271,41 +271,20 @@ impl State for WalletSettingsState {
Task::none()
}
}
Message::View(view::Message::Settings(view::SettingsMessage::ExportWallet)) => {
Message::View(view::Message::Settings(
view::SettingsMessage::ExportEncryptedDescriptor,
)) => {
if self.modal.is_none() {
let datadir = cache.datadir_path.clone();
let network = cache.network;
let config = self.config.clone();
let wallet = self.wallet.clone();
let daemon = daemon.clone();
let descriptor = self.wallet.main_descriptor.clone();
let modal = ExportModal::new(
Some(daemon),
ImportExportType::ExportProcessBackup(datadir, network, config, wallet),
ImportExportType::ExportEncryptedDescriptor(Box::new(descriptor)),
);
let launch = modal.launch(true);
self.modal = Modal::ImportExport(modal);
launch
} else {
Task::none()
}
}
Message::View(view::Message::Settings(view::SettingsMessage::ImportWallet)) => {
if self.modal.is_none() {
let modal = ExportModal::new(
Some(daemon),
ImportExportType::ImportBackup {
network_dir: cache.datadir_path.network_directory(cache.network),
wallet: self.wallet.clone(),
overwrite_labels: None,
overwrite_aliases: None,
},
);
let launch = modal.launch(false);
self.modal = Modal::ImportExport(modal);
launch
} else {
Task::none()
return launch;
}
Task::none()
}
_ => match &mut self.modal {
Modal::RegisterWallet(m) => m.update(daemon, cache, message),
Expand Down
2 changes: 1 addition & 1 deletion liana-gui/src/app/view/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub enum SettingsMessage {
RemoteBackendSettings(RemoteBackendSettingsMessage),
EditWalletSettings,
ImportExportSection,
ExportDescriptor,
ExportEncryptedDescriptor,
ExportTransactions,
ExportLabels,
ExportWallet,
Expand Down
29 changes: 11 additions & 18 deletions liana-gui/src/app/view/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ pub fn import_export<'a>(cache: &'a Cache, warning: Option<&Error>) -> Element<'

let export_descriptor = export_section(
"Descriptor only",
"Descriptor file only, to use with other wallets.",
"Plain-text descriptor file only, to use with other wallets.",
icon::backup_icon(),
Message::Settings(SettingsMessage::ExportDescriptor),
Message::Settings(SettingsMessage::ExportEncryptedDescriptor),
);

let export_transactions = export_section(
Expand All @@ -238,14 +238,14 @@ pub fn import_export<'a>(cache: &'a Cache, warning: Option<&Error>) -> Element<'
);

let export_wallet = export_section(
"Back up wallet",
"File with wallet info needed to restore on other devices (no private keys).",
"Export wallet",
"File with wallet info useful to sync labels and data on other devices.",
icon::backup_icon(),
Message::Settings(SettingsMessage::ExportWallet),
);

let import_wallet = export_section(
"Restore wallet",
"Import wallet",
"Upload a backup file to update wallet info.",
icon::restore_icon(),
Message::Settings(SettingsMessage::ImportWallet),
Expand Down Expand Up @@ -1010,18 +1010,6 @@ pub fn wallet_settings<'a>(
) -> Element<'a, Message> {
let header = header("Wallet", SettingsMessage::EditWalletSettings);

let import_export = Row::new()
.push(
button::secondary(Some(icon::backup_icon()), "Backup")
.on_press(Message::Settings(SettingsMessage::ExportWallet)),
)
.push(Space::with_width(10))
.push(
button::secondary(Some(icon::restore_icon()), "Restore")
.on_press(Message::Settings(SettingsMessage::ImportWallet)),
)
.push(Space::with_width(Length::Fill));

let descr = card::simple(
Column::new()
.push(text("Wallet descriptor:").bold())
Expand All @@ -1039,6 +1027,12 @@ pub fn wallet_settings<'a>(
Row::new()
.spacing(10)
.push(Column::new().width(Length::Fill))
.push(
button::secondary(Some(icon::backup_icon()), "Back Up Descriptor")
.on_press(Message::Settings(
SettingsMessage::ExportEncryptedDescriptor,
)),
)
.push(
button::secondary(Some(icon::clipboard_icon()), "Copy")
.on_press(Message::Clipboard(descriptor.to_string())),
Expand Down Expand Up @@ -1118,7 +1112,6 @@ pub fn wallet_settings<'a>(
Column::new()
.spacing(20)
.push(header)
.push(import_export)
.push(descr)
.push(
card::simple(display_policy(
Expand Down
Loading
Loading