Skip to content

Commit

Permalink
add validation of packet ID in CLI to query packet (cosmos#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
crodriguezvega committed May 2, 2022
1 parent f962485 commit d91d1ad
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/apps/29-fee/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,23 @@ func GetCmdIncentivizedPacket() *cobra.Command {
Short: "Query for an unrelayed incentivized packet by port-id, channel-id and packet sequence.",
Long: "Query for an unrelayed incentivized packet by port-id, channel-id and packet sequence.",
Args: cobra.ExactArgs(3),
Example: fmt.Sprintf("%s query ibc-fee packet-by-id", version.AppName),
Example: fmt.Sprintf("%s query ibc-fee packet", 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.PacketId{
PortId: args[0],
ChannelId: args[1],
Sequence: seq,
packetID := channeltypes.NewPacketId(portID, channelID, seq)

if err := packetID.Validate(); err != nil {
return err
}

req := &types.QueryIncentivizedPacketRequest{
Expand Down

0 comments on commit d91d1ad

Please sign in to comment.