Skip to content

Commit

Permalink
deps: bump bdk to beta_6
Browse files Browse the repository at this point in the history
  • Loading branch information
reez committed Dec 13, 2024
1 parent b61bb97 commit 10c4d25
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 57 deletions.
52 changes: 18 additions & 34 deletions bdk-ffi/Cargo.lock

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

8 changes: 4 additions & 4 deletions bdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ path = "uniffi-bindgen.rs"
default = ["uniffi/cli"]

[dependencies]
bdk_wallet = { version = "=1.0.0-beta.5", features = ["all-keys", "keys-bip39", "rusqlite"] }
bdk_core = { version = "0.3.0" }
bdk_esplora = { version = "0.19.0", default-features = false, features = ["std", "blocking", "blocking-https-rustls"] }
bdk_electrum = { version = "0.19.0", default-features = false, features = ["use-rustls-ring"] }
bdk_wallet = { version = "=1.0.0-beta.6", features = ["all-keys", "keys-bip39", "rusqlite"] }
bdk_core = { version = "0.4.0" }
bdk_esplora = { version = "0.20.0", default-features = false, features = ["std", "blocking", "blocking-https-rustls"] }
bdk_electrum = { version = "0.20.0", default-features = false, features = ["use-rustls-ring"] }
bitcoin-ffi = { git = "https://github.com/bitcoindevkit/bitcoin-ffi", tag = "v0.1.2" }

uniffi = { version = "=0.28.0" }
Expand Down
7 changes: 4 additions & 3 deletions bdk-ffi/src/bdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ interface EsploraError {
InvalidHttpHeaderName(string name);
InvalidHttpHeaderValue(string value);
RequestAlreadyConsumed();
InvalidResponse();
};

