From 99f9193b7657a602af58a33afedb1e016253b6b5 Mon Sep 17 00:00:00 2001 From: "jaeseung.bae" Date: Fri, 3 May 2024 21:41:24 +0900 Subject: [PATCH] chore: minor change for convert to-coin-amount-cap --- x/fswap/client/cli/tx.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x/fswap/client/cli/tx.go b/x/fswap/client/cli/tx.go index fcf1d1ce59..433c8ae33e 100644 --- a/x/fswap/client/cli/tx.go +++ b/x/fswap/client/cli/tx.go @@ -10,6 +10,7 @@ import ( "github.com/Finschia/finschia-sdk/client/flags" "github.com/Finschia/finschia-sdk/client/tx" sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" bank "github.com/Finschia/finschia-sdk/x/bank/types" "github.com/Finschia/finschia-sdk/x/fswap/types" govcli "github.com/Finschia/finschia-sdk/x/gov/client/cli" @@ -181,9 +182,9 @@ Example of the content of messages-json: if err != nil { return err } - amountCap, err := sdk.NewDecFromStr(amountCapStr) - if err != nil { - return err + amountCap, ok := sdk.NewIntFromString(amountCapStr) + if !ok { + return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse %s %s", FlagAmountCapForToDenom, amountCap.String()) } swapRate, err := cmd.Flags().GetString(FlagSwapRate) @@ -197,7 +198,7 @@ Example of the content of messages-json: swap := types.Swap{ FromDenom: fromDenom, ToDenom: toDenom, - AmountCapForToDenom: amountCap.TruncateInt(), + AmountCapForToDenom: amountCap, SwapRate: swapRateDec, }