Only pass btc amount to CLI

The CLI requests a quote to nectar to know how much xmr it can get.
Also align terminology with the sequence diagram.
This commit is contained in:
Franck Royer 2021-02-15 13:01:38 +11:00
parent 144da75270
commit 2dbd43e2c0
No known key found for this signature in database
GPG key ID: A82ED75A8DFC50A4
8 changed files with 77 additions and 105 deletions

View file

@ -1,4 +1,4 @@
use crate::{bitcoin, monero};
use crate::bitcoin;
use libp2p::{core::Multiaddr, PeerId};
use std::path::PathBuf;
use uuid::Uuid;
@ -28,9 +28,6 @@ pub enum Command {
#[structopt(long = "send-btc", help = "Bitcoin amount as floating point nr without denomination (e.g. 1.25)", parse(try_from_str = parse_btc))]
send_bitcoin: bitcoin::Amount,
#[structopt(long = "receive-xmr", help = "Monero amount as floating point nr without denomination (e.g. 125.1)", parse(try_from_str = parse_xmr))]
receive_monero: monero::Amount,
},
History,
Resume(Resume),
@ -92,8 +89,3 @@ fn parse_btc(str: &str) -> anyhow::Result<bitcoin::Amount> {
let amount = bitcoin::Amount::from_str_in(str, ::bitcoin::Denomination::Bitcoin)?;
Ok(amount)
}
fn parse_xmr(str: &str) -> anyhow::Result<monero::Amount> {
let amount = monero::Amount::parse_monero(str)?;
Ok(amount)
}