2023-03-10 13:40:27 +13:00
|
|
|
#![doc = include_str!("../README.md")]
|
2023-03-09 10:59:18 +13:00
|
|
|
use bdk_chain::ConfirmationTime;
|
|
|
|
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-03-09 10:59:18 +13:00
|
|
|
pub(crate) fn map_confirmation_time(
|
|
|
|
tx_status: &TxStatus,
|
|
|
|
height_at_start: u32,
|
|
|
|
) -> ConfirmationTime {
|
2023-03-02 16:23:06 +11:00
|
|
|
match (tx_status.block_time, tx_status.block_height) {
|
|
|
|
(Some(time), Some(height)) if height <= height_at_start => {
|
|
|
|
ConfirmationTime::Confirmed { height, time }
|
|
|
|
}
|
|
|
|
_ => ConfirmationTime::Unconfirmed,
|
|
|
|
}
|
|
|
|
}
|