From 311ba74cd673fef893514eea7a4de4e7fcf4fff8 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 4 Feb 2021 16:33:13 +1100 Subject: [PATCH] Remove sell-xmr from CLI --- swap/src/cli.rs | 23 ------------------- swap/src/main.rs | 60 +----------------------------------------------- 2 files changed, 1 insertion(+), 82 deletions(-) diff --git a/swap/src/cli.rs b/swap/src/cli.rs index 16f80f2b..9a1d91a5 100644 --- a/swap/src/cli.rs +++ b/swap/src/cli.rs @@ -19,19 +19,6 @@ pub struct Options { #[derive(structopt::StructOpt, Debug)] #[structopt(name = "xmr_btc-swap", about = "XMR BTC atomic swap")] pub enum Command { - SellXmr { - #[structopt(long = "p2p-address", default_value = "/ip4/0.0.0.0/tcp/9876")] - listen_addr: Multiaddr, - - #[structopt(long = "send-xmr", help = "Monero amount as floating point nr without denomination (e.g. 125.1)", parse(try_from_str = parse_xmr))] - send_monero: monero::Amount, - - #[structopt(long = "receive-btc", help = "Bitcoin amount as floating point nr without denomination (e.g. 1.25)", parse(try_from_str = parse_btc))] - receive_bitcoin: bitcoin::Amount, - - #[structopt(flatten)] - config: Config, - }, BuyXmr { #[structopt(long = "connect-peer-id")] alice_peer_id: PeerId, @@ -56,16 +43,6 @@ pub enum Command { #[derive(structopt::StructOpt, Debug)] pub enum Resume { - SellXmr { - #[structopt(long = "swap-id")] - swap_id: Uuid, - - #[structopt(long = "listen-address", default_value = "/ip4/127.0.0.1/tcp/9876")] - listen_addr: Multiaddr, - - #[structopt(flatten)] - config: Config, - }, BuyXmr { #[structopt(long = "swap-id")] swap_id: Uuid, diff --git a/swap/src/main.rs b/swap/src/main.rs index bd7ec818..da6fd9fa 100644 --- a/swap/src/main.rs +++ b/swap/src/main.rs @@ -26,7 +26,7 @@ use database::Database; use fs::{default_config_path, default_data_dir}; use log::LevelFilter; use prettytable::{row, Table}; -use protocol::{alice, bob, bob::Builder, SwapAmounts}; +use protocol::{bob, bob::Builder, SwapAmounts}; use std::{path::PathBuf, sync::Arc}; use structopt::StructOpt; use trace::init_tracing; @@ -80,42 +80,6 @@ async fn main() -> Result<()> { let execution_params = execution_params::Testnet::get_execution_params(); match opt.cmd { - Command::SellXmr { - listen_addr, - send_monero, - receive_bitcoin, - config, - } => { - let swap_amounts = SwapAmounts { - xmr: send_monero, - btc: receive_bitcoin, - }; - - let (bitcoin_wallet, monero_wallet) = - init_wallets(config.path, bitcoin_network, monero_network).await?; - - let swap_id = Uuid::new_v4(); - - info!( - "Swap sending {} and receiving {} started with ID {}", - send_monero, receive_bitcoin, swap_id - ); - - let alice_factory = alice::Builder::new( - seed, - execution_params, - swap_id, - Arc::new(bitcoin_wallet), - Arc::new(monero_wallet), - db_path, - listen_addr, - ); - let (swap, mut event_loop) = - alice_factory.with_init_params(swap_amounts).build().await?; - - tokio::spawn(async move { event_loop.run().await }); - alice::run(swap).await?; - } Command::BuyXmr { alice_peer_id, alice_addr, @@ -167,28 +131,6 @@ async fn main() -> Result<()> { // Print the table to stdout table.printstd(); } - Command::Resume(Resume::SellXmr { - swap_id, - listen_addr, - config, - }) => { - let (bitcoin_wallet, monero_wallet) = - init_wallets(config.path, bitcoin_network, monero_network).await?; - - let alice_factory = alice::Builder::new( - seed, - execution_params, - swap_id, - Arc::new(bitcoin_wallet), - Arc::new(monero_wallet), - db_path, - listen_addr, - ); - let (swap, mut event_loop) = alice_factory.build().await?; - - tokio::spawn(async move { event_loop.run().await }); - alice::run(swap).await?; - } Command::Resume(Resume::BuyXmr { swap_id, alice_peer_id,