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

Commit b908d7b

Browse files
authored
[token-upgrade] Remove deprecated functions from cli (#6526)
* removed allow deprecated * remove deprecated validators * spelling * removed dep warning * removed dep clap functions * added allow_all() to SignerSourceParserBuilder
1 parent d209ddf commit b908d7b

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

token-upgrade/cli/src/main.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#![allow(deprecated)]
2-
31
use {
42
clap::{crate_description, crate_name, crate_version, Arg, Command},
53
solana_clap_v3_utils::{
6-
input_parsers::{parse_url_or_moniker, pubkey_of},
7-
input_validators::{is_valid_pubkey, is_valid_signer, normalize_to_url_if_moniker},
4+
input_parsers::{parse_url_or_moniker, pubkey_of, signer::SignerSourceParserBuilder},
5+
input_validators::normalize_to_url_if_moniker,
86
keypair::{
97
signer_from_path, signer_from_path_with_config, DefaultSigner, SignerFromPathConfig,
108
},
@@ -225,7 +223,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
225223
Arg::new("payer")
226224
.long("payer")
227225
.value_name("KEYPAIR")
228-
.validator(|s| is_valid_signer(s))
226+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
229227
.takes_value(true)
230228
.global(true)
231229
.help("Filepath or URL to a keypair [default: client keypair]"),
@@ -252,7 +250,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
252250
Command::new("create-escrow").about("Create token account for the program escrow")
253251
.arg(
254252
Arg::new("original_mint")
255-
.validator(|s| is_valid_pubkey(s))
253+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
256254
.value_name("ADDRESS")
257255
.required(true)
258256
.takes_value(true)
@@ -261,7 +259,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
261259
)
262260
.arg(
263261
Arg::new("new_mint")
264-
.validator(|s| is_valid_pubkey(s))
262+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
265263
.value_name("ADDRESS")
266264
.required(true)
267265
.takes_value(true)
@@ -271,7 +269,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
271269
.arg(
272270
Arg::new("account_keypair")
273271
.value_name("ACCOUNT_KEYPAIR")
274-
.validator(|s| is_valid_signer(s))
272+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
275273
.takes_value(true)
276274
.index(3)
277275
.help("Specify the account keypair. This may be a keypair file or the ASK keyword. [default: associated token account for escrow authority]"),
@@ -281,7 +279,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
281279
Command::new("exchange").about("Exchange original tokens for new tokens")
282280
.arg(
283281
Arg::new("original_mint")
284-
.validator(|s| is_valid_pubkey(s))
282+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
285283
.value_name("ADDRESS")
286284
.required(true)
287285
.takes_value(true)
@@ -290,7 +288,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
290288
)
291289
.arg(
292290
Arg::new("new_mint")
293-
.validator(|s| is_valid_pubkey(s))
291+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
294292
.value_name("ADDRESS")
295293
.required(true)
296294
.takes_value(true)
@@ -301,38 +299,38 @@ async fn main() -> Result<(), Box<dyn Error>> {
301299
Arg::new("owner")
302300
.long("owner")
303301
.value_name("OWNER_KEYPAIR")
304-
.validator(|s| is_valid_signer(s))
302+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
305303
.takes_value(true)
306304
.help("Specify the owner or delegate for the burnt account. This may be a keypair file or the ASK keyword. [default: fee payer]"),
307305
)
308306
.arg(
309307
Arg::new("burn_from")
310308
.long("burn-from")
311309
.value_name("BURN_TOKEN_ACCOUNT_ADDRESS")
312-
.validator(|s| is_valid_pubkey(s))
310+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
313311
.takes_value(true)
314312
.help("Specify the burnt account address. [default: associated token account for owner on original mint]"),
315313
)
316314
.arg(
317315
Arg::new("escrow")
318316
.long("escrow")
319317
.value_name("ESCROW_TOKEN_ACCOUNT_ADDRESS")
320-
.validator(|s| is_valid_pubkey(s))
318+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
321319
.takes_value(true)
322320
.help("Specify the escrow account address to transfer from. [default: associated token account for the escrow authority on new mint]"),
323321
)
324322
.arg(
325323
Arg::new("destination")
326324
.long("destination")
327325
.value_name("DESTINATION_ACCOUNT_ADDRESS")
328-
.validator(|s| is_valid_pubkey(s))
326+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
329327
.takes_value(true)
330328
.help("Specify the destination account to receive new tokens. [default: associated token account for owner on new mint]"),
331329
)
332330
.arg(
333331
Arg::new("multisig_signer")
334332
.long("multisig-signer")
335-
.validator(|s| is_valid_signer(s))
333+
.value_parser(SignerSourceParserBuilder::default().allow_all().build())
336334
.value_name("MULTISIG_SIGNER")
337335
.takes_value(true)
338336
.multiple(true)

0 commit comments

Comments
 (0)