Skip to content

Commit

Permalink
[token-cli] Upgrade to clap-v3 (#6376)
Browse files Browse the repository at this point in the history
* upgrade clap version to `3.2.23`

* remove lifetime parameters from `ArgMatches`

* remove extra lifetime parameters from `Arg`

* remove extra lifetime parameters from `App`

* use `usize` type parameters for `min_values` and `max_values`

* use `char` type parameters for `short` arguments

* update syntax for custom validator functions

* update pattern matching syntax for `subcommand`

* update for new `possible_values` syntax

* allow deprecated input validation for now

* resolve lifetime specifier issue with higher order validator functions

* directly specify positional parameter indices

* remove non-functioning `owner` alias in some subcommands

* remove long names for positional arguments

* remove potential panice from `value_of` and `is_present`

* add custom `signer_from_path` and `signer_from_path_with_config`

* cargo fmt

* remove duplicate addition of args in invalid config test

* use `try_get_one` to parse `compute_unit_price` and `compute_unit_limit`

* hard-code `signer_arg` and `OfflineArgs`

* replace `value_of` function

* revert direct parser for `is_amount` validation
  • Loading branch information
samkim-crypto authored Oct 30, 2024
1 parent 4ff64ce commit 60a7ffe
Show file tree
Hide file tree
Showing 9 changed files with 395 additions and 267 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions token/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ walkdir = "2"

[dependencies]
base64 = "0.22.1"
clap = "2.33.3"
clap = "3.2.23"
console = "0.15.8"
futures = "0.3"
serde = "1.0.214"
serde_derive = "1.0.103"
serde_json = "1.0.132"
solana-account-decoder = "2.0.3"
solana-clap-utils = "2.0.3"
solana-clap-v3-utils = "2.0.3"
solana-cli-config = "2.0.3"
solana-cli-output = "2.0.3"
solana-client = "2.0.3"
Expand Down
12 changes: 6 additions & 6 deletions token/cli/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use {
crate::{clap_app::Error, command::CommandResult, config::Config},
clap::{value_t_or_exit, ArgMatches},
solana_clap_utils::input_parsers::pubkey_of_signer,
solana_clap_v3_utils::input_parsers::pubkey_of_signer,
solana_client::{
nonblocking::rpc_client::RpcClient, rpc_client::RpcClient as BlockingRpcClient,
tpu_client::TpuClient, tpu_client::TpuClientConfig,
Expand All @@ -22,15 +22,15 @@ use {
};

pub(crate) async fn bench_process_command(
matches: &ArgMatches<'_>,
matches: &ArgMatches,
config: &Config<'_>,
mut signers: Vec<Arc<dyn Signer>>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> CommandResult {
assert!(!config.sign_only);

match matches.subcommand() {
("create-accounts", Some(arg_matches)) => {
Some(("create-accounts", arg_matches)) => {
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
.unwrap()
.unwrap();
Expand All @@ -42,7 +42,7 @@ pub(crate) async fn bench_process_command(

command_create_accounts(config, signers, &token, n, &owner).await?;
}
("close-accounts", Some(arg_matches)) => {
Some(("close-accounts", arg_matches)) => {
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
.unwrap()
.unwrap();
Expand All @@ -53,7 +53,7 @@ pub(crate) async fn bench_process_command(

command_close_accounts(config, signers, &token, n, &owner).await?;
}
("deposit-into", Some(arg_matches)) => {
Some(("deposit-into", arg_matches)) => {
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
.unwrap()
.unwrap();
Expand All @@ -68,7 +68,7 @@ pub(crate) async fn bench_process_command(
)
.await?;
}
("withdraw-from", Some(arg_matches)) => {
Some(("withdraw-from", arg_matches)) => {
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
.unwrap()
.unwrap();
Expand Down
Loading

0 comments on commit 60a7ffe

Please sign in to comment.