diff --git a/src/batch.rs b/src/batch.rs index 5d47bcd..5fdb130 100644 --- a/src/batch.rs +++ b/src/batch.rs @@ -22,6 +22,11 @@ pub struct Batch { } impl Batch { + /// Add a raw request to the batch queue + pub fn raw(&mut self, method: String, params: Vec) { + self.calls.push((method, params)); + } + /// Add one `blockchain.scripthash.listunspent` request to the batch queue pub fn script_list_unspent(&mut self, script: &Script) { let params = vec![Param::String(script.to_electrum_scripthash().to_hex())]; diff --git a/src/config.rs b/src/config.rs index c1ff2cd..47da1f9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,6 +1,11 @@ -use crate::Error; use std::time::Duration; +/// Configuration for an electrum client +/// +/// Refer to [`Client::from_config`] and [`ClientType::from_config`]. +/// +/// [`Client::from_config`]: crate::Client::from_config +/// [`ClientType::from_config`]: crate::ClientType::from_config #[derive(Debug, Clone)] pub struct Config { /// Proxy socks5 configuration, default None @@ -98,19 +103,35 @@ impl Socks5Config { } impl Config { + /// Get the configuration for `socks5` + /// + /// Set this with [`ConfigBuilder::socks5`] pub fn socks5(&self) -> &Option { &self.socks5 } + + /// Get the configuration for `retry` + /// + /// Set this with [`ConfigBuilder::retry`] pub fn retry(&self) -> u8 { self.retry } + + /// Get the configuration for `timeout` + /// + /// Set this with [`ConfigBuilder::timeout`] pub fn timeout(&self) -> Option { self.timeout } + + /// Get the configuration for `validate_domain` + /// + /// Set this with [`ConfigBuilder::validate_domain`] pub fn validate_domain(&self) -> bool { self.validate_domain } + /// Convenience method for calling [`ConfigBuilder::new`] pub fn builder() -> ConfigBuilder { ConfigBuilder::new() } diff --git a/src/types.rs b/src/types.rs index 12315f5..fcbce32 100644 --- a/src/types.rs +++ b/src/types.rs @@ -17,7 +17,7 @@ use serde::{de, Deserialize, Serialize}; static JSONRPC_2_0: &str = "2.0"; -pub type Call = (String, Vec); +pub(crate) type Call = (String, Vec); #[derive(Serialize, Clone)] #[serde(untagged)]