client: rename CliContext to Context (#6290)

* Refactor CliContext as Context

* Fix lint issues

* Fix goimports

* Fix gov tests

* Resolved ci-lint issues

* Add changelog

* Rename cliCtx to clientCtx

* Fix mocks and routes

* Add changelog

* Update changelog

* Apply suggestions from code review

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* merge client/rpc/ro{ot,utes}.go

* Update docs

* client/rpc: remove redundant client/rpc.RegisterRPCRoutes

* regenerate mocks

* Update ADRs

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
SaReN
2020-06-01 12:46:03 +00:00
committed by GitHub
co-authored by Alessio Treglia Federico Kunze mergify[bot]
parent 654b2fdd10
commit 39f53ac22f
158 changed files with 1810 additions and 1830 deletions
+3 -4
View File
@@ -6,7 +6,6 @@ import (
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/params/types"
@@ -35,7 +34,7 @@ func NewQuerySubspaceParamsCmd(m codec.JSONMarshaler) *cobra.Command {
Short: "Query for raw parameters by subspace and key",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx := context.NewCLIContext().WithJSONMarshaler(m)
clientCtx := client.NewContext().WithJSONMarshaler(m)
params := types.NewQuerySubspaceParams(args[0], args[1])
route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParams)
@@ -45,7 +44,7 @@ func NewQuerySubspaceParamsCmd(m codec.JSONMarshaler) *cobra.Command {
return fmt.Errorf("failed to marshal params: %w", err)
}
bz, _, err = cliCtx.QueryWithData(route, bz)
bz, _, err = clientCtx.QueryWithData(route, bz)
if err != nil {
return err
}
@@ -55,7 +54,7 @@ func NewQuerySubspaceParamsCmd(m codec.JSONMarshaler) *cobra.Command {
return err
}
return cliCtx.PrintOutput(resp)
return clientCtx.PrintOutput(resp)
},
}
+6 -6
View File
@@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
@@ -17,7 +17,7 @@ import (
// NewSubmitParamChangeProposalTxCmd returns a CLI command handler for creating
// a parameter change proposal governance transaction.
func NewSubmitParamChangeProposalTxCmd(ctx context.CLIContext) *cobra.Command {
func NewSubmitParamChangeProposalTxCmd(clientCtx client.Context) *cobra.Command {
cmd := &cobra.Command{
Use: "param-change [proposal-file]",
Args: cobra.ExactArgs(1),
@@ -57,14 +57,14 @@ Where proposal.json contains:
),
),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx := ctx.InitWithInput(cmd.InOrStdin())
clientCtx := clientCtx.InitWithInput(cmd.InOrStdin())
proposal, err := paramscutils.ParseParamChangeProposalJSON(ctx.JSONMarshaler, args[0])
proposal, err := paramscutils.ParseParamChangeProposalJSON(clientCtx.JSONMarshaler, args[0])
if err != nil {
return err
}
from := cliCtx.GetFromAddress()
from := clientCtx.GetFromAddress()
content := paramproposal.NewParameterChangeProposal(
proposal.Title, proposal.Description, proposal.Changes.ToParamChanges(),
)
@@ -82,7 +82,7 @@ Where proposal.json contains:
return err
}
return tx.GenerateOrBroadcastTx(cliCtx, msg)
return tx.GenerateOrBroadcastTx(clientCtx, msg)
},
}