From: Abiodun Awoyemi Date: Mon, 13 Jul 2026 14:27:19 +0000 (+0100) Subject: chore: migrate bdk_bip322 to bdk_message_signer 0.2.0 X-Git-Url: http://internal-gitweb-vhost/blockdata/script/encode/-script/display/LightClientBuilderException.DatabaseException.html?a=commitdiff_plain;h=d35395958a05b2a0e6552338ca894cfee8fcfb2b;p=bdk-cli chore: migrate bdk_bip322 to bdk_message_signer 0.2.0 --- diff --git a/Cargo.lock b/Cargo.lock index 915b4ba..420c1bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -255,7 +255,7 @@ dependencies = [ "bdk_redb", "bdk_sp", "bdk_testenv", - "bdk_wallet", + "bdk_wallet 2.4.0", "bitcoin-payment-instructions", "clap", "clap_complete", @@ -342,7 +342,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "346c1d502ee4613cf2201db9c3b93a2317772d8eaa372114f34bf5f374be94fd" dependencies = [ - "bdk_wallet", + "bdk_wallet 2.4.0", "bip157", ] @@ -351,6 +351,16 @@ name = "bdk_message_signer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2e0c999b3dcc448ceb6337658c363df3197bbed987b663810497bd9c20ea4ef" +dependencies = [ + "bdk_wallet 3.1.0", + "bitcoin", +] + +[[package]] +name = "bdk_redb" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e0c999b3dcc448ceb6337658c363df3197bbed987b663810497bd9c20ea4ef" dependencies = [ "bdk_wallet", "bitcoin", @@ -363,7 +373,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69ac8b88c9594c615fcb5b763e7afa16937e94f7a7f5ca334bf59a7fee69fea1" dependencies = [ "bdk_chain", - "bdk_wallet", + "bdk_wallet 2.4.0", "ciborium", "redb", "thiserror 2.0.18", @@ -402,6 +412,20 @@ dependencies = [ "serde_json", ] +[[package]] +name = "bdk_wallet" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1284fb23acc3e3022673712b55f4d5ce7e38aadc2c49bbef830dc3935f0a3289" +dependencies = [ + "bdk_chain", + "bitcoin", + "miniscript", + "rand_core 0.6.4", + "serde", + "serde_json", +] + [[package]] name = "bech32" version = "0.11.1" diff --git a/Cargo.toml b/Cargo.toml index e97625c..8ef4811 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,7 @@ dns_payment = ["bitcoin-payment-instructions"] # Internal features _payjoin-dependencies = ["payjoin", "reqwest", "url", "sqlite"] -bip322 = ["bdk_message_signer"] +message_signer = ["bdk_message_signer"] # Use this to consensus verify transactions at sync time verify = [] diff --git a/src/commands.rs b/src/commands.rs index 613a4f6..975f33b 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -13,7 +13,7 @@ //! All subcommands are defined in the below enums. #![allow(clippy::large_enum_variant)] -#[cfg(feature = "bip322")] +#[cfg(feature = "message_signer")] use crate::handlers::offline::{SignMessageCommand, VerifyMessageCommand}; use crate::handlers::{ config::{ListWalletsCommand, SaveConfigCommand}, @@ -362,10 +362,10 @@ pub enum OfflineWalletSubCommand { /// Combines multiple PSBTs into one. CombinePsbt(CombinePsbtCommand), /// Sign a message using BIP322 - #[cfg(feature = "bip322")] + #[cfg(feature = "message_signer")] SignMessage(SignMessageCommand), /// Verify a BIP322 signature - #[cfg(feature = "bip322")] + #[cfg(feature = "message_signer")] VerifyMessage(VerifyMessageCommand), /// Lock UTXO(s) so they're excluded from coin selection. LockUtxo(LockUtxoCommand), diff --git a/src/error.rs b/src/error.rs index dfd9f33..bee8f19 100644 --- a/src/error.rs +++ b/src/error.rs @@ -155,9 +155,10 @@ pub enum BDKCliError { #[cfg(feature = "payjoin")] #[error("Payjoin database error: {0}")] PayjoinDb(#[from] crate::handlers::payjoin::db::Error), - #[cfg(feature = "bip322")] + + #[cfg(feature = "message_signer")] #[error("BIP-322 error: {0}")] - Bip322Error(#[from] bdk_message_signer::error::Error), + MessageSignerError(#[from] bdk_message_signer::error::Error), } impl From for BDKCliError { diff --git a/src/handlers/offline.rs b/src/handlers/offline.rs index 725b29c..8cb5eca 100644 --- a/src/handlers/offline.rs +++ b/src/handlers/offline.rs @@ -28,11 +28,11 @@ use { bdk_wallet::keys::{DescriptorPublicKey, DescriptorSecretKey, SinglePubKey}, std::collections::HashMap, }; -#[cfg(feature = "bip322")] +#[cfg(feature = "message_signer")] use { crate::utils::parse_signature_format, crate::utils::types::MessageResult, - bdk_message_signer::{MessageProof, MessageSigner}, + bdk_message_signer::{MessageSigner, MessageProof}, }; impl OfflineWalletSubCommand { @@ -73,11 +73,11 @@ impl OfflineWalletSubCommand { Self::CombinePsbt(combine_psbt_command) => combine_psbt_command .execute(ctx)? .write_out(std::io::stdout()), - #[cfg(feature = "bip322")] + #[cfg(feature = "message_signer")] Self::SignMessage(sign_message_command) => sign_message_command .execute(ctx)? .write_out(std::io::stdout()), - #[cfg(feature = "bip322")] + #[cfg(feature = "message_signer")] Self::VerifyMessage(verify_message_command) => verify_message_command .execute(ctx)? .write_out(std::io::stdout()), @@ -773,7 +773,7 @@ impl AppCommand>> for CombinePsbtCommand { } } -#[cfg(feature = "bip322")] +#[cfg(feature = "message_signer")] #[derive(Debug, Parser, Clone, PartialEq)] pub struct SignMessageCommand { /// The message to sign @@ -793,7 +793,7 @@ pub struct SignMessageCommand { pub utxos: Option>, } -#[cfg(feature = "bip322")] +#[cfg(feature = "message_signer")] impl AppCommand>> for SignMessageCommand { type Output = MessageResult; @@ -823,7 +823,7 @@ impl AppCommand>> for SignMessageCommand { } } -#[cfg(feature = "bip322")] +#[cfg(feature = "message_signer")] #[derive(Debug, Parser, Clone, PartialEq)] pub struct VerifyMessageCommand { /// The signature proof to verify @@ -839,7 +839,7 @@ pub struct VerifyMessageCommand { pub address: String, } -#[cfg(feature = "bip322")] +#[cfg(feature = "message_signer")] impl AppCommand>> for VerifyMessageCommand { type Output = MessageResult; diff --git a/src/utils/common.rs b/src/utils/common.rs index a5f8c15..0300109 100644 --- a/src/utils/common.rs +++ b/src/utils/common.rs @@ -1,8 +1,8 @@ use crate::{commands::WalletOpts, config::WalletConfig, error::BDKCliError as Error}; +#[cfg(feature = "message_signer")] +use bdk_message_signer::SignatureFormat; #[cfg(feature = "cbf")] use bdk_kyoto::{Info, Receiver, UnboundedReceiver, Warning}; -#[cfg(feature = "bip322")] -use bdk_message_signer::SignatureFormat; #[cfg(feature = "silent-payments")] use bdk_sp::encoding::SilentPaymentCode; use bdk_wallet::bitcoin::{Address, Network, OutPoint, ScriptBuf}; @@ -198,7 +198,7 @@ pub(crate) fn parse_sp_code_value_pairs(s: &str) -> Result<(SilentPaymentCode, u } /// Function to parse the signature format from a string -#[cfg(feature = "bip322")] +#[cfg(feature = "message_signer")] pub(crate) fn parse_signature_format(format_str: &str) -> Result { match format_str.to_lowercase().as_str() { "legacy" => Ok(SignatureFormat::Legacy), @@ -232,10 +232,10 @@ pub fn command_requires_db(command: &OfflineWalletSubCommand) -> bool { | OfflineWalletSubCommand::FinalizePsbt(_) | OfflineWalletSubCommand::CombinePsbt(_) => false, - #[cfg(feature = "bip322")] + #[cfg(feature = "message_signer")] OfflineWalletSubCommand::SignMessage(_) => true, - #[cfg(feature = "bip322")] + #[cfg(feature = "message_signer")] OfflineWalletSubCommand::VerifyMessage(_) => true, #[cfg(feature = "silent-payments")] OfflineWalletSubCommand::CreateSpTx(_) => true, diff --git a/src/utils/types.rs b/src/utils/types.rs index 8a10d03..f6bd4cf 100644 --- a/src/utils/types.rs +++ b/src/utils/types.rs @@ -110,7 +110,7 @@ pub struct KeychainPair { pub internal: T, } -#[cfg(feature = "bip322")] +#[cfg(feature = "message_signer")] #[derive(Serialize, Debug, Default)] pub struct MessageResult { #[serde(skip_serializing_if = "Option::is_none")]