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

Commit 86a5aef

Browse files
committed
use try_get_one to parse compute_unit_price and compute_unit_limit
1 parent 619e6e4 commit 86a5aef

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

token/cli/src/config.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,18 @@ impl<'a> Config<'a> {
296296
(default_program_id, false)
297297
};
298298

299-
let nonce_blockhash = value_of(matches, BLOCKHASH_ARG.name);
300-
let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
301-
let compute_unit_limit = value_of(matches, COMPUTE_UNIT_LIMIT_ARG.name);
299+
let compute_unit_price = matches
300+
.try_get_one::<u64>(COMPUTE_UNIT_PRICE_ARG.name)
301+
.ok()
302+
.flatten()
303+
.copied();
304+
305+
let compute_unit_limit = matches
306+
.try_get_one::<u32>(COMPUTE_UNIT_LIMIT_ARG.name)
307+
.ok()
308+
.flatten()
309+
.copied();
310+
302311
let nonce_blockhash = matches
303312
.try_get_one::<Hash>(BLOCKHASH_ARG.name)
304313
.ok()

0 commit comments

Comments
 (0)