2021-03-02 05:22:39 +00:00
use crate ::bitcoin ::Amount ;
2021-03-04 00:28:58 +00:00
use bitcoin ::util ::amount ::ParseAmountError ;
use bitcoin ::Denomination ;
2021-02-11 04:07:01 +00:00
use std ::path ::PathBuf ;
#[ derive(structopt::StructOpt, Debug) ]
2021-03-18 00:25:31 +00:00
#[ structopt(
name = " asb " ,
about = " Automated Swap Backend for swapping XMR for BTC "
) ]
2021-02-11 04:07:01 +00:00
pub struct Arguments {
#[ structopt(
long = " config " ,
help = " Provide a custom path to the configuration file. The configuration file must be a toml file. " ,
parse ( from_os_str )
) ]
pub config : Option < PathBuf > ,
#[ structopt(subcommand) ]
pub cmd : Command ,
}
#[ derive(structopt::StructOpt, Debug) ]
#[ structopt(name = " xmr_btc-swap " , about = " XMR BTC atomic swap " ) ]
pub enum Command {
2021-02-25 02:54:12 +00:00
Start {
2021-03-02 05:22:39 +00:00
#[ structopt(long = " max-buy-btc " , help = " The maximum amount of BTC the ASB is willing to buy. " , default_value= " 0.005 " , parse(try_from_str = parse_btc)) ]
max_buy : Amount ,
2021-02-25 02:54:12 +00:00
} ,
2021-02-11 04:07:01 +00:00
History ,
}
2021-02-25 02:54:12 +00:00
2021-03-02 05:22:39 +00:00
fn parse_btc ( s : & str ) -> Result < Amount , ParseAmountError > {
Amount ::from_str_in ( s , Denomination ::Bitcoin )
2021-02-25 02:54:12 +00:00
}