Remove unnecessary wrapper struct

This commit is contained in:
rishflab 2021-04-06 11:05:36 +10:00
parent d144405182
commit 7df93faa4b
2 changed files with 17 additions and 25 deletions

View File

@ -21,7 +21,7 @@ use std::sync::Arc;
use std::time::Duration;
use structopt::StructOpt;
use swap::bitcoin::{Amount, TxLock};
use swap::cli::command::{AliceMultiaddress, Arguments, Command, Data, MoneroParams};
use swap::cli::command::{Arguments, Command, Data, MoneroParams};
use swap::database::Database;
use swap::env::{Config, GetConfig};
use swap::network::quote::BidQuote;
@ -82,10 +82,7 @@ async fn main() -> Result<()> {
match args.cmd {
Command::BuyXmr {
alice_peer_id,
alice_multi_addr:
AliceMultiaddress {
multiaddr: alice_addr,
},
alice_multiaddr,
monero_params:
MoneroParams {
receive_monero_address,
@ -108,7 +105,7 @@ async fn main() -> Result<()> {
let bitcoin_wallet = Arc::new(bitcoin_wallet);
let mut swarm = swarm::new::<Behaviour>(&seed)?;
swarm.add_address(alice_peer_id, alice_addr);
swarm.add_address(alice_peer_id, alice_multiaddr);
let (event_loop, mut event_loop_handle) =
EventLoop::new(swarm, alice_peer_id, bitcoin_wallet.clone())?;
@ -170,10 +167,7 @@ async fn main() -> Result<()> {
}
Command::Resume {
swap_id,
alice_multi_addr:
AliceMultiaddress {
multiaddr: alice_addr,
},
alice_multiaddr,
monero_params:
MoneroParams {
receive_monero_address,
@ -193,7 +187,7 @@ async fn main() -> Result<()> {
let alice_peer_id = db.get_peer_id(swap_id)?;
let mut swarm = swarm::new::<Behaviour>(&seed)?;
swarm.add_address(alice_peer_id, alice_addr);
swarm.add_address(alice_peer_id, alice_multiaddr);
let (event_loop, event_loop_handle) =
EventLoop::new(swarm, alice_peer_id, bitcoin_wallet.clone())?;

View File

@ -44,8 +44,12 @@ pub enum Command {
)]
alice_peer_id: PeerId,
#[structopt(flatten)]
alice_multi_addr: AliceMultiaddress,
#[structopt(
long = "seller-addr",
default_value = DEFAULT_ALICE_MULTIADDR,
help = "The multiaddr of a specific swap partner can be optionally provided"
)]
alice_multiaddr: Multiaddr,
#[structopt(long = "electrum-rpc",
help = "Provide the Bitcoin Electrum RPC URL",
@ -66,8 +70,12 @@ pub enum Command {
)]
swap_id: Uuid,
#[structopt(flatten)]
alice_multi_addr: AliceMultiaddress,
#[structopt(
long = "seller-addr",
default_value = DEFAULT_ALICE_MULTIADDR,
help = "The multiaddr of a specific swap partner can be optionally provided"
)]
alice_multiaddr: Multiaddr,
#[structopt(long = "electrum-rpc",
help = "Provide the Bitcoin Electrum RPC URL",
@ -114,16 +122,6 @@ pub enum Command {
},
}
#[derive(structopt::StructOpt, Debug)]
pub struct AliceMultiaddress {
#[structopt(
long = "seller-addr",
default_value = DEFAULT_ALICE_MULTIADDR,
help = "The multiaddr of a specific swap partner can be optionally provided"
)]
pub multiaddr: Multiaddr,
}
#[derive(structopt::StructOpt, Debug)]
pub struct MoneroParams {
#[structopt(long = "receive-address",