Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

[toekn-cli] Replace is_valid_pubkey validator with signer source parser #7447

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 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::ArgMatches,
solana_clap_v3_utils::input_parsers::{pubkey_of_signer, Amount},
solana_clap_v3_utils::input_parsers::{signer::SignerSource, Amount},
solana_client::{
nonblocking::rpc_client::RpcClient, rpc_client::RpcClient as BlockingRpcClient,
tpu_client::TpuClient, tpu_client::TpuClientConfig,
Expand Down Expand Up @@ -31,7 +31,7 @@ pub(crate) async fn bench_process_command(

match matches.subcommand() {
Some(("create-accounts", arg_matches)) => {
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
let token = SignerSource::try_get_pubkey(arg_matches, "token", wallet_manager)
.unwrap()
.unwrap();
let n = *arg_matches.get_one::<usize>("n").unwrap();
Expand All @@ -43,7 +43,7 @@ pub(crate) async fn bench_process_command(
command_create_accounts(config, signers, &token, n, &owner).await?;
}
Some(("close-accounts", arg_matches)) => {
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
let token = SignerSource::try_get_pubkey(arg_matches, "token", wallet_manager)
.unwrap()
.unwrap();
let n = *arg_matches.get_one::<usize>("n").unwrap();
Expand All @@ -54,30 +54,30 @@ pub(crate) async fn bench_process_command(
command_close_accounts(config, signers, &token, n, &owner).await?;
}
Some(("deposit-into", arg_matches)) => {
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
let token = SignerSource::try_get_pubkey(arg_matches, "token", wallet_manager)
.unwrap()
.unwrap();
let n = *arg_matches.get_one::<usize>("n").unwrap();
let ui_amount = *arg_matches.get_one::<Amount>("amount").unwrap();
let (owner_signer, owner) =
config.signer_or_default(arg_matches, "owner", wallet_manager);
signers.push(owner_signer);
let from = pubkey_of_signer(arg_matches, "from", wallet_manager).unwrap();
let from = SignerSource::try_get_pubkey(arg_matches, "from", wallet_manager).unwrap();
command_deposit_into_or_withdraw_from(
config, signers, &token, n, &owner, ui_amount, from, true,
)
.await?;
}
Some(("withdraw-from", arg_matches)) => {
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
let token = SignerSource::try_get_pubkey(arg_matches, "token", wallet_manager)
.unwrap()
.unwrap();
let n = *arg_matches.get_one::<usize>("n").unwrap();
let ui_amount = *arg_matches.get_one::<Amount>("amount").unwrap();
let (owner_signer, owner) =
config.signer_or_default(arg_matches, "owner", wallet_manager);
signers.push(owner_signer);
let to = pubkey_of_signer(arg_matches, "to", wallet_manager).unwrap();
let to = SignerSource::try_get_pubkey(arg_matches, "to", wallet_manager).unwrap();
command_deposit_into_or_withdraw_from(
config, signers, &token, n, &owner, ui_amount, to, false,
)
Expand Down
Loading
Loading