-
Notifications
You must be signed in to change notification settings - Fork 1
/
grpc_query.go
36 lines (28 loc) · 922 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
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/fibonacci-chain/core/x/mint/types"
)
var _ types.QueryServer = Querier{}
// Querier defines a wrapper around the x/mint keeper providing gRPC method
// handlers.
type Querier struct {
Keeper
}
func NewQuerier(k Keeper) Querier {
return Querier{Keeper: k}
}
// Params returns params of the mint module.
func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
params := q.Keeper.GetParams(ctx)
return &types.QueryParamsResponse{Params: params}, nil
}
// Returns the most last mint state
func (q Querier) Minter(c context.Context, _ *types.QueryMinterRequest) (*types.QueryMinterResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
minter := q.Keeper.GetMinter(ctx)
response := types.QueryMinterResponse(minter)
return &response, nil
}