diff --git a/.changelog/unreleased/bug-fixes/2125-fix-duplicate-balance.md b/.changelog/unreleased/bug-fixes/2125-fix-duplicate-balance.md new file mode 100644 index 0000000000..8c5fc2135f --- /dev/null +++ b/.changelog/unreleased/bug-fixes/2125-fix-duplicate-balance.md @@ -0,0 +1,2 @@ +- Fix balance query not to return duplicate results + ([\#2125](https://github.com/anoma/namada/issues/2125)) \ No newline at end of file diff --git a/apps/src/lib/client/rpc.rs b/apps/src/lib/client/rpc.rs index a90f49b926..5baf38e2fe 100644 --- a/apps/src/lib/client/rpc.rs +++ b/apps/src/lib/client/rpc.rs @@ -656,16 +656,23 @@ async fn query_tokens<'a>( owner: Option<&Address>, ) -> BTreeMap { 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())),