17
17
UiAccountData ,
18
18
} ,
19
19
solana_clap_v3_utils:: {
20
- input_parsers:: { pubkey_of_signer, pubkeys_of_multiple_signers, value_of } ,
20
+ input_parsers:: { pubkey_of_signer, pubkeys_of_multiple_signers} ,
21
21
keypair:: signer_from_path,
22
22
} ,
23
23
solana_cli_output:: {
@@ -3533,11 +3533,12 @@ pub async fn process_command<'a>(
3533
3533
)
3534
3534
} ) ;
3535
3535
3536
- let tranfer_fee_basis_point = value_of :: < u16 > ( arg_matches, "transfer_fee_basis_points" ) ;
3537
- let transfer_fee_maximum_fee = value_of :: < f64 > ( arg_matches, "transfer_fee_maximum_fee" )
3538
- . map ( |v| spl_token:: ui_amount_to_amount ( v, decimals) ) ;
3539
- let transfer_fee = tranfer_fee_basis_point
3540
- . map ( |v| ( v, transfer_fee_maximum_fee. unwrap ( ) ) )
3536
+ let transfer_fee_basis_point = arg_matches. get_one :: < u16 > ( "transfer_fee_basis_points" ) ;
3537
+ let transfer_fee_maximum_fee = arg_matches
3538
+ . get_one :: < f64 > ( "transfer_fee_maximum_fee" )
3539
+ . map ( |v| spl_token:: ui_amount_to_amount ( * v, decimals) ) ;
3540
+ let transfer_fee = transfer_fee_basis_point
3541
+ . map ( |v| ( * v, transfer_fee_maximum_fee. unwrap ( ) ) )
3541
3542
. or ( transfer_fee) ;
3542
3543
3543
3544
let ( token_signer, token) =
@@ -3660,7 +3661,9 @@ pub async fn process_command<'a>(
3660
3661
_ => Field :: Key ( field. to_string ( ) ) ,
3661
3662
} ;
3662
3663
let value = arg_matches. value_of ( "value" ) . map ( |v| v. to_string ( ) ) ;
3663
- let transfer_lamports = value_of :: < u64 > ( arg_matches, TRANSFER_LAMPORTS_ARG . name ) ;
3664
+ let transfer_lamports = arg_matches
3665
+ . get_one ( TRANSFER_LAMPORTS_ARG . name )
3666
+ . map ( |v : & String | v. parse :: < u64 > ( ) . unwrap ( ) ) ;
3664
3667
let bulk_signers = vec ! [ authority_signer] ;
3665
3668
3666
3669
command_update_metadata (
@@ -3766,7 +3769,10 @@ pub async fn process_command<'a>(
3766
3769
. await
3767
3770
}
3768
3771
( CommandName :: CreateMultisig , arg_matches) => {
3769
- let minimum_signers = value_of :: < u8 > ( arg_matches, "minimum_signers" ) . unwrap ( ) ;
3772
+ let minimum_signers = arg_matches
3773
+ . get_one ( "minimum_signers" )
3774
+ . map ( |v : & String | v. parse :: < u8 > ( ) . unwrap ( ) )
3775
+ . unwrap ( ) ;
3770
3776
let multisig_members =
3771
3777
pubkeys_of_multiple_signers ( arg_matches, "multisig_member" , & mut wallet_manager)
3772
3778
. unwrap_or_else ( print_error_and_exit)
@@ -3850,7 +3856,9 @@ pub async fn process_command<'a>(
3850
3856
push_signer_with_dedup ( owner_signer, & mut bulk_signers) ;
3851
3857
}
3852
3858
3853
- let mint_decimals = value_of :: < u8 > ( arg_matches, MINT_DECIMALS_ARG . name ) ;
3859
+ let mint_decimals = arg_matches
3860
+ . get_one ( MINT_DECIMALS_ARG . name )
3861
+ . map ( |v : & String | v. parse :: < u8 > ( ) . unwrap ( ) ) ;
3854
3862
let fund_recipient = arg_matches. is_present ( "fund_recipient" ) ;
3855
3863
let allow_unfunded_recipient = arg_matches. is_present ( "allow_empty_recipient" )
3856
3864
|| arg_matches. is_present ( "allow_unfunded_recipient" ) ;
@@ -3862,7 +3870,7 @@ pub async fn process_command<'a>(
3862
3870
println_display ( config, "recipient-is-ata-owner is now the default behavior. The option has been deprecated and will be removed in a future release." . to_string ( ) ) ;
3863
3871
}
3864
3872
let use_unchecked_instruction = arg_matches. is_present ( "use_unchecked_instruction" ) ;
3865
- let expected_fee = value_of :: < f64 > ( arg_matches , "expected_fee" ) ;
3873
+ let expected_fee = arg_matches . get_one :: < f64 > ( "expected_fee" ) . copied ( ) ;
3866
3874
let memo = value_t ! ( arg_matches, "memo" , String ) . ok ( ) ;
3867
3875
let transfer_hook_accounts = arg_matches. values_of ( "transfer_hook_account" ) . map ( |v| {
3868
3876
v. into_iter ( )
@@ -3906,7 +3914,9 @@ pub async fn process_command<'a>(
3906
3914
let amount = parse_amount_or_all ( arg_matches) ;
3907
3915
let mint_address =
3908
3916
pubkey_of_signer ( arg_matches, MINT_ADDRESS_ARG . name , & mut wallet_manager) . unwrap ( ) ;
3909
- let mint_decimals = value_of :: < u8 > ( arg_matches, MINT_DECIMALS_ARG . name ) ;
3917
+ let mint_decimals = arg_matches
3918
+ . get_one ( MINT_DECIMALS_ARG . name )
3919
+ . map ( |v : & String | v. parse :: < u8 > ( ) . unwrap ( ) ) ;
3910
3920
let use_unchecked_instruction = arg_matches. is_present ( "use_unchecked_instruction" ) ;
3911
3921
let memo = value_t ! ( arg_matches, "memo" , String ) . ok ( ) ;
3912
3922
command_burn (
@@ -3933,7 +3943,9 @@ pub async fn process_command<'a>(
3933
3943
. unwrap ( )
3934
3944
. unwrap ( ) ;
3935
3945
let amount = value_t_or_exit ! ( arg_matches, "amount" , f64 ) ;
3936
- let mint_decimals = value_of :: < u8 > ( arg_matches, MINT_DECIMALS_ARG . name ) ;
3946
+ let mint_decimals = arg_matches
3947
+ . get_one ( MINT_DECIMALS_ARG . name )
3948
+ . map ( |v : & String | v. parse :: < u8 > ( ) . unwrap ( ) ) ;
3937
3949
let mint_info = config. get_mint_info ( & token, mint_decimals) . await ?;
3938
3950
let recipient = if let Some ( address) =
3939
3951
pubkey_of_signer ( arg_matches, "recipient" , & mut wallet_manager) . unwrap ( )
@@ -4058,7 +4070,9 @@ pub async fn process_command<'a>(
4058
4070
. unwrap ( ) ;
4059
4071
let mint_address =
4060
4072
pubkey_of_signer ( arg_matches, MINT_ADDRESS_ARG . name , & mut wallet_manager) . unwrap ( ) ;
4061
- let mint_decimals = value_of :: < u8 > ( arg_matches, MINT_DECIMALS_ARG . name ) ;
4073
+ let mint_decimals = arg_matches
4074
+ . get_one ( MINT_DECIMALS_ARG . name )
4075
+ . map ( |v : & String | v. parse :: < u8 > ( ) . unwrap ( ) ) ;
4062
4076
let use_unchecked_instruction = arg_matches. is_present ( "use_unchecked_instruction" ) ;
4063
4077
command_approve (
4064
4078
config,
@@ -4395,7 +4409,9 @@ pub async fn process_command<'a>(
4395
4409
let maximum_fee = value_t_or_exit ! ( arg_matches, "maximum_fee" , f64 ) ;
4396
4410
let ( transfer_fee_authority_signer, transfer_fee_authority_pubkey) = config
4397
4411
. signer_or_default ( arg_matches, "transfer_fee_authority" , & mut wallet_manager) ;
4398
- let mint_decimals = value_of :: < u8 > ( arg_matches, MINT_DECIMALS_ARG . name ) ;
4412
+ let mint_decimals = arg_matches
4413
+ . get_one ( MINT_DECIMALS_ARG . name )
4414
+ . map ( |v : & String | v. parse :: < u8 > ( ) . unwrap ( ) ) ;
4399
4415
let bulk_signers = vec ! [ transfer_fee_authority_signer] ;
4400
4416
4401
4417
command_set_transfer_fee (
@@ -4541,7 +4557,9 @@ pub async fn process_command<'a>(
4541
4557
let ( owner_signer, owner) =
4542
4558
config. signer_or_default ( arg_matches, "owner" , & mut wallet_manager) ;
4543
4559
4544
- let mint_decimals = value_of :: < u8 > ( arg_matches, MINT_DECIMALS_ARG . name ) ;
4560
+ let mint_decimals = arg_matches
4561
+ . get_one ( MINT_DECIMALS_ARG . name )
4562
+ . map ( |v : & String | v. parse :: < u8 > ( ) . unwrap ( ) ) ;
4545
4563
4546
4564
let ( instruction_type, elgamal_keypair, aes_key) = match c {
4547
4565
CommandName :: DepositConfidentialTokens => {
0 commit comments