Merge PR #6806: Docs & Cleanup

This commit is contained in:
Alexander Bezobchuk 2020-07-21 11:28:43 -04:00 committed by GitHub
parent 61d0c4adcd
commit 61d69a978f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 185 additions and 83 deletions

View File

@ -5,16 +5,14 @@ import (
"io"
"os"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/pkg/errors"
yaml "gopkg.in/yaml.v2"
tmlite "github.com/tendermint/tendermint/lite"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
yaml "gopkg.in/yaml.v2"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
)

View File

@ -5,7 +5,6 @@ import (
"strconv"
"github.com/spf13/cobra"
"github.com/spf13/viper"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
@ -83,12 +82,6 @@ func AddQueryFlagsToCmd(cmd *cobra.Command) {
cmd.SetErr(cmd.ErrOrStderr())
cmd.SetOut(cmd.OutOrStdout())
// TODO: REMOVE VIPER CALLS!
viper.BindPFlag(FlagTrustNode, cmd.Flags().Lookup(FlagTrustNode))
viper.BindPFlag(FlagUseLedger, cmd.Flags().Lookup(FlagUseLedger))
viper.BindPFlag(FlagNode, cmd.Flags().Lookup(FlagNode))
viper.BindPFlag(FlagKeyringBackend, cmd.Flags().Lookup(FlagKeyringBackend))
}
// AddTxFlagsToCmd adds common flags to a module tx command.
@ -118,12 +111,6 @@ func AddTxFlagsToCmd(cmd *cobra.Command) {
cmd.SetErr(cmd.ErrOrStderr())
cmd.SetOut(cmd.OutOrStdout())
// TODO: REMOVE VIPER CALLS!
viper.BindPFlag(FlagTrustNode, cmd.Flags().Lookup(FlagTrustNode))
viper.BindPFlag(FlagUseLedger, cmd.Flags().Lookup(FlagUseLedger))
viper.BindPFlag(FlagNode, cmd.Flags().Lookup(FlagNode))
viper.BindPFlag(FlagKeyringBackend, cmd.Flags().Lookup(FlagKeyringBackend))
}
// AddPaginationFlagsToCmd adds common pagination flags to cmd

116
server/README.md Normal file
View File

@ -0,0 +1,116 @@
# Server
The `server` package is responsible for providing the mechanisms necessary to
start an ABCI Tendermint application and providing the CLI framework necessary
to fully bootstrap an application. The package exposes two core commands, `StartCmd`
and `ExportCmd`.
## Preliminary
The root command of an application typically is constructed with three core
sub-commands, query commands, tx commands, and auxiliary commands such as genesis
utilities, and starting an application binary.
It is vital that the root command of an application set the appropriate `PersistentPreRun(E)`
function so all child commands have access to the server and client contexts.
These contexts are set as their default values initially and maybe modified,
scoped to the command, in their respective `PersistentPreRun(E)` functions. Note,
the `client.Context` is typically pre-populated with "default" values that may be
useful for all commands to inherit and override if necessary.
Example:
```go
var (
rootCmd = &cobra.Command{
Use: "simd",
Short: "simulation app",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}
return server.InterceptConfigsPreRunHandler(cmd)
},
}
encodingConfig = simapp.MakeEncodingConfig()
initClientCtx = client.Context{}.
WithJSONMarshaler(encodingConfig.Marshaler).
WithTxConfig(encodingConfig.TxConfig).
WithCodec(encodingConfig.Amino).
WithInput(os.Stdin).
WithAccountRetriever(types.NewAccountRetriever(encodingConfig.Marshaler)).
WithBroadcastMode(flags.BroadcastBlock).
WithHomeDir(simapp.DefaultNodeHome)
)
```
The `SetCmdClientContextHandler` call reads persistent flags via `ReadPersistentCommandFlags`
which creates a `client.Context` and sets that on the root command's `Context`.
The `InterceptConfigsPreRunHandler` call creates a viper literal, default `server.Context`,
and a logger and sets that on the root command's `Context`. The `server.Context`
will be modified and saved to disk via the internal `interceptConfigs` call, which
either reads or creates a Tendermint configuration based on the home path provided.
In addition, `interceptConfigs` also reads and loads the application configuration,
`app.toml`, and binds that to the `server.Context` viper literal. This is vital
so the application can get access to not only the CLI flags, but also to the
application configuration values provided by this file.
## `StartCmd`
The `StartCmd` accepts an `AppCreator` function which returns an `Application`.
The `AppCreator` is responsible for constructing the application based on the
options provided to it via `AppOptions`. The `AppOptions` interface type defines
a single method, `Get() interface{}`, and is implemented as a [viper](https://github.com/spf13/viper)
literal that exists in the `server.Context`. All the possible options an application
may use and provide to the construction process are defined by the `StartCmd`
and by the application's config file, `app.toml`.
The application can either be started in-process or as an external process. The
former creates a Tendermint service and the latter creates a Tendermint Node.
Under the hood, `StartCmd` will call `GetServerContextFromCmd`, which provides
the command access to a `server.Context`. This context provides access to the
viper literal, the Tendermint config and logger. This allows flags to be bound
the viper literal and passed to the application construction.
Example:
```go
func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts server.AppOptions) server.Application {
var cache sdk.MultiStorePersistentCache
if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) {
cache = store.NewCommitKVStoreCacheManager()
}
skipUpgradeHeights := make(map[int64]bool)
for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) {
skipUpgradeHeights[int64(h)] = true
}
pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts)
if err != nil {
panic(err)
}
return simapp.NewSimApp(
logger, db, traceStore, true, skipUpgradeHeights,
cast.ToString(appOpts.Get(flags.FlagHome)),
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
baseapp.SetPruning(pruningOpts),
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))),
baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))),
baseapp.SetInterBlockCache(cache),
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
)
}
```
Note, some of the options provided are exposed via CLI flags in the start command
and some are also allowed to be set in the application's `app.toml`. It is recommend
to use the `cast` package for type safety guarantees and due to the limitations of
CLI flag types.

View File

@ -39,6 +39,7 @@ var (
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}
return server.InterceptConfigsPreRunHandler(cmd)
},
}
@ -114,7 +115,7 @@ func queryCommand() *cobra.Command {
authcmd.QueryTxCmd(),
)
simapp.ModuleBasics.AddQueryCommands(cmd, initClientCtx)
simapp.ModuleBasics.AddQueryCommands(cmd)
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")
return cmd
@ -141,7 +142,7 @@ func txCommand() *cobra.Command {
flags.LineBreak,
)
simapp.ModuleBasics.AddTxCommands(cmd, initClientCtx)
simapp.ModuleBasics.AddTxCommands(cmd)
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")
return cmd

