Skip to content

Commit de1fc98

Browse files
committed
ref(handlers): fix offline, online and desc mod
- fix execution logic for subcommands under offline and online wallet subcommands
1 parent 306069a commit de1fc98

13 files changed

Lines changed: 1153 additions & 998 deletions

File tree

src/commands.rs

Lines changed: 17 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ use crate::handlers::{
2424
FinalizePsbtCommand, NewAddressCommand, PoliciesCommand, PublicDescriptorCommand,
2525
SignCommand, TransactionsCommand, UnspentCommand, UnusedAddressCommand,
2626
},
27-
online::{
28-
BroadcastCommand, FullScanCommand, ReceivePayjoinCommand, SendPayjoinCommand, SyncCommand,
29-
},
3027
};
3128

3229
#[cfg(any(
@@ -35,7 +32,12 @@ use crate::handlers::{
3532
feature = "rpc",
3633
feature = "cbf"
3734
))]
38-
use crate::client::ClientType;
35+
use crate::{
36+
client::ClientType,
37+
online::{
38+
BroadcastCommand, FullScanCommand, ReceivePayjoinCommand, SendPayjoinCommand, SyncCommand,
39+
},
40+
};
3941

4042
#[cfg(feature = "compiler")]
4143
use crate::handlers::descriptor::CompileCommand;
@@ -46,7 +48,7 @@ use bdk_wallet::bitcoin::Network;
4648
use clap::{Args, Parser, Subcommand, value_parser};
4749
use clap_complete::Shell;
4850

49-
// #[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
51+
#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
5052
use crate::utils::parse_proxy_auth;
5153

5254
/// The BDK Command Line Wallet App
@@ -197,8 +199,8 @@ pub enum WalletSubCommand {
197199
#[cfg(any(
198200
feature = "electrum",
199201
feature = "esplora",
200-
feature = "rpc",
201-
feature = "cbf"
202+
feature = "cbf",
203+
feature = "rpc"
202204
))]
203205
#[command(flatten)]
204206
OnlineWalletSubCommand(OnlineWalletSubCommand),
@@ -269,7 +271,7 @@ pub struct WalletOpts {
269271
}
270272

