Skip to content

Commit

Permalink
add consumer-chain cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
sainoe committed Aug 29, 2024
1 parent 825a2c0 commit 9af41b8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 74 deletions.
8 changes: 0 additions & 8 deletions contrib/create-consumer-msg.json

This file was deleted.

66 changes: 0 additions & 66 deletions contrib/local-node.sh

This file was deleted.

28 changes: 28 additions & 0 deletions x/ccv/provider/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func NewQueryCmd() *cobra.Command {
cmd.AddCommand(CmdValidatorConsumerCommissionRate())
cmd.AddCommand(CmdBlocksUntilNextEpoch())
cmd.AddCommand(CmdConsumerIdFromClientId())
cmd.AddCommand(CmdConsumerChain())
return cmd
}

Expand Down Expand Up @@ -553,3 +554,30 @@ func CmdConsumerIdFromClientId() *cobra.Command {

return cmd
}

func CmdConsumerChain() *cobra.Command {
cmd := &cobra.Command{
Use: "consumer-chain [consumer-id]",
Short: "Query the consumer chain associated with the consumer id",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryConsumerChainRequest{ConsumerId: args[0]}
res, err := queryClient.QueryConsumerChain(cmd.Context(), req)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

0 comments on commit 9af41b8

Please sign in to comment.