refactor(client): add client/Context.Codec and deprecate JSONCodec (#9498)

* chore(types): add sdk.Context.Codec and deprecate JSONCodec

* Use clientContext.Codec rather than JSONCodec everywhere

* update tests to use clientContext.Codec

* added a note that EncodingConfig.Marshaler will be renamed to Codec

* update changelog

* fix tests to use clientCtx.WithCodec instead of WithJSONCodec

* fix genutil build

* Update simapp/params/encoding.go

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
This commit is contained in:
Robert Zaremba
2021-06-11 11:49:39 +00:00
committed by GitHub
co-authored by Amaury
parent 606bb2f46d
commit 7bca49e2d2
63 changed files with 222 additions and 203 deletions
+1 -1
View File
@@ -135,7 +135,7 @@ func setupApp(t *testing.T, tempDir string) (*simapp.SimApp, context.Context, *t
serverCtx := server.NewDefaultContext()
serverCtx.Config.RootDir = tempDir
clientCtx := client.Context{}.WithJSONCodec(app.AppCodec())
clientCtx := client.Context{}.WithCodec(app.AppCodec())
genDoc := newDefaultGenesisDoc(encCfg.Marshaler)
require.NoError(t, saveGenesisFile(genDoc, serverCtx.Config.GenesisFile()))
+1 -1
View File
@@ -347,7 +347,7 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App
Retries: config.Rosetta.Retries,
Offline: offlineMode,
}
conf.WithCodec(clientCtx.InterfaceRegistry, clientCtx.JSONCodec.(*codec.ProtoCodec))
conf.WithCodec(clientCtx.InterfaceRegistry, clientCtx.Codec.(*codec.ProtoCodec))
rosettaSrv, err = rosetta.ServerFromConfig(conf)
if err != nil {
+1 -1
View File
@@ -55,7 +55,7 @@ func ShowValidatorCmd() *cobra.Command {
return err
}
clientCtx := client.GetClientContextFromCmd(cmd)
bz, err := clientCtx.JSONCodec.MarshalInterfaceJSON(sdkPK)
bz, err := clientCtx.Codec.MarshalInterfaceJSON(sdkPK)
if err != nil {
return err
}