]> Untitled Git - bdk-cli/commitdiff
General cleanup for the docs
authorAlekos Filini <alekos.filini@gmail.com>
Mon, 31 Aug 2020 08:49:44 +0000 (10:49 +0200)
committerAlekos Filini <alekos.filini@gmail.com>
Mon, 31 Aug 2020 13:04:27 +0000 (15:04 +0200)
Cargo.toml
src/cli.rs

index ec9624b2a40bfc8c07943ee8e3f958c5d68cc070..599e8072a603cc2abf1d492aa745274aa608552f 100644 (file)
@@ -83,3 +83,10 @@ required-features = ["cli-utils"]
 
 [workspace]
 members = ["macros", "testutils", "testutils-macros"]
+
+# Generate docs with nightly to add the "features required" badge
+# https://stackoverflow.com/questions/61417452/how-to-get-a-feature-requirement-tag-in-the-documentation-generated-by-cargo-do
+[package.metadata.docs.rs]
+features = ["compiler", "electrum", "esplora", "compact_filters", "key-value-db"]
+# defines the configuration attribute `docsrs`
+rustdoc-args = ["--cfg", "docsrs"]
index f3b11ef6e20e848527b40b54d0cd02d11129c550..51c56ef910af59350d0e8ea3832efa76dec7721a 100644 (file)
@@ -40,7 +40,7 @@ use crate::error::Error;
 use crate::types::ScriptType;
 use crate::{FeeRate, TxBuilder, Wallet};
 
-fn parse_addressee(s: &str) -> Result<(Address, u64), String> {
+fn parse_recipient(s: &str) -> Result<(Address, u64), String> {
     let parts: Vec<_> = s.split(":").collect();
     if parts.len() != 2 {
         return Err("Invalid format".to_string());
@@ -62,8 +62,8 @@ fn parse_outpoint(s: &str) -> Result<OutPoint, String> {
     OutPoint::from_str(s).map_err(|e| format!("{:?}", e))
 }
 
-fn addressee_validator(s: String) -> Result<(), String> {
-    parse_addressee(&s).map(|_| ())
+fn recipient_validator(s: String) -> Result<(), String> {
+    parse_recipient(&s).map(|_| ())
 }
 
 fn outpoint_validator(s: String) -> Result<(), String> {
@@ -95,18 +95,18 @@ pub fn make_cli_subcommands<'a, 'b>() -> App<'a, 'b> {
                     Arg::with_name("to")
                         .long("to")
                         .value_name("ADDRESS:SAT")
-                        .help("Adds an addressee to the transaction")
+                        .help("Adds a recipient to the transaction")
                         .takes_value(true)
                         .number_of_values(1)
                         .required(true)
                         .multiple(true)
-                        .validator(addressee_validator),
+                        .validator(recipient_validator),
                 )
                 .arg(
                     Arg::with_name("send_all")
                         .short("all")
                         .long("send_all")
-                        .help("Sends all the funds (or all the selected utxos). Requires only one addressees of value 0"),
+                        .help("Sends all the funds (or all the selected utxos). Requires only one recipients of value 0"),
                 )
                 .arg(
                     Arg::with_name("enable_rbf")
@@ -382,13 +382,13 @@ where
             "satoshi": wallet.get_balance()?
         }))
     } else if let Some(sub_matches) = matches.subcommand_matches("create_tx") {
-        let addressees = sub_matches
+        let recipients = sub_matches
             .values_of("to")
             .unwrap()
-            .map(|s| parse_addressee(s))
+            .map(|s| parse_recipient(s))
             .collect::<Result<Vec<_>, _>>()
             .map_err(|s| Error::Generic(s))?;
-        let mut tx_builder = TxBuilder::from_addressees(addressees);
+        let mut tx_builder = TxBuilder::with_recipients(recipients);
 
         if sub_matches.is_present("send_all") {
             tx_builder = tx_builder.send_all();
@@ -503,13 +503,13 @@ where
         }))
     } else if let Some(sub_matches) = matches.subcommand_matches("finalize_psbt") {
         let psbt = base64::decode(&sub_matches.value_of("psbt").unwrap()).unwrap();
-        let mut psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();
+        let psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();
 
         let assume_height = sub_matches
             .value_of("assume_height")
             .and_then(|s| Some(s.parse().unwrap()));
 
-        let finalized = wallet.finalize_psbt(&mut psbt, assume_height)?;
+        let (psbt, finalized) = wallet.finalize_psbt(psbt, assume_height)?;
         Ok(json!({
             "psbt": base64::encode(&serialize(&psbt)),
             "is_finalized": finalized,