Skip to content

Commit

Permalink
add support for REST delegator rewards query to show all rewards (lav…
Browse files Browse the repository at this point in the history
…anet#1550)

Co-authored-by: Yaroms <[email protected]>
  • Loading branch information
oren-lava and Yaroms authored Jul 15, 2024
1 parent 3fe5dab commit f8f05e7
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 45 deletions.
5 changes: 5 additions & 0 deletions proto/lavanet/lava/dualstaking/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ service Query {
rpc DelegatorRewards(QueryDelegatorRewardsRequest) returns (QueryDelegatorRewardsResponse) {
option (google.api.http).get = "/lavanet/lava/dualstaking/delegator_rewards/{delegator}/{provider}/{chain_id}";
}

// Queries a the unclaimed rewards of a delegator.
rpc DelegatorRewardsList(QueryDelegatorRewardsRequest) returns (QueryDelegatorRewardsResponse) {
option (google.api.http).get = "/lavanet/lava/dualstaking/delegator_rewards/{delegator}";
}
}

// QueryParamsRequest is request type for the Query/Params RPC method.
Expand Down
4 changes: 4 additions & 0 deletions x/dualstaking/keeper/grpc_query_delegator_rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ func (k Keeper) DelegatorRewards(goCtx context.Context, req *types.QueryDelegato

return &types.QueryDelegatorRewardsResponse{Rewards: rewards}, nil
}

func (k Keeper) DelegatorRewardsList(goCtx context.Context, req *types.QueryDelegatorRewardsRequest) (res *types.QueryDelegatorRewardsResponse, err error) {
return k.DelegatorRewards(goCtx, req)
}
129 changes: 84 additions & 45 deletions x/dualstaking/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 119 additions & 0 deletions x/dualstaking/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f8f05e7

Please sign in to comment.