2023-03-01 17:02:06 +11:00
|
|
|
#![doc = include_str!("../README.md")]
|
2023-06-20 12:33:05 -05:00
|
|
|
// only enables the `doc_cfg` feature when the `docsrs` configuration attribute is defined
|
|
|
|
#![cfg_attr(docsrs, feature(doc_cfg))]
|
|
|
|
#![cfg_attr(
|
|
|
|
docsrs,
|
|
|
|
doc(html_logo_url = "https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png")
|
|
|
|
)]
|
2023-01-10 15:10:02 +11:00
|
|
|
#![no_std]
|
2023-05-29 21:54:53 +08:00
|
|
|
#![warn(missing_docs)]
|
|
|
|
|
2023-01-10 15:10:02 +11:00
|
|
|
#[cfg(feature = "std")]
|
|
|
|
#[macro_use]
|
|
|
|
extern crate std;
|
|
|
|
|
2023-02-21 12:38:16 +11:00
|
|
|
#[doc(hidden)]
|
2023-01-10 15:10:02 +11:00
|
|
|
#[macro_use]
|
2023-02-21 12:38:16 +11:00
|
|
|
pub extern crate alloc;
|
2024-07-17 14:37:10 +00:00
|
|
|
pub extern crate bdk_chain as chain;
|
|
|
|
#[cfg(feature = "file_store")]
|
|
|
|
pub extern crate bdk_file_store as file_store;
|
|
|
|
#[cfg(feature = "keys-bip39")]
|
|
|
|
pub extern crate bip39;
|
2020-01-27 22:02:55 +01:00
|
|
|
pub extern crate bitcoin;
|
|
|
|
pub extern crate miniscript;
|
2024-07-17 14:37:10 +00:00
|
|
|
pub extern crate serde;
|
|
|
|
pub extern crate serde_json;
|
2020-10-13 10:57:40 +02:00
|
|
|
|
2020-02-04 11:05:54 +01:00
|
|
|
pub mod descriptor;
|
2020-09-18 16:31:03 +02:00
|
|
|
pub mod keys;
|
2022-10-18 15:25:38 -05:00
|
|
|
pub mod psbt;
|
2024-07-17 14:37:10 +00:00
|
|
|
mod types;
|
|
|
|
mod wallet;
|
2020-02-07 23:22:28 +01:00
|
|
|
|
2024-07-17 14:37:10 +00:00
|
|
|
pub(crate) use bdk_chain::collections;
|
2024-07-19 11:20:34 +00:00
|
|
|
#[cfg(feature = "rusqlite")]
|
2024-07-17 14:37:10 +00:00
|
|
|
pub use bdk_chain::rusqlite;
|
2024-07-19 11:20:34 +00:00
|
|
|
#[cfg(feature = "rusqlite")]
|
|
|
|
pub use bdk_chain::rusqlite_impl;
|
2020-09-22 16:12:09 +02:00
|
|
|
pub use descriptor::template;
|
2021-03-30 16:33:07 +02:00
|
|
|
pub use descriptor::HdKeyPaths;
|
2024-07-17 14:37:10 +00:00
|
|
|
pub use signer;
|
|
|
|
pub use signer::SignOptions;
|
|
|
|
pub use tx_builder::*;
|
2020-08-31 10:49:44 +02:00
|
|
|
pub use types::*;
|
2024-07-17 14:37:10 +00:00
|
|
|
pub use wallet::*;
|
2021-01-25 15:13:45 -05:00
|
|
|
|
feat!: Rework sqlite, changesets, persistence and wallet-construction
Rework sqlite: Instead of only supported one schema (defined in
`bdk_sqlite`), we have a schema per changeset type for more flexiblity.
* rm `bdk_sqlite` crate (as we don't need `bdk_sqlite::Store` anymore).
* add `sqlite` feature on `bdk_chain` which adds methods on each
changeset type for initializing tables, loading the changeset and
writing.
Rework changesets: Some callers may want to use `KeychainTxOutIndex`
where `K` may change per descriptor on every run. So we only want to
persist the last revealed indices by `DescriptorId` (which uniquely-ish
identifies the descriptor).
* rm `keychain_added` field from `keychain_txout`'s changeset.
* Add `keychain_added` to `CombinedChangeSet` (which is renamed to
`WalletChangeSet`).
Rework persistence: add back some safety and convenience when persisting
our types. Working with changeset directly (as we were doing before) can
be cumbersome.
* Intoduce `struct Persisted<T>` which wraps a type `T` which stores
staged changes to it. This adds safety when creating and or loading
`T` from db.
* `struct Persisted<T>` methods, `create`, `load` and `persist`, are
avaliable if `trait PersistWith<Db>` is implemented for `T`. `Db`
represents the database connection and `PersistWith` should be
implemented per database-type.
* For async, we have `trait PersistedAsyncWith<Db>`.
* `Wallet` has impls of `PersistedWith<rusqlite::Connection>`,
`PersistedWith<rusqlite::Transaction>` and
`PersistedWith<bdk_file_store::Store>` by default.
Rework wallet-construction: Before, we had multiple methods for loading
and creating with different input-counts so it would be unwieldly to add
more parameters in the future. This also makes it difficult to impl
`PersistWith` (which has a single method for `load` that takes in
`PersistWith::LoadParams` and a single method for `create` that takes in
`PersistWith::CreateParams`).
* Introduce a builder pattern when constructing a `Wallet`. For loading
from persistence or `ChangeSet`, we have `LoadParams`. For creating a
new wallet, we have `CreateParams`.
2024-07-11 04:49:01 +00:00
|
|
|
/// Get the version of [`bdk_wallet`](crate) at runtime.
|
2021-01-25 15:13:45 -05:00
|
|
|
pub fn version() -> &'static str {
|
|
|
|
env!("CARGO_PKG_VERSION", "unknown")
|
|
|
|
}
|