View File

@ -107,31 +107,31 @@ func (mr *MockAppModuleBasicMockRecorder) RegisterRESTRoutes(arg0, arg1 interfac
}
// GetTxCmd mocks base method
func (m *MockAppModuleBasic) GetTxCmd(clientCtx client.Context) *cobra.Command {
func (m *MockAppModuleBasic) GetTxCmd() *cobra.Command {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetTxCmd", clientCtx)
ret := m.ctrl.Call(m, "GetTxCmd")
ret0, _ := ret[0].(*cobra.Command)
return ret0
}
// GetTxCmd indicates an expected call of GetTxCmd
func (mr *MockAppModuleBasicMockRecorder) GetTxCmd(clientCtx interface{}) *gomock.Call {
func (mr *MockAppModuleBasicMockRecorder) GetTxCmd() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModuleBasic)(nil).GetTxCmd), clientCtx)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModuleBasic)(nil).GetTxCmd))
}
// GetQueryCmd mocks base method
func (m *MockAppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command {
func (m *MockAppModuleBasic) GetQueryCmd() *cobra.Command {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetQueryCmd", clientCtx)
ret := m.ctrl.Call(m, "GetQueryCmd")
ret0, _ := ret[0].(*cobra.Command)
return ret0
}
// GetQueryCmd indicates an expected call of GetQueryCmd
func (mr *MockAppModuleBasicMockRecorder) GetQueryCmd(clientCtx interface{}) *gomock.Call {
func (mr *MockAppModuleBasicMockRecorder) GetQueryCmd() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModuleBasic)(nil).GetQueryCmd), clientCtx)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModuleBasic)(nil).GetQueryCmd))
}
// MockAppModuleGenesis is a mock of AppModuleGenesis interface
@ -224,31 +224,31 @@ func (mr *MockAppModuleGenesisMockRecorder) RegisterRESTRoutes(arg0, arg1 interf
}
// GetTxCmd mocks base method
func (m *MockAppModuleGenesis) GetTxCmd(clientCtx client.Context) *cobra.Command {
func (m *MockAppModuleGenesis) GetTxCmd() *cobra.Command {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetTxCmd", clientCtx)
ret := m.ctrl.Call(m, "GetTxCmd")
ret0, _ := ret[0].(*cobra.Command)
return ret0
}
// GetTxCmd indicates an expected call of GetTxCmd
func (mr *MockAppModuleGenesisMockRecorder) GetTxCmd(clientCtx interface{}) *gomock.Call {
func (mr *MockAppModuleGenesisMockRecorder) GetTxCmd() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModuleGenesis)(nil).GetTxCmd), clientCtx)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModuleGenesis)(nil).GetTxCmd))
}
// GetQueryCmd mocks base method
func (m *MockAppModuleGenesis) GetQueryCmd(clientCtx client.Context) *cobra.Command {
func (m *MockAppModuleGenesis) GetQueryCmd() *cobra.Command {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetQueryCmd", clientCtx)
ret := m.ctrl.Call(m, "GetQueryCmd")
ret0, _ := ret[0].(*cobra.Command)
return ret0
}
// GetQueryCmd indicates an expected call of GetQueryCmd
func (mr *MockAppModuleGenesisMockRecorder) GetQueryCmd(clientCtx interface{}) *gomock.Call {
func (mr *MockAppModuleGenesisMockRecorder) GetQueryCmd() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModuleGenesis)(nil).GetQueryCmd), clientCtx)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModuleGenesis)(nil).GetQueryCmd))
}
// InitGenesis mocks base method
@ -369,31 +369,31 @@ func (mr *MockAppModuleMockRecorder) RegisterRESTRoutes(arg0, arg1 interface{})
}
// GetTxCmd mocks base method
func (m *MockAppModule) GetTxCmd(clientCtx client.Context) *cobra.Command {
func (m *MockAppModule) GetTxCmd() *cobra.Command {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetTxCmd", clientCtx)
ret := m.ctrl.Call(m, "GetTxCmd")
ret0, _ := ret[0].(*cobra.Command)
return ret0
}
// GetTxCmd indicates an expected call of GetTxCmd
func (mr *MockAppModuleMockRecorder) GetTxCmd(clientCtx interface{}) *gomock.Call {
func (mr *MockAppModuleMockRecorder) GetTxCmd() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModule)(nil).GetTxCmd), clientCtx)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModule)(nil).GetTxCmd))
}
// GetQueryCmd mocks base method
func (m *MockAppModule) GetQueryCmd(clientCtx client.Context) *cobra.Command {
func (m *MockAppModule) GetQueryCmd() *cobra.Command {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetQueryCmd", clientCtx)
ret := m.ctrl.Call(m, "GetQueryCmd")
ret0, _ := ret[0].(*cobra.Command)
return ret0
}
// GetQueryCmd indicates an expected call of GetQueryCmd
func (mr *MockAppModuleMockRecorder) GetQueryCmd(clientCtx interface{}) *gomock.Call {
func (mr *MockAppModuleMockRecorder) GetQueryCmd() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModule)(nil).GetQueryCmd), clientCtx)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModule)(nil).GetQueryCmd))
}
// InitGenesis mocks base method

