diff --git a/crates/chain/Cargo.toml b/crates/chain/Cargo.toml index 7261bdfa25..18773d9dba 100644 --- a/crates/chain/Cargo.toml +++ b/crates/chain/Cargo.toml @@ -32,4 +32,6 @@ proptest = "1.2.0" default = ["std", "miniscript"] std = ["bitcoin/std", "miniscript?/std"] serde = ["dep:serde", "bitcoin/serde", "miniscript?/serde"] +base64 = ["bitcoin/base64"] +rand-std = ["bitcoin/rand-std"] rusqlite = ["std", "dep:rusqlite", "serde", "serde_json"] diff --git a/example-crates/example_cli/Cargo.toml b/example-crates/example_cli/Cargo.toml index 9b8c4debbb..4fbbb8329a 100644 --- a/example-crates/example_cli/Cargo.toml +++ b/example-crates/example_cli/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bdk_chain = { path = "../../crates/chain", features = ["serde", "miniscript"]} +bdk_chain = { path = "../../crates/chain", features = ["serde", "miniscript", "base64", "rand-std"]} bdk_coin_select = "0.3.0" bdk_file_store = { path = "../../crates/file_store" } diff --git a/example-crates/example_cli/src/lib.rs b/example-crates/example_cli/src/lib.rs index ee0c9b3761..1cdb7e1afd 100644 --- a/example-crates/example_cli/src/lib.rs +++ b/example-crates/example_cli/src/lib.rs @@ -667,7 +667,7 @@ pub fn handle_commands( // print base64 encoded psbt let fee = psbt.fee()?.to_sat(); let mut obj = serde_json::Map::new(); - obj.insert("psbt".to_string(), json!(psbt.to_string())); + obj.insert("psbt".to_string(), json!(psbt)); obj.insert("fee".to_string(), json!(fee)); println!("{}", serde_json::to_string_pretty(&obj)?); }; @@ -675,7 +675,7 @@ pub fn handle_commands( Ok(()) } PsbtCmd::Sign { psbt, descriptor } => { - let mut psbt = Psbt::from_str(&psbt.unwrap_or_default())?; + let mut psbt = Psbt::from_str(psbt.unwrap_or_default().as_str())?; let desc_str = match descriptor { Some(s) => s, @@ -717,7 +717,7 @@ pub fn handle_commands( chain_specific, psbt, } => { - let mut psbt = Psbt::from_str(&psbt)?; + let mut psbt = Psbt::from_str(&psbt.as_str())?; psbt.finalize_mut(&Secp256k1::new()) .map_err(|errors| anyhow::anyhow!("failed to finalize PSBT {errors:?}"))?;