@@ -16,12 +16,14 @@ use {
1616 Arg , ArgGroup , ArgMatches , SubCommand ,
1717 } ,
1818 solana_clap_utils:: {
19+ compute_unit_price:: { compute_unit_price_arg, COMPUTE_UNIT_PRICE_ARG } ,
1920 input_parsers:: { keypair_of, pubkey_of} ,
2021 input_validators:: {
2122 is_amount, is_keypair_or_ask_keyword, is_parsable, is_pubkey, is_url,
2223 is_valid_percentage, is_valid_pubkey, is_valid_signer,
2324 } ,
2425 keypair:: { signer_from_path_with_config, SignerFromPathConfig } ,
26+ ArgConstant ,
2527 } ,
2628 solana_cli_output:: OutputFormat ,
2729 solana_client:: rpc_client:: RpcClient ,
@@ -66,6 +68,8 @@ pub(crate) struct Config {
6668 fee_payer : Box < dyn Signer > ,
6769 dry_run : bool ,
6870 no_update : bool ,
71+ compute_unit_price : Option < u64 > ,
72+ compute_unit_limit : Option < u32 > ,
6973}
7074
7175type CommandResult = Result < ( ) , Error > ;
@@ -100,6 +104,12 @@ const FEES_REFERENCE: &str = "Consider setting a minimal fee. \
100104 aware of the possible risks of a stake pool with no fees, \
101105 you may force pool creation with the --unsafe-fees flag.";
102106
107+ pub const COMPUTE_UNIT_LIMIT_ARG : ArgConstant < ' static > = ArgConstant {
108+ name : "compute_unit_limit" ,
109+ long : "--with-compute-unit-limit" ,
110+ help : "Set compute unit limit for transaction, in compute units." ,
111+ } ;
112+
103113fn check_stake_pool_fees (
104114 epoch_fee : & Fee ,
105115 withdrawal_fee : & Fee ,
@@ -1998,6 +2008,15 @@ fn main() {
19982008 . global ( true )
19992009 . help ( "Transaction fee payer account [default: cli config keypair]" ) ,
20002010 )
2011+ . arg ( compute_unit_price_arg ( ) . validator ( is_parsable :: < u64 > ) )
2012+ . arg (
2013+ Arg :: with_name ( COMPUTE_UNIT_LIMIT_ARG . name )
2014+ . long ( COMPUTE_UNIT_LIMIT_ARG . long )
2015+ . takes_value ( true )
2016+ . value_name ( "COMPUTE-UNIT-LIMIT" )
2017+ . help ( COMPUTE_UNIT_LIMIT_ARG . help )
2018+ . validator ( is_parsable :: < u32 > )
2019+ )
20012020 . subcommand ( SubCommand :: with_name ( "create-pool" )
20022021 . about ( "Create a new stake pool" )
20032022 . arg (
@@ -2778,6 +2797,8 @@ fn main() {
27782797 } ) ;
27792798 let dry_run = matches. is_present ( "dry_run" ) ;
27802799 let no_update = matches. is_present ( "no_update" ) ;
2800+ let compute_unit_price = value_t ! ( matches, COMPUTE_UNIT_PRICE_ARG . name, u64 ) . ok ( ) ;
2801+ let compute_unit_limit = value_t ! ( matches, COMPUTE_UNIT_LIMIT_ARG . name, u32 ) . ok ( ) ;
27812802
27822803 Config {
27832804 rpc_client : RpcClient :: new_with_commitment ( json_rpc_url, CommitmentConfig :: confirmed ( ) ) ,
@@ -2790,6 +2811,8 @@ fn main() {
27902811 fee_payer,
27912812 dry_run,
27922813 no_update,
2814+ compute_unit_price,
2815+ compute_unit_limit,
27932816 }
27942817 } ;
27952818
0 commit comments