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
+8 -8
View File
@@ -19,7 +19,7 @@ import (
tmos "github.com/tendermint/tendermint/libs/os"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
@@ -36,7 +36,7 @@ import (
type StakingMsgBuildingHelpers interface {
CreateValidatorMsgHelpers(ipDefault string) (fs *flag.FlagSet, nodeIDFlag, pubkeyFlag, amountFlag, defaultsDesc string)
PrepareFlagsForTxCreateValidator(config *cfg.Config, nodeID, chainID string, valPubKey crypto.PubKey)
BuildCreateValidatorMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error)
BuildCreateValidatorMsg(clientCtx client.Context, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error)
}
// GenTxCmd builds the application's gentx command.
@@ -121,7 +121,7 @@ func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager, sm
}
txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(authclient.GetTxEncoder(cdc))
cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc)
clientCtx := client.NewContextWithInput(inBuf).WithCodec(cdc)
// Set the generate-only flag here after the CLI context has
// been created. This allows the from name/key to be correctly populated.
@@ -131,21 +131,21 @@ func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager, sm
viper.Set(flags.FlagGenerateOnly, true)
// create a 'create-validator' message
txBldr, msg, err := smbh.BuildCreateValidatorMsg(cliCtx, txBldr)
txBldr, msg, err := smbh.BuildCreateValidatorMsg(clientCtx, txBldr)
if err != nil {
return errors.Wrap(err, "failed to build create-validator message")
}
if key.GetType() == keyring.TypeOffline || key.GetType() == keyring.TypeMulti {
cmd.PrintErrln("Offline key passed in. Use `tx sign` command to sign.")
return authclient.PrintUnsignedStdTx(txBldr, cliCtx, []sdk.Msg{msg})
return authclient.PrintUnsignedStdTx(txBldr, clientCtx, []sdk.Msg{msg})
}
// write the unsigned transaction to the buffer
w := bytes.NewBuffer([]byte{})
cliCtx = cliCtx.WithOutput(w)
clientCtx = clientCtx.WithOutput(w)
if err = authclient.PrintUnsignedStdTx(txBldr, cliCtx, []sdk.Msg{msg}); err != nil {
if err = authclient.PrintUnsignedStdTx(txBldr, clientCtx, []sdk.Msg{msg}); err != nil {
return errors.Wrap(err, "failed to print unsigned std tx")
}
@@ -156,7 +156,7 @@ func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager, sm
}
// sign the transaction and write it to the output file
signedTx, err := authclient.SignStdTx(txBldr, cliCtx, name, stdTx, false, true)
signedTx, err := authclient.SignStdTx(txBldr, clientCtx, name, stdTx, false, true)
if err != nil {
return errors.Wrap(err, "failed to sign std tx")
}