## [Unreleased]
- Add distinct `key-value-db` and `sqlite-db` features, keep default as `key-value-db`
+- Reorganize existing codes in separate modules. Change crate type from lib to bin.
+- Rewrite relevant doc comments as `structopt` help document.
+- Update `bdk` and `bdk-reserves` to v0.19.0.
+- Change default database to `sqlite`.
## [0.5.0]
# To use the app in a REPL mode
repl = ["regex", "rustyline", "fd-lock"]
-# Avaialable dataabse options
+# Avaialable databse options
key-value-db = ["bdk/key-value-db"]
sqlite-db = ["bdk/sqlite"]
-# Avialable blockchain backend options
+# Avialable blockchain client options
rpc = ["bdk/rpc"]
electrum = ["bdk/electrum"]
compact_filters = ["bdk/compact_filters"]
+++ /dev/null
-// Copyright (c) 2020-2021 Bitcoin Dev Kit Developers
-//
-// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
-// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
-// You may not use this file except in accordance with one or both of these
-// licenses.
-
-//! The Backend
-//!
-//! This module defines the Backend struct and associated operations
-
-#[allow(dead_code)]
-// Different Backend types activated with `regtest-*` mode.
-// If `regtest-*` feature not activated, then default is `None`.
-pub enum Backend {
- None,
- Bitcoin { rpc_url: String, rpc_auth: String },
- Electrum { electrum_url: String },
- Esplora { esplora_url: String },
-}
use crate::commands::OnlineWalletSubCommand::*;
use crate::commands::*;
use crate::utils::*;
-use crate::Backend;
+use crate::Nodes;
use bdk::{database::BatchDatabase, wallet::AddressIndex, Error, FeeRate, KeychainKind, Wallet};
use structopt::StructOpt;
pub fn handle_command(
cli_opts: CliOpts,
network: Network,
- _backend: Backend,
+ _backend: Nodes,
) -> Result<String, Error> {
let result = match cli_opts.subcommand {
#[cfg(any(
//!
//! This module describes the app's main() function
-mod backend;
mod commands;
mod handlers;
+mod nodes;
mod utils;
-use backend::Backend;
+use nodes::Nodes;
use bitcoin::Network;
#[cfg(feature = "regtest-bitcoin")]
let backend = {
- Backend::Bitcoin {
+ Nodes::Bitcoin {
rpc_url: bitcoind.params.rpc_socket.to_string(),
rpc_auth: bitcoind
.params
let elect_exe =
electrsd::downloaded_exe_path().expect("We should always have downloaded path");
let electrsd = electrsd::ElectrsD::with_conf(elect_exe, &bitcoind, &elect_conf).unwrap();
- let backend = Backend::Electrum {
+ let backend = Nodes::Electrum {
electrum_url: electrsd.electrum_url.clone(),
};
(electrsd, backend)
let elect_exe =
electrsd::downloaded_exe_path().expect("Electrsd downloaded binaries not found");
let electrsd = electrsd::ElectrsD::with_conf(elect_exe, &bitcoind, &elect_conf).unwrap();
- let backend = Backend::Esplora {
+ let backend = Nodes::Esplora {
esplora_url: electrsd
.esplora_url
.clone()
.expect("Esplora port not open in electrum"),
};
- (electrsd, backend)
+ (electrsd, nodes)
};
#[cfg(not(feature = "regtest-node"))]
- let backend = Backend::None;
+ let backend = Nodes::None;
match handle_command(cli_opts, network, backend) {
Ok(result) => println!("{}", result),
--- /dev/null
+// Copyright (c) 2020-2021 Bitcoin Dev Kit Developers
+//
+// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
+// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// You may not use this file except in accordance with one or both of these
+// licenses.
+
+//! The Node structures
+//!
+//! This module defines the the backend node structures for `regtest-*` features
+
+#[allow(dead_code)]
+// Different regtest node types activated with `regtest-*` mode.
+// If `regtest-*` feature not activated, then default is `None`.
+pub enum Nodes {
+ None,
+ Bitcoin { rpc_url: String, rpc_auth: String },
+ Electrum { electrum_url: String },
+ Esplora { esplora_url: String },
+}
use std::path::PathBuf;
use std::str::FromStr;
+use crate::commands::WalletOpts;
#[cfg(any(
feature = "electrum",
feature = "esplora",
feature = "compact_filters",
feature = "rpc"
))]
-use crate::backend::Backend;
-use crate::commands::WalletOpts;
+use crate::nodes::Nodes;
use bdk::bitcoin::secp256k1::Secp256k1;
use bdk::bitcoin::{Address, Network, OutPoint, Script};
#[cfg(feature = "compact_filters")]
pub(crate) fn new_blockchain(
_network: Network,
wallet_opts: &WalletOpts,
- _backend: &Backend,
+ _backend: &Nodes,
) -> Result<AnyBlockchain, Error> {
#[cfg(feature = "electrum")]
let config = {
let url = match _backend {
- Backend::Electrum { electrum_url } => electrum_url.to_owned(),
+ Nodes::Electrum { electrum_url } => electrum_url.to_owned(),
_ => wallet_opts.electrum_opts.server.clone(),
};
#[cfg(feature = "rpc")]
let config: AnyBlockchainConfig = {
let (url, auth) = match _backend {
- Backend::Bitcoin { rpc_url, rpc_auth } => (
+ Nodes::Bitcoin { rpc_url, rpc_auth } => (
rpc_url,
Auth::Cookie {
file: rpc_auth.into(),