/
grpc_query.go
40 lines (27 loc) · 991 Bytes
/
grpc_query.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/interchain-security/x/ccv/consumer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
var _ types.QueryServer = Keeper{}
func (k Keeper) QueryNextFeeDistribution(c context.Context,
req *types.QueryNextFeeDistributionEstimateRequest) (*types.QueryNextFeeDistributionEstimateResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
}
nextDist := k.GetEstimatedNextFeeDistribution(ctx)
return &types.QueryNextFeeDistributionEstimateResponse{Data: &nextDist}, nil
}
func (k Keeper) QueryParams(c context.Context,
req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
}
p := k.GetParams(ctx)
return &types.QueryParamsResponse{Params: p}, nil
}