Add electrum_client

This commit is contained in:
Sosthene00 2024-03-15 12:39:04 +01:00
parent 7774207e01
commit ed37accb67
3 changed files with 17 additions and 0 deletions

View File

@ -8,6 +8,7 @@ anyhow = "1.0"
bitcoin = { version = "0.31.1", features = ["serde"] }
bitcoincore-rpc = { version = "0.18" }
bitcoincore-zmq = "1.4.0"
electrum-client = { git = "https://github.com/cygnet3/rust-electrum-client", branch = "sp_tweaks" }
env_logger = "0.9"
futures-util = { version = "0.3.28", default-features = false, features = ["sink", "std"] }
log = "0.4.20"

15
src/electrumclient.rs Normal file
View File

@ -0,0 +1,15 @@
use electrum_client::{Client, ConfigBuilder};
use log::info;
const ELECTRS_URI: &str = "ssl://silentpayments.dev:51002";
const VALIDATE_DOMAIN: bool = false; // self-signed cert, so we don't validate
pub fn create_electrum_client() -> anyhow::Result<Client> {
let config = ConfigBuilder::new()
.validate_domain(VALIDATE_DOMAIN)
.build();
let electrum_client = Client::from_config(ELECTRS_URI, config)?;
info!("ssl client {}", ELECTRS_URI);
Ok(electrum_client)
}

View File

@ -23,6 +23,7 @@ mod daemon;
mod spclient;
mod constants;
mod db;
mod electrumclient;
use crate::daemon::Daemon;
use crate::sp::VinData;