mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Remove roles from SwapFactory name as implied by module and cleanup
This commit is contained in:
parent
75f89f3b25
commit
82974412b2
@ -23,7 +23,7 @@ use swap::{
|
||||
config::Config,
|
||||
database::Database,
|
||||
monero,
|
||||
protocol::{alice, bob, bob::BobSwapFactory},
|
||||
protocol::{alice, bob, bob::SwapFactory},
|
||||
trace::init_tracing,
|
||||
StartingBalances, SwapAmounts,
|
||||
};
|
||||
@ -82,7 +82,7 @@ async fn main() -> Result<()> {
|
||||
send_monero, receive_bitcoin, swap_id
|
||||
);
|
||||
|
||||
let alice_factory = alice::AliceSwapFactory::new(
|
||||
let alice_factory = alice::SwapFactory::new(
|
||||
seed,
|
||||
config,
|
||||
swap_id,
|
||||
@ -127,7 +127,7 @@ async fn main() -> Result<()> {
|
||||
send_bitcoin, receive_monero, swap_id
|
||||
);
|
||||
|
||||
let bob_factory = BobSwapFactory::new(
|
||||
let bob_factory = SwapFactory::new(
|
||||
seed,
|
||||
db_path,
|
||||
swap_id,
|
||||
@ -172,7 +172,7 @@ async fn main() -> Result<()> {
|
||||
)
|
||||
.await?;
|
||||
|
||||
let alice_factory = alice::AliceSwapFactory::new(
|
||||
let alice_factory = alice::SwapFactory::new(
|
||||
seed,
|
||||
config,
|
||||
swap_id,
|
||||
@ -204,7 +204,7 @@ async fn main() -> Result<()> {
|
||||
)
|
||||
.await?;
|
||||
|
||||
let bob_factory = BobSwapFactory::new(
|
||||
let bob_factory = SwapFactory::new(
|
||||
seed,
|
||||
db_path,
|
||||
swap_id,
|
||||
|
@ -50,21 +50,21 @@ pub struct Swap {
|
||||
pub db: Database,
|
||||
}
|
||||
|
||||
pub struct AliceSwapFactory {
|
||||
listen_address: Multiaddr,
|
||||
pub struct SwapFactory {
|
||||
swap_id: Uuid,
|
||||
identity: Keypair,
|
||||
peer_id: PeerId,
|
||||
|
||||
db_path: PathBuf,
|
||||
swap_id: Uuid,
|
||||
config: Config,
|
||||
|
||||
listen_address: Multiaddr,
|
||||
|
||||
pub bitcoin_wallet: Arc<bitcoin::Wallet>,
|
||||
pub monero_wallet: Arc<monero::Wallet>,
|
||||
config: Config,
|
||||
pub starting_balances: StartingBalances,
|
||||
}
|
||||
|
||||
impl AliceSwapFactory {
|
||||
impl SwapFactory {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn new(
|
||||
seed: Seed,
|
||||
@ -81,14 +81,14 @@ impl AliceSwapFactory {
|
||||
let peer_id = PeerId::from(identity.public());
|
||||
|
||||
Self {
|
||||
listen_address,
|
||||
swap_id,
|
||||
identity,
|
||||
peer_id,
|
||||
db_path,
|
||||
swap_id,
|
||||
config,
|
||||
listen_address,
|
||||
bitcoin_wallet,
|
||||
monero_wallet,
|
||||
config,
|
||||
starting_balances,
|
||||
}
|
||||
}
|
||||
|
@ -47,23 +47,22 @@ pub struct Swap {
|
||||
pub swap_id: Uuid,
|
||||
}
|
||||
|
||||
pub struct BobSwapFactory {
|
||||
pub struct SwapFactory {
|
||||
swap_id: Uuid,
|
||||
identity: Keypair,
|
||||
peer_id: PeerId,
|
||||
|
||||
db_path: PathBuf,
|
||||
swap_id: Uuid,
|
||||
|
||||
pub bitcoin_wallet: Arc<bitcoin::Wallet>,
|
||||
pub monero_wallet: Arc<monero::Wallet>,
|
||||
config: Config,
|
||||
pub starting_balances: StartingBalances,
|
||||
|
||||
alice_connect_address: Multiaddr,
|
||||
alice_connect_peer_id: PeerId,
|
||||
|
||||
pub bitcoin_wallet: Arc<bitcoin::Wallet>,
|
||||
pub monero_wallet: Arc<monero::Wallet>,
|
||||
pub starting_balances: StartingBalances,
|
||||
}
|
||||
|
||||
impl BobSwapFactory {
|
||||
impl SwapFactory {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
seed: Seed,
|
||||
@ -80,16 +79,16 @@ impl BobSwapFactory {
|
||||
let peer_id = identity.public().into_peer_id();
|
||||
|
||||
Self {
|
||||
swap_id,
|
||||
identity,
|
||||
peer_id,
|
||||
db_path,
|
||||
swap_id,
|
||||
bitcoin_wallet,
|
||||
monero_wallet,
|
||||
config,
|
||||
starting_balances,
|
||||
alice_connect_address,
|
||||
alice_connect_peer_id,
|
||||
bitcoin_wallet,
|
||||
monero_wallet,
|
||||
starting_balances,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,7 @@ use swap::{
|
||||
bitcoin,
|
||||
config::Config,
|
||||
monero,
|
||||
protocol::{
|
||||
alice,
|
||||
alice::{AliceState, AliceSwapFactory},
|
||||
bob,
|
||||
bob::{BobState, BobSwapFactory},
|
||||
},
|
||||
protocol::{alice, alice::AliceState, bob, bob::BobState},
|
||||
seed::Seed,
|
||||
StartingBalances, SwapAmounts,
|
||||
};
|
||||
@ -27,8 +22,8 @@ use uuid::Uuid;
|
||||
pub struct Test {
|
||||
swap_amounts: SwapAmounts,
|
||||
|
||||
alice_swap_factory: AliceSwapFactory,
|
||||
bob_swap_factory: BobSwapFactory,
|
||||
alice_swap_factory: alice::SwapFactory,
|
||||
bob_swap_factory: bob::SwapFactory,
|
||||
}
|
||||
|
||||
impl Test {
|
||||
@ -344,7 +339,7 @@ where
|
||||
)
|
||||
.await;
|
||||
|
||||
let alice_swap_factory = AliceSwapFactory::new(
|
||||
let alice_swap_factory = alice::SwapFactory::new(
|
||||
Seed::random().unwrap(),
|
||||
config,
|
||||
Uuid::new_v4(),
|
||||
@ -370,7 +365,7 @@ where
|
||||
)
|
||||
.await;
|
||||
|
||||
let bob_swap_factory = BobSwapFactory::new(
|
||||
let bob_swap_factory = bob::SwapFactory::new(
|
||||
Seed::random().unwrap(),
|
||||
tempdir().unwrap().path().to_path_buf(),
|
||||
Uuid::new_v4(),
|
||||
|
Loading…
Reference in New Issue
Block a user