Skip to content

Commit

Permalink
format denominated amount
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Aug 29, 2024
1 parent f8c679a commit 526c261
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 11 additions & 2 deletions crates/apps_lib/src/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ use namada_sdk::proof_of_stake::types::{
use namada_sdk::proof_of_stake::PosParams;
use namada_sdk::queries::{Client, RPC};
use namada_sdk::rpc::{
self, enriched_bonds_and_unbonds, query_epoch, TxResponse,
self, enriched_bonds_and_unbonds, format_denominated_amount, query_epoch,
TxResponse,
};
use namada_sdk::storage::BlockResults;
use namada_sdk::tendermint_rpc::endpoint::status;
Expand Down Expand Up @@ -1188,9 +1189,17 @@ pub async fn query_total_supply<N: Namada>(
.total_supply(context.client(), &token)
.await,
);
let amount_str = format_denominated_amount(
context.client(),
context.io(),
&token,
supply,
)
.await;
display_line!(
context.io(),
"Total supply of token {token}: {supply} raw units"
"Total supply of token {token}: {}",
amount_str
);
}

Expand Down
3 changes: 1 addition & 2 deletions crates/tests/src/integration/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1182,8 +1182,7 @@ fn pgf_governance_proposal() -> Result<()> {
CapturedOutput::of(|| run(&node, Bin::Client, query_total_supply_args));
assert_matches!(captured.result, Ok(_));
assert!(captured.contains(
"token tnam1q9kn74xfzytqkqyycfrhycr8ajam8ny935cge0z5: 114400023904507 \
raw units"
"token tnam1q9kn74xfzytqkqyycfrhycr8ajam8ny935cge0z5: 114400023.904507"
));

let query_native_supply_args =
Expand Down

0 comments on commit 526c261

Please sign in to comment.