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

Commit 6ee1f09

Browse files
Use config commitment for balance checks (#842)
1 parent c4ec3b3 commit 6ee1f09

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

token/cli/src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ fn new_throwaway_signer() -> (Option<Box<dyn Signer>>, Option<Pubkey>) {
163163
}
164164

165165
fn check_fee_payer_balance(config: &Config, required_balance: u64) -> Result<(), Error> {
166-
let balance = config.rpc_client.get_balance(&config.fee_payer)?;
166+
let balance = config
167+
.rpc_client
168+
.get_balance_with_commitment(&config.fee_payer, config.commitment_config)?
169+
.value;
167170
if balance < required_balance {
168171
Err(format!(
169172
"Fee payer, {}, has insufficient balance: {} required, {} available",
@@ -178,7 +181,10 @@ fn check_fee_payer_balance(config: &Config, required_balance: u64) -> Result<(),
178181
}
179182

180183
fn check_owner_balance(config: &Config, required_balance: u64) -> Result<(), Error> {
181-
let balance = config.rpc_client.get_balance(&config.owner)?;
184+
let balance = config
185+
.rpc_client
186+
.get_balance_with_commitment(&config.owner, config.commitment_config)?
187+
.value;
182188
if balance < required_balance {
183189
Err(format!(
184190
"Owner, {}, has insufficient balance: {} required, {} available",

0 commit comments

Comments
 (0)