Skip to content

Commit

Permalink
Merge branch 'main' into sean/issue#868-new-packet-id
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Apr 8, 2022
2 parents 1ce3957 + b71bbf2 commit b715686
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (modules/core/04-channel) [\#1232](https://github.com/cosmos/ibc-go/pull/1232) Updating params on `NewPacketId` and moving to bottom of file.

### 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.
Expand Down
1 change: 1 addition & 0 deletions modules/apps/29-fee/client/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func GetQueryCmd() *cobra.Command {
GetCmdTotalRecvFees(),
GetCmdTotalAckFees(),
GetCmdTotalTimeoutFees(),
GetCmdIncentivizedPacketsForChannel(),
GetCmdCounterpartyAddress(),
GetCmdFeeEnabledChannel(),
GetCmdFeeEnabledChannels(),
Expand Down
43 changes: 43 additions & 0 deletions modules/apps/29-fee/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit b715686

Please sign in to comment.