Skip to content

Commit

Permalink
Impl cli query logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel committed Nov 1, 2022
1 parent 8e6e978 commit 6c7b6a0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions x/ccv/provider/client/cli/query.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cli

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -147,18 +148,28 @@ func CmdConsumerStopProposals() *cobra.Command {

func CmdConsumerValidatorKeyMapping() *cobra.Command {
cmd := &cobra.Command{
Use: "list-chain-validator-key-mapping",
Use: "TODO:",
Short: "TODO:",
Long: `TODO:`,
Args: cobra.ExactArgs(0),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryConsumerChainValidatorKeyMappingRequest{}
consumerChainID := args[0]

addr, err := sdk.ValAddressFromBech32(args[1])
if err != nil {
return err
}

req := &types.QueryConsumerChainValidatorKeyMappingRequest{
ChainId: consumerChainID,
ProviderValidatorAddress: addr.String(),
}
res, err := queryClient.QueryConsumerChainValidatorKeyMapping(cmd.Context(), req)
if err != nil {
return err
Expand Down

0 comments on commit 6c7b6a0

Please sign in to comment.