diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f195384040..8b1f9271632 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (modules/core/04-channel) [\#1160](https://github.com/cosmos/ibc-go/pull/1160) Improve `uint64 -> string` performance in `Logger`. ### Features +* (modules/apps/29-fee) [\#1230](https://github.com/cosmos/ibc-go/pull/1230) Adding CLI command for getting incentivized packets for a specific channel-id. + * [\#276](https://github.com/cosmos/ibc-go/pull/276) Adding the Fee Middleware module v1 * (apps/29-fee) [\#1229](https://github.com/cosmos/ibc-go/pull/1229) Adding CLI commands for getting all unrelayed incentivized packets and packet by packet-id. diff --git a/modules/apps/29-fee/client/cli/cli.go b/modules/apps/29-fee/client/cli/cli.go index c2afc6e25ed..a0141c20f9a 100644 --- a/modules/apps/29-fee/client/cli/cli.go +++ b/modules/apps/29-fee/client/cli/cli.go @@ -20,6 +20,7 @@ func GetQueryCmd() *cobra.Command { GetCmdTotalRecvFees(), GetCmdTotalAckFees(), GetCmdTotalTimeoutFees(), + GetCmdIncentivizedPacketsForChannel(), GetCmdCounterpartyAddress(), GetCmdFeeEnabledChannel(), GetCmdFeeEnabledChannels(), diff --git a/modules/apps/29-fee/client/cli/query.go b/modules/apps/29-fee/client/cli/query.go index 9eca35cae48..22ad1378309 100644 --- a/modules/apps/29-fee/client/cli/query.go +++ b/modules/apps/29-fee/client/cli/query.go @@ -350,3 +350,46 @@ func GetCmdFeeEnabledChannel() *cobra.Command { return cmd } + +// GetCmdIncentivizedPacketsForChannel returns all of the unrelayed incentivized packets on a given channel +func GetCmdIncentivizedPacketsForChannel() *cobra.Command { + cmd := &cobra.Command{ + Use: "packets-for-channel [port-id] [channel-id]", + Short: "Query for all of the unrelayed incentivized packets on a given channel", + Long: "Query for all of the unrelayed incentivized packets on a given channel. These are packets that have not yet been relayed.", + Args: cobra.ExactArgs(2), + Example: fmt.Sprintf("%s query ibc-fee packets-for-channel", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + req := &types.QueryIncentivizedPacketsForChannelRequest{ + Pagination: pageReq, + PortId: args[0], + ChannelId: args[1], + QueryHeight: uint64(clientCtx.Height), + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.IncentivizedPacketsForChannel(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "packets-for-channel") + + return cmd +}