Skip to content

Commit

Permalink
wip: update liana dep with bitcoin-0.30
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardparis committed Jul 13, 2023
1 parent ebea147 commit de038b4
Show file tree
Hide file tree
Showing 29 changed files with 139 additions and 123 deletions.
117 changes: 73 additions & 44 deletions gui/Cargo.lock

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

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

[dependencies]
async-hwi = "0.0.7"
async-hwi = { git = "https://github.com/wizardsardine/async-hwi", branch = "bitcoin-0.30" }
liana = { git = "https://github.com/wizardsardine/liana", branch = "master", default-features = false }
liana_ui = { path = "ui" }
backtrace = "0.3"
base64 = "0.13"
hex = "0.4.3"

iced = { version = "0.9", default-features= false, features = ["tokio", "glow", "svg", "qr_code", "image"] }
iced_native = "0.10"
Expand Down
5 changes: 1 addition & 4 deletions gui/src/app/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use std::sync::Arc;

use liana::{
config::Config as DaemonConfig,
miniscript::bitcoin::{
util::{bip32::Fingerprint, psbt::Psbt},
Address,
},
miniscript::bitcoin::{bip32::Fingerprint, psbt::Psbt, Address},
};

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion gui/src/app/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fs::OpenOptions;
use std::io::Write;
use std::path::PathBuf;

use liana::miniscript::bitcoin::{util::bip32::Fingerprint, Network};
use liana::miniscript::bitcoin::{bip32::Fingerprint, Network};
use serde::{Deserialize, Serialize};

use crate::{app::wallet::Wallet, hw::HardwareWalletConfig};
Expand Down
9 changes: 4 additions & 5 deletions gui/src/app/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ impl State for ReceivePanel {
async move {
daemon
.get_new_address()
.map(|res| res.address)
.map(|res| res.address().clone())
.map_err(|e| e.into())
},
Message::ReceiveAddress,
Expand Down Expand Up @@ -351,12 +351,11 @@ mod tests {
async fn test_receive_panel() {
let addr =
Address::from_str("tb1qkldgvljmjpxrjq2ev5qxe8dvhn0dph9q85pwtfkjeanmwdue2akqj4twxj")
.unwrap();
.unwrap()
.assume_checked();
let daemon = Daemon::new(vec![(
Some(json!({"method": "getnewaddress", "params": Option::<Request>::None})),
Ok(json!(GetAddressResult {
address: addr.clone()
})),
Ok(json!(GetAddressResult::new(addr.clone()))),
)]);

let sandbox: Sandbox<ReceivePanel> = Sandbox::new(ReceivePanel::default());
Expand Down
15 changes: 5 additions & 10 deletions gui/src/app/state/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ use std::sync::Arc;
use iced::Command;
use liana::{
descriptors::LianaPolicy,
miniscript::bitcoin::{
consensus,
util::{bip32::Fingerprint, psbt::Psbt},
},
miniscript::bitcoin::{bip32::Fingerprint, psbt::Psbt},
};

use liana_ui::{
Expand Down Expand Up @@ -463,10 +460,8 @@ impl Action for UpdateAction {
Ok(()) => {
self.success = true;
self.error = None;
let psbt = consensus::encode::deserialize::<Psbt>(
&base64::decode(&self.updated.value).unwrap(),
)
.expect("Already checked");
let psbt = Psbt::deserialize(&base64::decode(&self.updated.value).unwrap())
.expect("Already checked");
for (i, input) in tx.psbt.inputs.iter_mut().enumerate() {
if tx
.psbt
Expand Down Expand Up @@ -501,7 +496,7 @@ impl Action for UpdateAction {
self.updated.value = s;
if let Some(psbt) = base64::decode(&self.updated.value)
.ok()
.and_then(|bytes| consensus::encode::deserialize::<Psbt>(&bytes).ok())
.and_then(|bytes| Psbt::deserialize(&bytes).ok())
{
self.updated.valid = tx.psbt.unsigned_tx.txid() == psbt.unsigned_tx.txid();
}
Expand All @@ -510,7 +505,7 @@ impl Action for UpdateAction {
if self.updated.valid {
self.processing = true;
self.error = None;
let updated: Psbt = consensus::encode::deserialize(
let updated = Psbt::deserialize(
&base64::decode(&self.updated.value).expect("Already checked"),
)
.unwrap();
Expand Down
Loading

0 comments on commit de038b4

Please sign in to comment.