Skip to content

Commit

Permalink
client/rpc: use the new token balance method
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed May 19, 2023
1 parent cc5043a commit 69b0745
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ pub async fn get_token_balance<C: namada::ledger::queries::Client + Sync>(
client: &C,
token: &Address,
owner: &Address,
) -> Option<token::Amount> {
) -> token::Amount {
namada::ledger::rpc::get_token_balance(client, token, owner).await
}

Expand Down
3 changes: 1 addition & 2 deletions apps/src/lib/client/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,7 @@ pub async fn submit_init_proposal<C: namada::ledger::queries::Client + Sync>(
&args.native_token,
&proposal.author,
)
.await
.unwrap_or_default();
.await;
if balance
< token::Amount::from(governance_parameters.min_proposal_fund)
{
Expand Down
5 changes: 2 additions & 3 deletions shared/src/ledger/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ pub async fn get_token_balance<C: crate::ledger::queries::Client + Sync>(
client: &C,
token: &Address,
owner: &Address,
) -> Option<token::Amount> {
let balance_key = balance_key(token, owner);
query_storage_value(client, &balance_key).await
) -> token::Amount {
unwrap_client_response::<C, _>(RPC.vp().token().balance(client, token, owner).await)
}

/// Get account's public key stored in its storage sub-space
Expand Down

0 comments on commit 69b0745

Please sign in to comment.