Skip to content

Commit

Permalink
Split into lianad and liana crate
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardparis committed Nov 19, 2024
1 parent 36b24d4 commit 74820d9
Show file tree
Hide file tree
Showing 60 changed files with 1,068 additions and 1,027 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ task:
fingerprint_script:
- rustc --version
- cat tests/tools/taproot_signer/Cargo.lock
lianad_build_script: cd liana && cargo build --release && cd ../tests/tools/taproot_signer && cargo build --release
lianad_build_script: cd lianad && cargo build --release && cd ../tests/tools/taproot_signer && cargo build --release

deps_script: apt update && apt install -y python3 python3-pip

Expand Down
27 changes: 19 additions & 8 deletions 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ resolver = "2"
members = [
"fuzz",
"liana",
"lianad",
"liana-gui",
"liana-ui",
]
default-members = ["liana", "liana-gui", "liana-ui"]
default-members = ["liana", "lianad", "liana-gui", "liana-ui"]

[patch.crates-io]
iced_style = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}
Expand Down
3 changes: 2 additions & 1 deletion liana-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ path = "src/main.rs"
[dependencies]
async-trait = "0.1"
async-hwi = { version = "0.0.24" }
liana = { path = "../liana", default-features = false, features = ["nonblocking_shutdown"] }
liana = { path = "../liana" }
lianad = { path = "../lianad", default-features = false, features = ["nonblocking_shutdown"] }
liana-ui = { path = "../liana-ui" }
backtrace = "0.3"
hex = "0.4.3"
Expand Down
3 changes: 2 additions & 1 deletion liana-gui/src/app/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::convert::From;
use std::io::ErrorKind;

use liana::{config::ConfigError, descriptors::LianaDescError, spend::SpendCreationError};
use liana::{descriptors::LianaDescError, spend::SpendCreationError};
use lianad::config::ConfigError;

