feat!: improve wallet building methods

Remove returning `Result` for builder methods on `CreateParams` and
`LoadParams`.
This commit is contained in:
志宇
2024-07-18 03:04:00 +00:00
parent eb73f0659e
commit 22d02ed3d1
15 changed files with 287 additions and 297 deletions

View File

@@ -21,7 +21,7 @@ use bitcoin::Network;
use miniscript::policy::Concrete;
use miniscript::Descriptor;
use bdk_wallet::{CreateParams, KeychainKind};
use bdk_wallet::{KeychainKind, Wallet};
/// Miniscript policy is a high level abstraction of spending conditions. Defined in the
/// rust-miniscript library here https://docs.rs/miniscript/7.0.0/miniscript/policy/index.html
@@ -77,7 +77,8 @@ fn main() -> Result<(), Box<dyn Error>> {
);
// Create a new wallet from descriptors
let mut wallet = CreateParams::new(&descriptor, &internal_descriptor, Network::Regtest)?
let mut wallet = Wallet::create(descriptor, internal_descriptor)
.network(Network::Regtest)
.create_wallet_no_persist()?;
println!(