mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 13:44:26 -08:00
Initialized with Ignite CLI
This commit is contained in:
31
x/cosmostest/client/cli/query.go
Normal file
31
x/cosmostest/client/cli/query.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
// "strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
// "github.com/cosmos/cosmos-sdk/client/flags"
|
||||
// sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"cosmos-test/x/cosmostest/types"
|
||||
)
|
||||
|
||||
// GetQueryCmd returns the cli query commands for this module
|
||||
func GetQueryCmd(queryRoute string) *cobra.Command {
|
||||
// Group cosmostest 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(CmdQueryParams())
|
||||
// this line is used by starport scaffolding # 1
|
||||
|
||||
return cmd
|
||||
}
|
||||
34
x/cosmostest/client/cli/query_params.go
Normal file
34
x/cosmostest/client/cli/query_params.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"cosmos-test/x/cosmostest/types"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func CmdQueryParams() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "params",
|
||||
Short: "shows the parameters of the module",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
|
||||
res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
36
x/cosmostest/client/cli/tx.go
Normal file
36
x/cosmostest/client/cli/tx.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
// "github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"cosmos-test/x/cosmostest/types"
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())
|
||||
)
|
||||
|
||||
const (
|
||||
flagPacketTimeoutTimestamp = "packet-timeout-timestamp"
|
||||
listSeparator = ","
|
||||
)
|
||||
|
||||
// GetTxCmd returns the transaction commands for this module
|
||||
func GetTxCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: types.ModuleName,
|
||||
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName),
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
}
|
||||
|
||||
// this line is used by starport scaffolding # 1
|
||||
|
||||
return cmd
|
||||
}
|
||||
Reference in New Issue
Block a user