Remove default connection details from CLI

Connecting buyers to us by default is not consistent with our vision of
a decentralised network of sellers.

Closes #395
This commit is contained in:
rishflab 2021-04-01 15:13:29 +11:00
parent 7df93faa4b
commit 9b0467d43a
3 changed files with 17 additions and 40 deletions

View File

@ -18,6 +18,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Automatic resume of unfinished swaps for the `asb` upon startup. - Automatic resume of unfinished swaps for the `asb` upon startup.
Unfinished swaps from earlier versions will be skipped. Unfinished swaps from earlier versions will be skipped.
### Changed
- Require the buyer to specify the connection details of the peer they wish to swap with.
Throughout the public demo phase of this project, the CLI traded with us by default if the peer id and multiaddress of the seller were not specified.
Having the defaults made it easy for us to give something to the community that can easily be tested, however it is not aligned with our long-term vision of a decentralised network of sellers.
We have removed these defaults forcing the user to specify the seller they wish to trade with.
### Fixed ### Fixed
- An [issue](https://github.com/comit-network/xmr-btc-swap/issues/353) where the `swap` CLI would fail on systems that were set to a locale different than English. - An [issue](https://github.com/comit-network/xmr-btc-swap/issues/353) where the `swap` CLI would fail on systems that were set to a locale different than English.

View File

@ -8,7 +8,13 @@ More information about the protocol in this [presentation](https://youtu.be/Jj8r
## Quick start - CLI ## Quick start - CLI
1. Download the [latest `swap` binary release](https://github.com/comit-network/xmr-btc-swap/releases/latest) for your operating system 1. Download the [latest `swap` binary release](https://github.com/comit-network/xmr-btc-swap/releases/latest) for your operating system
2. Run the binary: `./swap buy-xmr --receive-address <YOUR MONERO ADDRESS>` 2. Run the binary specifying the monero address where you wish to receive monero and the connection details of the seller:
`./swap buy-xmr --receive-address <YOUR MONERO ADDRESS> --seller-peer-id <SELLERS PEER ID> --seller-multiaddr <SELLERS MULTIADDRESS>`
You can generate a receive address using your monero wallet.
The seller will provide you their peer id and multiaddress.
We are running an `asb` instance on testnet.
You can swap with to get familiar with the `swap` CLI.
Our peer id is `12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi` and our multiaddress is `/dns4/xmr-btc-asb.coblox.tech/tcp/9876`
3. Follow the instructions printed to the terminal 3. Follow the instructions printed to the terminal
## Limitations ## Limitations

View File

@ -7,9 +7,6 @@ use std::str::FromStr;
use url::Url; use url::Url;
use uuid::Uuid; use uuid::Uuid;
pub const DEFAULT_ALICE_MULTIADDR: &str = "/dns4/xmr-btc-asb.coblox.tech/tcp/9876";
pub const DEFAULT_ALICE_PEER_ID: &str = "12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi";
// Port is assumed to be stagenet standard port 38081 // Port is assumed to be stagenet standard port 38081
pub const DEFAULT_STAGENET_MONERO_DAEMON_HOST: &str = "monero-stagenet.exan.tech"; pub const DEFAULT_STAGENET_MONERO_DAEMON_HOST: &str = "monero-stagenet.exan.tech";
@ -37,18 +34,10 @@ pub struct Arguments {
pub enum Command { pub enum Command {
/// Start a XMR for BTC swap /// Start a XMR for BTC swap
BuyXmr { BuyXmr {
#[structopt( #[structopt(long = "seller-peer-id", help = "The seller's peer id")]
long = "seller-peer-id",
default_value = DEFAULT_ALICE_PEER_ID,
help = "The peer id of a specific swap partner can be optionally provided"
)]
alice_peer_id: PeerId, alice_peer_id: PeerId,
#[structopt( #[structopt(long = "seller-addr", help = "The seller's multiaddress")]
long = "seller-addr",
default_value = DEFAULT_ALICE_MULTIADDR,
help = "The multiaddr of a specific swap partner can be optionally provided"
)]
alice_multiaddr: Multiaddr, alice_multiaddr: Multiaddr,
#[structopt(long = "electrum-rpc", #[structopt(long = "electrum-rpc",
@ -70,11 +59,7 @@ pub enum Command {
)] )]
swap_id: Uuid, swap_id: Uuid,
#[structopt( #[structopt(long = "seller-addr", help = "The seller's multiaddress")]
long = "seller-addr",
default_value = DEFAULT_ALICE_MULTIADDR,
help = "The multiaddr of a specific swap partner can be optionally provided"
)]
alice_multiaddr: Multiaddr, alice_multiaddr: Multiaddr,
#[structopt(long = "electrum-rpc", #[structopt(long = "electrum-rpc",
@ -173,24 +158,3 @@ fn parse_monero_address(s: &str) -> Result<monero::Address> {
) )
}) })
} }
#[cfg(test)]
mod tests {
use crate::cli::command::{DEFAULT_ALICE_MULTIADDR, DEFAULT_ALICE_PEER_ID};
use libp2p::core::Multiaddr;
use libp2p::PeerId;
#[test]
fn parse_default_alice_peer_id_success() {
DEFAULT_ALICE_PEER_ID
.parse::<PeerId>()
.expect("default alice peer id str is a valid PeerId");
}
#[test]
fn parse_default_alice_multiaddr_success() {
DEFAULT_ALICE_MULTIADDR
.parse::<Multiaddr>()
.expect("default alice multiaddr str is a valid Multiaddr>");
}
}