From d15f3e5f48bd4b5ecdd01afac1dad83d89e41717 Mon Sep 17 00:00:00 2001 From: "jaeseung.bae" Date: Fri, 3 May 2024 16:28:50 +0900 Subject: [PATCH] chore: fix query cli --- x/fswap/client/cli/query.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/x/fswap/client/cli/query.go b/x/fswap/client/cli/query.go index 4e5f0db89b..46c87aa868 100644 --- a/x/fswap/client/cli/query.go +++ b/x/fswap/client/cli/query.go @@ -31,17 +31,20 @@ func GetQueryCmd(queryRoute string) *cobra.Command { func CmdQuerySwapped() *cobra.Command { cmd := &cobra.Command{ - Use: "swapped", + Use: "swapped [from_denom] [to_denom]", Short: "shows the current swap status, including both old and new coin amount", - Args: cobra.NoArgs, + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Swapped(cmd.Context(), &types.QuerySwappedRequest{}) + req := &types.QuerySwappedRequest{ + FromDenom: args[0], + ToDenom: args[1], + } + res, err := queryClient.Swapped(cmd.Context(), req) if err != nil { return err } @@ -56,9 +59,9 @@ func CmdQuerySwapped() *cobra.Command { func CmdQueryTotalSwappableAmount() *cobra.Command { cmd := &cobra.Command{ - Use: "total-swappable-amount", + Use: "total-swappable-amount [from_denom] [to_denom]", Short: "shows the current total amount of new coin that're swappable", - Args: cobra.NoArgs, + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -66,7 +69,11 @@ func CmdQueryTotalSwappableAmount() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.TotalSwappableToCoinAmount(cmd.Context(), &types.QueryTotalSwappableToCoinAmountRequest{}) + req := &types.QueryTotalSwappableToCoinAmountRequest{ + FromDenom: args[0], + ToDenom: args[1], + } + res, err := queryClient.TotalSwappableToCoinAmount(cmd.Context(), req) if err != nil { return err }