diff --git a/Cargo.toml b/Cargo.toml
index 5fc13258..4ed59411 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,16 +1,24 @@
[workspace]
resolver = "2"
-members = [ "electrum-pool", "monero-rpc", "monero-rpc-pool", "monero-sys", "monero-seed", "src-tauri", "swap", "swap-env", "swap-fs", "swap-feed", "swap-serde", "throttle"]
+members = [
+ "electrum-pool",
+ "monero-rpc",
+ "monero-rpc-pool",
+ "monero-seed",
+ "monero-sys",
+ "src-tauri",
+ "swap",
+ "swap-env",
+ "swap-feed",
+ "swap-fs",
+ "swap-serde",
+ "throttle",
+]
[workspace.dependencies]
anyhow = "1"
-serde = { version = "1.0", features = ["derive"] }
-serde_json = "1"
-tokio = { version = "1", features = ["rt-multi-thread", "time", "macros", "sync"] }
-futures = { version = "0.3", default-features = false, features = ["std"] }
-tracing = { version = "0.1", features = ["attributes"] }
-tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "ansi", "env-filter", "time", "tracing-log", "json"] }
bitcoin = { version = "0.32", features = ["rand", "serde"] }
+futures = { version = "0.3", default-features = false, features = ["std"] }
hex = "0.4"
libp2p = { version = "0.53.2" }
monero = { version = "0.12", features = ["serde_support"] }
@@ -18,7 +26,12 @@ rand = "0.8"
reqwest = { version = "0.12", default-features = false, features = ["json"] }
rust_decimal = { version = "1", features = ["serde-float"] }
rust_decimal_macros = "1"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1"
thiserror = "1"
+tokio = { version = "1", features = ["rt-multi-thread", "time", "macros", "sync"] }
+tracing = { version = "0.1", features = ["attributes"] }
+tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "ansi", "env-filter", "time", "tracing-log", "json"] }
typeshare = "1.0"
url = { version = "2", features = ["serde"] }
uuid = { version = "1", features = ["v4"] }
diff --git a/flatpak/index.html b/flatpak/index.html
index 78984f81..41ab1eec 100644
--- a/flatpak/index.html
+++ b/flatpak/index.html
@@ -66,9 +66,7 @@
This repository provides Flatpak packages for
- eigenwallet GUI.
+ eigenwallet GUI.
diff --git a/monero-sys/src/lib.rs b/monero-sys/src/lib.rs
index 5f00fe0c..c950a802 100644
--- a/monero-sys/src/lib.rs
+++ b/monero-sys/src/lib.rs
@@ -1639,7 +1639,9 @@ impl FfiWallet {
/// Store the wallet state.
fn store(&mut self, path: &str) {
let_cxx_string!(path = path);
- self.inner.pinned().store(&path)
+ self.inner
+ .pinned()
+ .store(&path)
.context("Failed to store wallet: FFI call failed with exception")
.expect("Shouldn't panic");
}
diff --git a/src-gui/src/renderer/components/navigation/UnfinishedSwapsCountBadge.tsx b/src-gui/src/renderer/components/navigation/UnfinishedSwapsCountBadge.tsx
index ccd3c862..4fd559c3 100644
--- a/src-gui/src/renderer/components/navigation/UnfinishedSwapsCountBadge.tsx
+++ b/src-gui/src/renderer/components/navigation/UnfinishedSwapsCountBadge.tsx
@@ -1,6 +1,9 @@
import React from "react";
import { Badge } from "@mui/material";
-import { useIsSwapRunning, useResumeableSwapsCountExcludingPunished } from "store/hooks";
+import {
+ useIsSwapRunning,
+ useResumeableSwapsCountExcludingPunished,
+} from "store/hooks";
export default function UnfinishedSwapsBadge({
children,
@@ -10,7 +13,9 @@ export default function UnfinishedSwapsBadge({
const isSwapRunning = useIsSwapRunning();
const resumableSwapsCount = useResumeableSwapsCountExcludingPunished();
- const displayedResumableSwapsCount = isSwapRunning ? resumableSwapsCount - 1 : resumableSwapsCount;
+ const displayedResumableSwapsCount = isSwapRunning
+ ? resumableSwapsCount - 1
+ : resumableSwapsCount;
if (displayedResumableSwapsCount > 0) {
return (
diff --git a/src-gui/src/renderer/components/pages/monero/SendTransactionModal.tsx b/src-gui/src/renderer/components/pages/monero/SendTransactionModal.tsx
index a3661f21..1ae68367 100644
--- a/src-gui/src/renderer/components/pages/monero/SendTransactionModal.tsx
+++ b/src-gui/src/renderer/components/pages/monero/SendTransactionModal.tsx
@@ -22,7 +22,8 @@ export default function SendTransactionModal({
const pendingApprovals = usePendingSendMoneroApproval();
const hasPendingApproval = pendingApprovals.length > 0;
- const [successResponse, setSuccessResponse] = useState
(null);
+ const [successResponse, setSuccessResponse] =
+ useState(null);
const showSuccess = successResponse !== null;
@@ -42,13 +43,20 @@ export default function SendTransactionModal({
}}
>
{!showSuccess && !hasPendingApproval && (
-
+
)}
{!showSuccess && hasPendingApproval && (
)}
{showSuccess && (
-
+
)}
);
diff --git a/src-gui/src/renderer/components/pages/monero/components/SendSuccessContent.tsx b/src-gui/src/renderer/components/pages/monero/components/SendSuccessContent.tsx
index c128150f..7834910f 100644
--- a/src-gui/src/renderer/components/pages/monero/components/SendSuccessContent.tsx
+++ b/src-gui/src/renderer/components/pages/monero/components/SendSuccessContent.tsx
@@ -1,6 +1,9 @@
import { Box, Button, Typography } from "@mui/material";
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
-import { FiatPiconeroAmount, PiconeroAmount } from "renderer/components/other/Units";
+import {
+ FiatPiconeroAmount,
+ PiconeroAmount,
+} from "renderer/components/other/Units";
import MonospaceTextBox from "renderer/components/other/MonospaceTextBox";
import ArrowOutwardIcon from "@mui/icons-material/ArrowOutward";
import { SendMoneroResponse } from "models/tauriModel";
@@ -15,10 +18,12 @@ export default function SendSuccessContent({
onClose: () => void;
successDetails: SendMoneroResponse | null;
}) {
-
const address = successDetails?.address;
const amount = successDetails?.amount_sent;
- const explorerUrl = getMoneroTxExplorerUrl(successDetails?.tx_hash, isTestnet());
+ const explorerUrl = getMoneroTxExplorerUrl(
+ successDetails?.tx_hash,
+ isTestnet(),
+ );
return (
Transaction Published
-
- Sent
-
-
-
- ()
+
+
+ Sent
+
+
+
+
+
+ ()
+
-
- to
-
- {address.slice(0, 8)} ... {address.slice(-8)}
-
+
+
+ to
+
+
+
+ {address.slice(0, 8)} ... {address.slice(-8)}
+
+
-
-
- } onClick={() => open(explorerUrl)}>View on Explorer
+
+
+ }
+ onClick={() => open(explorerUrl)}
+ >
+ View on Explorer
+
);
diff --git a/src-gui/src/renderer/rpc.ts b/src-gui/src/renderer/rpc.ts
index c7e6747a..595b8a56 100644
--- a/src-gui/src/renderer/rpc.ts
+++ b/src-gui/src/renderer/rpc.ts
@@ -514,16 +514,15 @@ export async function sendMoneroTransaction(
const response = await sendMonero(args);
// Refresh balance and history after sending - but don't let this block the response
- Promise.all([
- getMoneroBalance(),
- getMoneroHistory(),
- ]).then(([newBalance, newHistory]) => {
- store.dispatch(setBalance(newBalance));
- store.dispatch(setHistory(newHistory));
- }).catch(refreshErr => {
- console.error("Failed to refresh wallet data after send:", refreshErr);
- // Could emit a toast notification here
- });
+ Promise.all([getMoneroBalance(), getMoneroHistory()])
+ .then(([newBalance, newHistory]) => {
+ store.dispatch(setBalance(newBalance));
+ store.dispatch(setHistory(newHistory));
+ })
+ .catch((refreshErr) => {
+ console.error("Failed to refresh wallet data after send:", refreshErr);
+ // Could emit a toast notification here
+ });
return response;
} catch (err) {
diff --git a/swap-env/src/config.rs b/swap-env/src/config.rs
index 1759610b..c2c5adc7 100644
--- a/swap-env/src/config.rs
+++ b/swap-env/src/config.rs
@@ -379,7 +379,7 @@ pub fn query_user_for_initial_config(testnet: bool) -> Result {
println!();
Ok(Config {
- data: Data { dir: data_dir},
+ data: Data { dir: data_dir },
network: Network {
listen: listen_addresses,
rendezvous_point: rendezvous_points, // keeping the singular key name for backcompat
diff --git a/swap-feed/Cargo.toml b/swap-feed/Cargo.toml
index 58115921..269c6e20 100644
--- a/swap-feed/Cargo.toml
+++ b/swap-feed/Cargo.toml
@@ -26,4 +26,4 @@ tokio = { workspace = true }
tokio-tungstenite = { version = "0.15", features = ["rustls-tls"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
-url = { workspace = true }
\ No newline at end of file
+url = { workspace = true }
diff --git a/swap-feed/src/lib.rs b/swap-feed/src/lib.rs
index 570be086..051f5ed6 100644
--- a/swap-feed/src/lib.rs
+++ b/swap-feed/src/lib.rs
@@ -3,11 +3,11 @@ pub mod rate;
pub mod traits;
// Re-exports for convenience
-pub use kraken::{connect, PriceUpdates, Error as KrakenError};
-pub use rate::{Rate, FixedRate, KrakenRate};
+pub use kraken::{connect, Error as KrakenError, PriceUpdates};
+pub use rate::{FixedRate, KrakenRate, Rate};
pub use traits::LatestRate;
// Core functions
pub fn connect_kraken(url: url::Url) -> anyhow::Result {
kraken::connect(url)
-}
\ No newline at end of file
+}
diff --git a/swap-feed/src/rate.rs b/swap-feed/src/rate.rs
index c84c4f56..cb29ad95 100644
--- a/swap-feed/src/rate.rs
+++ b/swap-feed/src/rate.rs
@@ -177,8 +177,9 @@ mod tests {
.sell_quote(bitcoin::Amount::ONE_BTC)
.unwrap();
- let xmr_factor =
- xmr_no_spread.into().as_piconero_decimal() / xmr_with_spread.into().as_piconero_decimal() - ONE;
+ let xmr_factor = xmr_no_spread.into().as_piconero_decimal()
+ / xmr_with_spread.into().as_piconero_decimal()
+ - ONE;
assert!(xmr_with_spread < xmr_no_spread);
assert_eq!(xmr_factor.round_dp(8), TWO_PERCENT); // round to 8 decimal
@@ -186,4 +187,4 @@ mod tests {
// it is really close
// to two percent
}
-}
\ No newline at end of file
+}
diff --git a/swap-feed/src/traits.rs b/swap-feed/src/traits.rs
index 1d65aa15..4fad04f8 100644
--- a/swap-feed/src/traits.rs
+++ b/swap-feed/src/traits.rs
@@ -10,7 +10,7 @@ pub trait LatestRate {
pub trait PriceFeed: Sized {
type Error: std::error::Error + Send + Sync + 'static;
type Update;
-
+
async fn connect(url: url::Url) -> Result;
async fn next_update(&mut self) -> Result;
-}
\ No newline at end of file
+}
diff --git a/swap/Cargo.toml b/swap/Cargo.toml
index 7ecbb0b3..6d8332f7 100644
--- a/swap/Cargo.toml
+++ b/swap/Cargo.toml
@@ -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"] }
diff --git a/swap/src/asb.rs b/swap/src/asb.rs
index 8ca29f5c..9aaf321d 100644
--- a/swap/src/asb.rs
+++ b/swap/src/asb.rs
@@ -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;
diff --git a/swap/src/asb/event_loop.rs b/swap/src/asb/event_loop.rs
index 3884085a..6d6f0f9d 100644
--- a/swap/src/asb/event_loop.rs
+++ b/swap/src/asb/event_loop.rs
@@ -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,
diff --git a/swap/src/asb/network.rs b/swap/src/asb/network.rs
index 097a772e..7d322bc7 100644
--- a/swap/src/asb/network.rs
+++ b/swap/src/asb/network.rs
@@ -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 {
diff --git a/swap/src/bin/asb.rs b/swap/src/bin/asb.rs
index 69343804..d71d823c 100644
--- a/swap/src/bin/asb.rs
+++ b/swap/src/bin/asb.rs
@@ -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);
diff --git a/swap/src/cli/api.rs b/swap/src/cli/api.rs
index 2fa91d54..e9f86af8 100644
--- a/swap/src/cli/api.rs
+++ b/swap/src/cli/api.rs
@@ -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")?;
diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs
index 071ffaca..d9b260c0 100644
--- a/swap/src/monero/wallet.rs
+++ b/swap/src/monero/wallet.rs
@@ -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::{
diff --git a/throttle/Cargo.toml b/throttle/Cargo.toml
index 9a3f6da9..2a7c9b0b 100644
--- a/throttle/Cargo.toml
+++ b/throttle/Cargo.toml
@@ -6,7 +6,6 @@ edition = "2024"
[dependencies]
tracing = { workspace = true }
-
[lib]
path = "src/throttle.rs"