[Error]
Expand Down Expand Up @@ -396,11 +397,11 @@ dictionary TxOut {
/// Represents the observed position of some chain data.
[Enum]
interface ChainPosition {
/// The chain data is seen as confirmed, and in anchored by `A`.
Confirmed(ConfirmationBlockTime confirmation_block_time);
/// The chain data is confirmed as it is anchored in the best chain by `A`.
Confirmed(ConfirmationBlockTime confirmation_block_time, string? transitively);

/// The chain data is not confirmed and last seen in the mempool at this timestamp.
Unconfirmed(u64 timestamp);
Unconfirmed(u64? timestamp);
};

dictionary ConfirmationBlockTime {
Expand Down
8 changes: 4 additions & 4 deletions bdk-ffi/src/electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use crate::types::Update;
use crate::types::{FullScanRequest, SyncRequest};

use bdk_core::spk_client::FullScanRequest as BdkFullScanRequest;
use bdk_core::spk_client::FullScanResult as BdkFullScanResult;
use bdk_core::spk_client::FullScanResponse as BdkFullScanResponse;
use bdk_core::spk_client::SyncRequest as BdkSyncRequest;
use bdk_core::spk_client::SyncResult as BdkSyncResult;
use bdk_core::spk_client::SyncResponse as BdkSyncResponse;
use bdk_electrum::BdkElectrumClient as BdkBdkElectrumClient;
use bdk_wallet::bitcoin::Transaction as BdkTransaction;
use bdk_wallet::KeychainKind;
Expand Down Expand Up @@ -43,7 +43,7 @@ impl ElectrumClient {
.take()
.ok_or(ElectrumError::RequestAlreadyConsumed)?;

let full_scan_result: BdkFullScanResult<KeychainKind> = self.0.full_scan(
let full_scan_result: BdkFullScanResponse<KeychainKind> = self.0.full_scan(
request,
stop_gap as usize,
batch_size as usize,
Expand Down Expand Up @@ -73,7 +73,7 @@ impl ElectrumClient {
.take()
.ok_or(ElectrumError::RequestAlreadyConsumed)?;

let sync_result: BdkSyncResult =
let sync_result: BdkSyncResponse =
self.0
.sync(request, batch_size as usize, fetch_prev_txouts)?;

Expand Down
19 changes: 14 additions & 5 deletions bdk-ffi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bitcoin_ffi::OutPoint;

use bdk_core::bitcoin::script::PushBytesError;
use bdk_electrum::electrum_client::Error as BdkElectrumError;
use bdk_esplora::esplora_client::{Error as BdkEsploraError, Error};
use bdk_esplora::esplora_client::Error as BdkEsploraError;
use bdk_wallet::bitcoin::address::ParseError as BdkParseError;
use bdk_wallet::bitcoin::address::{FromScriptError as BdkFromScriptError, ParseError};
use bdk_wallet::bitcoin::bip32::Error as BdkBip32Error;
Expand Down Expand Up @@ -364,6 +364,9 @@ pub enum EsploraError {

#[error("the request has already been consumed")]
RequestAlreadyConsumed,

#[error("the server sent an invalid response")]
InvalidResponse,
}

#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -1084,7 +1087,7 @@ impl From<BdkEsploraError> for EsploraError {
BdkEsploraError::Parsing(e) => EsploraError::Parsing {
error_message: e.to_string(),
},
Error::StatusCode(e) => EsploraError::StatusCode {
BdkEsploraError::StatusCode(e) => EsploraError::StatusCode {
error_message: e.to_string(),
},
BdkEsploraError::BitcoinEncoding(e) => EsploraError::BitcoinEncoding {
Expand All @@ -1101,10 +1104,13 @@ impl From<BdkEsploraError> for EsploraError {
EsploraError::HeaderHeightNotFound { height }
}
BdkEsploraError::HeaderHashNotFound(_) => EsploraError::HeaderHashNotFound,
Error::InvalidHttpHeaderName(name) => EsploraError::InvalidHttpHeaderName { name },
BdkEsploraError::InvalidHttpHeaderName(name) => {
EsploraError::InvalidHttpHeaderName { name }
}
BdkEsploraError::InvalidHttpHeaderValue(value) => {
EsploraError::InvalidHttpHeaderValue { value }
}
BdkEsploraError::InvalidResponse => EsploraError::InvalidResponse,
}
}
}
Expand All @@ -1122,7 +1128,7 @@ impl From<Box<BdkEsploraError>> for EsploraError {
BdkEsploraError::Parsing(e) => EsploraError::Parsing {
error_message: e.to_string(),
},
Error::StatusCode(e) => EsploraError::StatusCode {
BdkEsploraError::StatusCode(e) => EsploraError::StatusCode {
error_message: e.to_string(),
},
BdkEsploraError::BitcoinEncoding(e) => EsploraError::BitcoinEncoding {
Expand All @@ -1139,10 +1145,13 @@ impl From<Box<BdkEsploraError>> for EsploraError {
EsploraError::HeaderHeightNotFound { height }
}
BdkEsploraError::HeaderHashNotFound(_) => EsploraError::HeaderHashNotFound,
Error::InvalidHttpHeaderName(name) => EsploraError::InvalidHttpHeaderName { name },
BdkEsploraError::InvalidHttpHeaderName(name) => {
EsploraError::InvalidHttpHeaderName { name }
}
BdkEsploraError::InvalidHttpHeaderValue(value) => {
EsploraError::InvalidHttpHeaderValue { value }
}
BdkEsploraError::InvalidResponse => EsploraError::InvalidResponse,
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions bdk-ffi/src/esplora.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use bdk_esplora::EsploraExt;
use bdk_wallet::bitcoin::Transaction as BdkTransaction;
use bdk_wallet::bitcoin::Txid;
use bdk_wallet::chain::spk_client::FullScanRequest as BdkFullScanRequest;
use bdk_wallet::chain::spk_client::FullScanResult as BdkFullScanResult;
use bdk_wallet::chain::spk_client::FullScanResponse as BdkFullScanResponse;
use bdk_wallet::chain::spk_client::SyncRequest as BdkSyncRequest;
use bdk_wallet::chain::spk_client::SyncResult as BdkSyncResult;
use bdk_wallet::chain::spk_client::SyncResponse as BdkSyncResponse;
use bdk_wallet::KeychainKind;
use bdk_wallet::Update as BdkUpdate;

Expand Down Expand Up @@ -40,7 +40,7 @@ impl EsploraClient {
.take()
.ok_or(EsploraError::RequestAlreadyConsumed)?;

let result: BdkFullScanResult<KeychainKind> =
let result: BdkFullScanResponse<KeychainKind> =
self.0
.full_scan(request, stop_gap as usize, parallel_requests as usize)?;

Expand All @@ -66,7 +66,7 @@ impl EsploraClient {
.take()
.ok_or(EsploraError::RequestAlreadyConsumed)?;

let result: BdkSyncResult = self.0.sync(request, parallel_requests as usize)?;
let result: BdkSyncResponse = self.0.sync(request, parallel_requests as usize)?;

let update = BdkUpdate {
last_active_indices: BTreeMap::default(),
Expand Down
13 changes: 10 additions & 3 deletions bdk-ffi/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ use std::sync::{Arc, Mutex};
pub enum ChainPosition {
Confirmed {
confirmation_block_time: ConfirmationBlockTime,
transitively: Option<String>,
},
Unconfirmed {
timestamp: u64,
timestamp: Option<u64>,
},
}

Expand All @@ -62,7 +63,10 @@ pub struct CanonicalTx {
impl From<BdkCanonicalTx<'_, Arc<BdkTransaction>, BdkConfirmationBlockTime>> for CanonicalTx {
fn from(tx: BdkCanonicalTx<'_, Arc<BdkTransaction>, BdkConfirmationBlockTime>) -> Self {
let chain_position = match tx.chain_position {
BdkChainPosition::Confirmed(anchor) => {
BdkChainPosition::Confirmed {
anchor,
transitively,
} => {
let block_id = BlockId {
height: anchor.block_id.height,
hash: anchor.block_id.hash.to_string(),
Expand All @@ -72,9 +76,12 @@ impl From<BdkCanonicalTx<'_, Arc<BdkTransaction>, BdkConfirmationBlockTime>> for
block_id,
confirmation_time: anchor.confirmation_time,
},
transitively: transitively.map(|t| t.to_string()),
}
}
BdkChainPosition::Unconfirmed(timestamp) => ChainPosition::Unconfirmed { timestamp },
BdkChainPosition::Unconfirmed { last_seen } => ChainPosition::Unconfirmed {
timestamp: last_seen,
},
};

CanonicalTx {
Expand Down

0 comments on commit 10c4d25

Please sign in to comment.