View File

@ -54,8 +54,8 @@ type AppModuleBasic interface {
// client functionality
RegisterRESTRoutes(client.Context, *mux.Router)
GetTxCmd(clientCtx client.Context) *cobra.Command
GetQueryCmd(clientCtx client.Context) *cobra.Command
GetTxCmd() *cobra.Command
GetQueryCmd() *cobra.Command
}
// BasicManager is a collection of AppModuleBasic
@ -109,9 +109,9 @@ func (bm BasicManager) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rou
//
// TODO: Remove clientCtx argument.
// REF: https://github.com/cosmos/cosmos-sdk/issues/6571
func (bm BasicManager) AddTxCommands(rootTxCmd *cobra.Command, ctx client.Context) {
func (bm BasicManager) AddTxCommands(rootTxCmd *cobra.Command) {
for _, b := range bm {
if cmd := b.GetTxCmd(ctx); cmd != nil {
if cmd := b.GetTxCmd(); cmd != nil {
rootTxCmd.AddCommand(cmd)
}
}
@ -121,9 +121,9 @@ func (bm BasicManager) AddTxCommands(rootTxCmd *cobra.Command, ctx client.Contex
//
// TODO: Remove clientCtx argument.
// REF: https://github.com/cosmos/cosmos-sdk/issues/6571
func (bm BasicManager) AddQueryCommands(rootQueryCmd *cobra.Command, clientCtx client.Context) {
func (bm BasicManager) AddQueryCommands(rootQueryCmd *cobra.Command) {
for _, b := range bm {
if cmd := b.GetQueryCmd(clientCtx); cmd != nil {
if cmd := b.GetQueryCmd(); cmd != nil {
rootQueryCmd.AddCommand(cmd)
}
}

View File

@ -35,8 +35,8 @@ func TestBasicManager(t *testing.T) {
mockAppModuleBasic1.EXPECT().ValidateGenesis(gomock.Eq(cdc), gomock.Eq(wantDefaultGenesis["mockAppModuleBasic1"])).Times(1).Return(errFoo)
mockAppModuleBasic1.EXPECT().RegisterRESTRoutes(gomock.Eq(client.Context{}), gomock.Eq(&mux.Router{})).Times(1)
mockAppModuleBasic1.EXPECT().RegisterCodec(gomock.Eq(cdc)).Times(1)
mockAppModuleBasic1.EXPECT().GetTxCmd(clientCtx).Times(1).Return(nil)
mockAppModuleBasic1.EXPECT().GetQueryCmd(clientCtx).Times(1).Return(nil)
mockAppModuleBasic1.EXPECT().GetTxCmd().Times(1).Return(nil)
mockAppModuleBasic1.EXPECT().GetQueryCmd().Times(1).Return(nil)
mm := module.NewBasicManager(mockAppModuleBasic1)
require.Equal(t, mm["mockAppModuleBasic1"], mockAppModuleBasic1)
@ -53,9 +53,9 @@ func TestBasicManager(t *testing.T) {
mm.RegisterRESTRoutes(client.Context{}, &mux.Router{})
mockCmd := &cobra.Command{Use: "root"}
mm.AddTxCommands(mockCmd, clientCtx)
mm.AddTxCommands(mockCmd)
mm.AddQueryCommands(mockCmd, clientCtx)
mm.AddQueryCommands(mockCmd)
// validate genesis returns nil
require.Nil(t, module.NewBasicManager().ValidateGenesis(cdc, wantDefaultGenesis))

View File

@ -66,12 +66,12 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout
}
// GetTxCmd returns the root tx command for the auth module.
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
}
// GetQueryCmd returns the root query command for the auth module.
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

View File

@ -63,12 +63,12 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout
}
// GetTxCmd returns the root tx command for the bank module.
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
}
// GetQueryCmd returns no root query command for the bank module.
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

View File

@ -67,10 +67,10 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessag
func (a AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {}
// GetTxCmd returns the capability module's root tx command.
func (a AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command { return nil }
func (a AppModuleBasic) GetTxCmd() *cobra.Command { return nil }
// GetQueryCmd returns the capability module's root query command.
func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command { return nil }
func (AppModuleBasic) GetQueryCmd() *cobra.Command { return nil }
// ----------------------------------------------------------------------------
// AppModule

View File

@ -57,12 +57,12 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessag
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {}
// GetTxCmd returns the root tx command for the crisis module.
func (b AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (b AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
}
// GetQueryCmd returns no root query command for the crisis module.
func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command { return nil }
func (AppModuleBasic) GetQueryCmd() *cobra.Command { return nil }
// RegisterInterfaceTypes registers interfaces and implementations of the crisis
// module.

View File

@ -69,12 +69,12 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx sdkclient.Context, rtr *mux.R
}
// GetTxCmd returns the root tx command for the distribution module.
func (AppModuleBasic) GetTxCmd(_ sdkclient.Context) *cobra.Command {
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
}
// GetQueryCmd returns the root query command for the distribution module.
func (AppModuleBasic) GetQueryCmd(_ sdkclient.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

View File

@ -86,7 +86,7 @@ func (a AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Ro
}
// GetTxCmd returns the evidence module's root tx command.
func (a AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
evidenceCLIHandlers := make([]*cobra.Command, len(a.evidenceHandlers))
for i, evidenceHandler := range a.evidenceHandlers {
@ -97,7 +97,7 @@ func (a AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
}
// GetQueryCmd returns the evidence module's root query command.
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

View File

@ -52,10 +52,10 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessag
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {}
// GetTxCmd returns no root tx command for the genutil module.
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command { return nil }
func (AppModuleBasic) GetTxCmd() *cobra.Command { return nil }
// GetQueryCmd returns no root query command for the genutil module.
func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command { return nil }
func (AppModuleBasic) GetQueryCmd() *cobra.Command { return nil }
//____________________________________________________________________________

View File

@ -85,7 +85,7 @@ func (a AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Ro
}
// GetTxCmd returns the root tx command for the gov module.
func (a AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
proposalCLIHandlers := make([]*cobra.Command, 0, len(a.proposalHandlers))
for _, proposalHandler := range a.proposalHandlers {
proposalCLIHandlers = append(proposalCLIHandlers, proposalHandler.CLIHandler())
@ -95,7 +95,7 @@ func (a AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
}
// GetQueryCmd returns the root query command for the gov module.
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

View File

@ -71,12 +71,12 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout
}
// GetTxCmd implements AppModuleBasic interface
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
}
// GetQueryCmd implements AppModuleBasic interface
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return nil
}

View File

@ -69,12 +69,12 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout
}
// GetTxCmd returns the root tx command for the ibc module.
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
}
// GetQueryCmd returns no root query command for the ibc module.
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

View File

@ -65,10 +65,10 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout
}
// GetTxCmd returns no root tx command for the mint module.
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command { return nil }
func (AppModuleBasic) GetTxCmd() *cobra.Command { return nil }
// GetQueryCmd returns the root query command for the mint module.
func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

View File

@ -54,10 +54,10 @@ func (AppModuleBasic) ValidateGenesis(_ codec.JSONMarshaler, _ json.RawMessage)
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {}
// GetTxCmd returns no root tx command for the params module.
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command { return nil }
func (AppModuleBasic) GetTxCmd() *cobra.Command { return nil }
// GetQueryCmd returns no root query command for the params module.
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.NewQueryCmd()
}

View File

@ -70,12 +70,12 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout
}
// GetTxCmd returns the root tx command for the slashing module.
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
}
// GetQueryCmd returns no root query command for the slashing module.
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

View File

@ -68,12 +68,12 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout
}
// GetTxCmd returns the root tx command for the staking module.
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
}
// GetQueryCmd returns no root query command for the staking module.
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

View File

@ -53,12 +53,12 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, r *mux.Router
}
// GetQueryCmd returns the cli query commands for this module
func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}
// GetTxCmd returns the transaction commands for this module
func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
}