Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/example_wallet_electrum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version = "0.2.0"
edition = "2021"

[dependencies]
bdk_wallet = { path = "../../wallet", features = ["rusqlite"] }
bdk_wallet = { version = "2.1.0", features = ["rusqlite"] }
bdk_electrum = { version = "0.23.1" }
anyhow = "1"
2 changes: 1 addition & 1 deletion examples/example_wallet_esplora_async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bdk_wallet = { path = "../../wallet", features = ["rusqlite"] }
bdk_wallet = { version = "2.1.0", features = ["rusqlite"] }
bdk_esplora = { version = "0.22.1", features = ["async-https", "tokio"] }
tokio = { version = "1.38.1", features = ["rt", "rt-multi-thread", "macros"] }
anyhow = "1"
2 changes: 1 addition & 1 deletion examples/example_wallet_esplora_blocking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bdk_wallet = { path = "../../wallet", features = ["rusqlite"] }
bdk_wallet = { version = "2.1.0", features = ["rusqlite"] }
bdk_esplora = { version = "0.22.1", features = ["blocking"] }
anyhow = "1"
13 changes: 2 additions & 11 deletions wallet/examples/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use std::error::Error;

use bdk_wallet::bitcoin::Network;
use bdk_wallet::descriptor::{policy::BuildSatisfaction, ExtractPolicy, IntoWalletDescriptor};
use bdk_wallet::signer::SignersContainer;

/// This example describes the use of the BDK's [`bdk_wallet::descriptor::policy`] module.
///
Expand All @@ -35,23 +34,15 @@ fn main() -> Result<(), Box<dyn Error>> {

// Use the descriptor string to derive the full descriptor and a keymap.
// The wallet descriptor can be used to create a new bdk_wallet::wallet.
// While the `keymap` can be used to create a `SignerContainer`.
//
// The `SignerContainer` can sign for `PSBT`s.
// a `bdk_wallet::Wallet` internally uses these to handle transaction signing.
// But they can be used as independent tools also.
let (wallet_desc, keymap) = desc.into_wallet_descriptor(&secp, Network::Testnet)?;
let (wallet_desc, _keymap) = desc.into_wallet_descriptor(&secp, Network::Testnet)?;

println!("Example Descriptor for policy analysis : {wallet_desc}");

// Create the signer with the keymap and descriptor.
let signers_container = SignersContainer::build(keymap, &wallet_desc, &secp);

// Extract the Policy from the given descriptor and signer.
// Note that Policy is a wallet specific structure. It depends on the the descriptor, and
// what the concerned wallet with a given signer can sign for.
let policy = wallet_desc
.extract_policy(&signers_container, BuildSatisfaction::None, &secp)?
.extract_policy(BuildSatisfaction::None, &secp)?
.expect("We expect a policy");

println!("Derived Policy for the descriptor {policy:#?}");
Expand Down
2 changes: 0 additions & 2 deletions wallet/src/descriptor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pub use self::error::Error as DescriptorError;
pub use self::policy::Policy;
use self::template::DescriptorTemplateOut;
use crate::keys::{IntoDescriptorKey, KeyError};
use crate::wallet::signer::SignersContainer;
use crate::wallet::utils::SecpCtx;

/// Alias for a [`Descriptor`] that can contain extended keys using [`DescriptorPublicKey`]
Expand Down Expand Up @@ -348,7 +347,6 @@ pub trait ExtractPolicy {
/// Extract the spending [`policy`]
fn extract_policy(
&self,
signers: &SignersContainer,
psbt: BuildSatisfaction,
secp: &SecpCtx,
) -> Result<Option<Policy>, DescriptorError>;
Expand Down
Loading
Loading