Remove sell-xmr from CLI

This commit is contained in:
Franck Royer 2021-02-04 16:33:13 +11:00
parent 639b3169d8
commit 311ba74cd6
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 1 additions and 82 deletions

View File

@ -19,19 +19,6 @@ pub struct Options {
#[derive(structopt::StructOpt, Debug)] #[derive(structopt::StructOpt, Debug)]
#[structopt(name = "xmr_btc-swap", about = "XMR BTC atomic swap")] #[structopt(name = "xmr_btc-swap", about = "XMR BTC atomic swap")]
pub enum Command { 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 { BuyXmr {
#[structopt(long = "connect-peer-id")] #[structopt(long = "connect-peer-id")]
alice_peer_id: PeerId, alice_peer_id: PeerId,
@ -56,16 +43,6 @@ pub enum Command {
#[derive(structopt::StructOpt, Debug)] #[derive(structopt::StructOpt, Debug)]
pub enum Resume { 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 { BuyXmr {
#[structopt(long = "swap-id")] #[structopt(long = "swap-id")]
swap_id: Uuid, swap_id: Uuid,

View File

@ -26,7 +26,7 @@ use database::Database;
use fs::{default_config_path, default_data_dir}; use fs::{default_config_path, default_data_dir};
use log::LevelFilter; use log::LevelFilter;
use prettytable::{row, Table}; use prettytable::{row, Table};
use protocol::{alice, bob, bob::Builder, SwapAmounts}; use protocol::{bob, bob::Builder, SwapAmounts};
use std::{path::PathBuf, sync::Arc}; use std::{path::PathBuf, sync::Arc};
use structopt::StructOpt; use structopt::StructOpt;
use trace::init_tracing; use trace::init_tracing;
@ -80,42 +80,6 @@ async fn main() -> Result<()> {
let execution_params = execution_params::Testnet::get_execution_params(); let execution_params = execution_params::Testnet::get_execution_params();
match opt.cmd { 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 { Command::BuyXmr {
alice_peer_id, alice_peer_id,
alice_addr, alice_addr,
@ -167,28 +131,6 @@ async fn main() -> Result<()> {
// Print the table to stdout // Print the table to stdout
table.printstd(); 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 { Command::Resume(Resume::BuyXmr {
swap_id, swap_id,
alice_peer_id, alice_peer_id,