x/ibc: update CLI queries (#6647)

This commit is contained in:
Federico Kunze 2020-07-08 16:57:42 +02:00 committed by GitHub
parent 67be012e3f
commit 3fc5a4dfc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 79 additions and 63 deletions

View File

@ -76,7 +76,7 @@ func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
} }
// GetQueryCmd implements AppModuleBasic interface // GetQueryCmd implements AppModuleBasic interface
func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command { func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
return nil return nil
} }

View File

@ -9,8 +9,8 @@ import (
) )
// GetQueryCmd returns the query commands for IBC clients // GetQueryCmd returns the query commands for IBC clients
func GetQueryCmd(clientCtx client.Context) *cobra.Command { func GetQueryCmd() *cobra.Command {
ics02ClientQueryCmd := &cobra.Command{ queryCmd := &cobra.Command{
Use: types.SubModuleName, Use: types.SubModuleName,
Short: "IBC client query subcommands", Short: "IBC client query subcommands",
DisableFlagParsing: true, DisableFlagParsing: true,
@ -18,12 +18,12 @@ func GetQueryCmd(clientCtx client.Context) *cobra.Command {
RunE: client.ValidateCmd, RunE: client.ValidateCmd,
} }
ics02ClientQueryCmd.AddCommand(flags.GetCommands( queryCmd.AddCommand(flags.GetCommands(
GetCmdQueryClientStates(clientCtx), GetCmdQueryClientStates(),
GetCmdQueryClientState(clientCtx), GetCmdQueryClientState(),
GetCmdQueryConsensusState(clientCtx), GetCmdQueryConsensusState(),
GetCmdQueryHeader(clientCtx), GetCmdQueryHeader(),
GetCmdNodeConsensusState(clientCtx), GetCmdNodeConsensusState(),
)...) )...)
return ics02ClientQueryCmd return queryCmd
} }

View File

@ -18,7 +18,7 @@ import (
// GetCmdQueryClientStates defines the command to query all the light clients // GetCmdQueryClientStates defines the command to query all the light clients
// that this chain mantains. // that this chain mantains.
func GetCmdQueryClientStates(clientCtx client.Context) *cobra.Command { func GetCmdQueryClientStates() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "states", Use: "states",
Short: "Query all available light clients", Short: "Query all available light clients",
@ -26,6 +26,7 @@ func GetCmdQueryClientStates(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s states", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s states", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.NoArgs, Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -52,7 +53,7 @@ func GetCmdQueryClientStates(clientCtx client.Context) *cobra.Command {
// GetCmdQueryClientState defines the command to query the state of a client with // GetCmdQueryClientState defines the command to query the state of a client with
// a given id as defined in https://github.com/cosmos/ics/tree/master/spec/ics-002-client-semantics#query // a given id as defined in https://github.com/cosmos/ics/tree/master/spec/ics-002-client-semantics#query
func GetCmdQueryClientState(clientCtx client.Context) *cobra.Command { func GetCmdQueryClientState() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "state [client-id]", Use: "state [client-id]",
Short: "Query a client state", Short: "Query a client state",
@ -60,6 +61,7 @@ func GetCmdQueryClientState(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s state [client-id]", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s state [client-id]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -88,7 +90,7 @@ func GetCmdQueryClientState(clientCtx client.Context) *cobra.Command {
// GetCmdQueryConsensusState defines the command to query the consensus state of // GetCmdQueryConsensusState defines the command to query the consensus state of
// the chain as defined in https://github.com/cosmos/ics/tree/master/spec/ics-002-client-semantics#query // the chain as defined in https://github.com/cosmos/ics/tree/master/spec/ics-002-client-semantics#query
func GetCmdQueryConsensusState(clientCtx client.Context) *cobra.Command { func GetCmdQueryConsensusState() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "consensus-state [client-id] [height]", Use: "consensus-state [client-id] [height]",
Short: "Query the consensus state of a client at a given height", Short: "Query the consensus state of a client at a given height",
@ -96,6 +98,7 @@ func GetCmdQueryConsensusState(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s consensus-state [client-id] [height]", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s consensus-state [client-id] [height]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -128,13 +131,14 @@ func GetCmdQueryConsensusState(clientCtx client.Context) *cobra.Command {
} }
// GetCmdQueryHeader defines the command to query the latest header on the chain // GetCmdQueryHeader defines the command to query the latest header on the chain
func GetCmdQueryHeader(clientCtx client.Context) *cobra.Command { func GetCmdQueryHeader() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "header", Use: "header",
Short: "Query the latest header of the running chain", Short: "Query the latest header of the running chain",
Long: "Query the latest Tendermint header of the running chain", Long: "Query the latest Tendermint header of the running chain",
Example: fmt.Sprintf("%s query %s %s header", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s header", version.AppName, host.ModuleName, types.SubModuleName),
RunE: func(cmd *cobra.Command, _ []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -153,7 +157,7 @@ func GetCmdQueryHeader(clientCtx client.Context) *cobra.Command {
// GetCmdNodeConsensusState defines the command to query the latest consensus state of a node // GetCmdNodeConsensusState defines the command to query the latest consensus state of a node
// The result is feed to client creation // The result is feed to client creation
func GetCmdNodeConsensusState(clientCtx client.Context) *cobra.Command { func GetCmdNodeConsensusState() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "node-state", Use: "node-state",
Short: "Query a node consensus state", Short: "Query a node consensus state",
@ -161,6 +165,7 @@ func GetCmdNodeConsensusState(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s node-state", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s node-state", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(0), Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, _ []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err

View File

@ -21,6 +21,6 @@ func RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {
} }
// GetQueryCmd returns no root query command for the IBC client // GetQueryCmd returns no root query command for the IBC client
func GetQueryCmd(clientCtx client.Context) *cobra.Command { func GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd(clientCtx) return cli.GetQueryCmd()
} }

View File

@ -9,26 +9,26 @@ import (
) )
// GetQueryCmd returns the query commands for IBC connections // GetQueryCmd returns the query commands for IBC connections
func GetQueryCmd(clientCtx client.Context) *cobra.Command { func GetQueryCmd() *cobra.Command {
ics03ConnectionQueryCmd := &cobra.Command{ queryCmd := &cobra.Command{
Use: types.SubModuleName, Use: types.SubModuleName,
Short: "IBC connection query subcommands", Short: "IBC connection query subcommands",
DisableFlagParsing: true, DisableFlagParsing: true,
SuggestionsMinimumDistance: 2, SuggestionsMinimumDistance: 2,
} }
ics03ConnectionQueryCmd.AddCommand(flags.GetCommands( queryCmd.AddCommand(flags.GetCommands(
GetCmdQueryConnections(clientCtx), GetCmdQueryConnections(),
GetCmdQueryConnection(clientCtx), GetCmdQueryConnection(),
GetCmdQueryClientConnections(clientCtx), GetCmdQueryClientConnections(),
)...) )...)
return ics03ConnectionQueryCmd return queryCmd
} }
// NewTxCmd returns a CLI command handler for all x/ibc connection transaction commands. // NewTxCmd returns a CLI command handler for all x/ibc connection transaction commands.
func NewTxCmd() *cobra.Command { func NewTxCmd() *cobra.Command {
ics03ConnectionTxCmd := &cobra.Command{ txCmd := &cobra.Command{
Use: types.SubModuleName, Use: types.SubModuleName,
Short: "IBC connection transaction subcommands", Short: "IBC connection transaction subcommands",
DisableFlagParsing: true, DisableFlagParsing: true,
@ -36,12 +36,12 @@ func NewTxCmd() *cobra.Command {
RunE: client.ValidateCmd, RunE: client.ValidateCmd,
} }
ics03ConnectionTxCmd.AddCommand(flags.PostCommands( txCmd.AddCommand(flags.PostCommands(
NewConnectionOpenInitCmd(), NewConnectionOpenInitCmd(),
NewConnectionOpenTryCmd(), NewConnectionOpenTryCmd(),
NewConnectionOpenAckCmd(), NewConnectionOpenAckCmd(),
NewConnectionOpenConfirmCmd(), NewConnectionOpenConfirmCmd(),
)...) )...)
return ics03ConnectionTxCmd return txCmd
} }

View File

@ -17,7 +17,7 @@ import (
// GetCmdQueryConnections defines the command to query all the connection ends // GetCmdQueryConnections defines the command to query all the connection ends
// that this chain mantains. // that this chain mantains.
func GetCmdQueryConnections(clientCtx client.Context) *cobra.Command { func GetCmdQueryConnections() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "connections", Use: "connections",
Short: "Query all connections", Short: "Query all connections",
@ -25,6 +25,7 @@ func GetCmdQueryConnections(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s connections", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s connections", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.NoArgs, Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -57,7 +58,7 @@ func GetCmdQueryConnections(clientCtx client.Context) *cobra.Command {
} }
// GetCmdQueryConnection defines the command to query a connection end // GetCmdQueryConnection defines the command to query a connection end
func GetCmdQueryConnection(clientCtx client.Context) *cobra.Command { func GetCmdQueryConnection() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "end [connection-id]", Use: "end [connection-id]",
Short: "Query stored connection end", Short: "Query stored connection end",
@ -65,6 +66,7 @@ func GetCmdQueryConnection(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s end [connection-id]", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s end [connection-id]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -88,7 +90,7 @@ func GetCmdQueryConnection(clientCtx client.Context) *cobra.Command {
} }
// GetCmdQueryClientConnections defines the command to query a client connections // GetCmdQueryClientConnections defines the command to query a client connections
func GetCmdQueryClientConnections(clientCtx client.Context) *cobra.Command { func GetCmdQueryClientConnections() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "path [client-id]", Use: "path [client-id]",
Short: "Query stored client connection paths", Short: "Query stored client connection paths",
@ -96,6 +98,7 @@ func GetCmdQueryClientConnections(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s path [client-id]", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s path [client-id]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err

View File

@ -22,8 +22,8 @@ func GetTxCmd() *cobra.Command {
} }
// GetQueryCmd returns the root query command for the IBC connections. // GetQueryCmd returns the root query command for the IBC connections.
func GetQueryCmd(clientCtx client.Context) *cobra.Command { func GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd(clientCtx) return cli.GetQueryCmd()
} }
// RegisterRESTRoutes registers the REST routes for the IBC connections. // RegisterRESTRoutes registers the REST routes for the IBC connections.

View File

@ -9,8 +9,8 @@ import (
) )
// GetQueryCmd returns the query commands for IBC channels // GetQueryCmd returns the query commands for IBC channels
func GetQueryCmd(clientCtx client.Context) *cobra.Command { func GetQueryCmd() *cobra.Command {
ics04ChannelQueryCmd := &cobra.Command{ queryCmd := &cobra.Command{
Use: types.SubModuleName, Use: types.SubModuleName,
Short: "IBC channel query subcommands", Short: "IBC channel query subcommands",
DisableFlagParsing: true, DisableFlagParsing: true,
@ -18,24 +18,24 @@ func GetQueryCmd(clientCtx client.Context) *cobra.Command {
RunE: client.ValidateCmd, RunE: client.ValidateCmd,
} }
ics04ChannelQueryCmd.AddCommand(flags.GetCommands( queryCmd.AddCommand(flags.GetCommands(
GetCmdQueryChannels(clientCtx), GetCmdQueryChannels(),
GetCmdQueryChannel(clientCtx), GetCmdQueryChannel(),
GetCmdQueryConnectionChannels(clientCtx), GetCmdQueryConnectionChannels(),
GetCmdQueryChannelClientState(clientCtx), GetCmdQueryChannelClientState(),
GetCmdQueryPacketCommitment(clientCtx), GetCmdQueryPacketCommitment(),
GetCmdQueryPacketCommitments(clientCtx), GetCmdQueryPacketCommitments(),
GetCmdQueryUnrelayedPackets(clientCtx), GetCmdQueryUnrelayedPackets(),
GetCmdQueryNextSequenceReceive(clientCtx), GetCmdQueryNextSequenceReceive(),
// TODO: next sequence Send ? // TODO: next sequence Send ?
)...) )...)
return ics04ChannelQueryCmd return queryCmd
} }
// NewTxCmd returns a CLI command handler for all x/ibc channel transaction commands. // NewTxCmd returns a CLI command handler for all x/ibc channel transaction commands.
func NewTxCmd() *cobra.Command { func NewTxCmd() *cobra.Command {
ics04ChannelTxCmd := &cobra.Command{ txCmd := &cobra.Command{
Use: types.SubModuleName, Use: types.SubModuleName,
Short: "IBC channel transaction subcommands", Short: "IBC channel transaction subcommands",
DisableFlagParsing: true, DisableFlagParsing: true,
@ -43,7 +43,7 @@ func NewTxCmd() *cobra.Command {
RunE: client.ValidateCmd, RunE: client.ValidateCmd,
} }
ics04ChannelTxCmd.AddCommand(flags.PostCommands( txCmd.AddCommand(flags.PostCommands(
NewChannelOpenInitCmd(), NewChannelOpenInitCmd(),
NewChannelOpenTryCmd(), NewChannelOpenTryCmd(),
NewChannelOpenAckCmd(), NewChannelOpenAckCmd(),
@ -52,5 +52,5 @@ func NewTxCmd() *cobra.Command {
NewChannelCloseConfirmCmd(), NewChannelCloseConfirmCmd(),
)...) )...)
return ics04ChannelTxCmd return txCmd
} }

View File

@ -20,7 +20,7 @@ const flagSequences = "sequences"
// GetCmdQueryChannels defines the command to query all the channels ends // GetCmdQueryChannels defines the command to query all the channels ends
// that this chain mantains. // that this chain mantains.
func GetCmdQueryChannels(clientCtx client.Context) *cobra.Command { func GetCmdQueryChannels() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "channels", Use: "channels",
Short: "Query all channels", Short: "Query all channels",
@ -28,6 +28,7 @@ func GetCmdQueryChannels(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s channels", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s channels", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.NoArgs, Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -60,7 +61,7 @@ func GetCmdQueryChannels(clientCtx client.Context) *cobra.Command {
} }
// GetCmdQueryChannel defines the command to query a channel end // GetCmdQueryChannel defines the command to query a channel end
func GetCmdQueryChannel(clientCtx client.Context) *cobra.Command { func GetCmdQueryChannel() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "end [port-id] [channel-id]", Use: "end [port-id] [channel-id]",
Short: "Query a channel end", Short: "Query a channel end",
@ -70,6 +71,7 @@ func GetCmdQueryChannel(clientCtx client.Context) *cobra.Command {
), ),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -94,7 +96,7 @@ func GetCmdQueryChannel(clientCtx client.Context) *cobra.Command {
// GetCmdQueryConnectionChannels defines the command to query all the channels associated with a // GetCmdQueryConnectionChannels defines the command to query all the channels associated with a
// connection // connection
func GetCmdQueryConnectionChannels(clientCtx client.Context) *cobra.Command { func GetCmdQueryConnectionChannels() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "connections [connection-id]", Use: "connections [connection-id]",
Short: "Query all channels associated with a connection", Short: "Query all channels associated with a connection",
@ -102,6 +104,7 @@ func GetCmdQueryConnectionChannels(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s connections [connection-id]", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s connections [connection-id]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -135,7 +138,7 @@ func GetCmdQueryConnectionChannels(clientCtx client.Context) *cobra.Command {
} }
// GetCmdQueryChannelClientState defines the command to query a client state from a channel // GetCmdQueryChannelClientState defines the command to query a client state from a channel
func GetCmdQueryChannelClientState(clientCtx client.Context) *cobra.Command { func GetCmdQueryChannelClientState() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "client-state [port-id] [channel-id]", Use: "client-state [port-id] [channel-id]",
Short: "Query the client state associated with a channel", Short: "Query the client state associated with a channel",
@ -143,6 +146,7 @@ func GetCmdQueryChannelClientState(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query ibc channel client-state [port-id] [channel-id]", version.AppName), Example: fmt.Sprintf("%s query ibc channel client-state [port-id] [channel-id]", version.AppName),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -165,7 +169,7 @@ func GetCmdQueryChannelClientState(clientCtx client.Context) *cobra.Command {
// GetCmdQueryPacketCommitments defines the command to query all packet commitments associated with // GetCmdQueryPacketCommitments defines the command to query all packet commitments associated with
// a channel // a channel
func GetCmdQueryPacketCommitments(clientCtx client.Context) *cobra.Command { func GetCmdQueryPacketCommitments() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "packet-commitments [port-id] [channel-id]", Use: "packet-commitments [port-id] [channel-id]",
Short: "Query all packet commitments associated with a channel", Short: "Query all packet commitments associated with a channel",
@ -173,6 +177,7 @@ func GetCmdQueryPacketCommitments(clientCtx client.Context) *cobra.Command {
Example: fmt.Sprintf("%s query %s %s packet-commitments [port-id] [channel-id]", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s packet-commitments [port-id] [channel-id]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -207,7 +212,7 @@ func GetCmdQueryPacketCommitments(clientCtx client.Context) *cobra.Command {
} }
// GetCmdQueryPacketCommitment defines the command to query a channel end // GetCmdQueryPacketCommitment defines the command to query a channel end
func GetCmdQueryPacketCommitment(clientCtx client.Context) *cobra.Command { func GetCmdQueryPacketCommitment() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "packet-commitment [port-id] [channel-id] [sequence]", Use: "packet-commitment [port-id] [channel-id] [sequence]",
Short: "Query a packet commitment", Short: "Query a packet commitment",
@ -217,6 +222,7 @@ func GetCmdQueryPacketCommitment(clientCtx client.Context) *cobra.Command {
), ),
Args: cobra.ExactArgs(3), Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -245,7 +251,7 @@ func GetCmdQueryPacketCommitment(clientCtx client.Context) *cobra.Command {
} }
// GetCmdQueryUnrelayedPackets defines the command to query all the unrelayed packets. // GetCmdQueryUnrelayedPackets defines the command to query all the unrelayed packets.
func GetCmdQueryUnrelayedPackets(clientCtx client.Context) *cobra.Command { func GetCmdQueryUnrelayedPackets() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "unrelayed-packets [port-id] [channel-id]", Use: "unrelayed-packets [port-id] [channel-id]",
Short: "Query all the unrelayed packets associated with a channel", Short: "Query all the unrelayed packets associated with a channel",
@ -257,6 +263,7 @@ An unrelayed packet corresponds to:
Example: fmt.Sprintf("%s query %s %s unrelayed-packets [port-id] [channel-id] --sequences=1,2,3", version.AppName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s unrelayed-packets [port-id] [channel-id] --sequences=1,2,3", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err
@ -303,7 +310,7 @@ An unrelayed packet corresponds to:
} }
// GetCmdQueryNextSequenceReceive defines the command to query a next receive sequence for a given channel // GetCmdQueryNextSequenceReceive defines the command to query a next receive sequence for a given channel
func GetCmdQueryNextSequenceReceive(clientCtx client.Context) *cobra.Command { func GetCmdQueryNextSequenceReceive() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "next-sequence-receive [port-id] [channel-id]", Use: "next-sequence-receive [port-id] [channel-id]",
Short: "Query a next receive sequence", Short: "Query a next receive sequence",
@ -313,6 +320,7 @@ func GetCmdQueryNextSequenceReceive(clientCtx client.Context) *cobra.Command {
), ),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
if err != nil { if err != nil {
return err return err

View File

@ -22,8 +22,8 @@ func GetTxCmd() *cobra.Command {
} }
// GetQueryCmd returns the root query command for IBC channels. // GetQueryCmd returns the root query command for IBC channels.
func GetQueryCmd(clientCtx client.Context) *cobra.Command { func GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd(clientCtx) return cli.GetQueryCmd()
} }
// RegisterRESTRoutes registers the REST routes for IBC channels. // RegisterRESTRoutes registers the REST routes for IBC channels.

View File

@ -33,7 +33,7 @@ func GetTxCmd() *cobra.Command {
} }
// GetQueryCmd returns the cli query commands for this module // GetQueryCmd returns the cli query commands for this module
func GetQueryCmd(clientCtx client.Context) *cobra.Command { func GetQueryCmd() *cobra.Command {
// Group ibc queries under a subcommand // Group ibc queries under a subcommand
ibcQueryCmd := &cobra.Command{ ibcQueryCmd := &cobra.Command{
Use: host.ModuleName, Use: host.ModuleName,
@ -44,9 +44,9 @@ func GetQueryCmd(clientCtx client.Context) *cobra.Command {
} }
ibcQueryCmd.AddCommand(flags.GetCommands( ibcQueryCmd.AddCommand(flags.GetCommands(
ibcclient.GetQueryCmd(clientCtx), ibcclient.GetQueryCmd(),
connection.GetQueryCmd(clientCtx), connection.GetQueryCmd(),
channel.GetQueryCmd(clientCtx), channel.GetQueryCmd(),
)...) )...)
return ibcQueryCmd return ibcQueryCmd
} }

View File

@ -74,8 +74,8 @@ func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command {
} }
// GetQueryCmd returns no root query command for the ibc module. // GetQueryCmd returns no root query command for the ibc module.
func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command { func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command {
return cli.GetQueryCmd(clientCtx) return cli.GetQueryCmd()
} }
// RegisterInterfaceTypes registers module concrete types into protobuf Any. // RegisterInterfaceTypes registers module concrete types into protobuf Any.