-
Notifications
You must be signed in to change notification settings - Fork 2
/
module.go
132 lines (100 loc) · 3.49 KB
/
module.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package icamauth
import (
"context"
"encoding/json"
"github.com/fibonacci-chain/fbc/x/icamauth/keeper"
sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
abci "github.com/fibonacci-chain/fbc/libs/tendermint/abci/types"
"github.com/fibonacci-chain/fbc/x/icamauth/client/cli"
clictx "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/client/context"
"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec"
interfacetypes "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec/types"
"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types/module"
"github.com/fibonacci-chain/fbc/x/icamauth/types"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
)
var (
_ module.AppModuleAdapter = AppModule{}
_ module.AppModuleBasicAdapter = AppModuleBasic{}
)
// AppModuleBasic implements the AppModuleBasic interface for the capability module.
type AppModuleBasic struct {
cdc *codec.CodecProxy
}
func NewAppModuleBasic(cdc *codec.CodecProxy) AppModuleBasic {
return AppModuleBasic{cdc: cdc}
}
func (a AppModuleBasic) Name() string {
return types.ModuleName
}
func (a AppModuleBasic) RegisterCodec(c *codec.Codec) {
types.RegisterCodec(c)
}
func (a AppModuleBasic) DefaultGenesis() json.RawMessage {
return nil
}
func (a AppModuleBasic) ValidateGenesis(message json.RawMessage) error {
return nil
}
func (a AppModuleBasic) RegisterRESTRoutes(context clictx.CLIContext, router *mux.Router) {}
func (a AppModuleBasic) GetTxCmd(c *codec.Codec) *cobra.Command {
return nil
}
func (a AppModuleBasic) GetQueryCmd(c *codec.Codec) *cobra.Command {
return nil
}
func (a AppModuleBasic) RegisterInterfaces(registry interfacetypes.InterfaceRegistry) {
types.RegisterInterfaces(registry)
}
func (a AppModuleBasic) RegisterGRPCGatewayRoutes(ctx clictx.CLIContext, mux *runtime.ServeMux) {
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(ctx))
if err != nil {
panic(err)
}
}
func (a AppModuleBasic) GetTxCmdV2(cdc *codec.CodecProxy, reg interfacetypes.InterfaceRegistry) *cobra.Command {
return cli.GetTxCmd(cdc, reg)
}
func (a AppModuleBasic) GetQueryCmdV2(cdc *codec.CodecProxy, reg interfacetypes.InterfaceRegistry) *cobra.Command {
return cli.GetQueryCmd(cdc, reg)
}
func (a AppModuleBasic) RegisterRouterForGRPC(cliCtx clictx.CLIContext, r *mux.Router) {}
type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
}
func NewAppModule(cdc *codec.CodecProxy, keeper keeper.Keeper) AppModule {
return AppModule{
AppModuleBasic: NewAppModuleBasic(cdc),
keeper: keeper,
}
}
func (a AppModule) Route() string {
return types.RouterKey
}
func (a AppModule) InitGenesis(s sdk.Context, message json.RawMessage) []abci.ValidatorUpdate {
return nil
}
func (a AppModule) ExportGenesis(s sdk.Context) json.RawMessage {
return nil
}
func (a AppModule) NewHandler() sdk.Handler {
return NewHandler(keeper.NewMsgServerImpl(a.keeper))
}
func (a AppModule) QuerierRoute() string {
return types.QuerierRoute
}
func (a AppModule) NewQuerierHandler() sdk.Querier {
return nil
}
func (a AppModule) BeginBlock(s sdk.Context, block abci.RequestBeginBlock) {}
func (a AppModule) EndBlock(s sdk.Context, block abci.RequestEndBlock) []abci.ValidatorUpdate {
return nil
}
func (a AppModule) RegisterInvariants(registry sdk.InvariantRegistry) {}
func (a AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(a.keeper))
types.RegisterQueryServer(cfg.QueryServer(), a.keeper)
}