Skip to content

Commit

Permalink
Prep for publishing to crates.io, rename bin to bdk-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
notmandatory committed Jan 6, 2021
1 parent 8cd25ce commit 6e52278
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ name = "bdk-cli"
version = "0.1.0"
edition = "2018"
authors = ["Alekos Filini <alekos.filini@gmail.com>", "Riccardo Casatta <riccardo@casatta.it>"]
homepage = "https://bitcoindevkit.org"
repository = "https://github.com/bitcoindevkit/bdk-cli"
documentation = "https://docs.rs/bdk-cli"
description = "A CLI library and example CLI tools based on the BDK descriptor-based wallet library"
keywords = ["bitcoin", "wallet", "descriptor", "psbt"]
readme = "README.md"
license-file = "LICENSE"

[dependencies]
bdk = { git = "https://github.com/bitcoindevkit/bdk.git" }
Expand All @@ -25,8 +32,7 @@ repl = ["async-trait", "rustyline", "dirs-next", "env_logger", "clap", "electrum
electrum = ["bdk/electrum"]
esplora = ["bdk/esplora"]


[[bin]]
name = "repl"
path = "src/repl.rs"
name = "bdk-cli"
path = "src/bdkcli.rs"
required-features = ["repl"]
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# BDK CLI lib and REPL bin
# bdk-cli lib and example bin tools

![CI](https://github.com/bitcoindevkit/bdk-cli/workflows/CI/badge.svg)
![Code Coverage](https://github.com/bitcoindevkit/bdk-cli/workflows/Code%20Coverage/badge.svg)

## About

This project provides a command line interface (cli) Bitcoin wallet library and [`REPL`](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)
wallet tool based on the [bdk](https://github.com/bitcoindevkit/bdk) library.
wallet tools based on the [bdk](https://github.com/bitcoindevkit/bdk) library.

### REPL wallet usage examples
### bdk-cli bin usage examples

To get usage information for the `repl` wallet tool use the below command which
returns a list of available wallet options and commands:
To get usage information for the `bdk-cli` bin use the below command which returns a list of
available wallet options and commands:

```shell
cargo run
Expand Down
File renamed without changes.
22 changes: 11 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
//! parse global wallet options and wallet subcommand options needed for a wallet command line
//! interface.
//!
//! See the `repl.rs` example for how to use this module to create a simple command line REPL
//! See the `bdk-cli` example bin for how to use this module to create a simple command line
//! wallet application.
//!
//! See [`WalletOpt`] for global wallet options and [`WalletSubCommand`] for supported sub-commands.
Expand All @@ -50,7 +50,7 @@
//! // to get args from cli use:
//! // let cli_opt = WalletOpt::from_args();
//!
//! let cli_args = vec!["repl", "--network", "testnet", "--descriptor",
//! let cli_args = vec!["bdk-cli", "--network", "testnet", "--descriptor",
//! "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)",
//! "sync", "--max_addresses", "50"];
//! let cli_opt = WalletOpt::from_iter(&cli_args);
Expand Down Expand Up @@ -123,7 +123,7 @@ use bdk::{FeeRate, KeychainKind, TxBuilder, Wallet};
/// # use structopt::StructOpt;
/// # use bdk_cli::{WalletSubCommand, WalletOpt};
///
/// let cli_args = vec!["repl", "--network", "testnet",
/// let cli_args = vec!["bdk-cli", "--network", "testnet",
/// "--descriptor", "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/44'/1'/0'/0/*)",
/// "sync", "--max_addresses", "50"];
///
Expand Down Expand Up @@ -211,16 +211,16 @@ pub struct WalletOpt {
/// Wallet sub-command
///
/// A [structopt](https://docs.rs/crate/structopt) enum that parses wallet sub-command arguments from
/// the command line or from a `String` vector, such as in the [`repl`](https://github.com/bitcoindevkit/bdk/blob/master/examples/repl.rs)
/// example app.
/// the command line or from a `String` vector, such as in the [`bdk-cli`](https://github.com/bitcoindevkit/bdk-cli/blob/master/src/bdkcli.rs)
/// example cli wallet.
///
/// # Example
///
/// ```
/// # use bdk_cli::WalletSubCommand;
/// # use structopt::StructOpt;
///
/// let sync_sub_command = WalletSubCommand::from_iter(&["repl", "sync", "--max_addresses", "50"]);
/// let sync_sub_command = WalletSubCommand::from_iter(&["bdk-cli", "sync", "--max_addresses", "50"]);
/// assert!(matches!(
/// sync_sub_command,
/// WalletSubCommand::Sync {
Expand All @@ -231,7 +231,7 @@ pub struct WalletOpt {
///
/// To capture wallet sub-commands from a string vector without a preceeding binary name you can
/// create a custom struct the includes the `NoBinaryName` clap setting and wraps the WalletSubCommand
/// enum. See also the [`repl`](https://github.com/bitcoindevkit/bdk/blob/master/examples/repl.rs)
/// enum. See also the [`bdk-cli`](https://github.com/bitcoindevkit/bdk-cli/blob/master/src/bdkcli.rs)
/// example app.
///
/// # Example
Expand Down Expand Up @@ -596,7 +596,7 @@ mod test {

#[test]
fn test_get_new_address() {
let cli_args = vec!["repl", "--network", "bitcoin",
let cli_args = vec!["bdk-cli", "--network", "bitcoin",
"--descriptor", "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)",
"--change_descriptor", "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)",
"--esplora", "https://blockstream.info/api/",
Expand Down Expand Up @@ -624,7 +624,7 @@ mod test {

#[test]
fn test_sync() {
let cli_args = vec!["repl", "--network", "testnet",
let cli_args = vec!["bdk-cli", "--network", "testnet",
"--descriptor", "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)",
"sync", "--max_addresses", "50"];

Expand All @@ -651,7 +651,7 @@ mod test {

#[test]
fn test_create_tx() {
let cli_args = vec!["repl", "--network", "testnet", "--proxy", "127.0.0.1:9150",
let cli_args = vec!["bdk-cli", "--network", "testnet", "--proxy", "127.0.0.1:9150",
"--descriptor", "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)",
"--change_descriptor", "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)",
"--server","ssl://electrum.blockstream.info:50002",
Expand Down Expand Up @@ -705,7 +705,7 @@ mod test {

#[test]
fn test_broadcast() {
let cli_args = vec!["repl", "--network", "testnet",
let cli_args = vec!["bdk-cli", "--network", "testnet",
"--descriptor", "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)",
"broadcast",
"--psbt", "cHNidP8BAEICAAAAASWhGE1AhvtO+2GjJHopssFmgfbq+WweHd8zN/DeaqmDAAAAAAD/////AQAAAAAAAAAABmoEAAECAwAAAAAAAAA="];
Expand Down

0 comments on commit 6e52278

Please sign in to comment.