2023-03-10 13:40:27 +13:00
|
|
|
#![doc = include_str!("../README.md")]
|
2023-05-24 11:37:26 +08:00
|
|
|
use bdk_chain::{BlockId, ConfirmationTimeAnchor};
|
2023-03-09 10:59:18 +13:00
|
|
|
use esplora_client::TxStatus;
|
2023-03-02 16:23:06 +11:00
|
|
|
|
|
|
|
pub use esplora_client;
|
2023-03-07 17:04:06 +03:00
|
|
|
|
|
|
|
#[cfg(feature = "blocking")]
|
2023-03-09 10:59:18 +13:00
|
|
|
mod blocking_ext;
|
2023-03-03 12:07:04 +01:00
|
|
|
#[cfg(feature = "blocking")]
|
2023-03-09 10:59:18 +13:00
|
|
|
pub use blocking_ext::*;
|
2023-03-02 16:23:06 +11:00
|
|
|
|
2023-03-09 10:59:18 +13:00
|
|
|
#[cfg(feature = "async")]
|
|
|
|
mod async_ext;
|
|
|
|
#[cfg(feature = "async")]
|
|
|
|
pub use async_ext::*;
|
2023-03-02 16:23:06 +11:00
|
|
|
|
2023-05-18 14:04:48 +08:00
|
|
|
pub(crate) fn map_confirmation_time_anchor(
|
|
|
|
tx_status: &TxStatus,
|
|
|
|
tip_at_start: BlockId,
|
|
|
|
) -> Option<ConfirmationTimeAnchor> {
|
|
|
|
match (tx_status.block_time, tx_status.block_height) {
|
|
|
|
(Some(confirmation_time), Some(confirmation_height)) => Some(ConfirmationTimeAnchor {
|
|
|
|
anchor_block: tip_at_start,
|
|
|
|
confirmation_height,
|
|
|
|
confirmation_time,
|
|
|
|
}),
|
|
|
|
_ => None,
|
|
|
|
}
|
|
|
|
}
|