package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" ) // RegisterCodec registers the account interfaces and concrete types on the // provided Amino codec. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*ModuleAccountI)(nil), nil) cdc.RegisterInterface((*GenesisAccount)(nil), nil) cdc.RegisterInterface((*AccountI)(nil), nil) cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount", nil) cdc.RegisterConcrete(&ModuleAccount{}, "cosmos-sdk/ModuleAccount", nil) cdc.RegisterConcrete(StdTx{}, "cosmos-sdk/StdTx", nil) } // RegisterInterface associates protoName with AccountI interface // and creates a registry of it's concrete implementations func RegisterInterfaces(registry types.InterfaceRegistry) { registry.RegisterInterface( "cosmos_sdk.auth.v1.AccountI", (*AccountI)(nil), &BaseAccount{}, &ModuleAccount{}, ) } // 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.New() ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry()) ) func init() { RegisterCodec(amino) cryptocodec.RegisterCrypto(amino) }