diff --git a/x/bank/client/cli/cli_test.go b/x/bank/client/cli/cli_test.go index d234c5a7ca..74b9de358c 100644 --- a/x/bank/client/cli/cli_test.go +++ b/x/bank/client/cli/cli_test.go @@ -97,7 +97,7 @@ func (s *IntegrationTestSuite) TestGetBalancesCmd() { s.Run(tc.name, func() { buf.Reset() - cmd := cli.GetBalancesCmd(clientCtx) + cmd := cli.GetBalancesCmd() cmd.SetErr(buf) cmd.SetOut(buf) cmd.SetArgs(tc.args) @@ -167,7 +167,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryTotalSupply() { s.Run(tc.name, func() { buf.Reset() - cmd := cli.GetCmdQueryTotalSupply(clientCtx) + cmd := cli.GetCmdQueryTotalSupply() cmd.SetErr(buf) cmd.SetOut(buf) cmd.SetArgs(tc.args) diff --git a/x/bank/client/cli/query.go b/x/bank/client/cli/query.go index 2bcd56d2f9..81a0e6a225 100644 --- a/x/bank/client/cli/query.go +++ b/x/bank/client/cli/query.go @@ -22,7 +22,7 @@ const ( // GetQueryCmd returns the parent command for all x/bank CLi query commands. The // provided clientCtx should have, at a minimum, a verifier, Tendermint RPC client, // and marshaler set. -func GetQueryCmd(clientCtx client.Context) *cobra.Command { +func GetQueryCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, Short: "Querying commands for the bank module", @@ -32,14 +32,14 @@ func GetQueryCmd(clientCtx client.Context) *cobra.Command { } cmd.AddCommand( - GetBalancesCmd(clientCtx), - GetCmdQueryTotalSupply(clientCtx), + GetBalancesCmd(), + GetCmdQueryTotalSupply(), ) return cmd } -func GetBalancesCmd(clientCtx client.Context) *cobra.Command { +func GetBalancesCmd() *cobra.Command { cmd := &cobra.Command{ Use: "balances [address]", Short: "Query for account balances by address", @@ -55,6 +55,7 @@ Example: ), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) if err != nil { return err @@ -97,7 +98,7 @@ Example: return flags.GetCommands(cmd)[0] } -func GetCmdQueryTotalSupply(clientCtx client.Context) *cobra.Command { +func GetCmdQueryTotalSupply() *cobra.Command { cmd := &cobra.Command{ Use: "total", Short: "Query the total supply of coins of the chain", @@ -114,6 +115,7 @@ To query for the total supply of a specific coin denomination use: ), ), RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags()) if err != nil { return err diff --git a/x/bank/module.go b/x/bank/module.go index 5381cadcd4..ed2081ecf9 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -69,8 +69,8 @@ func (AppModuleBasic) GetTxCmd(_ client.Context) *cobra.Command { } // GetQueryCmd returns no root query command for the bank module. -func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command { - return cli.GetQueryCmd(clientCtx) +func (AppModuleBasic) GetQueryCmd(_ client.Context) *cobra.Command { + return cli.GetQueryCmd() } // RegisterInterfaceTypes registers interfaces and implementations of the bank module.