Move main.rs to cli.rs to prepare for nectar binary

This commit is contained in:
Franck Royer 2021-02-04 16:42:14 +11:00
parent 311ba74cd6
commit 788445964a
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
4 changed files with 30 additions and 26 deletions

View File

@ -5,6 +5,12 @@ authors = ["CoBloX developers <team@coblox.tech>"]
edition = "2018" edition = "2018"
description = "XMR/BTC trustless atomic swaps." description = "XMR/BTC trustless atomic swaps."
[[bin]]
name = "cli"
[lib]
name = "swap"
[dependencies] [dependencies]
anyhow = "1" anyhow = "1"
async-recursion = "0.3.1" async-recursion = "0.3.1"

View File

@ -12,41 +12,34 @@
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
use crate::{ use anyhow::{Context, Result};
use log::LevelFilter;
use prettytable::{row, Table};
use std::{path::PathBuf, sync::Arc};
use structopt::StructOpt;
use swap::{
bitcoin,
cli::{Cancel, Command, Options, Refund, Resume}, cli::{Cancel, Command, Options, Refund, Resume},
config,
config::{ config::{
initial_setup, query_user_for_initial_testnet_config, read_config, ConfigNotInitialized, initial_setup, query_user_for_initial_testnet_config, read_config, ConfigNotInitialized,
}, },
database::Database,
execution_params,
execution_params::GetExecutionParams, execution_params::GetExecutionParams,
fs::{default_config_path, default_data_dir},
monero,
monero::{CreateWallet, OpenWallet}, monero::{CreateWallet, OpenWallet},
protocol::bob::cancel::CancelError, protocol::{
bob,
bob::{cancel::CancelError, Builder},
SwapAmounts,
},
trace::init_tracing,
}; };
use anyhow::{Context, Result};
use database::Database;
use fs::{default_config_path, default_data_dir};
use log::LevelFilter;
use prettytable::{row, Table};
use protocol::{bob, bob::Builder, SwapAmounts};
use std::{path::PathBuf, sync::Arc};
use structopt::StructOpt;
use trace::init_tracing;
use tracing::{error, info, warn}; use tracing::{error, info, warn};
use uuid::Uuid; use uuid::Uuid;
pub mod bitcoin;
pub mod config;
pub mod database;
pub mod execution_params;
pub mod monero;
pub mod network;
pub mod protocol;
pub mod seed;
pub mod trace;
mod cli;
mod fs;
mod serde_peer_id;
#[macro_use] #[macro_use]
extern crate prettytable; extern crate prettytable;
@ -70,7 +63,7 @@ async fn main() -> Result<()> {
); );
let db_path = data_dir.join("database"); let db_path = data_dir.join("database");
let seed = config::seed::Seed::from_file_or_generate(&data_dir) let seed = config::Seed::from_file_or_generate(&data_dir)
.expect("Could not retrieve/initialize seed") .expect("Could not retrieve/initialize seed")
.into(); .into();

View File

@ -13,6 +13,8 @@ use url::Url;
pub mod seed; pub mod seed;
pub use seed::Seed;
const DEFAULT_BITCOIND_TESTNET_URL: &str = "http://127.0.0.1:18332"; const DEFAULT_BITCOIND_TESTNET_URL: &str = "http://127.0.0.1:18332";
const DEFAULT_MONERO_WALLET_RPC_TESTNET_URL: &str = "http://127.0.0.1:38083/json_rpc"; const DEFAULT_MONERO_WALLET_RPC_TESTNET_URL: &str = "http://127.0.0.1:38083/json_rpc";

View File

@ -17,8 +17,11 @@
)] )]
pub mod bitcoin; pub mod bitcoin;
pub mod cli;
pub mod config;
pub mod database; pub mod database;
pub mod execution_params; pub mod execution_params;
pub mod fs;
pub mod monero; pub mod monero;
pub mod network; pub mod network;
pub mod protocol; pub mod protocol;