mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-07 22:12:51 -04:00
Add the list-sellers
command to the CLI
This command uses a rendezvous node to find sellers (i.e. ASBs) and query them for quotes. Sellers, that can be dialed and queried for a quote will be listed.
This commit is contained in:
parent
f45cde84ab
commit
ff10edd8a4
13 changed files with 800 additions and 247 deletions
|
@ -1,5 +1,6 @@
|
|||
use crate::env::GetConfig;
|
||||
use crate::fs::system_data_dir;
|
||||
use crate::network::rendezvous::{XmrBtcNamespace, DEFAULT_RENDEZVOUS_ADDRESS};
|
||||
use crate::{env, monero};
|
||||
use anyhow::{Context, Result};
|
||||
use libp2p::core::Multiaddr;
|
||||
|
@ -188,6 +189,20 @@ where
|
|||
bitcoin_target_block: bitcoin_target_block_from(bitcoin_target_block, is_testnet),
|
||||
},
|
||||
},
|
||||
RawCommand::ListSellers {
|
||||
rendezvous_node_addr,
|
||||
tor: Tor { tor_socks5_port },
|
||||
} => Arguments {
|
||||
env_config: env_config_from(is_testnet),
|
||||
debug,
|
||||
json,
|
||||
data_dir: data::data_dir_from(data, is_testnet)?,
|
||||
cmd: Command::ListSellers {
|
||||
rendezvous_node_addr,
|
||||
namespace: rendezvous_namespace_from(is_testnet),
|
||||
tor_socks5_port,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Ok(ParseResult::Arguments(arguments))
|
||||
|
@ -224,6 +239,11 @@ pub enum Command {
|
|||
bitcoin_electrum_rpc_url: Url,
|
||||
bitcoin_target_block: usize,
|
||||
},
|
||||
ListSellers {
|
||||
rendezvous_node_addr: Multiaddr,
|
||||
namespace: XmrBtcNamespace,
|
||||
tor_socks5_port: u16,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(structopt::StructOpt, Debug)]
|
||||
|
@ -311,6 +331,17 @@ pub enum RawCommand {
|
|||
#[structopt(flatten)]
|
||||
bitcoin: Bitcoin,
|
||||
},
|
||||
ListSellers {
|
||||
#[structopt(
|
||||
long,
|
||||
help = "The multiaddr (including peer-id) of a rendezvous node that sellers register with",
|
||||
default_value = DEFAULT_RENDEZVOUS_ADDRESS
|
||||
)]
|
||||
rendezvous_node_addr: Multiaddr,
|
||||
|
||||
#[structopt(flatten)]
|
||||
tor: Tor,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(structopt::StructOpt, Debug)]
|
||||
|
@ -406,6 +437,14 @@ fn bitcoin_electrum_rpc_url_from(url: Option<Url>, testnet: bool) -> Result<Url>
|
|||
}
|
||||
}
|
||||
|
||||
fn rendezvous_namespace_from(is_testnet: bool) -> XmrBtcNamespace {
|
||||
if is_testnet {
|
||||
XmrBtcNamespace::Testnet
|
||||
} else {
|
||||
XmrBtcNamespace::Mainnet
|
||||
}
|
||||
}
|
||||
|
||||
fn bitcoin_target_block_from(target_block: Option<usize>, testnet: bool) -> usize {
|
||||
if let Some(target_block) = target_block {
|
||||
target_block
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue