Skip to content

Commit

Permalink
legacytx: move RegisterLegacyAminoCodec from init to tests/init
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Sep 15, 2020
1 parent 5738792 commit 3352c56
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
5 changes: 2 additions & 3 deletions x/auth/legacy/legacytx/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
)

func init() {
var amino = codec.NewLegacyAmino()
amino.RegisterConcrete(StdTx{}, "cosmos-sdk/StdTx", nil)
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(StdTx{}, "cosmos-sdk/StdTx", nil)
}
5 changes: 5 additions & 0 deletions x/auth/legacy/legacytx/stdtx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ var (
addr = sdk.AccAddress(priv.PubKey().Address())
)

func init() {
var amino = codec.NewLegacyAmino()
RegisterLegacyAminoCodec(amino)
}

// Deprecated, use fee amount and gas limit separately on TxBuilder.
func NewTestStdFee() StdFee {
return NewStdFee(100000,
Expand Down
8 changes: 2 additions & 6 deletions x/auth/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount", nil)
cdc.RegisterConcrete(&ModuleAccount{}, "cosmos-sdk/ModuleAccount", nil)
cdc.RegisterConcrete(legacytx.StdTx{}, "cosmos-sdk/StdTx", nil)

legacytx.RegisterLegacyAminoCodec(cdc)
}

// RegisterInterface associates protoName with AccountI interface
Expand All @@ -36,12 +38,6 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
)
}

// RegisterKeyTypeCodec registers an external concrete type defined in
// another module for the internal ModuleCdc.
func RegisterKeyTypeCodec(o interface{}, name string) {
amino.RegisterConcrete(o, name, nil)
}

var (
amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewAminoCodec(amino)
Expand Down

0 comments on commit 3352c56

Please sign in to comment.