cosmos-sdk/x/evidence/client/cli/tx.go
SaReN 39f53ac22f
client: rename CliContext to Context (#6290)
* Refactor CliContext as Context

* Fix lint issues

* Fix goimports

* Fix gov tests

* Resolved ci-lint issues

* Add changelog

* Rename cliCtx to clientCtx

* Fix mocks and routes

* Add changelog

* Update changelog

* Apply suggestions from code review

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* merge client/rpc/ro{ot,utes}.go

* Update docs

* client/rpc: remove redundant client/rpc.RegisterRPCRoutes

* regenerate mocks

* Update ADRs

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-06-01 12:46:03 +00:00

46 lines
1.4 KiB
Go

package cli
import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/spf13/cobra"
)
// GetTxCmd returns a CLI command that has all the native evidence module tx
// commands mounted. In addition, it mounts all childCmds, implemented by outside
// modules, under a sub-command. This allows external modules to implement custom
// Evidence types and Handlers while having the ability to create and sign txs
// containing them all from a single root command.
func GetTxCmd(clientCtx client.Context, childCmds []*cobra.Command) *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: "Evidence transaction subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
submitEvidenceCmd := SubmitEvidenceCmd(clientCtx)
for _, childCmd := range childCmds {
submitEvidenceCmd.AddCommand(flags.PostCommands(childCmd)[0])
}
// TODO: Add tx commands.
return cmd
}
// SubmitEvidenceCmd returns the top-level evidence submission command handler.
// All concrete evidence submission child command handlers should be registered
// under this command.
func SubmitEvidenceCmd(_ client.Context) *cobra.Command {
cmd := &cobra.Command{
Use: "submit",
Short: "Submit arbitrary evidence of misbehavior",
}
return cmd
}