/
query.go
63 lines (58 loc) · 1.76 KB
/
query.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
54
55
56
57
58
59
60
61
62
63
package cli
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/spf13/cobra"
// linotypes "github.com/lino-network/lino/types"
types "github.com/lino-network/lino/param"
"github.com/lino-network/lino/utils"
)
func GetQueryCmd(cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: "Querying commands for the param module",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(client.GetCommands(
getCmdAll(cdc),
)...)
return cmd
}
// GetCmdAll -
func getCmdAll(cdc *codec.Codec) *cobra.Command {
return &cobra.Command{
Use: "all",
Short: "all print all blockchain parameters",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
all := []struct {
path string
t interface{}
}{
{types.QueryAllocationParam, &types.GlobalAllocationParam{}},
{types.QueryDeveloperParam, &types.DeveloperParam{}},
{types.QueryVoteParam, &types.VoteParam{}},
{types.QueryProposalParam, &types.ProposalParam{}},
{types.QueryValidatorParam, &types.ValidatorParam{}},
{types.QueryBandwidthParam, &types.BandwidthParam{}},
{types.QueryAccountParam, &types.AccountParam{}},
{types.QueryPostParam, &types.PostParam{}},
{types.QueryReputationParam, &types.ReputationParam{}},
{types.QueryPriceParam, &types.PriceParam{}},
}
for _, v := range all {
uri := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, v.path)
fmt.Print(v.path)
err := utils.CLIQueryJSONPrint(cdc, uri, nil,
func() interface{} { return v.t })
if err != nil {
return err
}
}
return nil
},
}
}