Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
cli: Use CliBalance for solana balance output (#26717)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Jul 22, 2022
1 parent 44b9c7a commit 069dd8a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions cli/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use {
offline::*,
},
solana_cli_output::{
display::build_balance_message, return_signers_with_config, CliAccount,
CliSignatureVerificationStatus, CliTransaction, CliTransactionConfirmation, OutputFormat,
ReturnSignersConfig,
display::{build_balance_message, BuildBalanceMessageConfig},
return_signers_with_config, CliAccount, CliBalance, CliSignatureVerificationStatus,
CliTransaction, CliTransactionConfirmation, OutputFormat, ReturnSignersConfig,
},
solana_client::{
blockhash_query::BlockhashQuery, nonce_utils, rpc_client::RpcClient,
Expand Down Expand Up @@ -543,7 +543,16 @@ pub fn process_balance(
config.pubkey()?
};
let balance = rpc_client.get_balance(&pubkey)?;
Ok(build_balance_message(balance, use_lamports_unit, true))
let balance_output = CliBalance {
lamports: balance,
config: BuildBalanceMessageConfig {
use_lamports_unit,
show_unit: true,
trim_trailing_zeros: true,
},
};

Ok(config.output_format.formatted_string(&balance_output))
}

pub fn process_confirm(
Expand Down

0 comments on commit 069dd8a

Please sign in to comment.