Skip to content

Commit

Permalink
fix(account): parse deccoins instead of coins (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsora authored Feb 14, 2022
1 parent ec72684 commit 5381431
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/account/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,16 @@ func GetDelegatorRewards(c *gin.Context) {
return
}

coinsSlice := func(in []*sdkutilities.Coin) sdktypes.Coins {
ret := sdktypes.Coins{}
coinsSlice := func(in []*sdkutilities.Coin) sdktypes.DecCoins {
ret := sdktypes.DecCoins{}

for _, c := range in {
amount, ok := sdktypes.NewIntFromString(c.Amount)
if !ok {
panic("cannot create Int from sdkutilities.Coin amount")
amount, err := sdktypes.NewDecFromStr(c.Amount)
if err != nil {
panic(fmt.Errorf("cannot create dec from sdkutilities.Coin amount: %w", err))
}

ret = append(ret, sdktypes.Coin{
ret = append(ret, sdktypes.DecCoin{
Denom: c.Denom,
Amount: amount,
})
Expand Down

0 comments on commit 5381431

Please sign in to comment.