Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ serde_json = "1.0"
thiserror = "2.0.11"
tokio = { version = "1", features = ["full"] }
cli-table = "0.5.0"

bdk_electrum = { version = "0.23.0", optional = true }
# Optional dependencies
bdk_bitcoind_rpc = { version = "0.21.0", features = ["std"], optional = true }
bdk_electrum = { version = "0.23.0", optional = true }

bdk_esplora = { version = "0.22.1", features = ["async-https", "tokio"], optional = true }
bdk_kyoto = { version = "0.15.1", optional = true }
bdk_redb = { version = "0.1.0", optional = true }
shlex = { version = "1.3.0", optional = true }
tracing = "0.1.41"
tracing-subscriber = "0.3.20"

[features]
default = ["repl", "sqlite"]

Expand Down
8 changes: 5 additions & 3 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//! All subcommands are defined in the below enums.

#![allow(clippy::large_enum_variant)]

use bdk_wallet::bitcoin::{
Address, Network, OutPoint, ScriptBuf,
bip32::{DerivationPath, Xpriv},
Expand Down Expand Up @@ -396,8 +395,11 @@ pub enum OnlineWalletSubCommand {
stop_gap: usize,
},
/// Syncs with the chosen blockchain server.
Sync,
/// Broadcasts a transaction to the network. Takes either a raw transaction or a PSBT to extract.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc comment should not be removed.

Sync {
#[command(flatten)]
wallet_opts: WalletOpts,
},

Broadcast {
/// Sets the PSBT to sign.
#[arg(
Expand Down
4 changes: 2 additions & 2 deletions src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
//! Command Handlers
//!
//! This module describes all the command handling logic used by bdk-cli.

use crate::commands::OfflineWalletSubCommand::*;
use crate::commands::*;
use crate::error::BDKCliError as Error;
Expand Down Expand Up @@ -686,14 +685,15 @@ pub(crate) async fn handle_online_wallet_subcommand(
}
Ok(serde_json::to_string_pretty(&json!({}))?)
}
Sync => {
sync => {
#[cfg(any(feature = "electrum", feature = "esplora"))]
let request = wallet
.start_sync_with_revealed_spks()
.inspect(|item, progress| {
let pc = (100 * progress.consumed()) as f32 / progress.total() as f32;
eprintln!("[ SCANNING {pc:03.0}% ] {item}");
});

match client {
#[cfg(feature = "electrum")]
Electrum { client, batch_size } => {
Expand Down
14 changes: 7 additions & 7 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@
//! Utility Tools
//!
//! This module includes all the utility tools used by the App.
use crate::error::BDKCliError as Error;
use std::fmt::Display;
use std::str::FromStr;

use std::path::{Path, PathBuf};

use crate::commands::WalletOpts;
use crate::error::BDKCliError as Error;
use bdk_electrum::electrum_client::ConfigBuilder;
#[cfg(feature = "cbf")]
use bdk_kyoto::{
BuilderExt, Info, LightClient, Receiver, ScanType::Sync, UnboundedReceiver, Warning,
builder::Builder,
};
use bdk_wallet::bitcoin::{Address, Network, OutPoint, ScriptBuf};
use std::fmt::Display;
use std::path::{Path, PathBuf};
use std::str::FromStr;

#[cfg(any(
feature = "electrum",
Expand Down Expand Up @@ -159,7 +158,8 @@ pub(crate) fn new_blockchain_client(
let client = match wallet_opts.client_type {
#[cfg(feature = "electrum")]
ClientType::Electrum => {
let client = bdk_electrum::electrum_client::Client::new(url)
let config = ConfigBuilder::new().build();
let client = bdk_electrum::electrum_client::Client::from_config(url, config)
.map(bdk_electrum::BdkElectrumClient::new)?;
BlockchainClient::Electrum {
client: Box::new(client),
Expand Down