mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-09 23:12:40 -04:00
Bitcoind RPC url, wallet name and Monero RPC url through config
On startup, if the config file does not exist yet initial setup is triggered and the user is queried for Bitcoind rpc url and Bitcoin wallet name, and Monero wallet rpc url. The values entered by the user is written to config file in operating system specific default path. Upon subsequent startups the value are read from the config file. The corresponding CLI parameters were removed.
This commit is contained in:
parent
4cc74bad62
commit
b75e9b436c
7 changed files with 281 additions and 86 deletions
|
@ -1,6 +1,5 @@
|
|||
use crate::{bitcoin, monero};
|
||||
use libp2p::{core::Multiaddr, PeerId};
|
||||
use url::Url;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(structopt::StructOpt, Debug)]
|
||||
|
@ -17,18 +16,6 @@ pub struct Options {
|
|||
#[structopt(name = "xmr_btc-swap", about = "XMR BTC atomic swap")]
|
||||
pub enum Command {
|
||||
SellXmr {
|
||||
#[structopt(long = "bitcoind-rpc", default_value = "http://127.0.0.1:8332")]
|
||||
bitcoind_url: Url,
|
||||
|
||||
#[structopt(long = "bitcoin-wallet-name")]
|
||||
bitcoin_wallet_name: String,
|
||||
|
||||
#[structopt(
|
||||
long = "monero-wallet-rpc",
|
||||
default_value = "http://127.0.0.1:18083/json_rpc"
|
||||
)]
|
||||
monero_wallet_rpc_url: Url,
|
||||
|
||||
#[structopt(long = "p2p-address", default_value = "/ip4/0.0.0.0/tcp/9876")]
|
||||
listen_addr: Multiaddr,
|
||||
|
||||
|
@ -45,18 +32,6 @@ pub enum Command {
|
|||
#[structopt(long = "connect-addr")]
|
||||
alice_addr: Multiaddr,
|
||||
|
||||
#[structopt(long = "bitcoind-rpc", default_value = "http://127.0.0.1:8332")]
|
||||
bitcoind_url: Url,
|
||||
|
||||
#[structopt(long = "bitcoin-wallet-name")]
|
||||
bitcoin_wallet_name: String,
|
||||
|
||||
#[structopt(
|
||||
long = "monero-wallet-rpc",
|
||||
default_value = "http://127.0.0.1:18083/json_rpc"
|
||||
)]
|
||||
monero_wallet_rpc_url: Url,
|
||||
|
||||
#[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,
|
||||
|
||||
|
@ -73,18 +48,6 @@ pub enum Resume {
|
|||
#[structopt(long = "swap-id")]
|
||||
swap_id: Uuid,
|
||||
|
||||
#[structopt(long = "bitcoind-rpc", default_value = "http://127.0.0.1:8332")]
|
||||
bitcoind_url: Url,
|
||||
|
||||
#[structopt(long = "bitcoin-wallet-name")]
|
||||
bitcoin_wallet_name: String,
|
||||
|
||||
#[structopt(
|
||||
long = "monero-wallet-rpc",
|
||||
default_value = "http://127.0.0.1:18083/json_rpc"
|
||||
)]
|
||||
monero_wallet_rpc_url: Url,
|
||||
|
||||
#[structopt(long = "listen-address", default_value = "/ip4/127.0.0.1/tcp/9876")]
|
||||
listen_addr: Multiaddr,
|
||||
},
|
||||
|
@ -97,18 +60,6 @@ pub enum Resume {
|
|||
|
||||
#[structopt(long = "counterpart-addr")]
|
||||
alice_addr: Multiaddr,
|
||||
|
||||
#[structopt(long = "bitcoind-rpc", default_value = "http://127.0.0.1:8332")]
|
||||
bitcoind_url: Url,
|
||||
|
||||
#[structopt(long = "bitcoin-wallet-name")]
|
||||
bitcoin_wallet_name: String,
|
||||
|
||||
#[structopt(
|
||||
long = "monero-wallet-rpc",
|
||||
default_value = "http://127.0.0.1:18083/json_rpc"
|
||||
)]
|
||||
monero_wallet_rpc_url: Url,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue