github.com/lino-network/lino@v0.6.11/x/global/client/cli/query.go (about) 1 package cli 2 3 import ( 4 // "fmt" 5 6 "github.com/cosmos/cosmos-sdk/client" 7 "github.com/cosmos/cosmos-sdk/codec" 8 "github.com/spf13/cobra" 9 10 linotypes "github.com/lino-network/lino/types" 11 "github.com/lino-network/lino/utils" 12 "github.com/lino-network/lino/x/global/model" 13 types "github.com/lino-network/lino/x/global/types" 14 ) 15 16 func GetQueryCmd(cdc *codec.Codec) *cobra.Command { 17 cmd := &cobra.Command{ 18 Use: types.ModuleName, 19 Short: "Querying commands for the global module", 20 DisableFlagParsing: true, 21 SuggestionsMinimumDistance: 2, 22 RunE: client.ValidateCmd, 23 } 24 cmd.AddCommand(client.GetCommands( 25 // getCmdListEvents(cdc), 26 utils.SimpleQueryCmd( 27 "time", 28 "time", 29 types.QuerierRoute, types.QueryGlobalTime, 30 0, &model.GlobalTime{})(cdc), 31 utils.SimpleQueryCmd( 32 "event-errors", 33 "event-errors", 34 types.QuerierRoute, types.QueryGlobalEventErrors, 35 0, &([]model.EventError{}))(cdc), 36 utils.SimpleQueryCmd( 37 "bc-event-errors", 38 "bc-event-errors", 39 types.QuerierRoute, types.QueryGlobalBCEventErrors, 40 0, &([]linotypes.BCEventErr{}))(cdc), 41 )...) 42 return cmd 43 } 44 45 // // GetCmdListEvents - 46 // func getCmdListEvents(cdc *codec.Codec) *cobra.Command { 47 // return &cobra.Command{ 48 // Use: "list-events", 49 // Short: "list-events <unix_time>", 50 // Args: cobra.ExactArgs(1), 51 // RunE: func(cmd *cobra.Command, args []string) error { 52 // time := args[0] 53 // uri := fmt.Sprintf("custom/%s/%s/%s", types.QuerierRoute, types.QueryTimeEventList, time) 54 // rst := linotypes.TimeEventList{} 55 // return utils.CLIQueryJSONPrint(cdc, uri, nil, 56 // func() interface{} { return &rst }) 57 // }, 58 // } 59 // }