@@ -149,3 +149,50 @@ func GetCmdTotalTimeoutFees() *cobra.Command {
149149
150150 return cmd
151151}
152+
153+ // GetIncentivizedPacketByPacketId returns the unrelayed incentivized packets for a given packetID
154+ func GetIncentivizedPacketByPacketId () * cobra.Command {
155+ cmd := & cobra.Command {
156+ Use : "packet-by-id [port-id] [channel-id] [sequence]" ,
157+ Short : "Query for an incentivized packet by packet-id." ,
158+ Long : "Query for an incentivized packet packet-id. A packet-id is made up of port-id, channel-id and packet sequence." ,
159+ Args : cobra .ExactArgs (3 ),
160+ Example : fmt .Sprintf ("%s query ibc-fee packet-by-id" , version .AppName ),
161+ RunE : func (cmd * cobra.Command , args []string ) error {
162+ clientCtx , err := client .GetClientQueryContext (cmd )
163+ if err != nil {
164+ return err
165+ }
166+
167+ seq , err := strconv .ParseUint (args [2 ], 10 , 64 )
168+ if err != nil {
169+ return err
170+ }
171+
172+ packetId := channeltypes.PacketId {
173+ PortId : args [0 ],
174+ ChannelId : args [1 ],
175+ Sequence : seq ,
176+ }
177+
178+ req := & types.QueryIncentivizedPacketRequest {
179+ PacketId : packetId ,
180+ QueryHeight : uint64 (clientCtx .Height ),
181+ }
182+
183+ queryClient := types .NewQueryClient (clientCtx )
184+
185+ res , err := queryClient .IncentivizedPacket (cmd .Context (), req )
186+ if err != nil {
187+ return err
188+ }
189+
190+ return clientCtx .PrintProto (res )
191+ },
192+ }
193+
194+ flags .AddQueryFlagsToCmd (cmd )
195+ flags .AddPaginationFlagsToCmd (cmd , "packet-by-id" )
196+
197+ return cmd
198+ }
0 commit comments