66 } ,
77 solana_clap_v3_utils:: {
88 fee_payer:: fee_payer_arg,
9- input_parsers:: Amount ,
9+ input_parsers:: { signer :: SignerSourceParserBuilder , Amount } ,
1010 input_validators:: { is_pubkey, is_url_or_moniker, is_valid_pubkey, is_valid_signer} ,
1111 memo:: memo_arg,
1212 nonce:: * ,
@@ -282,6 +282,17 @@ pub fn owner_address_arg<'a>() -> Arg<'a> {
282282 . help ( OWNER_ADDRESS_ARG . help )
283283}
284284
285+ // Temporary function that uses proper parsing to minimize commit size
286+ // TODO: use this to replace `owner_address_arg`
287+ pub fn owner_address_arg_temp < ' a > ( ) -> Arg < ' a > {
288+ Arg :: with_name ( OWNER_ADDRESS_ARG . name )
289+ . long ( OWNER_ADDRESS_ARG . long )
290+ . takes_value ( true )
291+ . value_name ( "OWNER_ADDRESS" )
292+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
293+ . help ( OWNER_ADDRESS_ARG . help )
294+ }
295+
285296pub fn owner_keypair_arg_with_value_name < ' a > ( value_name : & ' static str ) -> Arg < ' a > {
286297 Arg :: with_name ( OWNER_KEYPAIR_ARG . name )
287298 . long ( OWNER_KEYPAIR_ARG . long )
@@ -1228,7 +1239,7 @@ pub fn app<'a>(
12281239 "Lock the owner of this token account from ever being changed"
12291240 ) ,
12301241 )
1231- . arg ( owner_address_arg ( ) )
1242+ . arg ( owner_address_arg_temp ( ) )
12321243 . nonce_args ( true )
12331244 )
12341245 . subcommand (
@@ -1759,7 +1770,7 @@ pub fn app<'a>(
17591770 . arg (
17601771 Arg :: with_name ( "recipient" )
17611772 . long ( "recipient" )
1762- . validator ( |s| is_valid_pubkey ( s ) )
1773+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
17631774 . value_name ( "REFUND_ACCOUNT_ADDRESS" )
17641775 . takes_value ( true )
17651776 . help ( "The address of the account to receive remaining SOL [default: --owner]" ) ,
@@ -1807,7 +1818,7 @@ pub fn app<'a>(
18071818 . arg (
18081819 Arg :: with_name ( "recipient" )
18091820 . long ( "recipient" )
1810- . validator ( |s| is_valid_pubkey ( s ) )
1821+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
18111822 . value_name ( "REFUND_ACCOUNT_ADDRESS" )
18121823 . takes_value ( true )
18131824 . help ( "The address of the account to receive remaining SOL [default: --owner]" ) ,
@@ -1834,17 +1845,17 @@ pub fn app<'a>(
18341845 . about ( "Get token account balance" )
18351846 . arg (
18361847 Arg :: with_name ( "token" )
1837- . validator ( |s| is_valid_pubkey ( s ) )
1848+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
18381849 . value_name ( "TOKEN_MINT_ADDRESS" )
18391850 . takes_value ( true )
18401851 . index ( 1 )
18411852 . required_unless ( "address" )
18421853 . help ( "Token of associated account. To query a specific account, use the `--address` parameter instead" ) ,
18431854 )
1844- . arg ( owner_address_arg ( ) . conflicts_with ( "address" ) )
1855+ . arg ( owner_address_arg_temp ( ) . conflicts_with ( "address" ) )
18451856 . arg (
18461857 Arg :: with_name ( "address" )
1847- . validator ( |s| is_valid_pubkey ( s ) )
1858+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
18481859 . value_name ( "TOKEN_ACCOUNT_ADDRESS" )
18491860 . takes_value ( true )
18501861 . long ( "address" )
@@ -1905,7 +1916,7 @@ pub fn app<'a>(
19051916 "Print token account addresses only"
19061917 ) ,
19071918 )
1908- . arg ( owner_address_arg ( ) )
1919+ . arg ( owner_address_arg_temp ( ) )
19091920 )
19101921 . subcommand (
19111922 SubCommand :: with_name ( CommandName :: Address . into ( ) )
@@ -1921,7 +1932,7 @@ pub fn app<'a>(
19211932 [Default: return the client keypair address]")
19221933 )
19231934 . arg (
1924- owner_address_arg ( )
1935+ owner_address_arg_temp ( )
19251936 . requires ( "token" )
19261937 . help ( "Return the associated token address for the given owner. \
19271938 [Default: return the associated token address for the client keypair]") ,
@@ -1933,7 +1944,7 @@ pub fn app<'a>(
19331944 . setting ( AppSettings :: Hidden )
19341945 . arg (
19351946 Arg :: with_name ( "token" )
1936- . validator ( |s| is_valid_pubkey ( s ) )
1947+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
19371948 . value_name ( "TOKEN_MINT_ADDRESS" )
19381949 . takes_value ( true )
19391950 . index ( 1 )
@@ -2028,7 +2039,7 @@ pub fn app<'a>(
20282039 . about ( "Enable required transfer memos for token account" )
20292040 . arg (
20302041 Arg :: with_name ( "account" )
2031- . validator ( |s| is_valid_pubkey ( s ) )
2042+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
20322043 . value_name ( "TOKEN_ACCOUNT_ADDRESS" )
20332044 . takes_value ( true )
20342045 . index ( 1 )
@@ -2046,7 +2057,7 @@ pub fn app<'a>(
20462057 . about ( "Disable required transfer memos for token account" )
20472058 . arg (
20482059 Arg :: with_name ( "account" )
2049- . validator ( |s| is_valid_pubkey ( s ) )
2060+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
20502061 . value_name ( "TOKEN_ACCOUNT_ADDRESS" )
20512062 . takes_value ( true )
20522063 . index ( 1 )
@@ -2064,7 +2075,7 @@ pub fn app<'a>(
20642075 . about ( "Enable CPI Guard for token account" )
20652076 . arg (
20662077 Arg :: with_name ( "account" )
2067- . validator ( |s| is_valid_pubkey ( s ) )
2078+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
20682079 . value_name ( "TOKEN_ACCOUNT_ADDRESS" )
20692080 . takes_value ( true )
20702081 . index ( 1 )
@@ -2082,7 +2093,7 @@ pub fn app<'a>(
20822093 . about ( "Disable CPI Guard for token account" )
20832094 . arg (
20842095 Arg :: with_name ( "account" )
2085- . validator ( |s| is_valid_pubkey ( s ) )
2096+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
20862097 . value_name ( "TOKEN_ACCOUNT_ADDRESS" )
20872098 . takes_value ( true )
20882099 . index ( 1 )
@@ -2357,15 +2368,15 @@ pub fn app<'a>(
23572368 . about ( "Withdraw lamports from a Token Program owned account" )
23582369 . arg (
23592370 Arg :: with_name ( "from" )
2360- . validator ( |s| is_valid_pubkey ( s ) )
2371+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
23612372 . value_name ( "SOURCE_ACCOUNT_ADDRESS" )
23622373 . takes_value ( true )
23632374 . required ( true )
23642375 . help ( "Specify the address of the account to recover lamports from" ) ,
23652376 )
23662377 . arg (
23672378 Arg :: with_name ( "recipient" )
2368- . validator ( |s| is_valid_pubkey ( s ) )
2379+ . value_parser ( SignerSourceParserBuilder :: default ( ) . allow_all ( ) . build ( ) )
23692380 . value_name ( "REFUND_ACCOUNT_ADDRESS" )
23702381 . takes_value ( true )
23712382 . required ( true )
0 commit comments