0g-chain/x/issuance/client/cli/query.go
Ruaridh ffef832d45
Upgrade to sdk v0.44.5 and add IBC (#1106)
- 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>
2022-01-07 17:39:27 -07:00

60 lines
1.3 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/issuance/types"
)
// GetQueryCmd returns the cli query commands for the issuance module
func GetQueryCmd() *cobra.Command {
issuanceQueryCmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName),
}
cmds := []*cobra.Command{
GetCmdQueryParams(),
}
for _, cmd := range cmds {
flags.AddQueryFlagsToCmd(cmd)
}
issuanceQueryCmd.AddCommand(cmds...)
return issuanceQueryCmd
}
// GetCmdQueryParams queries the issuance module parameters
func GetCmdQueryParams() *cobra.Command {
return &cobra.Command{
Use: "params",
Short: fmt.Sprintf("get the %s module parameters", types.ModuleName),
Long: "Get the current issuance module parameters.",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(&res.Params)
},
}
}