Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

Commit 1171ace

Browse files
ZhimaoLStumble
authored andcommitted
validator cli (#407)
* val cli * mod tidy
1 parent d31a70a commit 1171ace

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

x/validator/client/cli/query.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func GetQueryCmd(cdc *codec.Codec) *cobra.Command {
2424
cmd.AddCommand(client.GetCommands(
2525
getCmdShow(cdc),
2626
getCmdList(cdc),
27+
getCmdVoteInfo(cdc),
2728
)...)
2829
return cmd
2930
}
@@ -58,3 +59,19 @@ func getCmdList(cdc *codec.Codec) *cobra.Command {
5859
},
5960
}
6061
}
62+
63+
// GetCmdVoteInfo
64+
func getCmdVoteInfo(cdc *codec.Codec) *cobra.Command {
65+
return &cobra.Command{
66+
Use: "voteinfo",
67+
Short: "voteinfo <username>",
68+
Args: cobra.ExactArgs(1),
69+
RunE: func(cmd *cobra.Command, args []string) error {
70+
user := linotypes.AccountKey(args[0])
71+
uri := fmt.Sprintf("custom/%s/%s/%s", types.QuerierRoute, types.QueryElectionVoteList, user)
72+
rst := model.ElectionVoteList{}
73+
return utils.CLIQueryJSONPrint(cdc, uri, nil,
74+
func() interface{} { return &rst })
75+
},
76+
}
77+
}

x/validator/client/cli/tx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func GetTxCmd(cdc *codec.Codec) *cobra.Command {
3636
cmd.AddCommand(client.PostCommands(
3737
GetCmdRegister(cdc),
3838
GetCmdRevoke(cdc),
39+
GetCmdVote(cdc),
3940
)...)
4041

4142
return cmd

0 commit comments

Comments
 (0)