-
Notifications
You must be signed in to change notification settings - Fork 13
/
module.go
93 lines (79 loc) · 2.7 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
package signutil
import (
"encoding/json"
"fmt"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/gorilla/mux"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
)
const ModuleName = "signutil"
// ModuleCdc instantiates a new codec for the domain module
var ModuleCdc = codec.New()
func init() {
RegisterCodec(ModuleCdc)
}
func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterConcrete(MsgSignText{}, fmt.Sprintf("%s/%s", ModuleName, "MsgSignText"), nil)
}
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
)
// nolint
// - - - FILL APP MODULE BASIC -- //
// AppModuleBasic implements the AppModuleBasic interface of the cosmos-sdk
type AppModuleBasic struct{}
func (AppModuleBasic) Name() string { return ModuleName }
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { RegisterCodec(cdc) }
func (AppModuleBasic) DefaultGenesis() json.RawMessage {
return []byte("{}")
}
func (AppModuleBasic) ValidateGenesis(_ json.RawMessage) (err error) {
return nil
}
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, r *mux.Router) {
RegisterRestRoutes(ctx, r)
}
func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command {
return getTxCmd(ModuleName, cdc)
}
func (AppModuleBasic) GetQueryCmd(_ *codec.Codec) *cobra.Command {
return nil
}
// - - FILL APP MODULE - -
type AppModule struct {
AppModuleBasic
}
func NewAppModule() AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{},
}
}
func (AppModule) Name() string { return ModuleName }
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
func (AppModule) Route() string { return ModuleName }
func (AppModule) QuerierRoute() string { return ModuleName }
func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}
func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{}
}
func (a AppModule) NewHandler() sdk.Handler {
return func(_ sdk.Context, _ sdk.Msg) (*sdk.Result, error) {
return nil, fmt.Errorf("invalid call to signutil module")
}
}
func (a AppModule) NewQuerierHandler() sdk.Querier {
return func(_ sdk.Context, _ []string, _ abci.RequestQuery) ([]byte, error) {
return nil, fmt.Errorf("invalid query to signutil module")
}
}
func (a AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate {
return nil
}
func (a AppModule) ExportGenesis(_ sdk.Context) json.RawMessage {
return []byte("{}")
}