mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
59 lines
1.3 KiB
Go
59 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/0glabs/0g-chain/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)
|
|
},
|
|
}
|
|
}
|