forked from terra-money/classic-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module_client.go
53 lines (43 loc) · 1.3 KB
/
module_client.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
47
48
49
50
51
52
53
package client
import (
"terra/x/budget/client/cli"
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"
amino "github.com/tendermint/go-amino"
)
// ModuleClient exports all client functionality from this module
type ModuleClient struct {
storeKey string
cdc *amino.Codec
}
func NewModuleClient(storeKey string, cdc *amino.Codec) ModuleClient {
return ModuleClient{storeKey, cdc}
}
// GetQueryCmd returns the cli query commands for this module
func (mc ModuleClient) GetQueryCmd() *cobra.Command {
budgetQueryCmd := &cobra.Command{
Use: "budget",
Short: "Querying commands for the budget module",
}
budgetQueryCmd.AddCommand(client.GetCommands(
cli.GetCmdQueryProgram(mc.storeKey, mc.cdc),
cli.GetCmdQueryActives(mc.storeKey, mc.cdc),
cli.GetCmdQueryCandidates(mc.storeKey, mc.cdc),
cli.GetCmdQueryVotes(mc.storeKey, mc.cdc),
cli.GetCmdQueryParams(mc.storeKey, mc.cdc),
)...)
return budgetQueryCmd
}
// GetTxCmd returns the transaction commands for this module
func (mc ModuleClient) GetTxCmd() *cobra.Command {
budgetTxCmd := &cobra.Command{
Use: "budget",
Short: "budget transaction subcommands",
}
budgetTxCmd.AddCommand(client.PostCommands(
cli.GetCmdSubmitProgram(mc.cdc),
cli.GetCmdWithdrawProgram(mc.cdc),
cli.GetCmdVote(mc.cdc),
)...)
return budgetTxCmd
}