Skip to content

Commit

Permalink
make resolvers configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedberg committed May 13, 2024
1 parent 1e5a22b commit 47d79f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ serde = ["serde_crate", "serde_yaml", "bp-std/serde", "descriptors/serde", "rgb-
features = ["all"]

[patch.crates-io]
bp-esplora = { git = "https://github.com/zoedberg/bp-esplora-client", branch = "add_config" }
strict_encoding = { git = "https://github.com/strict-types/strict-encoding", branch = "develop" }
strict_types = { git = "https://github.com/strict-types/strict-types", branch = "develop" }
commit_verify = { git = "https://github.com/LNP-BP/client_side_validation", branch = "develop" }
Expand Down
12 changes: 7 additions & 5 deletions src/resolvers/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,21 @@ pub struct AnyResolver {

impl AnyResolver {
#[cfg(feature = "electrum_blocking")]
pub fn electrum_blocking(url: &str) -> Result<Self, String> {
pub fn electrum_blocking(url: &str, config: Option<electrum::Config>) -> Result<Self, String> {
Ok(AnyResolver {
inner: Box::new(electrum::Client::new(url).map_err(|e| e.to_string())?),
inner: Box::new(
electrum::Client::from_config(url, config.unwrap_or_default())
.map_err(|e| e.to_string())?,
),
terminal_txes: Default::default(),
})
}

#[cfg(feature = "esplora_blocking")]
pub fn esplora_blocking(url: &str) -> Result<Self, String> {
pub fn esplora_blocking(url: &str, config: Option<esplora::Config>) -> Result<Self, String> {
Ok(AnyResolver {
inner: Box::new(
esplora::Builder::new(url)
.build_blocking()
esplora::BlockingClient::from_config(url, config.unwrap_or_default())
.map_err(|e| e.to_string())?,
),
terminal_txes: Default::default(),
Expand Down

0 comments on commit 47d79f6

Please sign in to comment.