2019-06-05 16:26:17 -07:00
|
|
|
package types
|
2018-09-13 11:17:32 -07:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2020-05-20 12:21:00 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec/types"
|
2020-06-04 03:38:24 -07:00
|
|
|
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
2021-07-05 07:55:51 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
|
2018-09-13 11:17:32 -07:00
|
|
|
)
|
|
|
|
|
2020-09-07 07:47:12 -07:00
|
|
|
// RegisterLegacyAminoCodec registers the account interfaces and concrete types on the
|
|
|
|
// provided LegacyAmino codec. These types are used for Amino JSON serialization
|
|
|
|
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
2020-05-20 12:21:00 -07:00
|
|
|
cdc.RegisterInterface((*ModuleAccountI)(nil), nil)
|
|
|
|
cdc.RegisterInterface((*GenesisAccount)(nil), nil)
|
|
|
|
cdc.RegisterInterface((*AccountI)(nil), nil)
|
|
|
|
cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount", nil)
|
2020-04-20 12:32:10 -07:00
|
|
|
cdc.RegisterConcrete(&ModuleAccount{}, "cosmos-sdk/ModuleAccount", nil)
|
2020-09-22 07:35:18 -07:00
|
|
|
|
|
|
|
legacytx.RegisterLegacyAminoCodec(cdc)
|
2019-02-08 13:35:19 -08:00
|
|
|
}
|
|
|
|
|
2020-10-06 09:07:37 -07:00
|
|
|
// RegisterInterfaces associates protoName with AccountI interface
|
2020-05-20 12:21:00 -07:00
|
|
|
// and creates a registry of it's concrete implementations
|
|
|
|
func RegisterInterfaces(registry types.InterfaceRegistry) {
|
|
|
|
registry.RegisterInterface(
|
2020-08-11 04:49:45 -07:00
|
|
|
"cosmos.auth.v1beta1.AccountI",
|
2020-05-20 12:21:00 -07:00
|
|
|
(*AccountI)(nil),
|
|
|
|
&BaseAccount{},
|
|
|
|
&ModuleAccount{},
|
|
|
|
)
|
2020-08-11 07:22:30 -07:00
|
|
|
|
|
|
|
registry.RegisterInterface(
|
2020-10-15 06:07:59 -07:00
|
|
|
"cosmos.auth.v1beta1.GenesisAccount",
|
2020-08-11 07:22:30 -07:00
|
|
|
(*GenesisAccount)(nil),
|
|
|
|
&BaseAccount{},
|
|
|
|
&ModuleAccount{},
|
|
|
|
)
|
2020-05-20 12:21:00 -07:00
|
|
|
}
|
|
|
|
|
2020-02-18 04:50:13 -08:00
|
|
|
var (
|
2020-09-22 07:35:18 -07:00
|
|
|
amino = codec.NewLegacyAmino()
|
2020-08-11 07:22:30 -07:00
|
|
|
ModuleCdc = codec.NewAminoCodec(amino)
|
2020-02-18 04:50:13 -08:00
|
|
|
)
|
2018-09-13 11:17:32 -07:00
|
|
|
|
|
|
|
func init() {
|
2020-09-07 07:47:12 -07:00
|
|
|
RegisterLegacyAminoCodec(amino)
|
2020-06-04 03:38:24 -07:00
|
|
|
cryptocodec.RegisterCrypto(amino)
|
2018-09-13 11:17:32 -07:00
|
|
|
}
|