dprint fmt

This commit is contained in:
Binarybaron 2025-10-11 15:27:50 +02:00
parent b3439e4ae6
commit e7ff02958d
23 changed files with 69 additions and 63 deletions

View file

@ -101,7 +101,11 @@ export default function WalletActionButtons({
<IconButton onClick={handleMenuClick}> <IconButton onClick={handleMenuClick}>
<MoreHorizIcon /> <MoreHorizIcon />
</IconButton> </IconButton>
<Menu anchorEl={menuAnchorEl} open={menuOpen} onClose={handleMenuClose}> <Menu
anchorEl={menuAnchorEl}
open={menuOpen}
onClose={handleMenuClose}
>
<MenuItem <MenuItem
onClick={() => { onClick={() => {
setRestoreHeightDialogOpen(true); setRestoreHeightDialogOpen(true);

View file

@ -24,8 +24,8 @@ monero-sys = { path = "../monero-sys" }
swap = { path = "../swap" } swap = { path = "../swap" }
swap-env = { path = "../swap-env" } swap-env = { path = "../swap-env" }
swap-feed = { path = "../swap-feed" } swap-feed = { path = "../swap-feed" }
swap-machine = { path = "../swap-machine" }
swap-serde = { path = "../swap-serde" } swap-serde = { path = "../swap-serde" }
swap-machine = { path = "../swap-machine"}
# Async # Async
tokio = { workspace = true, features = ["process", "fs", "net", "parking_lot", "rt"] } tokio = { workspace = true, features = ["process", "fs", "net", "parking_lot", "rt"] }

View file

@ -16,21 +16,21 @@ pub use crate::bitcoin::timelocks::{BlockHeight, ExpiredTimelocks};
pub use ::bitcoin::amount::Amount; pub use ::bitcoin::amount::Amount;
pub use ::bitcoin::psbt::Psbt as PartiallySignedTransaction; pub use ::bitcoin::psbt::Psbt as PartiallySignedTransaction;
pub use ::bitcoin::{Address, AddressType, Network, Transaction, Txid}; pub use ::bitcoin::{Address, AddressType, Network, Transaction, Txid};
pub use ecdsa_fun::Signature;
pub use ecdsa_fun::adaptor::EncryptedSignature; pub use ecdsa_fun::adaptor::EncryptedSignature;
pub use ecdsa_fun::fun::Scalar; pub use ecdsa_fun::fun::Scalar;
pub use ecdsa_fun::Signature;
use ::bitcoin::hashes::Hash; use ::bitcoin::hashes::Hash;
use ::bitcoin::secp256k1::ecdsa; use ::bitcoin::secp256k1::ecdsa;
use ::bitcoin::sighash::SegwitV0Sighash as Sighash; use ::bitcoin::sighash::SegwitV0Sighash as Sighash;
use anyhow::{Context, Result, bail}; use anyhow::{bail, Context, Result};
use bdk_wallet::miniscript::descriptor::Wsh; use bdk_wallet::miniscript::descriptor::Wsh;
use bdk_wallet::miniscript::{Descriptor, Segwitv0}; use bdk_wallet::miniscript::{Descriptor, Segwitv0};
use bitcoin_wallet::primitives::ScriptStatus; use bitcoin_wallet::primitives::ScriptStatus;
use ecdsa_fun::ECDSA;
use ecdsa_fun::adaptor::{Adaptor, HashTranscript}; use ecdsa_fun::adaptor::{Adaptor, HashTranscript};
use ecdsa_fun::fun::Point; use ecdsa_fun::fun::Point;
use ecdsa_fun::nonce::Deterministic; use ecdsa_fun::nonce::Deterministic;
use ecdsa_fun::ECDSA;
use rand::{CryptoRng, RngCore}; use rand::{CryptoRng, RngCore};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sha2::Sha256; use sha2::Sha256;
@ -261,8 +261,8 @@ pub fn current_epoch(
pub mod bitcoin_address { pub mod bitcoin_address {
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use bitcoin::{ use bitcoin::{
Address,
address::{NetworkChecked, NetworkUnchecked}, address::{NetworkChecked, NetworkUnchecked},
Address,
}; };
use serde::Serialize; use serde::Serialize;
use std::str::FromStr; use std::str::FromStr;

View file

@ -1,13 +1,13 @@
use crate::bitcoin; use crate::bitcoin;
use crate::bitcoin::{ use crate::bitcoin::{
Address, Amount, BlockHeight, PublicKey, Transaction, TxLock, build_shared_output_descriptor, build_shared_output_descriptor, Address, Amount, BlockHeight, PublicKey, Transaction, TxLock,
}; };
use ::bitcoin::Weight;
use ::bitcoin::sighash::SighashCache; use ::bitcoin::sighash::SighashCache;
use ::bitcoin::transaction::Version; use ::bitcoin::transaction::Version;
use ::bitcoin::Weight;
use ::bitcoin::{ use ::bitcoin::{
EcdsaSighashType, OutPoint, ScriptBuf, Sequence, TxIn, TxOut, Txid,
locktime::absolute::LockTime as PackedLockTime, secp256k1, sighash::SegwitV0Sighash as Sighash, locktime::absolute::LockTime as PackedLockTime, secp256k1, sighash::SegwitV0Sighash as Sighash,
EcdsaSighashType, OutPoint, ScriptBuf, Sequence, TxIn, TxOut, Txid,
}; };
use anyhow::Result; use anyhow::Result;
use bdk_wallet::miniscript::Descriptor; use bdk_wallet::miniscript::Descriptor;

View file

@ -1,7 +1,7 @@
use crate::bitcoin; use crate::bitcoin;
use ::bitcoin::sighash::SighashCache; use ::bitcoin::sighash::SighashCache;
use ::bitcoin::{EcdsaSighashType, Txid, sighash::SegwitV0Sighash as Sighash}; use ::bitcoin::{secp256k1, ScriptBuf};
use ::bitcoin::{ScriptBuf, secp256k1}; use ::bitcoin::{sighash::SegwitV0Sighash as Sighash, EcdsaSighashType, Txid};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use bdk_wallet::miniscript::Descriptor; use bdk_wallet::miniscript::Descriptor;
use bitcoin::{Address, Amount, Transaction}; use bitcoin::{Address, Amount, Transaction};

View file

@ -1,10 +1,10 @@
use crate::bitcoin::{Address, Amount, PublicKey, Transaction, build_shared_output_descriptor}; use crate::bitcoin::{build_shared_output_descriptor, Address, Amount, PublicKey, Transaction};
use ::bitcoin::psbt::Psbt as PartiallySignedTransaction; use ::bitcoin::psbt::Psbt as PartiallySignedTransaction;
use ::bitcoin::{OutPoint, TxIn, TxOut, Txid}; use ::bitcoin::{OutPoint, TxIn, TxOut, Txid};
use anyhow::{Context, Result, bail}; use anyhow::{bail, Context, Result};
use bdk_wallet::miniscript::Descriptor; use bdk_wallet::miniscript::Descriptor;
use bdk_wallet::psbt::PsbtUtils; use bdk_wallet::psbt::PsbtUtils;
use bitcoin::{ScriptBuf, Sequence, locktime::absolute::LockTime as PackedLockTime}; use bitcoin::{locktime::absolute::LockTime as PackedLockTime, ScriptBuf, Sequence};
use bitcoin_wallet::primitives::Watchable; use bitcoin_wallet::primitives::Watchable;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -195,8 +195,8 @@ impl Watchable for TxLock {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::bitcoin::Amount;
use crate::bitcoin::wallet::TestWalletBuilder; use crate::bitcoin::wallet::TestWalletBuilder;
use crate::bitcoin::Amount;
use ::bitcoin::psbt::Psbt as PartiallySignedTransaction; use ::bitcoin::psbt::Psbt as PartiallySignedTransaction;
// Basic setup function for tests // Basic setup function for tests

View file

@ -1,6 +1,6 @@
use crate::bitcoin::{self, Address, Amount, PunishTimelock, Transaction, TxCancel, Txid}; use crate::bitcoin::{self, Address, Amount, PunishTimelock, Transaction, TxCancel, Txid};
use ::bitcoin::sighash::SighashCache; use ::bitcoin::sighash::SighashCache;
use ::bitcoin::{EcdsaSighashType, secp256k1, sighash::SegwitV0Sighash as Sighash}; use ::bitcoin::{secp256k1, sighash::SegwitV0Sighash as Sighash, EcdsaSighashType};
use ::bitcoin::{ScriptBuf, Weight}; use ::bitcoin::{ScriptBuf, Weight};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use bdk_wallet::miniscript::Descriptor; use bdk_wallet::miniscript::Descriptor;

View file

@ -1,18 +1,18 @@
use crate::bitcoin::{ use crate::bitcoin::{
Address, Amount, EmptyWitnessStack, EncryptedSignature, NoInputs, NotThreeWitnesses, PublicKey, verify_encsig, verify_sig, Address, Amount, EmptyWitnessStack, EncryptedSignature, NoInputs,
SecretKey, TooManyInputs, Transaction, TxLock, verify_encsig, verify_sig, NotThreeWitnesses, PublicKey, SecretKey, TooManyInputs, Transaction, TxLock,
}; };
use ::bitcoin::{Txid, sighash::SegwitV0Sighash as Sighash}; use ::bitcoin::{sighash::SegwitV0Sighash as Sighash, Txid};
use anyhow::{Context, Result, bail}; use anyhow::{bail, Context, Result};
use bdk_wallet::miniscript::Descriptor; use bdk_wallet::miniscript::Descriptor;
use bitcoin::sighash::SighashCache; use bitcoin::sighash::SighashCache;
use bitcoin::{secp256k1, ScriptBuf};
use bitcoin::{EcdsaSighashType, Weight}; use bitcoin::{EcdsaSighashType, Weight};
use bitcoin::{ScriptBuf, secp256k1};
use bitcoin_wallet::primitives::Watchable; use bitcoin_wallet::primitives::Watchable;
use ecdsa_fun::Signature;
use ecdsa_fun::adaptor::{Adaptor, HashTranscript}; use ecdsa_fun::adaptor::{Adaptor, HashTranscript};
use ecdsa_fun::fun::Scalar; use ecdsa_fun::fun::Scalar;
use ecdsa_fun::nonce::Deterministic; use ecdsa_fun::nonce::Deterministic;
use ecdsa_fun::Signature;
use sha2::Sha256; use sha2::Sha256;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Arc; use std::sync::Arc;

View file

@ -1,12 +1,12 @@
use crate::bitcoin; use crate::bitcoin;
use crate::bitcoin::{ use crate::bitcoin::{
Address, Amount, EmptyWitnessStack, NoInputs, NotThreeWitnesses, PublicKey, TooManyInputs, verify_sig, Address, Amount, EmptyWitnessStack, NoInputs, NotThreeWitnesses, PublicKey,
Transaction, TxCancel, verify_sig, TooManyInputs, Transaction, TxCancel,
}; };
use ::bitcoin::sighash::SighashCache; use ::bitcoin::sighash::SighashCache;
use ::bitcoin::{EcdsaSighashType, Txid, sighash::SegwitV0Sighash as Sighash}; use ::bitcoin::{secp256k1, ScriptBuf, Weight};
use ::bitcoin::{ScriptBuf, Weight, secp256k1}; use ::bitcoin::{sighash::SegwitV0Sighash as Sighash, EcdsaSighashType, Txid};
use anyhow::{Context, Result, bail}; use anyhow::{bail, Context, Result};
use bdk_wallet::miniscript::Descriptor; use bdk_wallet::miniscript::Descriptor;
use bitcoin_wallet::primitives::Watchable; use bitcoin_wallet::primitives::Watchable;
use curve25519_dalek::scalar::Scalar; use curve25519_dalek::scalar::Scalar;

View file

@ -1,10 +1,10 @@
use crate::bitcoin; use crate::bitcoin;
use anyhow::{Result, bail}; use anyhow::{bail, Result};
pub use curve25519_dalek::scalar::Scalar; pub use curve25519_dalek::scalar::Scalar;
use monero::Address; use monero::Address;
use rand::{CryptoRng, RngCore}; use rand::{CryptoRng, RngCore};
use rust_decimal::Decimal;
use rust_decimal::prelude::*; use rust_decimal::prelude::*;
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::convert::TryFrom; use std::convert::TryFrom;
use std::fmt; use std::fmt;
@ -382,10 +382,12 @@ impl MoneroAddressPool {
impl From<::monero::Address> for MoneroAddressPool { impl From<::monero::Address> for MoneroAddressPool {
fn from(address: ::monero::Address) -> Self { fn from(address: ::monero::Address) -> Self {
Self(vec![ Self(vec![LabeledMoneroAddress::new(
LabeledMoneroAddress::new(address, Decimal::from(1), "user address".to_string()) address,
.expect("Percentage 1 is always valid"), Decimal::from(1),
]) "user address".to_string(),
)
.expect("Percentage 1 is always valid")])
} }
} }

View file

@ -1,7 +1,7 @@
use crate::defaults::GetDefaults; use crate::defaults::GetDefaults;
use crate::env::{Mainnet, Testnet}; use crate::env::{Mainnet, Testnet};
use crate::prompt; use crate::prompt;
use anyhow::{Context, Result, bail}; use anyhow::{bail, Context, Result};
use config::ConfigError; use config::ConfigError;
use libp2p::core::Multiaddr; use libp2p::core::Multiaddr;
use rust_decimal::Decimal; use rust_decimal::Decimal;

View file

@ -1,15 +1,15 @@
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use crate::defaults::{ use crate::defaults::{
DEFAULT_MAX_BUY_AMOUNT, DEFAULT_MIN_BUY_AMOUNT, DEFAULT_SPREAD, default_rendezvous_points, default_rendezvous_points, DEFAULT_MAX_BUY_AMOUNT, DEFAULT_MIN_BUY_AMOUNT, DEFAULT_SPREAD,
}; };
use anyhow::{Context, Result, bail}; use anyhow::{bail, Context, Result};
use console::Style; use console::Style;
use dialoguer::Confirm; use dialoguer::Confirm;
use dialoguer::{Input, Select, theme::ColorfulTheme}; use dialoguer::{theme::ColorfulTheme, Input, Select};
use libp2p::Multiaddr; use libp2p::Multiaddr;
use rust_decimal::Decimal;
use rust_decimal::prelude::FromPrimitive; use rust_decimal::prelude::FromPrimitive;
use rust_decimal::Decimal;
use url::Url; use url::Url;
/// Prompt user for data directory /// Prompt user for data directory

View file

@ -1,17 +1,17 @@
use crate::common::{CROSS_CURVE_PROOF_SYSTEM, Message0, Message1, Message2, Message3, Message4}; use crate::common::{Message0, Message1, Message2, Message3, Message4, CROSS_CURVE_PROOF_SYSTEM};
use anyhow::{Context, Result, anyhow, bail}; use anyhow::{anyhow, bail, Context, Result};
use rand::{CryptoRng, RngCore}; use rand::{CryptoRng, RngCore};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sigma_fun::ext::dl_secp256k1_ed25519_eq::CrossCurveDLEQProof; use sigma_fun::ext::dl_secp256k1_ed25519_eq::CrossCurveDLEQProof;
use std::fmt; use std::fmt;
use std::sync::Arc; use std::sync::Arc;
use swap_core::bitcoin::{ use swap_core::bitcoin::{
CancelTimelock, ExpiredTimelocks, PunishTimelock, Transaction, TxCancel, TxEarlyRefund, current_epoch, CancelTimelock, ExpiredTimelocks, PunishTimelock, Transaction, TxCancel,
TxPunish, TxRedeem, TxRefund, Txid, current_epoch, TxEarlyRefund, TxPunish, TxRedeem, TxRefund, Txid,
}; };
use swap_core::monero; use swap_core::monero;
use swap_core::monero::ScalarExt;
use swap_core::monero::primitives::{BlockHeight, TransferProof, TransferRequest, WatchRequest}; use swap_core::monero::primitives::{BlockHeight, TransferProof, TransferRequest, WatchRequest};
use swap_core::monero::ScalarExt;
use swap_env::env::Config; use swap_env::env::Config;
use uuid::Uuid; use uuid::Uuid;

View file

@ -1,9 +1,9 @@
use crate::common::{CROSS_CURVE_PROOF_SYSTEM, Message0, Message1, Message2, Message3, Message4}; use crate::common::{Message0, Message1, Message2, Message3, Message4, CROSS_CURVE_PROOF_SYSTEM};
use anyhow::{Context, Result, anyhow, bail}; use anyhow::{anyhow, bail, Context, Result};
use bitcoin_wallet::primitives::Subscription; use bitcoin_wallet::primitives::Subscription;
use ecdsa_fun::Signature;
use ecdsa_fun::adaptor::{Adaptor, HashTranscript}; use ecdsa_fun::adaptor::{Adaptor, HashTranscript};
use ecdsa_fun::nonce::Deterministic; use ecdsa_fun::nonce::Deterministic;
use ecdsa_fun::Signature;
use monero::BlockHeight; use monero::BlockHeight;
use rand::{CryptoRng, RngCore}; use rand::{CryptoRng, RngCore};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -12,11 +12,11 @@ use sigma_fun::ext::dl_secp256k1_ed25519_eq::CrossCurveDLEQProof;
use std::fmt; use std::fmt;
use std::sync::Arc; use std::sync::Arc;
use swap_core::bitcoin::{ use swap_core::bitcoin::{
self, CancelTimelock, ExpiredTimelocks, PunishTimelock, Transaction, TxCancel, TxLock, Txid, self, current_epoch, CancelTimelock, ExpiredTimelocks, PunishTimelock, Transaction, TxCancel,
current_epoch, TxLock, Txid,
}; };
use swap_core::monero::ScalarExt;
use swap_core::monero::primitives::WatchRequest; use swap_core::monero::primitives::WatchRequest;
use swap_core::monero::ScalarExt;
use swap_core::monero::{self, TransferProof}; use swap_core::monero::{self, TransferProof};
use swap_serde::bitcoin::address_serde; use swap_serde::bitcoin::address_serde;
use uuid::Uuid; use uuid::Uuid;

View file

@ -1,15 +1,15 @@
use crate::alice::AliceState;
use crate::alice::is_complete as alice_is_complete; use crate::alice::is_complete as alice_is_complete;
use crate::bob::BobState; use crate::alice::AliceState;
use crate::bob::is_complete as bob_is_complete; use crate::bob::is_complete as bob_is_complete;
use crate::bob::BobState;
use anyhow::Result; use anyhow::Result;
use async_trait::async_trait; use async_trait::async_trait;
use conquer_once::Lazy; use conquer_once::Lazy;
use libp2p::{Multiaddr, PeerId}; use libp2p::{Multiaddr, PeerId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sha2::Sha256; use sha2::Sha256;
use sigma_fun::HashTranscript;
use sigma_fun::ext::dl_secp256k1_ed25519_eq::{CrossCurveDLEQ, CrossCurveDLEQProof}; use sigma_fun::ext::dl_secp256k1_ed25519_eq::{CrossCurveDLEQ, CrossCurveDLEQProof};
use sigma_fun::HashTranscript;
use std::convert::TryInto; use std::convert::TryInto;
use swap_core::bitcoin; use swap_core::bitcoin;
use swap_core::monero::{self, MoneroAddressPool}; use swap_core::monero::{self, MoneroAddressPool};

View file

@ -8,6 +8,7 @@ name = "orchestrator"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
anyhow = { workspace = true }
bitcoin = { workspace = true } bitcoin = { workspace = true }
chrono = "0.4.41" chrono = "0.4.41"
compose_spec = "0.3.0" compose_spec = "0.3.0"
@ -17,7 +18,6 @@ serde_yaml = "0.9.34"
swap-env = { path = "../swap-env" } swap-env = { path = "../swap-env" }
toml = { workspace = true } toml = { workspace = true }
url = { workspace = true } url = { workspace = true }
anyhow = { workspace = true }
[build-dependencies] [build-dependencies]
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -4,8 +4,8 @@ mod images;
mod prompt; mod prompt;
use crate::compose::{ use crate::compose::{
ASB_DATA_DIR, DOCKER_COMPOSE_FILE, IntoSpec, OrchestratorDirectories, OrchestratorImage, IntoSpec, OrchestratorDirectories, OrchestratorImage, OrchestratorImages, OrchestratorInput,
OrchestratorImages, OrchestratorInput, OrchestratorNetworks, OrchestratorNetworks, ASB_DATA_DIR, DOCKER_COMPOSE_FILE,
}; };
use std::path::PathBuf; use std::path::PathBuf;
use swap_env::config::{ use swap_env::config::{

View file

@ -1,4 +1,4 @@
use dialoguer::{Select, theme::ColorfulTheme}; use dialoguer::{theme::ColorfulTheme, Select};
use swap_env::prompt as config_prompt; use swap_env::prompt as config_prompt;
use url::Url; use url::Url;

View file

@ -1,6 +1,6 @@
pub mod urls { pub mod urls {
use serde::de::Unexpected; use serde::de::Unexpected;
use serde::{Deserialize, Deserializer, de}; use serde::{de, Deserialize, Deserializer};
use serde_json::Value; use serde_json::Value;
use url::Url; use url::Url;

View file

@ -1,7 +1,7 @@
pub mod multiaddresses { pub mod multiaddresses {
use libp2p::Multiaddr; use libp2p::Multiaddr;
use serde::de::Unexpected; use serde::de::Unexpected;
use serde::{Deserialize, Deserializer, de}; use serde::{de, Deserialize, Deserializer};
use serde_json::Value; use serde_json::Value;
pub fn deserialize<'de, D>(deserializer: D) -> Result<Vec<Multiaddr>, D::Error> pub fn deserialize<'de, D>(deserializer: D) -> Result<Vec<Multiaddr>, D::Error>

View file

@ -12,11 +12,11 @@ pub enum network {
pub mod private_key { pub mod private_key {
use hex; use hex;
use monero::PrivateKey;
use monero::consensus::{Decodable, Encodable}; use monero::consensus::{Decodable, Encodable};
use monero::PrivateKey;
use serde::de::Visitor; use serde::de::Visitor;
use serde::ser::Error; use serde::ser::Error;
use serde::{Deserializer, Serializer, de}; use serde::{de, Deserializer, Serializer};
use std::fmt; use std::fmt;
use std::io::Cursor; use std::io::Cursor;
@ -100,7 +100,7 @@ pub mod amount {
} }
pub mod address { pub mod address {
use anyhow::{Context, Result, bail}; use anyhow::{bail, Context, Result};
use std::str::FromStr; use std::str::FromStr;
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq)] #[derive(thiserror::Error, Debug, Clone, Copy, PartialEq)]

View file

@ -2,7 +2,7 @@
// MIT License // MIT License
use std::pin::Pin; use std::pin::Pin;
use std::sync::{Arc, Mutex, mpsc}; use std::sync::{mpsc, Arc, Mutex};
use std::time::{self, /* SystemTime, UNIX_EPOCH, */ Duration}; use std::time::{self, /* SystemTime, UNIX_EPOCH, */ Duration};
pub fn throttle<F, T>(closure: F, delay: Duration) -> Throttle<T> pub fn throttle<F, T>(closure: F, delay: Duration) -> Throttle<T>

View file

@ -34,4 +34,4 @@ gpg: Signature made [date]
gpg: Good signature from "..." gpg: Good signature from "..."
``` ```
The warning `This key is not certified with a trusted signature` is expected unless you've explicitly trusted the key. The warning `This key is not certified with a trusted signature` is expected unless you've explicitly trusted the key.