From e3777792007de53cb1385567cefc4cf1c2166201 Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Thu, 10 Dec 2020 18:06:56 +1100 Subject: [PATCH] Replace the roles on the CLI by swap direction (buy-/sell-xmr) The user should not be exposed to the cryptographic roles, thus we opted to remove them from the CLI. We opted for using buy-xmr and sell-xmr for indicating the swap direction. Eventually we could try to imply the role from currency params of send and receive. This makes the CLI impl more complex though, because we have to cater for the allowed combinations. It can be done in a later iteration. --- swap/src/bin/swap.rs | 8 ++++---- swap/src/cli.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/swap/src/bin/swap.rs b/swap/src/bin/swap.rs index 806fd158..b0bcba81 100644 --- a/swap/src/bin/swap.rs +++ b/swap/src/bin/swap.rs @@ -52,7 +52,7 @@ async fn main() -> Result<()> { let rng = &mut OsRng; match opt { - Options::Alice { + Options::SellXmr { bitcoind_url, bitcoin_wallet_name, monero_wallet_rpc_url, @@ -61,7 +61,7 @@ async fn main() -> Result<()> { send_monero, receive_bitcoin, } => { - info!("running swap node as Alice ..."); + info!("running swap node as Alice for selling XMR ..."); let behaviour = alice::Behaviour::default(); let alice_peer_id = behaviour.peer_id().clone(); @@ -142,7 +142,7 @@ async fn main() -> Result<()> { ) .await?; } - Options::Bob { + Options::BuyXmr { alice_addr, alice_peer_id, bitcoind_url, @@ -152,7 +152,7 @@ async fn main() -> Result<()> { send_bitcoin, receive_monero, } => { - info!("running swap node as Bob ..."); + info!("running swap node as Bob for buying XMR ..."); let behaviour = bob::Behaviour::default(); let local_key_pair = behaviour.identity(); diff --git a/swap/src/cli.rs b/swap/src/cli.rs index dbee766c..53c5eb3b 100644 --- a/swap/src/cli.rs +++ b/swap/src/cli.rs @@ -6,7 +6,7 @@ use uuid::Uuid; #[derive(structopt::StructOpt, Debug)] #[structopt(name = "xmr-btc-swap", about = "Trustless XMR BTC swaps")] pub enum Options { - Alice { + SellXmr { #[structopt( short = "b", long = "bitcoind", @@ -40,7 +40,7 @@ pub enum Options { #[structopt(short = "r", long = "receive-sats", parse(try_from_str = parse_sats))] receive_bitcoin: bitcoin::Amount, }, - Bob { + BuyXmr { #[structopt(short = "a", long = "alice-addr")] alice_addr: Multiaddr,