github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/evidence/client/cli/tx.go (about) 1 package cli 2 3 import ( 4 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/client" 5 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/client/flags" 6 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec" 7 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/evidence/internal/types" 8 9 "github.com/spf13/cobra" 10 ) 11 12 // GetTxCmd returns a CLI command that has all the native evidence module tx 13 // commands mounted. In addition, it mounts all childCmds, implemented by outside 14 // modules, under a sub-command. This allows external modules to implement custom 15 // Evidence types and Handlers while having the ability to create and sign txs 16 // containing them all from a single root command. 17 func GetTxCmd(storeKey string, cdc *codec.Codec, childCmds []*cobra.Command) *cobra.Command { 18 cmd := &cobra.Command{ 19 Use: types.ModuleName, 20 Short: "Evidence transaction subcommands", 21 DisableFlagParsing: true, 22 SuggestionsMinimumDistance: 2, 23 RunE: client.ValidateCmd, 24 } 25 26 submitEvidenceCmd := SubmitEvidenceCmd(cdc) 27 for _, childCmd := range childCmds { 28 submitEvidenceCmd.AddCommand(flags.PostCommands(childCmd)[0]) 29 } 30 31 // TODO: Add tx commands. 32 33 return cmd 34 } 35 36 // SubmitEvidenceCmd returns the top-level evidence submission command handler. 37 // All concrete evidence submission child command handlers should be registered 38 // under this command. 39 func SubmitEvidenceCmd(cdc *codec.Codec) *cobra.Command { 40 cmd := &cobra.Command{ 41 Use: "submit", 42 Short: "Submit arbitrary evidence of misbehavior", 43 } 44 45 return cmd 46 }