Skip to content

Prettify wallet-cli help; require mnemonic during wallet recovery#1953

Merged
ImplOfAnImpl merged 2 commits intomasterfrom
prettify_wallet_cli_help
Aug 18, 2025
Merged

Prettify wallet-cli help; require mnemonic during wallet recovery#1953
ImplOfAnImpl merged 2 commits intomasterfrom
prettify_wallet_cli_help

Conversation

@ImplOfAnImpl
Copy link
Copy Markdown
Contributor

@ImplOfAnImpl ImplOfAnImpl commented Aug 15, 2025

  1. Previously, in the output of the help command, the docs for individual commands were sometimes separated from each other with an empty line (when the doc was taken from RPC) and sometimes not (when it was generated by clap from the comamnd itself).
    Now they are always separated by an empty line.
  2. Docs taken from RPC used to preserve all original EOLs, and the clap ones didn't. Now the RPC docs are "clapified" before being re-used for CLI.
  3. Docs from RPC were put into the "about" part entirely, so they were printed fully in the output of the help command; the clap docs only put the first paragraph into "about", and to see the entire doc ("long_about") you need to run "help the_command".
    Now the docs from RPC also have the "about"/"long_about" parts.
  4. In the output of the help command, all commands are now sorted by name, except for "help", which comes at the end.
  5. I re-reviewed the output of each "help command" and reformulated some of them.
    Many commands now have a shorter first paragraph (which goes to "about" and which is shown in the output of "help"). So, the output of "help" is now less cluttered, but the user will have to run "help command" or "command --help" to see the full help (btw, "command -h" still prints the short version).

Also,

  1. The min Rust version was bumped to 1.88, this is because the latest version of cargo deny (which we always install on our CI) now requires at least 1.88.
  2. During software wallet recovery the mnemonic is now not optional.

use wallet_rpc_lib::RpcError;

#[derive(thiserror::Error, Debug)]
#[derive(thiserror::Error, derive_more::Debug)]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: the standard Debug macro requires N to implement Debug as well, so basically it never works. derive_more::Debug is more clever and puts no requirements on N.

Comment thread wallet/wallet-cli-commands/src/lib.rs Outdated
Comment on lines 58 to 64
/// Specifies whether the seed-phrase should be stored in the wallet file or
/// only printed on the screen.
///
/// Not storing the seed-phrase can be seen as a security measure
/// to ensure sufficient secrecy in case that seed-phrase is reused
/// elsewhere if this wallet is compromised.
whether_to_store_seed_phrase: CliStoreSeedPhrase,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: the possible values are still mentioned in the help. E.g. here is how it looks like now:

<WHETHER_TO_STORE_SEED_PHRASE>
          Specifies whether the seed-phrase should be stored in the wallet file or only printed on the screen.
          
          Not storing the seed-phrase can be seen as a security measure to ensure sufficient secrecy in case that seed-phrase is reused elsewhere if this wallet is compromised.
          
          [possible values: store-seed-phrase, do-not-store-seed-phrase]

Comment on lines +438 to 439
/// The type of utxos to be listed.
#[arg(value_enum, default_value_t = CliUtxoTypes::All)]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: the default value is still mentioned, here is the new output:

The type of utxos to be listed [default: all] [possible values: all, transfer, lock-then-transfer, create-stake-pool, produce-block-from-stake]

Comment on lines +1220 to +1223
lazy_static::lazy_static! {
static ref CUSTOM_RPC_TO_CLI_NAME_MAPPINGS: BTreeMap<&'static str, &'static str> =
BTreeMap::from([("account_extended_public_key", "account-extended-public-key-as-hex")]);
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: previously this wasn't needed because we allowed one name to be a prefix of the other (due to the usage of zip during comparison). Now we require the names to be identical (except for the separator)

@ImplOfAnImpl ImplOfAnImpl force-pushed the prettify_wallet_cli_help branch from 3cafe06 to 5796010 Compare August 15, 2025 08:50
@ImplOfAnImpl ImplOfAnImpl marked this pull request as ready for review August 15, 2025 08:54
@ImplOfAnImpl ImplOfAnImpl force-pushed the prettify_wallet_cli_help branch from 5796010 to 0293882 Compare August 15, 2025 12:02
Comment thread wallet/wallet-cli-commands/src/lib.rs Outdated
/// The utxos to pay fees from will be selected automatically; these will be normal, single-sig utxos.
/// The optional `fee_change_address` specifies the destination for the change for the fee payment;
/// The optional "fee change address" specifies the destination for the change for the fee payment;
/// If it's unset, the destination will be taken from one of existing single-sig utxos.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how clear single-sig utxos is to most users, maybe something like:
one of the existing UTXOs that require only a single signature (not multisig)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how clear single-sig utxos is to most users, maybe something like: one of the existing UTXOs that require only a single signature (not multisig)

This is a hidden command for internal use, so I'd leave it as is.

Comment thread wallet/wallet-cli-commands/src/lib.rs Outdated
@ImplOfAnImpl ImplOfAnImpl force-pushed the prettify_wallet_cli_help branch from 56f6048 to 3eef874 Compare August 17, 2025 15:30
@ImplOfAnImpl ImplOfAnImpl merged commit 40bc7ff into master Aug 18, 2025
28 checks passed
@ImplOfAnImpl ImplOfAnImpl deleted the prettify_wallet_cli_help branch August 18, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants