mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-08 06:22:39 -04:00
Sweep all from generated wallet to user wallet
The default implementation for the command was removed because it does not add additional value if we have a mandatory parameter anyway.
This commit is contained in:
parent
5111a12706
commit
66c8401c95
9 changed files with 166 additions and 40 deletions
|
@ -18,13 +18,16 @@ pub struct Arguments {
|
|||
pub debug: bool,
|
||||
|
||||
#[structopt(subcommand)]
|
||||
pub cmd: Option<Command>,
|
||||
pub cmd: Command,
|
||||
}
|
||||
|
||||
#[derive(structopt::StructOpt, Debug)]
|
||||
#[structopt(name = "xmr_btc-swap", about = "XMR BTC atomic swap")]
|
||||
pub enum Command {
|
||||
BuyXmr {
|
||||
#[structopt(long = "receive-address")]
|
||||
receive_monero_address: monero::Address,
|
||||
|
||||
#[structopt(long = "connect-peer-id", default_value = DEFAULT_ALICE_PEER_ID)]
|
||||
alice_peer_id: PeerId,
|
||||
|
||||
|
@ -36,6 +39,9 @@ pub enum Command {
|
|||
},
|
||||
History,
|
||||
Resume {
|
||||
#[structopt(long = "receive-address")]
|
||||
receive_monero_address: monero::Address,
|
||||
|
||||
#[structopt(long = "swap-id")]
|
||||
swap_id: Uuid,
|
||||
|
||||
|
@ -66,22 +72,9 @@ pub enum Command {
|
|||
},
|
||||
}
|
||||
|
||||
impl Default for Command {
|
||||
fn default() -> Self {
|
||||
Self::BuyXmr {
|
||||
alice_peer_id: DEFAULT_ALICE_PEER_ID
|
||||
.parse()
|
||||
.expect("default alice peer id str is a valid Multiaddr>"),
|
||||
alice_addr: DEFAULT_ALICE_MULTIADDR
|
||||
.parse()
|
||||
.expect("default alice multiaddr str is a valid PeerId"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::cli::command::{Command, DEFAULT_ALICE_MULTIADDR, DEFAULT_ALICE_PEER_ID};
|
||||
use crate::cli::command::{DEFAULT_ALICE_MULTIADDR, DEFAULT_ALICE_PEER_ID};
|
||||
use libp2p::{core::Multiaddr, PeerId};
|
||||
|
||||
#[test]
|
||||
|
@ -97,9 +90,4 @@ mod tests {
|
|||
.parse::<Multiaddr>()
|
||||
.expect("default alice multiaddr str is a valid Multiaddr>");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_command_success() {
|
||||
Command::default();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue