/
tx.go
46 lines (38 loc) · 1.52 KB
/
tx.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
package cli
import (
"github.com/FiboChain/fbc/libs/cosmos-sdk/client"
"github.com/FiboChain/fbc/libs/cosmos-sdk/client/flags"
"github.com/FiboChain/fbc/libs/cosmos-sdk/codec"
"github.com/FiboChain/fbc/libs/cosmos-sdk/x/evidence/internal/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(storeKey string, cdc *codec.Codec, childCmds []*cobra.Command) *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: "Evidence transaction subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
submitEvidenceCmd := SubmitEvidenceCmd(cdc)
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(cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "submit",
Short: "Submit arbitrary evidence of misbehavior",
}
return cmd
}