Skip to content

Commit b71bbf2

Browse files
authored
feat: adding CLI for getting incentivized packets on a specific channel (#1230)
* feat: adding CLI for getting incentivized packets on a specific channel * chore: changelog * refactor: usage
1 parent c5897ae commit b71bbf2

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
4747
* (modules/core/04-channel) [\#1160](https://github.com/cosmos/ibc-go/pull/1160) Improve `uint64 -> string` performance in `Logger`.
4848

4949
### Features
50+
* (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.
51+
5052

5153
* [\#276](https://github.com/cosmos/ibc-go/pull/276) Adding the Fee Middleware module v1
5254
* (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.

modules/apps/29-fee/client/cli/cli.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func GetQueryCmd() *cobra.Command {
2020
GetCmdTotalRecvFees(),
2121
GetCmdTotalAckFees(),
2222
GetCmdTotalTimeoutFees(),
23+
GetCmdIncentivizedPacketsForChannel(),
2324
GetCmdCounterpartyAddress(),
2425
GetCmdFeeEnabledChannel(),
2526
GetCmdFeeEnabledChannels(),

modules/apps/29-fee/client/cli/query.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,46 @@ func GetCmdFeeEnabledChannel() *cobra.Command {
350350

351351
return cmd
352352
}
353+
354+
// GetCmdIncentivizedPacketsForChannel returns all of the unrelayed incentivized packets on a given channel
355+
func GetCmdIncentivizedPacketsForChannel() *cobra.Command {
356+
cmd := &cobra.Command{
357+
Use: "packets-for-channel [port-id] [channel-id]",
358+
Short: "Query for all of the unrelayed incentivized packets on a given channel",
359+
Long: "Query for all of the unrelayed incentivized packets on a given channel. These are packets that have not yet been relayed.",
360+
Args: cobra.ExactArgs(2),
361+
Example: fmt.Sprintf("%s query ibc-fee packets-for-channel", version.AppName),
362+
RunE: func(cmd *cobra.Command, args []string) error {
363+
clientCtx, err := client.GetClientQueryContext(cmd)
364+
if err != nil {
365+
return err
366+
}
367+
368+
pageReq, err := client.ReadPageRequest(cmd.Flags())
369+
if err != nil {
370+
return err
371+
}
372+
373+
req := &types.QueryIncentivizedPacketsForChannelRequest{
374+
Pagination: pageReq,
375+
PortId: args[0],
376+
ChannelId: args[1],
377+
QueryHeight: uint64(clientCtx.Height),
378+
}
379+
380+
queryClient := types.NewQueryClient(clientCtx)
381+
382+
res, err := queryClient.IncentivizedPacketsForChannel(cmd.Context(), req)
383+
if err != nil {
384+
return err
385+
}
386+
387+
return clientCtx.PrintProto(res)
388+
},
389+
}
390+
391+
flags.AddQueryFlagsToCmd(cmd)
392+
flags.AddPaginationFlagsToCmd(cmd, "packets-for-channel")
393+
394+
return cmd
395+
}

0 commit comments

Comments
 (0)