gui: change project and crate name for liana
This commit is contained in:
parent
72a7bbea4c
commit
ee466798bd
84
gui/Cargo.lock
generated
84
gui/Cargo.lock
generated
@ -1409,6 +1409,48 @@ dependencies = [
|
||||
"bitcoin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "liana"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/revault/liana?branch=master#72a7bbea4c2bb931ff78286cff8be4fbe9c44b48"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"base64",
|
||||
"dirs",
|
||||
"fern",
|
||||
"jsonrpc",
|
||||
"libc",
|
||||
"log",
|
||||
"miniscript",
|
||||
"rusqlite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "liana_gui"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"async-hwi",
|
||||
"backtrace",
|
||||
"base64",
|
||||
"chrono",
|
||||
"dirs",
|
||||
"fern",
|
||||
"iced",
|
||||
"iced_lazy",
|
||||
"iced_native",
|
||||
"iced_pure",
|
||||
"liana",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"toml",
|
||||
"uds_windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.126"
|
||||
@ -1617,48 +1659,6 @@ version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "minisafe"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/revault/minisafe?branch=master#25bbce8612f7aaef45d24ec16fc1fd55c6b73594"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"base64",
|
||||
"dirs",
|
||||
"fern",
|
||||
"jsonrpc",
|
||||
"libc",
|
||||
"log",
|
||||
"miniscript",
|
||||
"rusqlite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minisafe-gui"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"async-hwi",
|
||||
"backtrace",
|
||||
"base64",
|
||||
"chrono",
|
||||
"dirs",
|
||||
"fern",
|
||||
"iced",
|
||||
"iced_lazy",
|
||||
"iced_native",
|
||||
"iced_pure",
|
||||
"log",
|
||||
"minisafe",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"toml",
|
||||
"uds_windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniscript"
|
||||
version = "8.0.0"
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
[package]
|
||||
name = "minisafe-gui"
|
||||
name = "liana_gui"
|
||||
version = "0.0.1"
|
||||
readme = "README.md"
|
||||
description = "Minisafe GUI"
|
||||
repository = "https://github.com/revault/minisafe"
|
||||
description = "Liana GUI"
|
||||
repository = "https://github.com/revault/liana"
|
||||
license = "BSD-3-Clause"
|
||||
authors = ["Edouard Paris <m@edouard.paris>", "Daniela Brozzoni <danielabrozzoni@protonmail.com>"]
|
||||
authors = ["Edouard Paris <m@edouard.paris>"]
|
||||
edition = "2018"
|
||||
resolver = "2"
|
||||
|
||||
[[bin]]
|
||||
name = "minisafe-gui"
|
||||
name = "liana-gui"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
async-hwi = { git = "https://github.com/revault/async-hwi", branch = "master" }
|
||||
minisafe = { git = "https://github.com/revault/minisafe", branch = "master", default-features = false }
|
||||
liana = { git = "https://github.com/revault/liana", branch = "master", default-features = false }
|
||||
backtrace = "0.3"
|
||||
base64 = "0.13"
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# minisafe-gui
|
||||
# liana GUI
|
||||
|
||||
Minisafe GUI is an user graphical interface written in rust for the
|
||||
[Minisafe daemon](https://github.com/revault/minisafe).
|
||||
Liana GUI is an user graphical interface written in rust for the
|
||||
[Liana daemon](https://github.com/revault/liana).
|
||||
|
||||
## Dependencies
|
||||
|
||||
@ -15,9 +15,9 @@ We are striving to remove dependencies, especially the 3D ones.
|
||||
|
||||
## Usage
|
||||
|
||||
`minisafe-gui --datadir <datadir> --<network>`
|
||||
`liana-gui --datadir <datadir> --<network>`
|
||||
|
||||
The default `datadir` is the default `minisafed` `datadir` (`~/.minisafe`
|
||||
The default `datadir` is the default `lianad` `datadir` (`~/.liana`
|
||||
for linux) and the default `network` is the bitcoin mainnet.
|
||||
|
||||
If no argument is provided, the GUI checks in the default `datadir`
|
||||
@ -29,8 +29,8 @@ file for the targeted `network`, the GUI starts with the installer mode.
|
||||
Instead of using `--datadir` and `--<network>`, a direct path to
|
||||
the GUI configuration file can be provided with `--conf`.
|
||||
|
||||
After start up, The GUI will connect to the running minisafed.
|
||||
A command starting minisafed is launched if no connection is made.
|
||||
After start up, The GUI will connect to the running lianad.
|
||||
A command starting lianad is launched if no connection is made.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use crate::daemon::model::{Coin, SpendTx};
|
||||
use minisafe::miniscript::bitcoin::Network;
|
||||
use liana::miniscript::bitcoin::Network;
|
||||
|
||||
pub struct Cache {
|
||||
pub network: Network,
|
||||
|
||||
@ -4,8 +4,8 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct Config {
|
||||
/// Path to minisafed configuration file.
|
||||
pub minisafed_config_path: PathBuf,
|
||||
/// Path to lianad configuration file.
|
||||
pub daemon_config_path: PathBuf,
|
||||
/// log level, can be "info", "debug", "trace".
|
||||
pub log_level: Option<String>,
|
||||
/// Use iced debug feature if true.
|
||||
@ -18,12 +18,9 @@ pub struct Config {
|
||||
pub const DEFAULT_FILE_NAME: &str = "gui.toml";
|
||||
|
||||
impl Config {
|
||||
pub fn new(
|
||||
minisafed_config_path: PathBuf,
|
||||
hardware_wallets: Vec<HardwareWalletConfig>,
|
||||
) -> Self {
|
||||
pub fn new(daemon_config_path: PathBuf, hardware_wallets: Vec<HardwareWalletConfig>) -> Self {
|
||||
Self {
|
||||
minisafed_config_path,
|
||||
daemon_config_path,
|
||||
log_level: None,
|
||||
debug: None,
|
||||
hardware_wallets,
|
||||
@ -72,10 +69,10 @@ impl std::fmt::Display for ConfigError {
|
||||
|
||||
impl std::error::Error for ConfigError {}
|
||||
|
||||
// Get the absolute path to the minisafe configuration folder.
|
||||
// Get the absolute path to the liana configuration folder.
|
||||
///
|
||||
/// This a "minisafe" directory in the XDG standard configuration directory for all OSes but
|
||||
/// Linux-based ones, for which it's `~/.minisafe`.
|
||||
/// This a "liana" directory in the XDG standard configuration directory for all OSes but
|
||||
/// Linux-based ones, for which it's `~/.liana`.
|
||||
/// Rationale: we want to have the database, RPC socket, etc.. in the same folder as the
|
||||
/// configuration file but for Linux the XDG specify a data directory (`~/.local/share/`) different
|
||||
/// from the configuration one (`~/.config/`).
|
||||
@ -88,10 +85,10 @@ pub fn default_datadir() -> Result<PathBuf, Box<dyn std::error::Error>> {
|
||||
|
||||
if let Some(mut path) = configs_dir {
|
||||
#[cfg(target_os = "linux")]
|
||||
path.push(".minisafe");
|
||||
path.push(".liana");
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
path.push("Minisafe");
|
||||
path.push("Liana");
|
||||
|
||||
return Ok(path);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use crate::daemon::DaemonError;
|
||||
use minisafe::config::ConfigError;
|
||||
use liana::config::ConfigError;
|
||||
use std::convert::From;
|
||||
use std::io::ErrorKind;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use minisafe::{
|
||||
use liana::{
|
||||
config::Config as DaemonConfig,
|
||||
miniscript::bitcoin::{
|
||||
util::{bip32::Fingerprint, psbt::Psbt},
|
||||
|
||||
@ -16,7 +16,7 @@ use iced::pure::Element;
|
||||
use iced::{clipboard, time, Command, Subscription};
|
||||
use iced_native::{window, Event};
|
||||
|
||||
pub use minisafe::config::Config as DaemonConfig;
|
||||
pub use liana::config::Config as DaemonConfig;
|
||||
|
||||
pub use config::Config;
|
||||
pub use message::Message;
|
||||
@ -157,7 +157,7 @@ impl App {
|
||||
|
||||
let mut daemon_config_file = OpenOptions::new()
|
||||
.write(true)
|
||||
.open(&self.config.minisafed_config_path)
|
||||
.open(&self.config.daemon_config_path)
|
||||
.map_err(|e| Error::Config(e.to_string()))?;
|
||||
|
||||
let content =
|
||||
|
||||
@ -6,7 +6,7 @@ use std::sync::Arc;
|
||||
|
||||
use iced::pure::{column, Element};
|
||||
use iced::{widget::qr_code, Command, Subscription};
|
||||
use minisafe::miniscript::bitcoin::{Address, Amount};
|
||||
use liana::miniscript::bitcoin::{Address, Amount};
|
||||
|
||||
use super::{cache::Cache, error::Error, menu::Menu, message::Message, view};
|
||||
use crate::daemon::{model::Coin, Daemon};
|
||||
@ -165,7 +165,7 @@ mod tests {
|
||||
use crate::{
|
||||
app::cache::Cache,
|
||||
daemon::{
|
||||
client::{Minisafed, Request},
|
||||
client::{Lianad, Request},
|
||||
model::*,
|
||||
},
|
||||
utils::{
|
||||
@ -174,7 +174,7 @@ mod tests {
|
||||
},
|
||||
};
|
||||
|
||||
use minisafe::miniscript::bitcoin::Address;
|
||||
use liana::miniscript::bitcoin::Address;
|
||||
use serde_json::json;
|
||||
use std::str::FromStr;
|
||||
|
||||
@ -191,7 +191,7 @@ mod tests {
|
||||
)]);
|
||||
|
||||
let sandbox: Sandbox<ReceivePanel> = Sandbox::new(ReceivePanel::default());
|
||||
let client = Arc::new(Minisafed::new(daemon.run(), fake_daemon_config()));
|
||||
let client = Arc::new(Lianad::new(daemon.run(), fake_daemon_config()));
|
||||
let sandbox = sandbox.load(client, &Cache::default()).await;
|
||||
|
||||
let panel = sandbox.state();
|
||||
|
||||
@ -7,7 +7,7 @@ use std::sync::Arc;
|
||||
use chrono::prelude::*;
|
||||
use iced::{pure::Element, Command};
|
||||
|
||||
use minisafe::config::Config;
|
||||
use liana::config::Config;
|
||||
|
||||
use crate::{
|
||||
app::{cache::Cache, error::Error, message::Message, state::State, view},
|
||||
@ -211,7 +211,7 @@ impl Setting for BitcoindSettings {
|
||||
|
||||
if self.addr.valid & self.cookie_path.valid {
|
||||
let mut daemon_config = daemon.config().clone();
|
||||
daemon_config.bitcoind_config = Some(minisafe::config::BitcoindConfig {
|
||||
daemon_config.bitcoind_config = Some(liana::config::BitcoindConfig {
|
||||
cookie_path: new_path.unwrap(),
|
||||
addr: new_addr.unwrap(),
|
||||
});
|
||||
|
||||
@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||
|
||||
use iced::pure::Element;
|
||||
use iced::Command;
|
||||
use minisafe::miniscript::bitcoin::util::{bip32::Fingerprint, psbt::Psbt};
|
||||
use liana::miniscript::bitcoin::util::{bip32::Fingerprint, psbt::Psbt};
|
||||
|
||||
use crate::{
|
||||
app::{
|
||||
@ -290,7 +290,7 @@ impl Action for SignAction {
|
||||
let config = self.config.clone();
|
||||
let desc = daemon.config().main_descriptor.to_string();
|
||||
Command::perform(
|
||||
list_hws(config, "Minisafe".to_string(), desc),
|
||||
list_hws(config, "Liana".to_string(), desc),
|
||||
Message::ConnectedHardwareWallets,
|
||||
)
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
|
||||
use iced::pure::Element;
|
||||
use iced::Command;
|
||||
use minisafe::miniscript::bitcoin::{
|
||||
use liana::miniscript::bitcoin::{
|
||||
util::psbt::Psbt, Address, Amount, Denomination, OutPoint, Script,
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ use iced::{
|
||||
pure::{column, Element},
|
||||
Alignment,
|
||||
};
|
||||
use minisafe::miniscript::bitcoin;
|
||||
use liana::miniscript::bitcoin;
|
||||
|
||||
use crate::ui::component::text::*;
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ pub fn sidebar<'a>(menu: &Menu, cache: &'a Cache) -> widget::Container<'a, Messa
|
||||
column()
|
||||
.push(
|
||||
column()
|
||||
.push(container(text("Minisafe").bold()).padding(10))
|
||||
.push(container(text("Liana").bold()).padding(10))
|
||||
.push(separation().width(Length::Units(200)))
|
||||
.spacing(10),
|
||||
)
|
||||
|
||||
@ -4,7 +4,7 @@ use iced::{
|
||||
Alignment,
|
||||
};
|
||||
|
||||
use minisafe::miniscript::bitcoin;
|
||||
use liana::miniscript::bitcoin;
|
||||
|
||||
use crate::ui::{
|
||||
component::{button, card, text::*},
|
||||
|
||||
@ -6,7 +6,7 @@ use iced::{
|
||||
Alignment, Length,
|
||||
};
|
||||
|
||||
use minisafe::miniscript::bitcoin;
|
||||
use liana::miniscript::bitcoin;
|
||||
|
||||
use super::{
|
||||
dashboard,
|
||||
@ -141,7 +141,7 @@ pub fn bitcoind_edit<'a>(
|
||||
|
||||
pub fn bitcoind<'a>(
|
||||
network: bitcoin::Network,
|
||||
config: &minisafe::config::BitcoindConfig,
|
||||
config: &liana::config::BitcoindConfig,
|
||||
blockheight: i32,
|
||||
is_running: Option<bool>,
|
||||
can_edit: bool,
|
||||
|
||||
@ -3,7 +3,7 @@ use iced::{
|
||||
Alignment, Length,
|
||||
};
|
||||
|
||||
use minisafe::miniscript::bitcoin::{
|
||||
use liana::miniscript::bitcoin::{
|
||||
util::{bip32::Fingerprint, psbt::Psbt},
|
||||
Address, Amount, Network,
|
||||
};
|
||||
|
||||
@ -3,7 +3,7 @@ use iced::{
|
||||
Alignment, Length,
|
||||
};
|
||||
|
||||
use minisafe::miniscript::bitcoin::Amount;
|
||||
use liana::miniscript::bitcoin::Amount;
|
||||
|
||||
use crate::{
|
||||
app::{
|
||||
|
||||
@ -87,7 +87,7 @@ impl JsonRPCClient {
|
||||
jsonrpc: "2.0",
|
||||
};
|
||||
|
||||
debug!("Sending to minisafed: {:#?}", request);
|
||||
debug!("Sending to lianad: {:#?}", request);
|
||||
|
||||
to_writer(&mut stream, &request)?;
|
||||
|
||||
@ -107,7 +107,7 @@ impl JsonRPCClient {
|
||||
return Err(Error::NonceMismatch);
|
||||
}
|
||||
|
||||
debug!("Received from minisafed: {:#?}", response);
|
||||
debug!("Received from lianad: {:#?}", response);
|
||||
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ use serde_json::json;
|
||||
pub mod error;
|
||||
pub mod jsonrpc;
|
||||
|
||||
use minisafe::{
|
||||
use liana::{
|
||||
config::Config,
|
||||
miniscript::bitcoin::{consensus, util::psbt::Psbt, Address, OutPoint, Txid},
|
||||
};
|
||||
@ -26,14 +26,14 @@ pub trait Client {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Minisafed<C: Client> {
|
||||
pub struct Lianad<C: Client> {
|
||||
config: Config,
|
||||
client: C,
|
||||
}
|
||||
|
||||
impl<C: Client> Minisafed<C> {
|
||||
pub fn new(client: C, config: Config) -> Minisafed<C> {
|
||||
Minisafed { client, config }
|
||||
impl<C: Client> Lianad<C> {
|
||||
pub fn new(client: C, config: Config) -> Lianad<C> {
|
||||
Lianad { client, config }
|
||||
}
|
||||
|
||||
/// Generic call function for RPC calls.
|
||||
@ -50,7 +50,7 @@ impl<C: Client> Minisafed<C> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Client + Debug> Daemon for Minisafed<C> {
|
||||
impl<C: Client + Debug> Daemon for Lianad<C> {
|
||||
fn is_external(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
||||
use std::sync::RwLock;
|
||||
|
||||
use super::{model::*, Daemon, DaemonError};
|
||||
use minisafe::{
|
||||
use liana::{
|
||||
config::Config,
|
||||
miniscript::bitcoin::{util::psbt::Psbt, Address, OutPoint, Txid},
|
||||
DaemonHandle,
|
||||
|
||||
@ -6,7 +6,7 @@ use std::collections::HashMap;
|
||||
use std::fmt::Debug;
|
||||
use std::io::ErrorKind;
|
||||
|
||||
use minisafe::{
|
||||
use liana::{
|
||||
config::Config,
|
||||
miniscript::bitcoin::{util::psbt::Psbt, Address, OutPoint, Txid},
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pub use minisafe::{
|
||||
pub use liana::{
|
||||
commands::{
|
||||
CreateSpendResult, GetAddressResult, GetInfoResult, ListCoinsEntry, ListCoinsResult,
|
||||
ListSpendEntry, ListSpendResult,
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_hwi::{ledger, specter, DeviceKind, Error as HWIError, HWI};
|
||||
use log::debug;
|
||||
use minisafe::miniscript::bitcoin::{
|
||||
use liana::miniscript::bitcoin::{
|
||||
hashes::hex::{FromHex, ToHex},
|
||||
util::bip32::Fingerprint,
|
||||
};
|
||||
use log::debug;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use minisafe::config::Config as MinisafeConfig;
|
||||
use liana::config::Config as LianaConfig;
|
||||
|
||||
use super::step::Context;
|
||||
|
||||
pub const DEFAULT_FILE_NAME: &str = "daemon.toml";
|
||||
|
||||
impl TryFrom<Context> for MinisafeConfig {
|
||||
impl TryFrom<Context> for LianaConfig {
|
||||
type Error = &'static str;
|
||||
|
||||
fn try_from(ctx: Context) -> Result<Self, Self::Error> {
|
||||
if ctx.descriptor.is_none() {
|
||||
return Err("config does not have a main Descriptor");
|
||||
}
|
||||
Ok(MinisafeConfig {
|
||||
Ok(LianaConfig {
|
||||
#[cfg(unix)]
|
||||
daemon: false,
|
||||
log_level: log::LevelFilter::Info,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use minisafe::miniscript::bitcoin::{util::bip32::Fingerprint, Network};
|
||||
use liana::miniscript::bitcoin::{util::bip32::Fingerprint, Network};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use super::Error;
|
||||
|
||||
@ -6,7 +6,7 @@ mod view;
|
||||
use iced::pure::Element;
|
||||
use iced::{clipboard, Command, Subscription};
|
||||
use iced_native::{window, Event};
|
||||
use minisafe::miniscript::bitcoin;
|
||||
use liana::miniscript::bitcoin;
|
||||
|
||||
use std::convert::TryInto;
|
||||
use std::io::Write;
|
||||
@ -153,11 +153,11 @@ pub async fn install(ctx: Context) -> Result<PathBuf, Error> {
|
||||
.map(|(kind, fingerprint, token)| HardwareWalletConfig::new(kind, fingerprint, token))
|
||||
.collect();
|
||||
|
||||
let mut cfg: minisafe::config::Config = ctx
|
||||
let mut cfg: liana::config::Config = ctx
|
||||
.try_into()
|
||||
.expect("Everything should be checked at this point");
|
||||
// Start Daemon to check correctness of installation
|
||||
let daemon = minisafe::DaemonHandle::start_default(cfg.clone()).map_err(|e| {
|
||||
let daemon = liana::DaemonHandle::start_default(cfg.clone()).map_err(|e| {
|
||||
Error::Unexpected(format!("Failed to start daemon with entered config: {}", e))
|
||||
})?;
|
||||
daemon.shutdown();
|
||||
@ -170,21 +170,21 @@ pub async fn install(ctx: Context) -> Result<PathBuf, Error> {
|
||||
let mut datadir_path = cfg.data_dir.clone().unwrap();
|
||||
datadir_path.push(cfg.bitcoin_config.network.to_string());
|
||||
|
||||
// create minisafed configuration file
|
||||
let mut minisafed_config_path = datadir_path.clone();
|
||||
minisafed_config_path.push(DEFAULT_FILE_NAME);
|
||||
let mut minisafed_config_file = std::fs::File::create(&minisafed_config_path)
|
||||
// create lianad configuration file
|
||||
let mut daemon_config_path = datadir_path.clone();
|
||||
daemon_config_path.push(DEFAULT_FILE_NAME);
|
||||
let mut daemon_config_file = std::fs::File::create(&daemon_config_path)
|
||||
.map_err(|e| Error::CannotCreateFile(e.to_string()))?;
|
||||
|
||||
// Step needed because of ValueAfterTable error in the toml serialize implementation.
|
||||
let minisafed_config =
|
||||
let daemon_config =
|
||||
toml::Value::try_from(&cfg).expect("daemon::Config has a proper Serialize implementation");
|
||||
|
||||
minisafed_config_file
|
||||
.write_all(minisafed_config.to_string().as_bytes())
|
||||
daemon_config_file
|
||||
.write_all(daemon_config.to_string().as_bytes())
|
||||
.map_err(|e| Error::CannotWriteToFile(e.to_string()))?;
|
||||
|
||||
// create minisafe GUI configuration file
|
||||
// create liana GUI configuration file
|
||||
let mut gui_config_path = datadir_path;
|
||||
gui_config_path.push(gui_config::DEFAULT_FILE_NAME);
|
||||
let mut gui_config_file = std::fs::File::create(&gui_config_path)
|
||||
@ -193,11 +193,8 @@ pub async fn install(ctx: Context) -> Result<PathBuf, Error> {
|
||||
gui_config_file
|
||||
.write_all(
|
||||
toml::to_string(&gui_config::Config::new(
|
||||
minisafed_config_path.canonicalize().map_err(|e| {
|
||||
Error::Unexpected(format!(
|
||||
"Failed to canonicalize minisafed config path: {}",
|
||||
e
|
||||
))
|
||||
daemon_config_path.canonicalize().map_err(|e| {
|
||||
Error::Unexpected(format!("Failed to canonicalize daemon config path: {}", e))
|
||||
})?,
|
||||
hardware_wallets,
|
||||
))
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use iced::{pure::Element, Command};
|
||||
use minisafe::{
|
||||
use liana::{
|
||||
descriptors::MultipathDescriptor,
|
||||
miniscript::{
|
||||
bitcoin::{
|
||||
@ -439,7 +439,7 @@ async fn register_wallet(
|
||||
descriptor: String,
|
||||
) -> Result<(Fingerprint, Option<[u8; 32]>), Error> {
|
||||
let hmac = hw
|
||||
.register_wallet("Minisafe", &descriptor)
|
||||
.register_wallet("Liana", &descriptor)
|
||||
.await
|
||||
.map_err(Error::from)?;
|
||||
Ok((fingerprint, hmac))
|
||||
|
||||
@ -7,7 +7,7 @@ use std::time::Duration;
|
||||
|
||||
use async_hwi::DeviceKind;
|
||||
use iced::{pure::Element, Command};
|
||||
use minisafe::{
|
||||
use liana::{
|
||||
config::{BitcoinConfig, BitcoindConfig},
|
||||
descriptors::MultipathDescriptor,
|
||||
miniscript::bitcoin,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use iced::pure::{column, container, pick_list, row, scrollable, widget, Element};
|
||||
use iced::{Alignment, Length};
|
||||
|
||||
use minisafe::miniscript::bitcoin;
|
||||
use liana::miniscript::bitcoin;
|
||||
|
||||
use crate::{
|
||||
hw::HardwareWallet,
|
||||
|
||||
@ -8,7 +8,7 @@ use iced::{Alignment, Command, Subscription};
|
||||
use iced_native::{window, Event};
|
||||
use log::{debug, info};
|
||||
|
||||
use minisafe::{
|
||||
use liana::{
|
||||
config::{Config, ConfigError},
|
||||
miniscript::bitcoin,
|
||||
};
|
||||
@ -18,7 +18,7 @@ use crate::{
|
||||
daemon::{client, embedded::EmbeddedDaemon, model::*, Daemon, DaemonError},
|
||||
};
|
||||
|
||||
type Minisafed = client::Minisafed<client::jsonrpc::JsonRPCClient>;
|
||||
type Lianad = client::Lianad<client::jsonrpc::JsonRPCClient>;
|
||||
|
||||
pub struct Loader {
|
||||
pub gui_config: GUIConfig,
|
||||
@ -89,7 +89,7 @@ impl Loader {
|
||||
self.step = Step::StartingDaemon;
|
||||
self.daemon_started = true;
|
||||
return Command::perform(
|
||||
start_daemon(self.gui_config.minisafed_config_path.clone()),
|
||||
start_daemon(self.gui_config.daemon_config_path.clone()),
|
||||
Message::Started,
|
||||
);
|
||||
}
|
||||
@ -103,12 +103,12 @@ impl Loader {
|
||||
|
||||
fn on_start(&mut self, res: Result<Arc<dyn Daemon + Sync + Send>, Error>) -> Command<Message> {
|
||||
match res {
|
||||
Ok(minisafed) => {
|
||||
Ok(daemon) => {
|
||||
self.step = Step::Syncing {
|
||||
daemon: minisafed.clone(),
|
||||
daemon: daemon.clone(),
|
||||
progress: 0.0,
|
||||
};
|
||||
Command::perform(sync(minisafed, false), Message::Syncing)
|
||||
Command::perform(sync(daemon, false), Message::Syncing)
|
||||
}
|
||||
Err(e) => {
|
||||
self.step = Step::Error(Box::new(e));
|
||||
@ -223,18 +223,18 @@ async fn connect(
|
||||
config: Config,
|
||||
) -> Result<Arc<dyn Daemon + Sync + Send>, Error> {
|
||||
let client = client::jsonrpc::JsonRPCClient::new(socket_path);
|
||||
let minisafed = Minisafed::new(client, config);
|
||||
let daemon = Lianad::new(client, config);
|
||||
|
||||
debug!("Searching for external daemon");
|
||||
minisafed.get_info()?;
|
||||
daemon.get_info()?;
|
||||
info!("Connected to external daemon");
|
||||
|
||||
Ok(Arc::new(minisafed))
|
||||
Ok(Arc::new(daemon))
|
||||
}
|
||||
|
||||
// Daemon can start only if a config path is given.
|
||||
pub async fn start_daemon(config_path: PathBuf) -> Result<Arc<dyn Daemon + Sync + Send>, Error> {
|
||||
debug!("starting minisafe daemon");
|
||||
debug!("starting liana daemon");
|
||||
|
||||
let config = Config::from_file(Some(config_path))
|
||||
.map_err(|e| DaemonError::Start(format!("Error parsing config: {}", e)))?;
|
||||
@ -246,13 +246,13 @@ pub async fn start_daemon(config_path: PathBuf) -> Result<Arc<dyn Daemon + Sync
|
||||
}
|
||||
|
||||
async fn sync(
|
||||
minisafed: Arc<dyn Daemon + Sync + Send>,
|
||||
daemon: Arc<dyn Daemon + Sync + Send>,
|
||||
sleep: bool,
|
||||
) -> Result<GetInfoResult, DaemonError> {
|
||||
if sleep {
|
||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||
}
|
||||
minisafed.get_info()
|
||||
daemon.get_info()
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
@ -266,7 +266,7 @@ impl std::fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Config(e) => write!(f, "Config error: {}", e),
|
||||
Self::Daemon(e) => write!(f, "Minisafed error: {}", e),
|
||||
Self::Daemon(e) => write!(f, "Liana daemon error: {}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -283,7 +283,7 @@ impl From<DaemonError> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
/// default minisafed socket path is .minisafe/bitcoin/minisafed_rpc
|
||||
/// default lianad socket path is .liana/bitcoin/lianad_rpc
|
||||
fn socket_path(
|
||||
datadir: &Option<PathBuf>,
|
||||
network: bitcoin::Network,
|
||||
@ -294,6 +294,6 @@ fn socket_path(
|
||||
default_datadir().map_err(|_| ConfigError::DatadirNotFound)?
|
||||
};
|
||||
path.push(network.to_string());
|
||||
path.push("minisafed_rpc");
|
||||
path.push("lianad_rpc");
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
@ -5,9 +5,9 @@ use iced::{executor, Command, Settings, Subscription};
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
|
||||
use minisafe::{config::Config as DaemonConfig, miniscript::bitcoin};
|
||||
use liana::{config::Config as DaemonConfig, miniscript::bitcoin};
|
||||
|
||||
use minisafe_gui::{
|
||||
use liana_gui::{
|
||||
app::{
|
||||
self,
|
||||
cache::Cache,
|
||||
@ -97,9 +97,9 @@ impl Application for GUI {
|
||||
|
||||
fn title(&self) -> String {
|
||||
match self.state {
|
||||
State::Installer(_) => String::from("Minisafe Installer"),
|
||||
State::App(_) => String::from("Minisafe"),
|
||||
State::Loader(..) => String::from("Minisafe"),
|
||||
State::Installer(_) => String::from("Liana Installer"),
|
||||
State::App(_) => String::from("Liana"),
|
||||
State::Loader(..) => String::from("Liana"),
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ impl Application for GUI {
|
||||
}
|
||||
Config::Run(cfg) => {
|
||||
let daemon_cfg =
|
||||
DaemonConfig::from_file(Some(cfg.minisafed_config_path.clone())).unwrap();
|
||||
DaemonConfig::from_file(Some(cfg.daemon_config_path.clone())).unwrap();
|
||||
let (loader, command) = Loader::new(cfg, daemon_cfg);
|
||||
(
|
||||
Self {
|
||||
@ -152,7 +152,7 @@ impl Application for GUI {
|
||||
if let installer::Message::Exit(path) = *msg {
|
||||
let cfg = app::Config::from_file(&path).unwrap();
|
||||
let daemon_cfg =
|
||||
DaemonConfig::from_file(Some(cfg.minisafed_config_path.clone())).unwrap();
|
||||
DaemonConfig::from_file(Some(cfg.daemon_config_path.clone())).unwrap();
|
||||
let (loader, command) = Loader::new(cfg, daemon_cfg);
|
||||
self.state = State::Loader(Box::new(loader));
|
||||
command.map(|msg| Message::Load(Box::new(msg)))
|
||||
@ -161,16 +161,16 @@ impl Application for GUI {
|
||||
}
|
||||
}
|
||||
(State::Loader(loader), Message::Load(msg)) => {
|
||||
if let loader::Message::Synced(info, coins, spend_txs, minisafed) = *msg {
|
||||
if let loader::Message::Synced(info, coins, spend_txs, daemon) = *msg {
|
||||
let cache = Cache {
|
||||
network: minisafed.config().bitcoin_config.network,
|
||||
network: daemon.config().bitcoin_config.network,
|
||||
blockheight: info.blockheight,
|
||||
coins,
|
||||
spend_txs,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let (app, command) = App::new(cache, loader.gui_config.clone(), minisafed);
|
||||
let (app, command) = App::new(cache, loader.gui_config.clone(), daemon);
|
||||
self.state = State::App(app);
|
||||
command.map(|msg| Message::Run(Box::new(msg)))
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use crate::daemon::{client::Client, DaemonError};
|
||||
use minisafe::config::Config;
|
||||
use liana::config::Config;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use std::fmt::Debug;
|
||||
@ -80,7 +80,7 @@ impl Daemon {
|
||||
pub fn fake_daemon_config() -> Config {
|
||||
toml::from_str(
|
||||
r#"
|
||||
data_dir = "/home/edouard/code/revault/demo/minisafe/datadir"
|
||||
data_dir = "/home/edouard/code/revault/demo/liana/datadir"
|
||||
main_descriptor = "wsh(or_d(pk(tpubDCbK3Ysvk8HjcF6mPyrgMu3KgLiaaP19RjKpNezd8GrbAbNg6v5BtWLaCt8FNm6QkLseopKLf5MNYQFtochDTKHdfgG6iqJ8cqnLNAwtXuP/<0;1>/*),and_v(v:pkh(tpubDDtb2WPYwEWw2WWDV7reLV348iJHw2HmhzvPysKKrJw3hYmvrd4jasyoioVPdKGQqjyaBMEvTn1HvHWDSVqQ6amyyxRZ5YjpPBBGjJ8yu8S/<0;1>/*),older(100))))#9sx3g3pv"
|
||||
|
||||
[bitcoin_config]
|
||||
@ -89,7 +89,7 @@ poll_interval_secs = 30
|
||||
|
||||
[bitcoind_config]
|
||||
addr = "127.0.0.1:9001"
|
||||
cookie_path = "/home/edouard/code/revault/demo/minisafe/regtest/bcdir1/regtest/.cookie"
|
||||
cookie_path = "/home/edouard/code/revault/demo/liana/regtest/bcdir1/regtest/.cookie"
|
||||
"#
|
||||
).unwrap()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user