Skip to content

Commit

Permalink
use try_get_one to parse compute_unit_price and compute_unit_limit
Browse files Browse the repository at this point in the history
  • Loading branch information
samkim-crypto committed Mar 29, 2024
1 parent 619e6e4 commit 86a5aef
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions token/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,18 @@ impl<'a> Config<'a> {
(default_program_id, false)
};

let nonce_blockhash = value_of(matches, BLOCKHASH_ARG.name);
let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
let compute_unit_limit = value_of(matches, COMPUTE_UNIT_LIMIT_ARG.name);
let compute_unit_price = matches
.try_get_one::<u64>(COMPUTE_UNIT_PRICE_ARG.name)
.ok()
.flatten()
.copied();

let compute_unit_limit = matches
.try_get_one::<u32>(COMPUTE_UNIT_LIMIT_ARG.name)
.ok()
.flatten()
.copied();

let nonce_blockhash = matches
.try_get_one::<Hash>(BLOCKHASH_ARG.name)
.ok()
Expand Down

0 comments on commit 86a5aef

Please sign in to comment.