diff --git a/src/lnd/client.rs b/src/lnd/client.rs index ff215e5..ebc078b 100644 --- a/src/lnd/client.rs +++ b/src/lnd/client.rs @@ -1,13 +1,12 @@ -use crate::{settings, utils}; -use hex; use std::collections::HashMap; use std::error::Error; use std::fs; -use config::Config; -use lnd_grpc_rust::{invoicesrpc, LndClient, lnrpc, routerrpc}; +use hex; +use lnd_grpc_rust::{lnrpc, LndClient}; use tokio::sync::{Mutex, MutexGuard}; -use crate::schema::scripts::address; + +use crate::{settings, utils}; #[derive(Clone)] pub struct LNDConfig { @@ -27,8 +26,10 @@ pub fn get_lnd_config(cfg: &settings::Config) -> Result Result Result { + /* pub async fn get_info(&self) -> Result { let mut client = self.get_client().await; let resp = client.lightning().get_info(lnrpc::GetInfoRequest {}).await; match resp { @@ -286,8 +287,10 @@ impl LNDGateway { } pub fn buffer_as_hex(bytes: Vec) -> String { - let hex_str = bytes.iter().map(|b| format!("{:02x}", b)).collect::(); - + let hex_str = bytes + .iter() + .map(|b| format!("{:02x}", b)) + .collect::(); return hex_str; } diff --git a/src/main.rs b/src/main.rs index db07d8e..d024434 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,29 +29,27 @@ async fn main() { } async fn run() { - let cfg = settings::build_config().unwrap(); let db = DB::new(&cfg); let migration_conn = &mut db.get_conn().unwrap(); db::run_migrations(migration_conn).unwrap(); match wallet::LooperWallet::new(&cfg) { - Ok(wallet) => { - match LNDGateway::new().await { - Ok(lndg) => { - let loopout_svc = services::loop_out::LoopOutService::new(&cfg, db, wallet, lndg).unwrap(); - let server = api::server::LooperServer::new(loopout_svc); - server.start(); - let stdin = io::stdin(); - let _line = stdin.lock().lines().next().unwrap().unwrap(); - }, - Err(err)=> { - panic!("could not start the lndGateway {} ", err.msg); - } + Ok(wallet) => match LNDGateway::new().await { + Ok(lndg) => { + let loopout_svc = + services::loop_out::LoopOutService::new(&cfg, db, wallet, lndg).unwrap(); + let server = api::server::LooperServer::new(loopout_svc); + server.start(); + let stdin = io::stdin(); + let _line = stdin.lock().lines().next().unwrap().unwrap(); + } + Err(err) => { + panic!("could not start the lndGateway {} ", err.msg); } }, - Err(err)=> { - panic!("could not create the wallet {} ", err.message); - } + Err(err) => { + panic!("could not create the wallet {} ", err.message); + } } }