Add electrum_client
This commit is contained in:
parent
7774207e01
commit
ed37accb67
@ -8,6 +8,7 @@ anyhow = "1.0"
|
|||||||
bitcoin = { version = "0.31.1", features = ["serde"] }
|
bitcoin = { version = "0.31.1", features = ["serde"] }
|
||||||
bitcoincore-rpc = { version = "0.18" }
|
bitcoincore-rpc = { version = "0.18" }
|
||||||
bitcoincore-zmq = "1.4.0"
|
bitcoincore-zmq = "1.4.0"
|
||||||
|
electrum-client = { git = "https://github.com/cygnet3/rust-electrum-client", branch = "sp_tweaks" }
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
futures-util = { version = "0.3.28", default-features = false, features = ["sink", "std"] }
|
futures-util = { version = "0.3.28", default-features = false, features = ["sink", "std"] }
|
||||||
log = "0.4.20"
|
log = "0.4.20"
|
||||||
|
15
src/electrumclient.rs
Normal file
15
src/electrumclient.rs
Normal 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)
|
||||||
|
}
|
@ -23,6 +23,7 @@ mod daemon;
|
|||||||
mod spclient;
|
mod spclient;
|
||||||
mod constants;
|
mod constants;
|
||||||
mod db;
|
mod db;
|
||||||
|
mod electrumclient;
|
||||||
|
|
||||||
use crate::daemon::Daemon;
|
use crate::daemon::Daemon;
|
||||||
use crate::sp::VinData;
|
use crate::sp::VinData;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user