mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Refactor ASB test-/mainnet default dir init
This commit is contained in:
parent
cfa85e0bad
commit
1aaffb09f9
@ -33,15 +33,10 @@ pub struct Defaults {
|
|||||||
impl GetDefaults for Testnet {
|
impl GetDefaults for Testnet {
|
||||||
fn getConfigFileDefaults() -> Result<Defaults> {
|
fn getConfigFileDefaults() -> Result<Defaults> {
|
||||||
let defaults = Defaults {
|
let defaults = Defaults {
|
||||||
config_path: system_config_dir()
|
config_path: default_asb_config_dir()?
|
||||||
.map(|dir| Path::join(&dir, "asb"))
|
.join("testnet")
|
||||||
.map(|dir| Path::join(&dir, "testnet"))
|
.join("config.toml"),
|
||||||
.map(|dir| Path::join(&dir, "config.toml"))
|
data_dir: default_asb_data_dir()?.join("testnet"),
|
||||||
.context("Could not generate default config file path")?,
|
|
||||||
data_dir: system_data_dir()
|
|
||||||
.map(|proj_dir| Path::join(&proj_dir, "asb"))
|
|
||||||
.map(|proj_dir| Path::join(&proj_dir, "testnet"))
|
|
||||||
.context("Could not generate default data dir")?,
|
|
||||||
listen_address_tcp: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9939")?,
|
listen_address_tcp: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9939")?,
|
||||||
listen_address_ws: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9940/ws")?,
|
listen_address_ws: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9940/ws")?,
|
||||||
electrum_rpc_url: Url::parse("ssl://electrum.blockstream.info:60002")?,
|
electrum_rpc_url: Url::parse("ssl://electrum.blockstream.info:60002")?,
|
||||||
@ -56,15 +51,10 @@ impl GetDefaults for Testnet {
|
|||||||
impl GetDefaults for Mainnet {
|
impl GetDefaults for Mainnet {
|
||||||
fn getConfigFileDefaults() -> Result<Defaults> {
|
fn getConfigFileDefaults() -> Result<Defaults> {
|
||||||
let defaults = Defaults {
|
let defaults = Defaults {
|
||||||
config_path: system_config_dir()
|
config_path: default_asb_config_dir()?
|
||||||
.map(|dir| Path::join(&dir, "asb"))
|
.join("mainnet")
|
||||||
.map(|dir| Path::join(&dir, "mainnet"))
|
.join("config.toml"),
|
||||||
.map(|dir| Path::join(&dir, "config.toml"))
|
data_dir: default_asb_data_dir()?.join("mainnet"),
|
||||||
.context("Could not generate default config file path")?,
|
|
||||||
data_dir: system_data_dir()
|
|
||||||
.map(|proj_dir| Path::join(&proj_dir, "asb"))
|
|
||||||
.map(|proj_dir| Path::join(&proj_dir, "mainnet"))
|
|
||||||
.context("Could not generate default data dir")?,
|
|
||||||
listen_address_tcp: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9939")?,
|
listen_address_tcp: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9939")?,
|
||||||
listen_address_ws: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9940/ws")?,
|
listen_address_ws: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9940/ws")?,
|
||||||
electrum_rpc_url: Url::parse("ssl://electrum.blockstream.info:50002")?,
|
electrum_rpc_url: Url::parse("ssl://electrum.blockstream.info:50002")?,
|
||||||
@ -76,6 +66,18 @@ impl GetDefaults for Mainnet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_asb_config_dir() -> Result<PathBuf> {
|
||||||
|
system_config_dir()
|
||||||
|
.map(|dir| Path::join(&dir, "asb"))
|
||||||
|
.context("Could not generate default config file path")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_asb_data_dir() -> Result<PathBuf> {
|
||||||
|
system_data_dir()
|
||||||
|
.map(|dir| Path::join(&dir, "asb"))
|
||||||
|
.context("Could not generate default config file path")
|
||||||
|
}
|
||||||
|
|
||||||
const DEFAULT_MIN_BUY_AMOUNT: f64 = 0.002f64;
|
const DEFAULT_MIN_BUY_AMOUNT: f64 = 0.002f64;
|
||||||
const DEFAULT_MAX_BUY_AMOUNT: f64 = 0.02f64;
|
const DEFAULT_MAX_BUY_AMOUNT: f64 = 0.02f64;
|
||||||
const DEFAULT_SPREAD: f64 = 0.02f64;
|
const DEFAULT_SPREAD: f64 = 0.02f64;
|
||||||
|
Loading…
Reference in New Issue
Block a user