- version: ${{ needs.prepare.outputs.rust_version }}
- version: 1.85.0 # MSRV
features:
- - --no-default-features --features miniscript/no-std,bdk_chain/hashbrown
+ - --no-default-features --features bdk_chain/hashbrown
- --all-features
steps:
- name: checkout
- name: Check bdk_chain
working-directory: ./crates/chain
# TODO "--target thumbv6m-none-eabi" should work but currently does not
- run: cargo check --no-default-features --features miniscript/no-std,hashbrown
+ run: cargo check --no-default-features --features hashbrown
- name: Check esplora
working-directory: ./crates/esplora
# TODO "--target thumbv6m-none-eabi" should work but currently does not
bitcoin = { version = "0.32.0", default-features = false }
bdk_core = { path = "../core", version = "0.6.2", default-features = false }
serde = { version = "1", optional = true, features = ["derive", "rc"] }
-miniscript = { version = "12.3.1", optional = true, default-features = false }
+miniscript = { version = "13.0.0", optional = true, default-features = false }
# Feature dependencies
rusqlite = { version = "0.31.0", features = ["bundled"], optional = true }
use bdk_chain::keychain_txout::DEFAULT_LOOKAHEAD;
use serde_json::json;
use std::cmp;
-use std::collections::HashMap;
use std::env;
use std::fmt;
use std::str::FromStr;
use anyhow::Context;
use bdk_chain::bitcoin::{
absolute, address::NetworkUnchecked, bip32, consensus, constants, hex::DisplayHex, relative,
- secp256k1::Secp256k1, transaction, Address, Amount, Network, NetworkKind, PrivateKey, Psbt,
- PublicKey, Sequence, Transaction, TxIn, TxOut,
+ secp256k1::Secp256k1, transaction, Address, Amount, Network, NetworkKind, Psbt, Sequence,
+ Transaction, TxIn, TxOut,
};
use bdk_chain::miniscript::{
- descriptor::{DescriptorSecretKey, SinglePubKey},
plan::{Assets, Plan},
psbt::PsbtExt,
Descriptor, DescriptorPublicKey, ForEachKey,
let secp = Secp256k1::new();
let (_, keymap) = Descriptor::parse_descriptor(&secp, &desc_str)?;
+
if keymap.is_empty() {
bail!("unable to sign")
}
- // note: we're only looking at the first entry in the keymap
- // the idea is to find something that impls `GetKey`
- let sign_res = match keymap.iter().next().expect("not empty") {
- (DescriptorPublicKey::Single(single_pub), DescriptorSecretKey::Single(prv)) => {
- let pk = match single_pub.key {
- SinglePubKey::FullKey(pk) => pk,
- SinglePubKey::XOnly(_) => unimplemented!("single xonly pubkey"),
- };
- let keys: HashMap<PublicKey, PrivateKey> = [(pk, prv.key)].into();
- psbt.sign(&keys, &secp)
- }
- (_, DescriptorSecretKey::XPrv(k)) => psbt.sign(&k.xkey, &secp),
- _ => unimplemented!("multi xkey signer"),
- };
-
- let _ =
- sign_res.map_err(|errors| anyhow::anyhow!("failed to sign PSBT {errors:?}"))?;
+ let _sign_res = psbt
+ .sign(&keymap, &secp)
+ .map_err(|errors| anyhow::anyhow!("failed to sign PSBT {errors:?}"))?;
let mut obj = serde_json::Map::new();
obj.insert("psbt".to_string(), json!(psbt.to_string()));