Some checks failed
CodeQL / Analyze (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Has been cancelled
76 lines
2.3 KiB
Go
76 lines
2.3 KiB
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"git.cw.tr/mukan-network/mukan-sdk/client"
|
|
"git.cw.tr/mukan-network/mukan-sdk/client/flags"
|
|
"git.cw.tr/mukan-network/mukan-sdk/version"
|
|
|
|
"git.cw.tr/mukan-network/mukan-ibc/modules/apps/27-interchain-accounts/controller/types"
|
|
)
|
|
|
|
// GetCmdQueryInterchainAccount returns the command handler for the controller submodule parameter querying.
|
|
func GetCmdQueryInterchainAccount() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "interchain-account [owner] [connection-id]",
|
|
Short: "Query the interchain account address for a given owner on a particular connection",
|
|
Long: "Query the controller submodule for the interchain account address for a given owner on a particular connection",
|
|
Args: cobra.ExactArgs(2),
|
|
Example: fmt.Sprintf("%s query interchain-accounts controller interchain-account cosmos1layxcsmyye0dc0har9sdfzwckaz8sjwlfsj8zs connection-0", version.AppName),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
clientCtx, err := client.GetClientQueryContext(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
queryClient := types.NewQueryClient(clientCtx)
|
|
req := &types.QueryInterchainAccountRequest{
|
|
Owner: args[0],
|
|
ConnectionId: args[1],
|
|
}
|
|
|
|
res, err := queryClient.InterchainAccount(cmd.Context(), req)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return clientCtx.PrintProto(res)
|
|
},
|
|
}
|
|
|
|
flags.AddQueryFlagsToCmd(cmd)
|
|
|
|
return cmd
|
|
}
|
|
|
|
// GetCmdParams returns the command handler for the controller submodule parameter querying.
|
|
func GetCmdParams() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "params",
|
|
Short: "Query the current interchain-accounts controller submodule parameters",
|
|
Long: "Query the current interchain-accounts controller submodule parameters",
|
|
Args: cobra.NoArgs,
|
|
Example: fmt.Sprintf("%s query interchain-accounts controller params", version.AppName),
|
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
|
clientCtx, err := client.GetClientQueryContext(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
queryClient := types.NewQueryClient(clientCtx)
|
|
|
|
res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return clientCtx.PrintProto(res.Params)
|
|
},
|
|
}
|
|
|
|
flags.AddQueryFlagsToCmd(cmd)
|
|
|
|
return cmd
|
|
}
|