diff --git a/modules/apps/29-fee/client/cli/query.go b/modules/apps/29-fee/client/cli/query.go index 1413ae001cb..95bb0959ba7 100644 --- a/modules/apps/29-fee/client/cli/query.go +++ b/modules/apps/29-fee/client/cli/query.go @@ -19,7 +19,7 @@ func GetCmdTotalRecvFees() *cobra.Command { Short: "Query the total receive fees for a packet", Long: "Query the total receive fees for a packet", Args: cobra.ExactArgs(3), - Example: fmt.Sprintf("%s query ibc-fee transfer channel-5 100", version.AppName), + Example: fmt.Sprintf("%s query ibc-fee total-recv-fees transfer channel-5 100", version.AppName), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -57,3 +57,95 @@ func GetCmdTotalRecvFees() *cobra.Command { return cmd } + +// GetCmdTotalAckFees returns the command handler for the Query/TotalAckFees rpc. +func GetCmdTotalAckFees() *cobra.Command { + cmd := &cobra.Command{ + Use: "total-ack-fees [port-id] [channel-id] [sequence]", + Short: "Query the total acknowledgement fees for a packet", + Long: "Query the total acknowledgement fees for a packet", + Args: cobra.ExactArgs(3), + Example: fmt.Sprintf("%s query ibc-fee total-ack-fees transfer channel-5 100", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + portID, channelID := args[0], args[1] + seq, err := strconv.ParseUint(args[2], 10, 64) + if err != nil { + return err + } + + packetID := channeltypes.NewPacketId(channelID, portID, seq) + + if err := packetID.Validate(); err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryTotalAckFeesRequest{ + PacketId: packetID, + } + + res, err := queryClient.TotalAckFees(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdTotalTimeoutFees returns the command handler for the Query/TotalTimeoutFees rpc. +func GetCmdTotalTimeoutFees() *cobra.Command { + cmd := &cobra.Command{ + Use: "total-timeout-fees [port-id] [channel-id] [sequence]", + Short: "Query the total timeout fees for a packet", + Long: "Query the total timeout fees for a packet", + Args: cobra.ExactArgs(3), + Example: fmt.Sprintf("%s query ibc-fee total-timeout-fees transfer channel-5 100", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + portID, channelID := args[0], args[1] + seq, err := strconv.ParseUint(args[2], 10, 64) + if err != nil { + return err + } + + packetID := channeltypes.NewPacketId(channelID, portID, seq) + + if err := packetID.Validate(); err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryTotalTimeoutFeesRequest{ + PacketId: packetID, + } + + res, err := queryClient.TotalTimeoutFees(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +}