-
Notifications
You must be signed in to change notification settings - Fork 172
/
querier.go
65 lines (49 loc) · 2.05 KB
/
querier.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package keeper
// TODO: Can not find anything in the docs which says we need this? the Route() was removed and seems this was apart of that.
// If so it does nothing now.
// import (
// abci "github.com/cometbft/cometbft/abci/types"
// "github.com/CosmosContracts/juno/v23/x/mint/types"
// "github.com/cosmos/cosmos-sdk/codec"
// sdk "github.com/cosmos/cosmos-sdk/types"
// sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
// )
// // NewQuerier returns a minting Querier handler.
// func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
// return func(ctx sdk.Context, path []string, _ abci.RequestQuery) ([]byte, error) {
// switch path[0] {
// case types.QueryParameters:
// return queryParams(ctx, k, legacyQuerierCdc)
// case types.QueryInflation:
// return queryInflation(ctx, k, legacyQuerierCdc)
// case types.QueryAnnualProvisions:
// return queryAnnualProvisions(ctx, k, legacyQuerierCdc)
// default:
// return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown query path: %s", path[0])
// }
// }
// }
// func queryParams(ctx sdk.Context, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
// params := k.GetParams(ctx)
// res, err := codec.MarshalJSONIndent(legacyQuerierCdc, params)
// if err != nil {
// return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
// }
// return res, nil
// }
// func queryInflation(ctx sdk.Context, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
// minter := k.GetMinter(ctx)
// res, err := codec.MarshalJSONIndent(legacyQuerierCdc, minter.Inflation)
// if err != nil {
// return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
// }
// return res, nil
// }
// func queryAnnualProvisions(ctx sdk.Context, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
// minter := k.GetMinter(ctx)
// res, err := codec.MarshalJSONIndent(legacyQuerierCdc, minter.AnnualProvisions)
// if err != nil {
// return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
// }
// return res, nil
// }