Skip to content
Merged
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
7 changes: 3 additions & 4 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ jobs:
- name: Test Esplora
run: cargo test --features esplora

# Temporarily disable compact filters
#- name: Test Compact Filters
# run: cargo test --features compact_filters

- name: Test Cbf
run: cargo test --features cbf

- name: Test RPC
run: cargo test --features rpc

Expand Down
97 changes: 89 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ tokio = { version = "1", features = ["full"] }
bdk_bitcoind_rpc = { version = "0.18.0", optional = true }
bdk_electrum = { version = "0.21.0", optional = true }
bdk_esplora = { version = "0.20.1", features = ["async-https", "tokio"], optional = true }
bdk_kyoto = { version = "0.7.1", optional = true }
bdk_kyoto = { version = "0.9.0", optional = true }
shlex = { version = "1.3.0", optional = true }
tracing = "0.1.41"
tracing-subscriber = "0.3.19"

[features]
default = ["repl", "sqlite"]
Expand Down
49 changes: 23 additions & 26 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ use bdk_wallet::bitcoin::{
};
use clap::{value_parser, Args, Parser, Subcommand, ValueEnum};

#[cfg(any(
feature = "cbf",
feature = "electrum",
feature = "esplora",
feature = "rpc"
))]
#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
use crate::utils::parse_proxy_auth;
use crate::utils::{parse_address, parse_outpoint, parse_recipient};

Expand Down Expand Up @@ -133,7 +128,12 @@ pub enum DatabaseType {
Sqlite,
}

#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
#[cfg(any(
feature = "electrum",
feature = "esplora",
feature = "rpc",
feature = "cbf"
))]
#[derive(Clone, ValueEnum, Debug, Eq, PartialEq)]
pub enum ClientType {
#[cfg(feature = "electrum")]
Expand All @@ -142,6 +142,8 @@ pub enum ClientType {
Esplora,
#[cfg(feature = "rpc")]
Rpc,
#[cfg(feature = "cbf")]
Cbf,
}

/// Config options wallet operations can take.
Expand All @@ -159,7 +161,12 @@ pub struct WalletOpts {
/// Sets the descriptor to use for internal/change addresses.
#[arg(env = "INT_DESCRIPTOR", short = 'i', long)]
pub int_descriptor: Option<String>,
#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
#[cfg(any(
feature = "electrum",
feature = "esplora",
feature = "rpc",
feature = "cbf"
))]
#[arg(env = "CLIENT_TYPE", short = 'c', long, value_enum, required = true)]
pub client_type: ClientType,
#[cfg(feature = "sqlite")]
Expand Down Expand Up @@ -196,10 +203,13 @@ pub struct WalletOpts {
/// Sets an optional cookie authentication.
#[arg(env = "COOKIE")]
pub cookie: Option<String>,
#[cfg(feature = "cbf")]
#[clap(flatten)]
pub compactfilter_opts: CompactFilterOpts,
}

/// Options to configure a SOCKS5 proxy for a blockchain client connection.
#[cfg(any(feature = "cbf", feature = "electrum", feature = "esplora"))]
#[cfg(any(feature = "electrum", feature = "esplora"))]
#[derive(Debug, Args, Clone, PartialEq, Eq)]
pub struct ProxyOpts {
/// Sets the SOCKS5 proxy for a blockchain client.
Expand Down Expand Up @@ -228,26 +238,13 @@ pub struct ProxyOpts {
#[cfg(feature = "cbf")]
#[derive(Debug, Args, Clone, PartialEq, Eq)]
pub struct CompactFilterOpts {
/// Sets the full node network address.
#[clap(
env = "ADDRESS:PORT",
long = "cbf-node",
default_value = "127.0.0.1:18444"
)]
pub address: Vec<String>,

/// Sets the number of parallel node connections.
#[clap(name = "CONNECTIONS", long = "cbf-conn-count", default_value = "4")]
pub conn_count: usize,
#[clap(name = "CONNECTIONS", long = "cbf-conn-count", default_value = "4", value_parser = value_parser!(u8).range(1..=15))]
pub conn_count: u8,

/// Optionally skip initial `skip_blocks` blocks.
#[clap(
env = "SKIP_BLOCKS",
short = 'k',
long = "cbf-skip-blocks",
default_value = "0"
)]
pub skip_blocks: usize,
#[clap(env = "SKIP_BLOCKS", short = 'k', long = "cbf-skip-blocks")]
pub skip_blocks: Option<u32>,
}

/// Wallet subcommands that can be issued without a blockchain backend.
Expand Down
4 changes: 4 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,8 @@ pub enum BDKCliError {
#[cfg(feature = "rpc")]
#[error("RPC error: {0}")]
BitcoinCoreRpcError(#[from] bdk_bitcoind_rpc::bitcoincore_rpc::Error),

#[cfg(feature = "cbf")]
#[error("BDK-Kyoto error: {0}")]
BuilderError(#[from] bdk_kyoto::builder::BuilderError),
}
Loading
Loading