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}>
<MoreHorizIcon />
</IconButton>
<Menu anchorEl={menuAnchorEl} open={menuOpen} onClose={handleMenuClose}>
<Menu
anchorEl={menuAnchorEl}
open={menuOpen}
onClose={handleMenuClose}
>
<MenuItem
onClick={() => {
setRestoreHeightDialogOpen(true);

View file

@ -24,8 +24,8 @@ monero-sys = { path = "../monero-sys" }
swap = { path = "../swap" }
swap-env = { path = "../swap-env" }
swap-feed = { path = "../swap-feed" }
swap-machine = { path = "../swap-machine" }
swap-serde = { path = "../swap-serde" }
swap-machine = { path = "../swap-machine"}
# Async
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::psbt::Psbt as PartiallySignedTransaction;
pub use ::bitcoin::{Address, AddressType, Network, Transaction, Txid};
pub use ecdsa_fun::Signature;
pub use ecdsa_fun::adaptor::EncryptedSignature;
pub use ecdsa_fun::fun::Scalar;
pub use ecdsa_fun::Signature;
use ::bitcoin::hashes::Hash;
use ::bitcoin::secp256k1::ecdsa;
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, Segwitv0};
use bitcoin_wallet::primitives::ScriptStatus;
use ecdsa_fun::ECDSA;
use ecdsa_fun::adaptor::{Adaptor, HashTranscript};
use ecdsa_fun::fun::Point;
use ecdsa_fun::nonce::Deterministic;
use ecdsa_fun::ECDSA;
use rand::{CryptoRng, RngCore};
use serde::{Deserialize, Serialize};
use sha2::Sha256;
@ -261,8 +261,8 @@ pub fn current_epoch(
pub mod bitcoin_address {
use anyhow::{Context, Result};
use bitcoin::{
Address,
address::{NetworkChecked, NetworkUnchecked},
Address,
};
use serde::Serialize;
use std::str::FromStr;

View file

@ -1,13 +1,13 @@
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::transaction::Version;
use ::bitcoin::Weight;
use ::bitcoin::{
EcdsaSighashType, OutPoint, ScriptBuf, Sequence, TxIn, TxOut, Txid,
locktime::absolute::LockTime as PackedLockTime, secp256k1, sighash::SegwitV0Sighash as Sighash,
EcdsaSighashType, OutPoint, ScriptBuf, Sequence, TxIn, TxOut, Txid,
};
use anyhow::Result;
use bdk_wallet::miniscript::Descriptor;

View file

@ -1,7 +1,7 @@
use crate::bitcoin;
use ::bitcoin::sighash::SighashCache;
use ::bitcoin::{EcdsaSighashType, Txid, sighash::SegwitV0Sighash as Sighash};
use ::bitcoin::{ScriptBuf, secp256k1};
use ::bitcoin::{secp256k1, ScriptBuf};
use ::bitcoin::{sighash::SegwitV0Sighash as Sighash, EcdsaSighashType, Txid};
use anyhow::{Context, Result};
use bdk_wallet::miniscript::Descriptor;
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::{OutPoint, TxIn, TxOut, Txid};
use anyhow::{Context, Result, bail};
use anyhow::{bail, Context, Result};
use bdk_wallet::miniscript::Descriptor;
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 serde::{Deserialize, Serialize};
@ -195,8 +195,8 @@ impl Watchable for TxLock {
#[cfg(test)]
mod tests {
use super::*;
use crate::bitcoin::Amount;
use crate::bitcoin::wallet::TestWalletBuilder;
use crate::bitcoin::Amount;
use ::bitcoin::psbt::Psbt as PartiallySignedTransaction;
// Basic setup function for tests

View file

@ -1,6 +1,6 @@
use crate::bitcoin::{self, Address, Amount, PunishTimelock, Transaction, TxCancel, Txid};
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 anyhow::{Context, Result};
use bdk_wallet::miniscript::Descriptor;

View file

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

View file

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

View file

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

View file

@ -1,15 +1,15 @@
use std::path::{Path, PathBuf};
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 dialoguer::Confirm;
use dialoguer::{Input, Select, theme::ColorfulTheme};
use dialoguer::{theme::ColorfulTheme, Input, Select};
use libp2p::Multiaddr;
use rust_decimal::Decimal;
use rust_decimal::prelude::FromPrimitive;
use rust_decimal::Decimal;
use url::Url;
/// Prompt user for data directory

View file

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

View file

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

View file

@ -1,15 +1,15 @@
use crate::alice::AliceState;
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::BobState;
use anyhow::Result;
use async_trait::async_trait;
use conquer_once::Lazy;
use libp2p::{Multiaddr, PeerId};
use serde::{Deserialize, Serialize};
use sha2::Sha256;
use sigma_fun::HashTranscript;
use sigma_fun::ext::dl_secp256k1_ed25519_eq::{CrossCurveDLEQ, CrossCurveDLEQProof};
use sigma_fun::HashTranscript;
use std::convert::TryInto;
use swap_core::bitcoin;
use swap_core::monero::{self, MoneroAddressPool};

View file

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

View file

@ -4,8 +4,8 @@ mod images;
mod prompt;
use crate::compose::{
ASB_DATA_DIR, DOCKER_COMPOSE_FILE, IntoSpec, OrchestratorDirectories, OrchestratorImage,
OrchestratorImages, OrchestratorInput, OrchestratorNetworks,
IntoSpec, OrchestratorDirectories, OrchestratorImage, OrchestratorImages, OrchestratorInput,
OrchestratorNetworks, ASB_DATA_DIR, DOCKER_COMPOSE_FILE,
};
use std::path::PathBuf;
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 url::Url;

View file

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

View file

@ -1,7 +1,7 @@
pub mod multiaddresses {
use libp2p::Multiaddr;
use serde::de::Unexpected;
use serde::{Deserialize, Deserializer, de};
use serde::{de, Deserialize, Deserializer};
use serde_json::Value;
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 {
use hex;
use monero::PrivateKey;
use monero::consensus::{Decodable, Encodable};
use monero::PrivateKey;
use serde::de::Visitor;
use serde::ser::Error;
use serde::{Deserializer, Serializer, de};
use serde::{de, Deserializer, Serializer};
use std::fmt;
use std::io::Cursor;
@ -100,7 +100,7 @@ pub mod amount {
}
pub mod address {
use anyhow::{Context, Result, bail};
use anyhow::{bail, Context, Result};
use std::str::FromStr;
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq)]

View file

@ -2,7 +2,7 @@
// MIT License
use std::pin::Pin;
use std::sync::{Arc, Mutex, mpsc};
use std::sync::{mpsc, Arc, Mutex};
use std::time::{self, /* SystemTime, UNIX_EPOCH, */ Duration};
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 "..."
```
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.