github.com/Finschia/finschia-sdk@v0.49.1/x/auth/vesting/types/codec.go (about) 1 package types 2 3 import ( 4 "github.com/Finschia/finschia-sdk/codec" 5 "github.com/Finschia/finschia-sdk/codec/legacy" 6 "github.com/Finschia/finschia-sdk/codec/types" 7 cryptocodec "github.com/Finschia/finschia-sdk/crypto/codec" 8 sdk "github.com/Finschia/finschia-sdk/types" 9 "github.com/Finschia/finschia-sdk/types/msgservice" 10 authtypes "github.com/Finschia/finschia-sdk/x/auth/types" 11 "github.com/Finschia/finschia-sdk/x/auth/vesting/exported" 12 authzcodec "github.com/Finschia/finschia-sdk/x/authz/codec" 13 fdncodec "github.com/Finschia/finschia-sdk/x/foundation/codec" 14 govcodec "github.com/Finschia/finschia-sdk/x/gov/codec" 15 ) 16 17 // RegisterLegacyAminoCodec registers the vesting interfaces and concrete types on the 18 // provided LegacyAmino codec. These types are used for Amino JSON serialization 19 func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { 20 cdc.RegisterInterface((*exported.VestingAccount)(nil), nil) 21 cdc.RegisterConcrete(&BaseVestingAccount{}, "cosmos-sdk/BaseVestingAccount", nil) 22 cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount", nil) 23 cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount", nil) 24 cdc.RegisterConcrete(&PeriodicVestingAccount{}, "cosmos-sdk/PeriodicVestingAccount", nil) 25 cdc.RegisterConcrete(&PermanentLockedAccount{}, "cosmos-sdk/PermanentLockedAccount", nil) 26 legacy.RegisterAminoMsg(cdc, &MsgCreateVestingAccount{}, "cosmos-sdk/MsgCreateVestingAccount") 27 } 28 29 // RegisterInterface associates protoName with AccountI and VestingAccount 30 // Interfaces and creates a registry of it's concrete implementations 31 func RegisterInterfaces(registry types.InterfaceRegistry) { 32 registry.RegisterInterface( 33 "cosmos.vesting.v1beta1.VestingAccount", 34 (*exported.VestingAccount)(nil), 35 &ContinuousVestingAccount{}, 36 &DelayedVestingAccount{}, 37 &PeriodicVestingAccount{}, 38 &PermanentLockedAccount{}, 39 ) 40 41 registry.RegisterImplementations( 42 (*authtypes.AccountI)(nil), 43 &BaseVestingAccount{}, 44 &DelayedVestingAccount{}, 45 &ContinuousVestingAccount{}, 46 &PeriodicVestingAccount{}, 47 &PermanentLockedAccount{}, 48 ) 49 50 registry.RegisterImplementations( 51 (*authtypes.GenesisAccount)(nil), 52 &BaseVestingAccount{}, 53 &DelayedVestingAccount{}, 54 &ContinuousVestingAccount{}, 55 &PeriodicVestingAccount{}, 56 &PermanentLockedAccount{}, 57 ) 58 59 registry.RegisterImplementations( 60 (*sdk.Msg)(nil), 61 &MsgCreateVestingAccount{}, 62 ) 63 64 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) 65 } 66 67 var ( 68 amino = codec.NewLegacyAmino() 69 ModuleCdc = codec.NewAminoCodec(amino) 70 ) 71 72 func init() { 73 RegisterLegacyAminoCodec(amino) 74 cryptocodec.RegisterCrypto(amino) 75 sdk.RegisterLegacyAminoCodec(amino) 76 77 // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be 78 // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances 79 RegisterLegacyAminoCodec(authzcodec.Amino) 80 RegisterLegacyAminoCodec(govcodec.Amino) 81 RegisterLegacyAminoCodec(fdncodec.Amino) 82 }