bdk_chain = { path = "../../crates/chain", features = ["serde", "miniscript"]}
bdk_coin_select = "0.3.0"
bdk_file_store = { path = "../../crates/file_store" }
+bitcoin = { version = "0.32.0", features = ["base64"], default-features = false }
anyhow = "1"
clap = { version = "3.2.23", features = ["derive", "env"] }
+rand = "0.8"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
use anyhow::bail;
use anyhow::Context;
use bdk_chain::bitcoin::{
- absolute,
- address::NetworkUnchecked,
- bip32, consensus, constants,
- hex::DisplayHex,
- relative,
- secp256k1::{rand::prelude::*, Secp256k1},
- transaction, Address, Amount, Network, NetworkKind, PrivateKey, Psbt, PublicKey, Sequence,
- Transaction, TxIn, TxOut,
+ absolute, address::NetworkUnchecked, bip32, consensus, constants, hex::DisplayHex, relative,
+ secp256k1::Secp256k1, transaction, Address, Amount, Network, NetworkKind, PrivateKey, Psbt,
+ PublicKey, Sequence, Transaction, TxIn, TxOut,
};
use bdk_chain::miniscript::{
descriptor::{DescriptorSecretKey, SinglePubKey},
};
use bdk_file_store::Store;
use clap::{Parser, Subcommand};
+use rand::prelude::*;
pub use anyhow;
pub use clap;
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,
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:?}"))?;