Skip to content

Commit

Permalink
Merge branch 'yuji/fix-duplicate-balance' (#2126)
Browse files Browse the repository at this point in the history
  • Loading branch information
yito88 committed Nov 8, 2023
2 parents cf90052 + 866ca1b commit d970f49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/2125-fix-duplicate-balance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix balance query not to return duplicate results
([\#2125](https://github.com/anoma/namada/issues/2125))
9 changes: 8 additions & 1 deletion apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,16 +656,23 @@ async fn query_tokens<'a>(
owner: Option<&Address>,
) -> BTreeMap<String, Address> {
let wallet = context.wallet().await;
let mut base_token = base_token;
// Base tokens
let mut tokens = match base_token {
Some(base_token) => {
let mut map = BTreeMap::new();
map.insert(wallet.lookup_alias(base_token), base_token.clone());
if let Some(alias) = wallet.find_alias(base_token) {
map.insert(alias.to_string(), base_token.clone());
}
map
}
None => wallet.tokens_with_aliases(),
};

// Check all IBC denoms if the token isn't an pre-existing token
if tokens.is_empty() {
base_token = None;
}
let prefixes = match (base_token, owner) {
(Some(base_token), Some(owner)) => vec![
ibc_denom_key_prefix(Some(base_token.to_string())),
Expand Down

0 comments on commit d970f49

Please sign in to comment.