]> Untitled Git - bdk-cli/commitdiff
if no wallet name was provided, use one derived from the descriptor
authorRichard Ulrich <richi@paraeasy.ch>
Thu, 25 Nov 2021 12:16:00 +0000 (13:16 +0100)
committerRichard Ulrich <richi@paraeasy.ch>
Tue, 11 Jan 2022 06:48:44 +0000 (07:48 +0100)
CHANGELOG.md
Cargo.lock
Cargo.toml
src/bdk_cli.rs
src/lib.rs

index 6924377b54de36cdbb54ccb0bf4a4b31aa32a721..7df29d34c4f446d4d854226bd3d3d0b63084905f 100644 (file)
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 - Replace `wallet bump_fee` command `--send_all` with new `--shrink` option
 - Add 'reserve' feature to enable proof of reserve
+- If no wallet name is provided, derive one from the descriptor instead of using "main"
 
 ## [0.3.0]
 
index 11e218879078af1e9d8e594383ef73773c989399..cbfd156cc7f9c695faa97b25da49c1a3fb443be3 100644 (file)
@@ -80,9 +80,9 @@ dependencies = [
 
 [[package]]
 name = "bdk"
-version = "0.14.0"
+version = "0.15.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6ec4da3dbaa41bb6d6cffe40b113ea8651566da7f96beebe9c0e87fc92b9094"
+checksum = "90456af1a5ceb48721ce092d97bd37d2d932c2877a352f52c934d8a564f62e49"
 dependencies = [
  "async-trait",
  "bdk-macros",
@@ -139,9 +139,9 @@ dependencies = [
 
 [[package]]
 name = "bdk-reserves"
-version = "0.14.3"
+version = "0.15.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af45ab67ba3a9e2bf44c0567a89b60cdcf3bcc21ae52938d98c8d2eaa1078a08"
+checksum = "6be281faf67beffdfbdb2b049dba1f97d58c7f46ff9d9586811c813d7abf9485"
 dependencies = [
  "base64 0.11.0",
  "bdk",
index 07e5b7c6afe3058fd25092767554f82db96378cf..9319bc3f229a93d91b15e80ba5de22afd4602300 100644 (file)
@@ -12,7 +12,7 @@ readme = "README.md"
 license = "MIT"
 
 [dependencies]
-bdk = { version = "0.14.0", default-features = false, features = ["all-keys"]}
+bdk = { version = "0.15", default-features = false, features = ["all-keys"]}
 bdk-macros = "0.6"
 structopt = "^0.3"
 serde_json = { version = "^1.0" }
@@ -26,7 +26,7 @@ dirs-next = { version = "2.0", optional = true }
 env_logger = { version = "0.7", optional = true }
 clap = { version = "2.33", optional = true }
 regex = { version = "1", optional = true }
-bdk-reserves = { version = "0.14.2", optional = true}
+bdk-reserves = { version = "0.15", optional = true}
 
 [features]
 default = ["cli", "repl"]
index 4902b0301fd0290f4a795d4fc35318f040424220..baa12cf8e05fb90abb73d58ff9f3ab213835a7fb 100644 (file)
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 // SOFTWARE.
 
+use bitcoin::secp256k1::Secp256k1;
+use bitcoin::Network;
 use std::fs;
 use std::path::PathBuf;
 
-#[cfg(feature = "rpc")]
-use bitcoin::secp256k1::Secp256k1;
-use bitcoin::Network;
 use clap::AppSettings;
 use log::{debug, error, info, warn};
 
@@ -54,11 +53,12 @@ use bdk::blockchain::esplora::EsploraBlockchainConfig;
 use bdk::blockchain::{AnyBlockchain, AnyBlockchainConfig, ConfigurableBlockchain};
 
 #[cfg(feature = "rpc")]
-use bdk::blockchain::rpc::{wallet_name_from_descriptor, Auth, RpcConfig};
+use bdk::blockchain::rpc::{Auth, RpcConfig};
 
 use bdk::database::BatchDatabase;
 use bdk::sled;
 use bdk::sled::Tree;
+use bdk::wallet::wallet_name_from_descriptor;
 use bdk::Wallet;
 use bdk::{bitcoin, Error};
 use bdk_cli::WalletSubCommand;
@@ -122,9 +122,13 @@ fn prepare_home_dir() -> Result<PathBuf, Error> {
 
 fn open_database(wallet_opts: &WalletOpts) -> Result<Tree, Error> {
     let mut database_path = prepare_home_dir()?;
-    database_path.push(wallet_opts.wallet.clone());
+    let wallet_name = wallet_opts
+        .wallet
+        .as_deref()
+        .expect("We should always have a wallet name at this point");
+    database_path.push(wallet_name);
     let database = sled::open(database_path)?;
-    let tree = database.open_tree(&wallet_opts.wallet)?;
+    let tree = database.open_tree(&wallet_name)?;
     debug!("database opened successfully");
     Ok(tree)
 }
@@ -152,18 +156,10 @@ where
         stop_gap: wallet_opts.electrum_opts.stop_gap,
     });
 
-    #[cfg(feature = "esplora-ureq")]
-    let config = AnyBlockchainConfig::Esplora(EsploraBlockchainConfig {
-        base_url: wallet_opts.esplora_opts.server.clone(),
-        timeout_read: wallet_opts.esplora_opts.read_timeout,
-        timeout_write: wallet_opts.esplora_opts.write_timeout,
-        stop_gap: wallet_opts.esplora_opts.stop_gap,
-        proxy: wallet_opts.proxy_opts.proxy.clone(),
-    });
-
-    #[cfg(feature = "esplora-reqwest")]
+    #[cfg(feature = "esplora")]
     let config = AnyBlockchainConfig::Esplora(EsploraBlockchainConfig {
         base_url: wallet_opts.esplora_opts.server.clone(),
+        timeout: Some(wallet_opts.esplora_opts.timeout),
         concurrency: Some(wallet_opts.esplora_opts.conc),
         stop_gap: wallet_opts.esplora_opts.stop_gap,
         proxy: wallet_opts.proxy_opts.proxy.clone(),
@@ -263,13 +259,33 @@ fn main() {
         Ok(result) => println!("{}", result),
         Err(e) => {
             match e {
-                Error::ChecksumMismatch => error!("Descriptor checksum mismatch. Are you using a different descriptor for an already defined wallet name? (if you are not specifying the wallet name it defaults to 'main')"),
+                Error::ChecksumMismatch => error!("Descriptor checksum mismatch. Are you using a different descriptor for an already defined wallet name? (if you are not specifying the wallet name it is automatically named based on the descriptor)"),
                 e => error!("{}", e.to_string()),
             }
         },
     }
 }
 
+fn maybe_descriptor_wallet_name(
+    wallet_opts: WalletOpts,
+    network: Network,
+) -> Result<WalletOpts, Error> {
+    if wallet_opts.wallet.is_some() {
+        return Ok(wallet_opts);
+    }
+    // Use deterministic wallet name derived from descriptor
+    let wallet_name = wallet_name_from_descriptor(
+        &wallet_opts.descriptor[..],
+        wallet_opts.change_descriptor.as_deref(),
+        network,
+        &Secp256k1::new(),
+    )?;
+    let mut wallet_opts = wallet_opts;
+    wallet_opts.wallet = Some(wallet_name);
+
+    Ok(wallet_opts)
+}
+
 fn handle_command(cli_opts: CliOpts, network: Network) -> Result<String, Error> {
     let result = match cli_opts.subcommand {
         #[cfg(any(
@@ -282,6 +298,7 @@ fn handle_command(cli_opts: CliOpts, network: Network) -> Result<String, Error>
             wallet_opts,
             subcommand: WalletSubCommand::OnlineWalletSubCommand(online_subcommand),
         } => {
+            let wallet_opts = maybe_descriptor_wallet_name(wallet_opts, network)?;
             let database = open_database(&wallet_opts)?;
             let wallet = new_online_wallet(network, &wallet_opts, database)?;
             let result = bdk_cli::handle_online_wallet_subcommand(&wallet, online_subcommand)?;
@@ -291,6 +308,7 @@ fn handle_command(cli_opts: CliOpts, network: Network) -> Result<String, Error>
             wallet_opts,
             subcommand: WalletSubCommand::OfflineWalletSubCommand(offline_subcommand),
         } => {
+            let wallet_opts = maybe_descriptor_wallet_name(wallet_opts, network)?;
             let database = open_database(&wallet_opts)?;
             let wallet = new_offline_wallet(network, &wallet_opts, database)?;
             let result = bdk_cli::handle_offline_wallet_subcommand(
index 71c8d60f3233100f260198120540aa253ac46261..4950dc294342e52770d317bdb540ac7902300dde 100644 (file)
@@ -209,7 +209,7 @@ use bdk_reserves::reserves::ProofOfReserves;
 ///             network: Network::Testnet,
 ///             subcommand: CliSubCommand::Wallet {
 ///                 wallet_opts: WalletOpts {
-///                     wallet: "main".to_string(),
+///                     wallet: None,
 ///                     verbose: false,
 ///                     descriptor: "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/44'/1'/0'/0/*)".to_string(),
 ///                     change_descriptor: None,
@@ -219,18 +219,12 @@ use bdk_reserves::reserves::ProofOfReserves;
 ///                   server: "ssl://electrum.blockstream.info:60002".to_string(),
 ///                   stop_gap: 10
 ///               },
-///               #[cfg(feature = "esplora-ureq")]
+///               #[cfg(feature = "esplora")]
 ///               esplora_opts: EsploraOpts {
 ///                   server: "https://blockstream.info/testnet/api/".to_string(),
-///                   read_timeout: 5,
-///                   write_timeout: 5,
-///                   stop_gap: 10
-///               },
-///               #[cfg(feature = "esplora-reqwest")]
-///               esplora_opts: EsploraOpts {
-///                   server: "https://blockstream.info/testnet/api/".to_string(),
-///                   conc: 4,
-///                   stop_gap: 10
+///                   timeout: 5,
+///                   stop_gap: 10,
+///                   conc: 4
 ///               },
 ///                 #[cfg(feature = "rpc")]
 ///                 rpc_opts: RpcOpts{
@@ -395,7 +389,7 @@ pub enum WalletSubCommand {
 /// let wallet_opts = WalletOpts::from_iter(&cli_args);
 ///
 /// let expected_wallet_opts = WalletOpts {
-///               wallet: "main".to_string(),
+///               wallet: None,
 ///                     verbose: false,
 ///               descriptor: "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/44'/1'/0'/0/*)".to_string(),
 ///               change_descriptor: None,
@@ -405,18 +399,12 @@ pub enum WalletSubCommand {
 ///                   server: "ssl://electrum.blockstream.info:60002".to_string(),
 ///                   stop_gap: 10
 ///               },
-///               #[cfg(feature = "esplora-ureq")]
+///               #[cfg(feature = "esplora")]
 ///               esplora_opts: EsploraOpts {
 ///                   server: "https://blockstream.info/testnet/api/".to_string(),
-///                   read_timeout: 5,
-///                   write_timeout: 5,
-///                   stop_gap: 10
-///               },
-///               #[cfg(feature = "esplora-reqwest")]
-///               esplora_opts: EsploraOpts {
-///                   server: "https://blockstream.info/testnet/api/".to_string(),
-///                   conc: 4,
-///                   stop_gap: 10
+///                   timeout: 5,
+///                   stop_gap: 10,
+///                   conc: 4
 ///               },
 ///                #[cfg(feature = "compact_filters")]
 ///                compactfilter_opts: CompactFilterOpts{
@@ -444,13 +432,8 @@ pub enum WalletSubCommand {
 #[derive(Debug, StructOpt, Clone, PartialEq)]
 pub struct WalletOpts {
     /// Selects the wallet to use
-    #[structopt(
-        name = "WALLET_NAME",
-        short = "w",
-        long = "wallet",
-        default_value = "main"
-    )]
-    pub wallet: String,
+    #[structopt(name = "WALLET_NAME", short = "w", long = "wallet")]
+    pub wallet: Option<String>,
     /// Adds verbosity, returns PSBT in JSON format alongside serialized, displays expanded objects
     #[structopt(name = "VERBOSE", short = "v", long = "verbose")]
     pub verbose: bool,
@@ -588,7 +571,7 @@ pub struct ElectrumOpts {
 /// Esplora options
 ///
 /// Esplora blockchain client information used by [`OnlineWalletSubCommand`]s.
-#[cfg(feature = "esplora-ureq")]
+#[cfg(feature = "esplora")]
 #[derive(Debug, StructOpt, Clone, PartialEq)]
 pub struct EsploraOpts {
     /// Use the esplora server if given as parameter
@@ -600,13 +583,9 @@ pub struct EsploraOpts {
     )]
     pub server: String,
 
-    /// Socket read timeout
-    #[structopt(name = "READ_TIMEOUT", long = "read_timeout", default_value = "5")]
-    pub read_timeout: u64,
-
-    /// Socket write timeout
-    #[structopt(name = "WRITE_TIMEOUT", long = "write_timeout", default_value = "5")]
-    pub write_timeout: u64,
+    /// Socket timeout
+    #[structopt(name = "TIMEOUT", long = "timeout", default_value = "5")]
+    pub timeout: u64,
 
     /// Stop searching addresses for transactions after finding an unused gap of this length.
     #[structopt(
@@ -616,32 +595,10 @@ pub struct EsploraOpts {
         default_value = "10"
     )]
     pub stop_gap: usize,
-}
-
-#[cfg(feature = "esplora-reqwest")]
-#[derive(Debug, StructOpt, Clone, PartialEq)]
-pub struct EsploraOpts {
-    /// Use the esplora server if given as parameter
-    #[structopt(
-        name = "ESPLORA_URL",
-        short = "s",
-        long = "server",
-        default_value = "https://blockstream.info/testnet/api/"
-    )]
-    pub server: String,
 
     /// Number of parallel requests sent to the esplora service (default: 4)
     #[structopt(name = "CONCURRENCY", long = "conc", default_value = "4")]
     pub conc: u8,
-
-    /// Stop searching addresses for transactions after finding an unused gap of this length.
-    #[structopt(
-        name = "STOP_GAP",
-        long = "stop_gap",
-        short = "g",
-        default_value = "10"
-    )]
-    pub stop_gap: usize,
 }
 
 // This is a workaround for `structopt` issue #333, #391, #418; see https://github.com/TeXitoi/structopt/issues/333#issuecomment-712265332
@@ -1467,7 +1424,7 @@ mod test {
             network: Network::Bitcoin,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: Some("wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()),
@@ -1477,18 +1434,12 @@ mod test {
                         server: "ssl://electrum.blockstream.info:60002".to_string(),
                         stop_gap: 10,
                     },
-                    #[cfg(feature = "esplora-ureq")]
+                    #[cfg(feature = "esplora")]
                     esplora_opts: EsploraOpts {
                         server: "https://blockstream.info/testnet/api/".to_string(),
-                        read_timeout: 5,
-                        write_timeout: 5,
+                        timeout: 5,
                         stop_gap: 10,
-                    },
-                    #[cfg(feature = "esplora-reqwest")]
-                    esplora_opts: EsploraOpts {
-                        server: "https://blockstream.info/testnet/api/".to_string(),
                         conc: 4,
-                        stop_gap: 10,
                     },
                     #[cfg(feature = "compact_filters")]
                     compactfilter_opts: CompactFilterOpts{
@@ -1533,7 +1484,7 @@ mod test {
             network: Network::Testnet,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: Some("wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()),
@@ -1562,8 +1513,7 @@ mod test {
                             "--descriptor", "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)",
                             "--change_descriptor", "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)",
                             "--server", "https://blockstream.info/api/",
-                            "--read_timeout", "10",
-                            "--write_timeout", "10",
+                            "--timeout", "10",
                             "--stop_gap", "20",
                             "get_new_address"];
 
@@ -1573,15 +1523,15 @@ mod test {
             network: Network::Bitcoin,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: Some("wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()),
                     esplora_opts: EsploraOpts {
                         server: "https://blockstream.info/api/".to_string(),
-                        read_timeout: 10,
-                        write_timeout: 10,
-                        stop_gap: 20
+                        timeout: 10,
+                        stop_gap: 20,
+                        conc: 4,
                     },
                     proxy_opts: ProxyOpts{
                         proxy: None,
@@ -1613,14 +1563,15 @@ mod test {
             network: Network::Bitcoin,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: Some("wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()),
                     esplora_opts: EsploraOpts {
                         server: "https://blockstream.info/api/".to_string(),
                         conc: 10,
-                        stop_gap: 20
+                        stop_gap: 20,
+                        timeout: 5,
                     },
                     proxy_opts: ProxyOpts{
                         proxy: None,
@@ -1652,7 +1603,7 @@ mod test {
             network: Network::Bitcoin,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: Some("wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()),
@@ -1688,7 +1639,7 @@ mod test {
             network: Network::Bitcoin,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: Some("wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()),
@@ -1728,7 +1679,7 @@ mod test {
             network: Network::Testnet,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: None,
@@ -1738,18 +1689,12 @@ mod test {
                         server: "ssl://electrum.blockstream.info:60002".to_string(),
                         stop_gap: 10,
                     },
-                    #[cfg(feature = "esplora-ureq")]
+                    #[cfg(feature = "esplora")]
                     esplora_opts: EsploraOpts {
                         server: "https://blockstream.info/testnet/api/".to_string(),
-                        read_timeout: 5,
-                        write_timeout: 5,
+                        timeout: 5,
                         stop_gap: 10,
-                    },
-                    #[cfg(feature = "esplora-reqwest")]
-                    esplora_opts: EsploraOpts {
-                        server: "https://blockstream.info/testnet/api/".to_string(),
                         conc: 4,
-                        stop_gap: 10,
                     },
                     #[cfg(feature = "compact_filters")]
                     compactfilter_opts: CompactFilterOpts{
@@ -1809,7 +1754,7 @@ mod test {
             network: Network::Testnet,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: Some("wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()),
@@ -1819,18 +1764,12 @@ mod test {
                         server: "ssl://electrum.blockstream.info:60002".to_string(),
                         stop_gap: 10,
                     },
-                    #[cfg(feature = "esplora-ureq")]
+                    #[cfg(feature = "esplora")]
                     esplora_opts: EsploraOpts {
                         server: "https://blockstream.info/testnet/api/".to_string(),
-                        read_timeout: 5,
-                        write_timeout: 5,
+                        timeout: 5,
                         stop_gap: 10,
-                    },
-                    #[cfg(feature = "esplora-reqwest")]
-                    esplora_opts: EsploraOpts {
-                        server: "https://blockstream.info/testnet/api/".to_string(),
                         conc: 4,
-                        stop_gap: 10,
                     },
                     #[cfg(feature = "compact_filters")]
                     compactfilter_opts: CompactFilterOpts{
@@ -1883,7 +1822,7 @@ mod test {
             network: Network::Testnet,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: Some("wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()),
@@ -1893,18 +1832,12 @@ mod test {
                         server: "ssl://electrum.blockstream.info:60002".to_string(),
                         stop_gap: 10,
                     },
-                    #[cfg(feature = "esplora-ureq")]
+                    #[cfg(feature = "esplora")]
                     esplora_opts: EsploraOpts {
                         server: "https://blockstream.info/testnet/api/".to_string(),
-                        read_timeout: 5,
-                        write_timeout: 5,
+                        timeout: 5,
                         stop_gap: 10,
-                    },
-                    #[cfg(feature = "esplora-reqwest")]
-                    esplora_opts: EsploraOpts {
-                        server: "https://blockstream.info/testnet/api/".to_string(),
                         conc: 4,
-                        stop_gap: 10,
                     },
                     #[cfg(feature = "compact_filters")]
                     compactfilter_opts: CompactFilterOpts{
@@ -1958,7 +1891,7 @@ mod test {
             network: Network::Testnet,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
                     change_descriptor: None,
@@ -1968,18 +1901,12 @@ mod test {
                         server: "ssl://electrum.blockstream.info:60002".to_string(),
                         stop_gap: 10,
                     },
-                    #[cfg(feature = "esplora-ureq")]
+                    #[cfg(feature = "esplora")]
                     esplora_opts: EsploraOpts {
                         server: "https://blockstream.info/testnet/api/".to_string(),
-                        read_timeout: 5,
-                        write_timeout: 5,
+                        timeout: 5,
                         stop_gap: 10,
-                    },
-                    #[cfg(feature = "esplora-reqwest")]
-                    esplora_opts: EsploraOpts {
-                        server: "https://blockstream.info/testnet/api/".to_string(),
                         conc: 4,
-                        stop_gap: 10,
                     },
                     #[cfg(feature = "compact_filters")]
                     compactfilter_opts: CompactFilterOpts{
@@ -2140,7 +2067,7 @@ mod test {
             network: Network::Bitcoin,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)"
                         .to_string(),
@@ -2190,16 +2117,16 @@ mod test {
             network: Network::Bitcoin,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)"
                         .to_string(),
                     change_descriptor: None,
                     esplora_opts: EsploraOpts {
                         server: "https://blockstream.info/testnet/api/".to_string(),
-                        read_timeout: 5,
-                        write_timeout: 5,
+                        timeout: 5,
                         stop_gap: 10,
+                        conc: 4,
                     },
                     proxy_opts: ProxyOpts {
                         proxy: None,
@@ -2245,16 +2172,16 @@ mod test {
             network: Network::Bitcoin,
             subcommand: CliSubCommand::Wallet {
                 wallet_opts: WalletOpts {
-                    wallet: "main".to_string(),
+                    wallet: None,
                     verbose: false,
                     descriptor: "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)"
                         .to_string(),
                     change_descriptor: None,
                     esplora_opts: EsploraOpts {
                         server: "https://blockstream.info/testnet/api/".to_string(),
-                        read_timeout: 5,
-                        write_timeout: 5,
+                        timeout: 5,
                         stop_gap: 10,
+                        conc: 4,
                     },
                     proxy_opts: ProxyOpts {
                         proxy: None,