/home/darosior/projects/bdk/crates/chain/src/lib.rs
Line | Count | Source (jump to first uncovered line) |
1 | | //! This crate is a collection of core structures for [Bitcoin Dev Kit]. |
2 | | //! |
3 | | //! The goal of this crate is to give wallets the mechanisms needed to: |
4 | | //! |
5 | | //! 1. Figure out what data they need to fetch. |
6 | | //! 2. Process the data in a way that never leads to inconsistent states. |
7 | | //! 3. Fully index that data and expose it to be consumed without friction. |
8 | | //! |
9 | | //! Our design goals for these mechanisms are: |
10 | | //! |
11 | | //! 1. Data source agnostic -- nothing in `bdk_chain` cares about where you get data from or whether |
12 | | //! you do it synchronously or asynchronously. If you know a fact about the blockchain, you can just |
13 | | //! tell `bdk_chain`'s APIs about it, and that information will be integrated, if it can be done |
14 | | //! consistently. |
15 | | //! 2. Data persistence agnostic -- `bdk_chain` does not care where you cache on-chain data, what you |
16 | | //! cache or how you retrieve it from persistent storage. |
17 | | //! |
18 | | //! [Bitcoin Dev Kit]: https://bitcoindevkit.org/ |
19 | | |
20 | | // only enables the `doc_cfg` feature when the `docsrs` configuration attribute is defined |
21 | | #![cfg_attr(docsrs, feature(doc_cfg))] |
22 | | #![cfg_attr( |
23 | | docsrs, |
24 | | doc(html_logo_url = "https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png") |
25 | | )] |
26 | | #![no_std] |
27 | | #![warn(missing_docs)] |
28 | | |
29 | | pub use bitcoin; |
30 | | mod balance; |
31 | | pub use balance::*; |
32 | | mod chain_data; |
33 | | pub use chain_data::*; |
34 | | pub mod indexed_tx_graph; |
35 | | pub use indexed_tx_graph::IndexedTxGraph; |
36 | | pub mod indexer; |
37 | | pub use indexer::spk_txout; |
38 | | pub use indexer::Indexer; |
39 | | pub mod local_chain; |
40 | | mod tx_data_traits; |
41 | | pub use tx_data_traits::*; |
42 | | pub mod tx_graph; |
43 | | pub use tx_graph::TxGraph; |
44 | | mod chain_oracle; |
45 | | pub use chain_oracle::*; |
46 | | |
47 | | #[doc(hidden)] |
48 | | pub mod example_utils; |
49 | | |
50 | | #[cfg(feature = "miniscript")] |
51 | | pub use miniscript; |
52 | | #[cfg(feature = "miniscript")] |
53 | | mod descriptor_ext; |
54 | | #[cfg(feature = "miniscript")] |
55 | | pub use descriptor_ext::{DescriptorExt, DescriptorId}; |
56 | | #[cfg(feature = "miniscript")] |
57 | | mod spk_iter; |
58 | | #[cfg(feature = "miniscript")] |
59 | | pub use indexer::keychain_txout; |
60 | | #[cfg(feature = "miniscript")] |
61 | | pub use spk_iter::*; |
62 | | #[cfg(feature = "rusqlite")] |
63 | | pub mod rusqlite_impl; |
64 | | |
65 | | pub extern crate bdk_core; |
66 | | pub use bdk_core::*; |
67 | | |
68 | | #[allow(unused_imports)] |
69 | | #[macro_use] |
70 | | extern crate alloc; |
71 | | #[cfg(feature = "rusqlite")] |
72 | | pub extern crate rusqlite; |
73 | | #[cfg(feature = "serde")] |
74 | | pub extern crate serde; |
75 | | |
76 | | #[cfg(feature = "std")] |
77 | | #[macro_use] |
78 | | extern crate std; |
79 | | |
80 | | /// How many confirmations are needed f or a coinbase output to be spent. |
81 | | pub const COINBASE_MATURITY: u32 = 100; |
82 | | |
83 | | /// A wrapper that we use to impl remote traits for types in our crate or dependency crates. |
84 | | pub struct Impl<T>(pub T); |
85 | | |
86 | | impl<T> Impl<T> { |
87 | | /// Returns the inner `T`. |
88 | 22 | pub fn into_inner(self) -> T { |
89 | 22 | self.0 |
90 | 22 | } Unexecuted instantiation: <bdk_chain::Impl<_>>::into_inner Unexecuted instantiation: <bdk_chain::Impl<_>>::into_inner <bdk_chain::Impl<miniscript::descriptor::Descriptor<miniscript::descriptor::key::DescriptorPublicKey>>>::into_inner Line | Count | Source | 88 | 14 | pub fn into_inner(self) -> T { | 89 | 14 | self.0 | 90 | 14 | } |
<bdk_chain::Impl<bitcoin::network::Network>>::into_inner Line | Count | Source | 88 | 8 | pub fn into_inner(self) -> T { | 89 | 8 | self.0 | 90 | 8 | } |
|
91 | | } |
92 | | |
93 | | impl<T> From<T> for Impl<T> { |
94 | 0 | fn from(value: T) -> Self { |
95 | 0 | Self(value) |
96 | 0 | } Unexecuted instantiation: <bdk_chain::Impl<bitcoin_units::amount::Amount> as core::convert::From<bitcoin_units::amount::Amount>>::from Unexecuted instantiation: <bdk_chain::Impl<bitcoin::blockdata::script::owned::ScriptBuf> as core::convert::From<bitcoin::blockdata::script::owned::ScriptBuf>>::from Unexecuted instantiation: <bdk_chain::Impl<_> as core::convert::From<_>>::from |
97 | | } |
98 | | |
99 | | impl<T> core::ops::Deref for Impl<T> { |
100 | | type Target = T; |
101 | | |
102 | 13 | fn deref(&self) -> &Self::Target { |
103 | 13 | &self.0 |
104 | 13 | } <bdk_chain::Impl<miniscript::descriptor::Descriptor<miniscript::descriptor::key::DescriptorPublicKey>> as core::ops::deref::Deref>::deref Line | Count | Source | 102 | 5 | fn deref(&self) -> &Self::Target { | 103 | 5 | &self.0 | 104 | 5 | } |
<bdk_chain::Impl<bdk_chain::descriptor_ext::DescriptorId> as core::ops::deref::Deref>::deref Line | Count | Source | 102 | 2 | fn deref(&self) -> &Self::Target { | 103 | 2 | &self.0 | 104 | 2 | } |
Unexecuted instantiation: <bdk_chain::Impl<bitcoin_units::amount::Amount> as core::ops::deref::Deref>::deref <bdk_chain::Impl<bitcoin::network::Network> as core::ops::deref::Deref>::deref Line | Count | Source | 102 | 3 | fn deref(&self) -> &Self::Target { | 103 | 3 | &self.0 | 104 | 3 | } |
Unexecuted instantiation: <bdk_chain::Impl<bitcoin::blockdata::transaction::Transaction> as core::ops::deref::Deref>::deref Unexecuted instantiation: <bdk_chain::Impl<bitcoin::blockdata::transaction::Txid> as core::ops::deref::Deref>::deref <bdk_chain::Impl<bitcoin::blockdata::block::BlockHash> as core::ops::deref::Deref>::deref Line | Count | Source | 102 | 3 | fn deref(&self) -> &Self::Target { | 103 | 3 | &self.0 | 104 | 3 | } |
Unexecuted instantiation: <bdk_chain::Impl<bitcoin::blockdata::script::owned::ScriptBuf> as core::ops::deref::Deref>::deref Unexecuted instantiation: <bdk_chain::Impl<_> as core::ops::deref::Deref>::deref |
105 | | } |
106 | | |
107 | | /// A wrapper that we use to impl remote traits for types in our crate or dependency crates that impl [`Anchor`]. |
108 | | pub struct AnchorImpl<T: tx_data_traits::Anchor>(pub T); |
109 | | |
110 | | impl<T: tx_data_traits::Anchor> AnchorImpl<T> { |
111 | | /// Returns the inner `T`. |
112 | 0 | pub fn into_inner(self) -> T { |
113 | 0 | self.0 |
114 | 0 | } Unexecuted instantiation: <bdk_chain::AnchorImpl<_>>::into_inner Unexecuted instantiation: <bdk_chain::AnchorImpl<_>>::into_inner |
115 | | } |
116 | | |
117 | | impl<T: tx_data_traits::Anchor> From<T> for AnchorImpl<T> { |
118 | 0 | fn from(value: T) -> Self { |
119 | 0 | Self(value) |
120 | 0 | } Unexecuted instantiation: <bdk_chain::AnchorImpl<_> as core::convert::From<_>>::from Unexecuted instantiation: <bdk_chain::AnchorImpl<_> as core::convert::From<_>>::from |
121 | | } |
122 | | |
123 | | impl<T: tx_data_traits::Anchor> core::ops::Deref for AnchorImpl<T> { |
124 | | type Target = T; |
125 | | |
126 | 0 | fn deref(&self) -> &Self::Target { |
127 | 0 | &self.0 |
128 | 0 | } Unexecuted instantiation: <bdk_chain::AnchorImpl<_> as core::ops::deref::Deref>::deref Unexecuted instantiation: <bdk_chain::AnchorImpl<_> as core::ops::deref::Deref>::deref |
129 | | } |