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 12, 2024
1 parent b61bb97 commit f857ce3
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 56 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
5 changes: 3 additions & 2 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,8 +397,8 @@ 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, Txid? transitively);

/// The chain data is not confirmed and last seen in the mempool at this timestamp.
Unconfirmed(u64 timestamp);
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
1 change: 1 addition & 0 deletions bdk-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ use bitcoin_ffi::FeeRate;
use bitcoin_ffi::Network;
use bitcoin_ffi::OutPoint;
use bitcoin_ffi::Script;
use bitcoin_ffi::Txid;

use bdk_wallet::keys::bip39::WordCount;
use bdk_wallet::tx_builder::ChangeSpendPolicy;
Expand Down
13 changes: 10 additions & 3 deletions bdk-ffi/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::bitcoin::{Address, Transaction, TxOut};
use crate::error::{CreateTxError, RequestBuilderError};

use bitcoin_ffi::Amount;
use bitcoin_ffi::OutPoint;
use bitcoin_ffi::Script;
use bitcoin_ffi::{Amount, Txid};

use bdk_core::bitcoin::absolute::LockTime as BdkLockTime;
use bdk_core::spk_client::SyncItem;
Expand Down Expand Up @@ -36,6 +36,7 @@ use std::sync::{Arc, Mutex};
pub enum ChainPosition {
Confirmed {
confirmation_block_time: ConfirmationBlockTime,
transitively: Option<Txid>,
},
Unconfirmed {
timestamp: 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,
}
}
BdkChainPosition::Unconfirmed(timestamp) => ChainPosition::Unconfirmed { timestamp },
BdkChainPosition::Unconfirmed { last_seen } => ChainPosition::Unconfirmed {
timestamp: last_seen.unwrap_or(0),
},
};

CanonicalTx {
Expand Down

0 comments on commit f857ce3

Please sign in to comment.