Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
This is version `3.0.0` of the BDK language bindings! This release uses the following Rust dependencies:

- bdk_wallet `3.0.0`
- bdk_electrum `0.23.2`
- bdk_electrum `0.24.0`
- bdk_esplora `0.22.1`
- bdk_kyoto `0.17.0`
- bitcoin `0.32.8`
Expand All @@ -35,6 +35,7 @@ This is version `3.0.0` of the BDK language bindings! This release uses the foll
- New `DescriptorPublicKey::add_wildcard` method, which adds an unhardened wildcard to the derivation path of the descriptor [#853]
- New `DescriptorSecretKey::add_wildcard(wildcard_type: WildcardType)` method, which adds a wildcard to the derivation path of the descriptor [#853]
- Exposed `new_sh`, `new_wsh`,`new_bare` and `new_sh_wsh` methods on `Descriptor` type [#988]
- Add optional `timeout` and `retry` parameters to the Electrum client constructor [#1010]

[#853]: https://github.com/bitcoindevkit/bdk-ffi/pull/853
[#945]: https://github.com/bitcoindevkit/bdk-ffi/pull/945
Expand All @@ -43,6 +44,7 @@ This is version `3.0.0` of the BDK language bindings! This release uses the foll
[#973]: https://github.com/bitcoindevkit/bdk-ffi/pull/973
[#986]: https://github.com/bitcoindevkit/bdk-ffi/pull/986
[#988]: https://github.com/bitcoindevkit/bdk-ffi/pull/988
[#1010]: https://github.com/bitcoindevkit/bdk-ffi/pull/1010

## [v2.3.0]

Expand Down
85 changes: 80 additions & 5 deletions bdk-ffi/Cargo.lock

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

2 changes: 1 addition & 1 deletion bdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ path = "uniffi-bindgen.rs"
[dependencies]
bdk_wallet = { version = "=3.0.0", features = ["all-keys", "keys-bip39", "rusqlite"] }
bdk_esplora = { version = "0.22.1", default-features = false, features = ["std", "blocking", "blocking-https-rustls"] }
bdk_electrum = { version = "0.23.2", default-features = false, features = ["use-rustls-ring"] }
bdk_electrum = { version = "0.24.0", default-features = false, features = ["use-rustls-ring"] }
bdk_kyoto = { version = "0.17.0" }

uniffi = { version = "=0.30.0", features = ["cli"]}
Expand Down
15 changes: 13 additions & 2 deletions bdk-ffi/src/electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use bdk_wallet::bitcoin::hex::{Case, DisplayHex};
use std::collections::BTreeMap;
use std::convert::TryFrom;
use std::sync::Arc;
use std::time::Duration;

/// Wrapper around an electrum_client::ElectrumApi which includes an internal in-memory transaction
/// cache to avoid re-fetching already downloaded transactions.
Expand All @@ -29,15 +30,25 @@ pub struct ElectrumClient(BdkBdkElectrumClient<bdk_electrum::electrum_client::Cl
impl ElectrumClient {
/// Creates a new bdk client from a electrum_client::ElectrumApi
/// Optional: Set the proxy of the builder
/// Optional: Set the timeout (in seconds) of the builder
/// Optional: Set the retry attempts number of the builder
/// Optional: Set whether the server's TLS certificate is validated.
#[uniffi::constructor(default(socks5 = None, validate_domain = true))]
#[uniffi::constructor(default(socks5 = None, timeout = None, retry = None, validate_domain = true))]
pub fn new(
url: String,
socks5: Option<String>,
timeout: Option<u8>,
retry: Option<u8>,
validate_domain: bool,
) -> Result<Self, ElectrumError> {
let mut config = bdk_electrum::electrum_client::ConfigBuilder::new();
config = config.validate_domain(validate_domain);
if let Some(timeout) = timeout {
config = config.timeout(Some(Duration::from_secs(timeout.into())));
}
if let Some(retry) = retry {
config = config.retry(retry);
}
if let Some(socks5) = socks5 {
config = config.socks5(Some(bdk_electrum::electrum_client::Socks5Config::new(
socks5.as_str(),
Expand Down Expand Up @@ -169,7 +180,7 @@ impl ElectrumClient {
pub fn estimate_fee(&self, number: u64) -> Result<f64, ElectrumError> {
self.0
.inner
.estimate_fee(number as usize)
.estimate_fee(number as usize, None)
.map_err(ElectrumError::from)
}

Expand Down
Loading