mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
ffef832d45
- Upgrade cosmos-sdk to v0.44.5 from v0.39.2 - Add Legacy Tx Endpoint for backwards compatibility - Add IBC v1.2.3 Support Co-authored-by: DracoLi <draco@dracoli.com> Co-authored-by: drklee3 <derrick@dlee.dev> Co-authored-by: denalimarsh <denalimarsh@gmail.com> Co-authored-by: Draco Li <draco@kava.io> Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com> Co-authored-by: Kevin Davis <karzak@users.noreply.github.com> Co-authored-by: Denali Marsh <denali@kava.io>
82 lines
1.9 KiB
Go
82 lines
1.9 KiB
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
|
|
|
"github.com/kava-labs/kava/x/kavadist/types"
|
|
)
|
|
|
|
// GetQueryCmd returns the cli query commands for this module
|
|
func GetQueryCmd() *cobra.Command {
|
|
// Group kavadist queries under a subcommand
|
|
cmd := &cobra.Command{
|
|
Use: types.ModuleName,
|
|
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName),
|
|
DisableFlagParsing: true,
|
|
SuggestionsMinimumDistance: 2,
|
|
RunE: client.ValidateCmd,
|
|
}
|
|
|
|
cmd.AddCommand(
|
|
queryParamsCmd(),
|
|
queryBalanceCmd(),
|
|
)
|
|
|
|
return cmd
|
|
}
|
|
|
|
func queryParamsCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "params",
|
|
Short: "get the kavadist module parameters",
|
|
Long: "Get the current global kavadist module parameters.",
|
|
Args: cobra.NoArgs,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
cliCtx, err := client.GetClientQueryContext(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
queryClient := types.NewQueryClient(cliCtx)
|
|
res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return cliCtx.PrintProto(&res.Params)
|
|
},
|
|
}
|
|
flags.AddQueryFlagsToCmd(cmd)
|
|
return cmd
|
|
}
|
|
|
|
func queryBalanceCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "balance",
|
|
Short: "get the kavadist module balance",
|
|
Long: "Get the current kavadist module account balance.",
|
|
Args: cobra.NoArgs,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
cliCtx, err := client.GetClientQueryContext(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
queryClient := types.NewQueryClient(cliCtx)
|
|
res, err := queryClient.Balance(context.Background(), &types.QueryBalanceRequest{})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return cliCtx.PrintProto(res)
|
|
},
|
|
}
|
|
|
|
flags.AddQueryFlagsToCmd(cmd)
|
|
return cmd
|
|
}
|