Skip to content

Commit

Permalink
imp: add page result to ics29-fee queries (#3054)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleem1314 authored Feb 8, 2023
1 parent a244245 commit 5dba356
Show file tree
Hide file tree
Showing 3 changed files with 281 additions and 88 deletions.
9 changes: 6 additions & 3 deletions modules/apps/29-fee/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -41,6 +41,7 @@ func (k Keeper) IncentivizedPackets(goCtx context.Context, req *types.QueryIncen

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

Expand Down Expand Up @@ -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
Expand All @@ -94,6 +95,7 @@ func (k Keeper) IncentivizedPacketsForChannel(goCtx context.Context, req *types.

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

Expand Down Expand Up @@ -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
Expand All @@ -238,6 +240,7 @@ func (k Keeper) FeeEnabledChannels(goCtx context.Context, req *types.QueryFeeEna

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

Expand Down
Loading

0 comments on commit 5dba356

Please sign in to comment.