Skip to content

Commit ba7fdc4

Browse files
committed
fixes
1 parent 5455f70 commit ba7fdc4

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

client/v2/autocli/query.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"io"
7+
"strings"
78
"time"
89

910
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
@@ -205,8 +206,13 @@ func encoder(encoder aminojson.Encoder) aminojson.Encoder {
205206
}
206207

207208
amount := msg.Get(amountField).String()
208-
if len(amount) >= math.LegacyPrecision {
209+
if len(amount) > math.LegacyPrecision {
209210
amount = amount[:len(amount)-math.LegacyPrecision] + "." + amount[len(amount)-math.LegacyPrecision:]
211+
} else if len(amount) == math.LegacyPrecision {
212+
amount = "0." + amount
213+
} else {
214+
decimalPlace := len(amount) - math.LegacyPrecision
215+
amount = "0." + strings.Repeat("0", -decimalPlace) + amount
210216
}
211217

212218
amountDec, err := math.LegacyNewDecFromStr(amount)

0 commit comments

Comments
 (0)