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

Commit ab83677

Browse files
committed
update Config::signer_or_default
1 parent b7a3ad5 commit ab83677

File tree

3 files changed

+31
-32
lines changed

3 files changed

+31
-32
lines changed

token/cli/src/clap_app.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ pub fn app<'a>(
920920
.arg(
921921
Arg::with_name("rate_authority")
922922
.long("rate-authority")
923-
.validator(|s| is_valid_signer(s))
923+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
924924
.value_name("SIGNER")
925925
.takes_value(true)
926926
.help(
@@ -961,7 +961,7 @@ pub fn app<'a>(
961961
Arg::with_name("authority")
962962
.long("authority")
963963
.alias("owner")
964-
.validator(|s| is_valid_signer(s))
964+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
965965
.value_name("SIGNER")
966966
.takes_value(true)
967967
.help("Specify the authority keypair. Defaults to the client keypair address.")
@@ -1008,7 +1008,7 @@ pub fn app<'a>(
10081008
.long("mint-authority")
10091009
.alias("owner")
10101010
.value_name("KEYPAIR")
1011-
.validator(|s| is_valid_signer(s))
1011+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
10121012
.takes_value(true)
10131013
.help(
10141014
"Specify the mint authority keypair. \
@@ -1066,7 +1066,7 @@ pub fn app<'a>(
10661066
.arg(
10671067
Arg::with_name("authority")
10681068
.long("authority")
1069-
.validator(|s| is_valid_signer(s))
1069+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
10701070
.value_name("SIGNER")
10711071
.takes_value(true)
10721072
.help("Specify the metadata update authority keypair. Defaults to the client keypair.")
@@ -1101,7 +1101,7 @@ pub fn app<'a>(
11011101
.long("mint-authority")
11021102
.alias("owner")
11031103
.value_name("KEYPAIR")
1104-
.validator(|s| is_valid_signer(s))
1104+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
11051105
.takes_value(true)
11061106
.help(
11071107
"Specify the mint authority keypair. \
@@ -1146,7 +1146,7 @@ pub fn app<'a>(
11461146
Arg::with_name("update_authority")
11471147
.long("update-authority")
11481148
.value_name("SIGNER")
1149-
.validator(|s| is_valid_signer(s))
1149+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
11501150
.takes_value(true)
11511151
.help(
11521152
"Specify the update authority address. \
@@ -1180,7 +1180,7 @@ pub fn app<'a>(
11801180
.long("mint-authority")
11811181
.alias("owner")
11821182
.value_name("KEYPAIR")
1183-
.validator(|s| is_valid_signer(s))
1183+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
11841184
.takes_value(true)
11851185
.help(
11861186
"Specify the mint authority keypair. \
@@ -1192,7 +1192,7 @@ pub fn app<'a>(
11921192
Arg::with_name("group_update_authority")
11931193
.long("group-update-authority")
11941194
.value_name("KEYPAIR")
1195-
.validator(|s| is_valid_signer(s))
1195+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
11961196
.takes_value(true)
11971197
.help(
11981198
"Specify the update authority keypair. \
@@ -1311,7 +1311,7 @@ pub fn app<'a>(
13111311
.long("authority")
13121312
.alias("owner")
13131313
.value_name("KEYPAIR")
1314-
.validator(|s| is_valid_signer(s))
1314+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
13151315
.takes_value(true)
13161316
.help(
13171317
"Specify the current authority keypair. \
@@ -1544,7 +1544,7 @@ pub fn app<'a>(
15441544
.long("mint-authority")
15451545
.alias("owner")
15461546
.value_name("KEYPAIR")
1547-
.validator(|s| is_valid_signer(s))
1547+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
15481548
.takes_value(true)
15491549
.help(
15501550
"Specify the mint authority keypair. \
@@ -1575,7 +1575,7 @@ pub fn app<'a>(
15751575
.long("freeze-authority")
15761576
.alias("owner")
15771577
.value_name("KEYPAIR")
1578-
.validator(|s| is_valid_signer(s))
1578+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
15791579
.takes_value(true)
15801580
.help(
15811581
"Specify the freeze authority keypair. \
@@ -1605,7 +1605,7 @@ pub fn app<'a>(
16051605
.long("freeze-authority")
16061606
.alias("owner")
16071607
.value_name("KEYPAIR")
1608-
.validator(|s| is_valid_signer(s))
1608+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
16091609
.takes_value(true)
16101610
.help(
16111611
"Specify the freeze authority keypair. \
@@ -1634,7 +1634,7 @@ pub fn app<'a>(
16341634
Arg::with_name("wallet_keypair")
16351635
.alias("owner")
16361636
.value_name("KEYPAIR")
1637-
.validator(|s| is_valid_signer(s))
1637+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
16381638
.takes_value(true)
16391639
.index(2)
16401640
.help(
@@ -1676,7 +1676,7 @@ pub fn app<'a>(
16761676
.arg(
16771677
Arg::with_name("wallet_keypair")
16781678
.value_name("KEYPAIR")
1679-
.validator(|s| is_valid_signer(s))
1679+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
16801680
.takes_value(true)
16811681
.index(2)
16821682
.help(
@@ -1773,7 +1773,7 @@ pub fn app<'a>(
17731773
Arg::with_name("close_authority")
17741774
.long("close-authority")
17751775
.value_name("KEYPAIR")
1776-
.validator(|s| is_valid_signer(s))
1776+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
17771777
.takes_value(true)
17781778
.help(
17791779
"Specify the token's close authority if it has one, \
@@ -1820,7 +1820,7 @@ pub fn app<'a>(
18201820
Arg::with_name("close_authority")
18211821
.long("close-authority")
18221822
.value_name("KEYPAIR")
1823-
.validator(|s| is_valid_signer(s))
1823+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
18241824
.takes_value(true)
18251825
.help(
18261826
"Specify the token's close authority. \
@@ -1950,7 +1950,7 @@ pub fn app<'a>(
19501950
Arg::with_name(OWNER_ADDRESS_ARG.name)
19511951
.takes_value(true)
19521952
.value_name("OWNER_ADDRESS")
1953-
.validator(|s| is_valid_signer(s))
1953+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
19541954
.help(OWNER_ADDRESS_ARG.help)
19551955
.index(2)
19561956
.conflicts_with("address")
@@ -2124,7 +2124,7 @@ pub fn app<'a>(
21242124
Arg::with_name("freeze_authority")
21252125
.long("freeze-authority")
21262126
.value_name("KEYPAIR")
2127-
.validator(|s| is_valid_signer(s))
2127+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
21282128
.takes_value(true)
21292129
.help(
21302130
"Specify the token's freeze authority. \
@@ -2169,7 +2169,7 @@ pub fn app<'a>(
21692169
Arg::with_name("authority")
21702170
.long("authority")
21712171
.value_name("KEYPAIR")
2172-
.validator(|s| is_valid_signer(s))
2172+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
21732173
.takes_value(true)
21742174
.help(
21752175
"Specify the token's metadata-pointer authority. \
@@ -2212,7 +2212,7 @@ pub fn app<'a>(
22122212
Arg::with_name("authority")
22132213
.long("authority")
22142214
.value_name("KEYPAIR")
2215-
.validator(|s| is_valid_signer(s))
2215+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
22162216
.takes_value(true)
22172217
.help(
22182218
"Specify the token's group-pointer authority. \
@@ -2255,7 +2255,7 @@ pub fn app<'a>(
22552255
Arg::with_name("authority")
22562256
.long("authority")
22572257
.value_name("KEYPAIR")
2258-
.validator(|s| is_valid_signer(s))
2258+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
22592259
.takes_value(true)
22602260
.help(
22612261
"Specify the token's group-member-pointer authority. \
@@ -2298,7 +2298,7 @@ pub fn app<'a>(
22982298
Arg::with_name("withdraw_withheld_authority")
22992299
.long("withdraw-withheld-authority")
23002300
.value_name("KEYPAIR")
2301-
.validator(|s| is_valid_signer(s))
2301+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
23022302
.takes_value(true)
23032303
.help(
23042304
"Specify the withdraw withheld authority keypair. \
@@ -2345,7 +2345,7 @@ pub fn app<'a>(
23452345
.arg(
23462346
Arg::with_name("transfer_fee_authority")
23472347
.long("transfer-fee-authority")
2348-
.validator(|s| is_valid_signer(s))
2348+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
23492349
.value_name("SIGNER")
23502350
.takes_value(true)
23512351
.help(
@@ -2427,7 +2427,7 @@ pub fn app<'a>(
24272427
.arg(
24282428
Arg::with_name("confidential_transfer_authority")
24292429
.long("confidential-transfer-authority")
2430-
.validator(|s| is_valid_signer(s))
2430+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
24312431
.value_name("SIGNER")
24322432
.takes_value(true)
24332433
.help(

token/cli/src/command.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ use {
1616
parse_token::{get_token_account_mint, parse_token_v2, TokenAccountType, UiAccountState},
1717
UiAccountData,
1818
},
19-
solana_clap_v3_utils::{
20-
input_parsers::{pubkey_of_signer, pubkeys_of_multiple_signers, signer::SignerSource},
21-
keypair::signer_from_path,
19+
solana_clap_v3_utils::input_parsers::{
20+
pubkey_of_signer, pubkeys_of_multiple_signers, signer::SignerSource,
2221
},
2322
solana_cli_output::{
2423
return_signers_data, CliSignOnlyData, CliSignature, OutputFormat, QuietDisplay,

token/cli/src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use {
22
crate::clap_app::{Error, COMPUTE_UNIT_LIMIT_ARG, COMPUTE_UNIT_PRICE_ARG, MULTISIG_SIGNER_ARG},
33
clap::ArgMatches,
44
solana_clap_v3_utils::{
5-
input_parsers::pubkey_of_signer,
5+
input_parsers::{pubkey_of_signer, signer::SignerSource},
66
input_validators::normalize_to_url_if_moniker,
7-
keypair::SignerFromPathConfig,
7+
keypair::{signer_from_source_with_config, SignerFromPathConfig},
88
nonce::{NONCE_ARG, NONCE_AUTHORITY_ARG},
99
offline::{BLOCKHASH_ARG, DUMP_TRANSACTION_MESSAGE, SIGNER_ARG, SIGN_ONLY_ARG},
1010
},
@@ -474,10 +474,10 @@ impl<'a> Config<'a> {
474474
};
475475
let mut load_authority = move || -> Result<Arc<dyn Signer>, Error> {
476476
if authority_name != "owner" {
477-
if let Some(keypair_path) = arg_matches.value_of(authority_name) {
478-
return signer_from_path_with_config(
477+
if let Some(source) = arg_matches.get_one::<SignerSource>(authority_name) {
478+
return signer_from_source_with_config(
479479
arg_matches,
480-
keypair_path,
480+
source,
481481
authority_name,
482482
wallet_manager,
483483
&config,

0 commit comments

Comments
 (0)