271273
/// Options to configure a SOCKS5 proxy for a blockchain client connection.
272-
// #[cfg(any(feature = "electrum", feature = "esplora"))]
274+
#[cfg(any(feature = "electrum", feature = "esplora"))]
273275
#[derive(Debug, Args, Clone, PartialEq, Eq)]
274276
pub struct ProxyOpts {
275277
/// Sets the SOCKS5 proxy for a blockchain client.
@@ -295,7 +297,7 @@ pub struct ProxyOpts {
295297
}
296298

297299
/// Options to configure a BIP157 Compact Filter backend.
298-
// #[cfg(feature = "cbf")]
300+
#[cfg(feature = "cbf")]
299301
#[derive(Debug, Args, Clone, PartialEq, Eq)]
300302
pub struct CompactFilterOpts {
301303
/// Sets the number of parallel node connections.
@@ -336,46 +338,21 @@ pub enum OfflineWalletSubCommand {
336338
CombinePsbt(CombinePsbtCommand),
337339
/// Sign a message using BIP322
338340
#[cfg(feature = "bip322")]
339-
// SignMessage {
340-
// /// The message to sign
341-
// #[arg(long)]
342-
// message: String,
343-
// /// The signature format (e.g., Legacy, Simple, Full)
344-
// #[arg(long, default_value = "simple")]
345-
// signature_type: String,
346-
// /// Address to sign
347-
// #[arg(long)]
348-
// address: String,
349-
// /// Optional list of specific UTXOs for proof-of-funds (only for `FullWithProofOfFunds`)
350-
// #[arg(long)]
351-
// utxos: Option<Vec<OutPoint>>,
352-
// },
353341
SignMessage(SignMessageCommand),
354342
/// Verify a BIP322 signature
355343
#[cfg(feature = "bip322")]
356-
// VerifyMessage {
357-
// /// The signature proof to verify
358-
// #[arg(long)]
359-
// proof: String,
360-
// /// The message that was signed
361-
// #[arg(long)]
362-
// message: String,
363-
// /// The address associated with the signature
364-
// #[arg(long)]
365-
// address: String,
366-
// },
367344
VerifyMessage(VerifyMessageCommand),
368345
}
369346

370347
/// Wallet subcommands that needs a blockchain backend.
371348
#[derive(Debug, Subcommand, Clone, PartialEq, Eq)]
372349
#[command(rename_all = "snake")]
373-
// #[cfg(any(
374-
// feature = "electrum",
375-
// feature = "esplora",
376-
// feature = "cbf",
377-
// feature = "rpc"
378-
// ))]
350+
#[cfg(any(
351+
feature = "electrum",
352+
feature = "esplora",
353+
feature = "cbf",
354+
feature = "rpc"
355+
))]
379356
pub enum OnlineWalletSubCommand {
380357
/// Full Scan with the chosen blockchain server.
381358
FullScan(FullScanCommand),
@@ -384,41 +361,8 @@ pub enum OnlineWalletSubCommand {
384361
/// Broadcasts a transaction to the network. Takes either a raw transaction or a PSBT to extract.
385362
Broadcast(BroadcastCommand),
386363
/// Generates a Payjoin receive URI and processes the sender's Payjoin proposal.
387-
// ReceivePayjoin {
388-
// /// Amount to be received in sats.
389-
// #[arg(env = "PAYJOIN_AMOUNT", long = "amount", required = true)]
390-
// amount: u64,
391-
// /// Payjoin directory which will be used to store the PSBTs which are pending action
392-
// /// from one of the parties.
393-
// #[arg(env = "PAYJOIN_DIRECTORY", long = "directory", required = true)]
394-
// directory: String,
395-
// /// URL of the Payjoin OHTTP relay. Can be repeated multiple times to attempt the
396-
// /// operation with multiple relays for redundancy.
397-
// #[arg(env = "PAYJOIN_OHTTP_RELAY", long = "ohttp_relay", required = true)]
398-
// ohttp_relay: Vec<String>,
399-
// /// Maximum effective fee rate the receiver is willing to pay for their own input/output contributions.
400-
// #[arg(env = "PAYJOIN_RECEIVER_MAX_FEE_RATE", long = "max_fee_rate")]
401-
// max_fee_rate: Option<u64>,
402-
// },
403364
ReceivePayjoin(ReceivePayjoinCommand),
404365
/// Sends an original PSBT to a BIP 21 URI and broadcasts the returned Payjoin PSBT.
405-
// SendPayjoin {
406-
// /// BIP 21 URI for the Payjoin.
407-
// #[arg(env = "PAYJOIN_URI", long = "uri", required = true)]
408-
// uri: String,
409-
// /// URL of the Payjoin OHTTP relay. Can be repeated multiple times to attempt the
410-
// /// operation with multiple relays for redundancy.
411-
// #[arg(env = "PAYJOIN_OHTTP_RELAY", long = "ohttp_relay", required = true)]
412-
// ohttp_relay: Vec<String>,
413-
// /// Fee rate to use in sat/vbyte.
414-
// #[arg(
415-
// env = "PAYJOIN_SENDER_FEE_RATE",
416-
// short = 'f',
417-
// long = "fee_rate",
418-
// required = true
419-
// )]
420-
// fee_rate: u64,
421-
// },
422366
SendPayjoin(SendPayjoinCommand),
423367
}
424368

src/handlers/key.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ use bdk_wallet::keys::{DescriptorKey, ExtendedKey, GeneratedKey};
1414
use bdk_wallet::miniscript::{self, Segwitv0};
1515
use clap::Parser;
1616

17-
18-
1917
impl KeySubCommand {
2018
pub fn execute(&self, ctx: &mut AppContext) -> Result<(), Error> {
2119
match self {

0 commit comments

Comments
 (0)