This repository was archived by the owner on Mar 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -299,10 +299,13 @@ impl<'a> Config<'a> {
299
299
( default_program_id, false )
300
300
} ;
301
301
302
- // need to specify a compute limit if compute price and blockhash are specified
303
- if matches. is_present ( BLOCKHASH_ARG . name )
304
- && matches. is_present ( COMPUTE_UNIT_PRICE_ARG . name )
305
- && !matches. is_present ( COMPUTE_UNIT_LIMIT_ARG . name )
302
+ if matches. try_contains_id ( BLOCKHASH_ARG . name ) . unwrap_or ( false )
303
+ && matches
304
+ . try_contains_id ( COMPUTE_UNIT_PRICE_ARG . name )
305
+ . unwrap_or ( false )
306
+ && !matches
307
+ . try_contains_id ( COMPUTE_UNIT_LIMIT_ARG . name )
308
+ . unwrap_or ( false )
306
309
{
307
310
clap:: Error :: with_description (
308
311
format ! (
@@ -320,8 +323,17 @@ impl<'a> Config<'a> {
320
323
. flatten ( )
321
324
. copied ( ) ;
322
325
323
- let compute_unit_price = value_of ( matches, COMPUTE_UNIT_PRICE_ARG . name ) ;
324
- let compute_unit_limit = value_of ( matches, COMPUTE_UNIT_LIMIT_ARG . name )
326
+ let compute_unit_price = matches
327
+ . try_get_one :: < u64 > ( COMPUTE_UNIT_PRICE_ARG . name )
328
+ . ok ( )
329
+ . flatten ( )
330
+ . copied ( ) ;
331
+
332
+ let compute_unit_limit = matches
333
+ . try_get_one :: < u32 > ( COMPUTE_UNIT_PRICE_ARG . name )
334
+ . ok ( )
335
+ . flatten ( )
336
+ . copied ( )
325
337
. map ( ComputeUnitLimit :: Static )
326
338
. unwrap_or_else ( || {
327
339
if nonce_blockhash. is_some ( ) {
You can’t perform that action at this time.
0 commit comments