Skip to content

Commit

Permalink
Fix query balance response (cosmos#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilkumarpilli committed Mar 22, 2021
1 parent 30b7ce5 commit 1ff4ae1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions helpers/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ func QueryBalance(chain *relayer.Chain, address string, showDenoms bool) (sdk.Co

var out sdk.Coins
for _, c := range coins {
for _, d := range dts.DenomTraces {
switch {
case c.Amount.Equal(sdk.NewInt(0)):
case c.Denom == d.IBCDenom():
out = append(out, sdk.NewCoin(d.IBCDenom(), c.Amount))
default:
if c.Amount.Equal(sdk.NewInt(0)) {
continue
}

for i, d := range dts.DenomTraces {
if c.Denom == d.IBCDenom() {
out = append(out, sdk.Coin{Denom: d.GetFullDenomPath(), Amount: c.Amount})
break
}

if i == len(dts.DenomTraces)-1 {
out = append(out, c)
}
}
Expand Down

0 comments on commit 1ff4ae1

Please sign in to comment.