2020-12-18 01:39:04 -05:00
|
|
|
use libp2p::{core::Multiaddr, PeerId};
|
2021-01-26 21:33:32 -05:00
|
|
|
use std::path::PathBuf;
|
2020-11-05 19:10:22 -05:00
|
|
|
use uuid::Uuid;
|
2020-10-28 23:45:45 -04:00
|
|
|
|
2021-02-24 20:05:07 -05:00
|
|
|
const DEFAULT_ALICE_MULTIADDR: &str = "/dns4/xmr-btc-asb.coblox.tech/tcp/9876";
|
|
|
|
const DEFAULT_ALICE_PEER_ID: &str = "12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi";
|
|
|
|
|
2020-12-15 05:26:02 -05:00
|
|
|
#[derive(structopt::StructOpt, Debug)]
|
2021-02-10 17:47:42 -05:00
|
|
|
pub struct Arguments {
|
2021-01-26 21:33:32 -05:00
|
|
|
#[structopt(
|
2021-02-10 23:21:34 -05:00
|
|
|
long = "config",
|
|
|
|
help = "Provide a custom path to the configuration file. The configuration file must be a toml file.",
|
2021-01-26 21:33:32 -05:00
|
|
|
parse(from_os_str)
|
|
|
|
)]
|
2021-02-10 23:21:34 -05:00
|
|
|
pub config: Option<PathBuf>,
|
2020-12-15 05:26:02 -05:00
|
|
|
|
|
|
|
#[structopt(subcommand)]
|
|
|
|
pub cmd: Command,
|
|
|
|
}
|
|
|
|
|
2020-10-15 18:14:39 -04:00
|
|
|
#[derive(structopt::StructOpt, Debug)]
|
2021-01-04 22:08:36 -05:00
|
|
|
#[structopt(name = "xmr_btc-swap", about = "XMR BTC atomic swap")]
|
2020-12-15 05:26:02 -05:00
|
|
|
pub enum Command {
|
2020-12-04 00:27:17 -05:00
|
|
|
BuyXmr {
|
2021-02-24 20:05:07 -05:00
|
|
|
#[structopt(long = "connect-peer-id", default_value = DEFAULT_ALICE_PEER_ID)]
|
2020-12-18 01:39:04 -05:00
|
|
|
alice_peer_id: PeerId,
|
|
|
|
|
2021-02-24 20:05:07 -05:00
|
|
|
#[structopt(
|
2021-02-25 22:44:48 -05:00
|
|
|
long = "connect-addr",
|
|
|
|
default_value = DEFAULT_ALICE_MULTIADDR
|
2021-02-24 20:05:07 -05:00
|
|
|
)]
|
2020-10-29 07:18:59 -04:00
|
|
|
alice_addr: Multiaddr,
|
2020-10-28 23:45:45 -04:00
|
|
|
},
|
2020-11-05 00:55:30 -05:00
|
|
|
History,
|
2021-02-25 22:44:48 -05:00
|
|
|
Resume {
|
2020-12-20 22:43:44 -05:00
|
|
|
#[structopt(long = "swap-id")]
|
|
|
|
swap_id: Uuid,
|
|
|
|
|
2021-02-25 22:44:48 -05:00
|
|
|
// TODO: Remove Alice peer-id/address, it should be saved in the database when running swap
|
|
|
|
// and loaded from the database when running resume/cancel/refund
|
2021-02-24 20:05:07 -05:00
|
|
|
#[structopt(long = "counterpart-peer-id", default_value = DEFAULT_ALICE_PEER_ID)]
|
2020-12-18 01:39:04 -05:00
|
|
|
alice_peer_id: PeerId,
|
|
|
|
|
2021-02-24 20:05:07 -05:00
|
|
|
#[structopt(
|
2021-02-25 22:44:48 -05:00
|
|
|
long = "counterpart-addr",
|
|
|
|
default_value = DEFAULT_ALICE_MULTIADDR
|
2021-02-24 20:05:07 -05:00
|
|
|
)]
|
2020-12-18 01:39:04 -05:00
|
|
|
alice_addr: Multiaddr,
|
2020-11-05 19:10:22 -05:00
|
|
|
},
|
2021-02-25 22:44:48 -05:00
|
|
|
Cancel {
|
2021-02-01 00:10:43 -05:00
|
|
|
#[structopt(long = "swap-id")]
|
2021-02-01 00:25:33 -05:00
|
|
|
swap_id: Uuid,
|
|
|
|
|
|
|
|
// TODO: Remove Alice peer-id/address, it should be saved in the database when running swap
|
|
|
|
// and loaded from the database when running resume/cancel/refund
|
2021-02-24 20:05:07 -05:00
|
|
|
#[structopt(long = "counterpart-peer-id", default_value = DEFAULT_ALICE_PEER_ID)]
|
2021-02-01 00:25:33 -05:00
|
|
|
alice_peer_id: PeerId,
|
2021-02-24 20:05:07 -05:00
|
|
|
|
|
|
|
#[structopt(
|
2021-02-25 22:44:48 -05:00
|
|
|
long = "counterpart-addr",
|
|
|
|
default_value = DEFAULT_ALICE_MULTIADDR
|
|
|
|
)]
|
2021-02-01 00:25:33 -05:00
|
|
|
alice_addr: Multiaddr,
|
|
|
|
|
2021-02-01 06:32:54 -05:00
|
|
|
#[structopt(short, long)]
|
|
|
|
force: bool,
|
2021-02-01 00:25:33 -05:00
|
|
|
},
|
2021-02-25 22:44:48 -05:00
|
|
|
Refund {
|
2021-02-01 00:25:33 -05:00
|
|
|
#[structopt(long = "swap-id")]
|
2021-02-01 00:10:43 -05:00
|
|
|
swap_id: Uuid,
|
|
|
|
|
|
|
|
// TODO: Remove Alice peer-id/address, it should be saved in the database when running swap
|
|
|
|
// and loaded from the database when running resume/cancel/refund
|
2021-02-24 20:05:07 -05:00
|
|
|
#[structopt(long = "counterpart-peer-id", default_value = DEFAULT_ALICE_PEER_ID)]
|
2021-02-01 00:10:43 -05:00
|
|
|
alice_peer_id: PeerId,
|
2021-02-24 20:05:07 -05:00
|
|
|
|
|
|
|
#[structopt(
|
2021-02-25 22:44:48 -05:00
|
|
|
long = "counterpart-addr",
|
|
|
|
default_value = DEFAULT_ALICE_MULTIADDR
|
2021-02-24 20:05:07 -05:00
|
|
|
)]
|
2021-02-01 00:10:43 -05:00
|
|
|
alice_addr: Multiaddr,
|
|
|
|
|
2021-02-01 06:32:54 -05:00
|
|
|
#[structopt(short, long)]
|
|
|
|
force: bool,
|
2021-02-01 00:10:43 -05:00
|
|
|
},
|
|
|
|
}
|