Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: add page result to ics29-fee queries #3054

Merged
9 changes: 6 additions & 3 deletions modules/apps/29-fee/keeper/grpc_query.go
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ func (k Keeper) IncentivizedPackets(goCtx context.Context, req *types.QueryIncen

var identifiedPackets []types.IdentifiedPacketFees
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.FeesInEscrowPrefix))
_, err := query.Paginate(store, req.Pagination, func(key, value []byte) error {
pagination, err := query.Paginate(store, req.Pagination, func(key, value []byte) error {
packetID, err := types.ParseKeyFeesInEscrow(types.FeesInEscrowPrefix + string(key))
if err != nil {
return err
@@ -41,6 +41,7 @@ func (k Keeper) IncentivizedPackets(goCtx context.Context, req *types.QueryIncen

return &types.QueryIncentivizedPacketsResponse{
IncentivizedPackets: identifiedPackets,
Pagination: pagination,
}, nil
}

@@ -75,7 +76,7 @@ func (k Keeper) IncentivizedPacketsForChannel(goCtx context.Context, req *types.
var packets []*types.IdentifiedPacketFees
keyPrefix := types.KeyFeesInEscrowChannelPrefix(req.PortId, req.ChannelId)
store := prefix.NewStore(ctx.KVStore(k.storeKey), keyPrefix)
_, err := query.Paginate(store, req.Pagination, func(key, value []byte) error {
pagination, err := query.Paginate(store, req.Pagination, func(key, value []byte) error {
packetID, err := types.ParseKeyFeesInEscrow(string(keyPrefix) + string(key))
if err != nil {
return err
@@ -94,6 +95,7 @@ func (k Keeper) IncentivizedPacketsForChannel(goCtx context.Context, req *types.

return &types.QueryIncentivizedPacketsForChannelResponse{
IncentivizedPackets: packets,
Pagination: pagination,
}, nil
}

@@ -217,7 +219,7 @@ func (k Keeper) FeeEnabledChannels(goCtx context.Context, req *types.QueryFeeEna

var feeEnabledChannels []types.FeeEnabledChannel
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.FeeEnabledKeyPrefix))
_, err := query.Paginate(store, req.Pagination, func(key, value []byte) error {
pagination, err := query.Paginate(store, req.Pagination, func(key, value []byte) error {
portID, channelID, err := types.ParseKeyFeeEnabled(types.FeeEnabledKeyPrefix + string(key))
if err != nil {
return err
@@ -238,6 +240,7 @@ func (k Keeper) FeeEnabledChannels(goCtx context.Context, req *types.QueryFeeEna

return &types.QueryFeeEnabledChannelsResponse{
FeeEnabledChannels: feeEnabledChannels,
Pagination: pagination,
}, nil
}

354 changes: 269 additions & 85 deletions modules/apps/29-fee/types/query.pb.go
6 changes: 6 additions & 0 deletions proto/ibc/applications/fee/v1/query.proto
Original file line number Diff line number Diff line change
@@ -83,6 +83,8 @@ message QueryIncentivizedPacketsRequest {
message QueryIncentivizedPacketsResponse {
// list of identified fees for incentivized packets
repeated ibc.applications.fee.v1.IdentifiedPacketFees incentivized_packets = 1 [(gogoproto.nullable) = false];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryIncentivizedPacketRequest defines the request type for the IncentivizedPacket rpc
@@ -114,6 +116,8 @@ message QueryIncentivizedPacketsForChannelRequest {
message QueryIncentivizedPacketsForChannelResponse {
// Map of all incentivized_packets
repeated ibc.applications.fee.v1.IdentifiedPacketFees incentivized_packets = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc
@@ -205,6 +209,8 @@ message QueryFeeEnabledChannelsResponse {
// list of fee enabled channels
repeated ibc.applications.fee.v1.FeeEnabledChannel fee_enabled_channels = 1
[(gogoproto.moretags) = "yaml:\"fee_enabled_channels\"", (gogoproto.nullable) = false];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryFeeEnabledChannelRequest defines the request type for the FeeEnabledChannel rpc