dprint fmt

This commit is contained in:
Binarybaron 2025-07-18 15:24:03 +02:00
parent 7102962898
commit c1c45571f0
20 changed files with 151 additions and 74 deletions

View file

@ -72,9 +72,9 @@ swap-env = { path = "../swap-env" }
swap-feed = { path = "../swap-feed" }
swap-fs = { path = "../swap-fs" }
swap-serde = { path = "../swap-serde" }
throttle = { path = "../throttle" }
tauri = { version = "2.0", features = ["config-json5"], optional = true, default-features = false }
thiserror = { workspace = true }
throttle = { path = "../throttle" }
time = "0.3"
tokio = { workspace = true, features = ["process", "fs", "net", "parking_lot", "rt"] }
tokio-tungstenite = { version = "0.15", features = ["rustls-tls"] }

View file

@ -7,13 +7,13 @@ pub use event_loop::{EventLoop, EventLoopHandle};
pub use network::behaviour::{Behaviour, OutEvent};
pub use network::rendezvous::RendezvousNode;
pub use network::transport;
pub use swap_feed::{FixedRate, KrakenRate, LatestRate, Rate};
pub use recovery::cancel::cancel;
pub use recovery::punish::punish;
pub use recovery::redeem::{redeem, Finality};
pub use recovery::refund::refund;
pub use recovery::safely_abort::safely_abort;
pub use recovery::{cancel, refund};
pub use swap_feed::{FixedRate, KrakenRate, LatestRate, Rate};
#[cfg(test)]
pub use network::rendezvous;

View file

@ -8,8 +8,6 @@ use crate::protocol::alice::swap::has_already_processed_enc_sig;
use crate::protocol::alice::{AliceState, ReservesMonero, State3, Swap};
use crate::protocol::{Database, State};
use crate::{bitcoin, monero};
use swap_feed::{LatestRate};
use swap_env::env;
use anyhow::{anyhow, Context, Result};
use futures::future;
use futures::future::{BoxFuture, FutureExt};
@ -20,10 +18,12 @@ use libp2p::{PeerId, Swarm};
use moka::future::Cache;
use monero::Amount;
use std::collections::HashMap;
use std::convert::{TryInto};
use std::convert::TryInto;
use std::fmt::Debug;
use std::sync::Arc;
use std::time::Duration;
use swap_env::env;
use swap_feed::LatestRate;
use tokio::sync::{mpsc, oneshot};
use tokio::time::timeout;
use uuid::Uuid;
@ -615,7 +615,6 @@ where
}
}
#[derive(Debug)]
pub struct EventLoopHandle {
swap_id: Uuid,

View file

@ -1,5 +1,3 @@
use swap_feed::LatestRate;
use swap_env::env;
use crate::network::quote::BidQuote;
use crate::network::rendezvous::XmrBtcNamespace;
use crate::network::swap_setup::alice;
@ -19,6 +17,8 @@ use libp2p::swarm::NetworkBehaviour;
use libp2p::{Multiaddr, PeerId};
use std::task::Poll;
use std::time::Duration;
use swap_env::env;
use swap_feed::LatestRate;
use uuid::Uuid;
pub mod transport {

View file

@ -36,10 +36,10 @@ use swap::protocol::alice::{run, AliceState};
use swap::protocol::{Database, State};
use swap::seed::Seed;
use swap::{bitcoin, monero};
use swap_feed;
use swap_env::config::{
initial_setup, query_user_for_initial_config, read_config, Config, ConfigNotInitialized,
};
use swap_feed;
use tracing_subscriber::filter::LevelFilter;
use uuid::Uuid;
@ -195,7 +195,8 @@ pub async fn main() -> Result<()> {
tracing::info!(%bitcoin_balance, "Bitcoin wallet balance");
// Connect to Kraken
let kraken_price_updates = swap_feed::connect_kraken(config.maker.price_ticker_ws_url.clone())?;
let kraken_price_updates =
swap_feed::connect_kraken(config.maker.price_ticker_ws_url.clone())?;
let kraken_rate = KrakenRate::new(config.maker.ask_spread, kraken_price_updates);
let namespace = XmrBtcNamespace::from_is_testnet(testnet);

View file

@ -507,7 +507,7 @@ impl ContextBuilder {
data_dir: data_dir.clone(),
log_dir: log_dir.clone(),
},
swap_lock,
swap_lock,
tasks,
tauri_handle: self.tauri_handle,
tor_client: tor,
@ -554,7 +554,7 @@ impl Context {
pub fn cleanup(&self) -> Result<()> {
// TODO: close all monero wallets
// call store(..) on all wallets
// TODO: This doesn't work because "there is no reactor running, must be called from the context of a Tokio 1.x runtime"
// let monero_manager = self.monero_manager.clone();
// tokio::spawn(async move {
@ -802,7 +802,12 @@ async fn request_and_open_monero_wallet(
}
SeedChoice::Legacy => {
let wallet = request_and_open_monero_wallet_legacy(legacy_data_dir, env_config, daemon).await?;
let wallet = request_and_open_monero_wallet_legacy(
legacy_data_dir,
env_config,
daemon,
)
.await?;
let seed = Seed::from_file_or_generate(legacy_data_dir)
.await
.context("Failed to extract seed from wallet")?;
@ -812,7 +817,10 @@ async fn request_and_open_monero_wallet(
};
// Extract seed from the wallet
tracing::info!("Extracting seed from wallet directory: {}", legacy_data_dir.display());
tracing::info!(
"Extracting seed from wallet directory: {}",
legacy_data_dir.display()
);
let seed = Seed::from_monero_wallet(&wallet)
.await
.context("Failed to extract seed from wallet")?;
@ -824,7 +832,8 @@ async fn request_and_open_monero_wallet(
// If we don't have a tauri handle, we use the seed.pem file
// This is used for the CLI to monitor the blockchain
None => {
let wallet = request_and_open_monero_wallet_legacy(legacy_data_dir, env_config, daemon).await?;
let wallet =
request_and_open_monero_wallet_legacy(legacy_data_dir, env_config, daemon).await?;
let seed = Seed::from_file_or_generate(legacy_data_dir)
.await
.context("Failed to extract seed from wallet")?;

View file

@ -7,11 +7,11 @@
use std::{path::PathBuf, sync::Arc, time::Duration};
use throttle::{throttle, Throttle};
use anyhow::{Context, Result};
use monero::{Address, Network};
use monero_sys::WalletEventListener;
pub use monero_sys::{Daemon, WalletHandle as Wallet, WalletHandleListener};
use throttle::{throttle, Throttle};
use uuid::Uuid;
use crate::cli::api::{