use crate::{
app::{settings::SettingsError, wallet::WalletError},
Expand Down
12 changes: 5 additions & 7 deletions liana-gui/src/app/message.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
use std::collections::{HashMap, HashSet};
use std::sync::Arc;

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

use crate::{
app::{cache::Cache, error::Error, view, wallet::Wallet},
Expand Down
3 changes: 2 additions & 1 deletion liana-gui/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ use iced::{clipboard, time, Command, Subscription};
use tokio::runtime::Handle;
use tracing::{error, info, warn};

pub use liana::{commands::CoinStatus, config::Config as DaemonConfig, miniscript::bitcoin};
pub use liana::miniscript::bitcoin;
use liana_ui::{
component::network_banner,
widget::{Column, Element},
};
pub use lianad::{commands::CoinStatus, config::Config as DaemonConfig};

pub use config::Config;
pub use message::Message;
Expand Down
2 changes: 1 addition & 1 deletion liana-gui/src/app/state/coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::{cmp::Ordering, collections::HashSet};

use iced::Command;

use liana::commands::CoinStatus;
use liana_ui::widget::Element;
use lianad::commands::CoinStatus;

use crate::{
app::{
Expand Down
6 changes: 2 additions & 4 deletions liana-gui/src/app/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};

use iced::{Command, Subscription};
use liana::{
commands::CoinStatus,
miniscript::bitcoin::{Amount, OutPoint},
};
use liana::miniscript::bitcoin::{Amount, OutPoint};
use liana_ui::widget::*;
use lianad::commands::CoinStatus;

use super::{
cache::Cache,
Expand Down
2 changes: 1 addition & 1 deletion liana-gui/src/app/state/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use iced::Subscription;

use iced::Command;
use liana::{
commands::CoinStatus,
descriptors::LianaPolicy,
miniscript::bitcoin::{bip32::Fingerprint, psbt::Psbt, Network, Txid},
};
use lianad::commands::CoinStatus;

use liana_ui::component::toast;
use liana_ui::{
Expand Down
10 changes: 4 additions & 6 deletions liana-gui/src/app/state/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ use std::sync::Arc;

use iced::Command;

use liana::{
commands::CoinStatus,
miniscript::bitcoin::{
bip32::{DerivationPath, Fingerprint},
secp256k1,
},
use liana::miniscript::bitcoin::{
bip32::{DerivationPath, Fingerprint},
secp256k1,
};
use liana_ui::{component::form, widget::Element};
use lianad::commands::CoinStatus;

use crate::{
app::{
Expand Down
12 changes: 5 additions & 7 deletions liana-gui/src/app/state/settings/bitcoind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ use chrono::{NaiveDate, Utc};
use iced::Command;
use tracing::info;

use liana::{
config::{
BitcoinBackend, BitcoinConfig, BitcoindConfig, BitcoindRpcAuth, Config, ElectrumConfig,
},
miniscript::bitcoin::Network,
use liana::miniscript::bitcoin::Network;
use lianad::config::{
BitcoinBackend, BitcoinConfig, BitcoindConfig, BitcoindRpcAuth, Config, ElectrumConfig,
};

use liana_ui::{component::form, widget::Element};
Expand Down Expand Up @@ -353,7 +351,7 @@ impl BitcoindSettings {
if let (true, Some(rpc_auth)) = (self.addr.valid, rpc_auth) {
let mut daemon_config = daemon.config().cloned().unwrap();
daemon_config.bitcoin_backend =
Some(liana::config::BitcoinBackend::Bitcoind(BitcoindConfig {
Some(lianad::config::BitcoinBackend::Bitcoind(BitcoindConfig {
rpc_auth,
addr: new_addr.unwrap(),
}));
Expand Down Expand Up @@ -461,7 +459,7 @@ impl ElectrumSettings {
if self.addr.valid {
let mut daemon_config = daemon.config().cloned().unwrap();
daemon_config.bitcoin_backend =
Some(liana::config::BitcoinBackend::Electrum(ElectrumConfig {
Some(lianad::config::BitcoinBackend::Electrum(ElectrumConfig {
addr: self.addr.value.clone(),
}));
self.processing = true;
Expand Down
6 changes: 2 additions & 4 deletions liana-gui/src/app/state/spend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ use std::sync::Arc;

use iced::Command;

use liana::{
commands::CoinStatus,
miniscript::bitcoin::{Network, OutPoint},
};
use liana::miniscript::bitcoin::{Network, OutPoint};
use liana_ui::widget::Element;
use lianad::commands::CoinStatus;

use super::{redirect, State};
use crate::{
Expand Down
2 changes: 1 addition & 1 deletion liana-gui/src/app/state/spend/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ use std::{

use iced::{Command, Subscription};
use liana::{
commands::ListCoinsEntry,
descriptors::LianaDescriptor,
miniscript::bitcoin::{
address, psbt::Psbt, secp256k1, Address, Amount, Denomination, Network, OutPoint,
},
spend::{SpendCreationError, MAX_FEERATE},
};
use lianad::commands::ListCoinsEntry;

use liana_ui::{component::form, widget::Element};

Expand Down
2 changes: 1 addition & 1 deletion liana-gui/src/app/state/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ use std::{

use iced::Command;
use liana::{
commands::CoinStatus,
miniscript::bitcoin::{OutPoint, Txid},
spend::{SpendCreationError, MAX_FEERATE},
};
use liana_ui::{
component::{form, modal::Modal},
widget::*,
};
use lianad::commands::CoinStatus;

pub const HISTORY_EVENT_PAGE_SIZE: u64 = 20;

Expand Down
6 changes: 3 additions & 3 deletions liana-gui/src/app/view/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ use iced::{
};

use liana::{
config::BitcoindRpcAuth,
descriptors::{LianaDescriptor, LianaPolicy},
miniscript::bitcoin::{bip32::Fingerprint, Network},
};
use lianad::config::BitcoindRpcAuth;

use super::{dashboard, message::*};

Expand Down Expand Up @@ -452,7 +452,7 @@ pub fn bitcoind_edit<'a>(
pub fn bitcoind<'a>(
is_configured_node_type: bool,
network: Network,
config: &liana::config::BitcoindConfig,
config: &lianad::config::BitcoindConfig,
blockheight: i32,
is_running: Option<bool>,
can_edit: bool,
Expand Down Expand Up @@ -638,7 +638,7 @@ pub fn electrum_edit<'a>(
pub fn electrum<'a>(
is_configured_node_type: bool,
network: Network,
config: &liana::config::ElectrumConfig,
config: &lianad::config::ElectrumConfig,
blockheight: i32,
is_running: Option<bool>,
can_edit: bool,
Expand Down
7 changes: 3 additions & 4 deletions liana-gui/src/daemon/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::iter::FromIterator;
use std::path::Path;

use async_trait::async_trait;
use liana::commands::{CoinStatus, CreateRecoveryResult};
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use serde_json::json;
Expand All @@ -13,10 +12,10 @@ use tracing::{error, info};
pub mod error;
pub mod jsonrpc;

use liana::{
commands::LabelItem,
use liana::miniscript::bitcoin::{address, psbt::Psbt, Address, Network, OutPoint, Txid};
use lianad::{
commands::{CoinStatus, CreateRecoveryResult, LabelItem},
config::Config,
miniscript::bitcoin::{address, psbt::Psbt, Address, Network, OutPoint, Txid},
};

use super::{model::*, Daemon, DaemonBackend, DaemonError};
Expand Down
4 changes: 2 additions & 2 deletions liana-gui/src/daemon/embedded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use tokio::sync::Mutex;

use super::{model::*, node, Daemon, DaemonBackend, DaemonError};
use async_trait::async_trait;
use liana::{
use liana::miniscript::bitcoin::{address, psbt::Psbt, Address, Network, OutPoint, Txid};
use lianad::{
commands::{CoinStatus, LabelItem},
config::Config,
miniscript::bitcoin::{address, psbt::Psbt, Address, Network, OutPoint, Txid},
DaemonControl, DaemonHandle,
};

Expand Down
8 changes: 4 additions & 4 deletions liana-gui/src/daemon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ use std::path::Path;

use async_trait::async_trait;

use liana::{
use liana::miniscript::bitcoin::{
address, bip32::Fingerprint, psbt::Psbt, secp256k1, Address, Network, OutPoint, Txid,
};
use lianad::{
commands::{CoinStatus, LabelItem, TransactionInfo},
config::Config,
miniscript::bitcoin::{
address, bip32::Fingerprint, psbt::Psbt, secp256k1, Address, Network, OutPoint, Txid,
},
StartupError,
};

Expand Down
9 changes: 4 additions & 5 deletions liana-gui/src/daemon/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ use std::collections::{HashMap, HashSet};

use liana::descriptors::LianaDescriptor;
pub use liana::{
commands::{
CreateSpendResult, GetAddressResult, GetInfoResult, GetLabelsResult, LabelItem,
ListCoinsEntry, ListCoinsResult, ListSpendEntry, ListSpendResult, ListTransactionsResult,
TransactionInfo,
},
descriptors::{LianaPolicy, PartialSpendInfo, PathSpendInfo},
miniscript::bitcoin::{
bip32::{DerivationPath, Fingerprint},
psbt::Psbt,
secp256k1, Address, Amount, Network, OutPoint, Transaction, Txid,
},
};
pub use lianad::commands::{
CreateSpendResult, GetAddressResult, GetInfoResult, GetLabelsResult, LabelItem, ListCoinsEntry,
ListCoinsResult, ListSpendEntry, ListSpendResult, ListTransactionsResult, TransactionInfo,
};

pub type Coin = ListCoinsEntry;

Expand Down
7 changes: 2 additions & 5 deletions liana-gui/src/installer/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ use crate::{
signer::Signer,
};
use async_hwi::DeviceKind;
use liana::{
config::{BitcoinBackend, BitcoinConfig},
descriptors::LianaDescriptor,
miniscript::bitcoin,
};
use liana::{descriptors::LianaDescriptor, miniscript::bitcoin};
use lianad::config::{BitcoinBackend, BitcoinConfig};

#[derive(Debug, Clone)]
pub enum RemoteBackend {
Expand Down
Loading

0 comments on commit 74820d9

Please sign in to comment.