github.com/cosmos/cosmos-sdk@v0.50.10/x/auth/vesting/types/codec.go (about)

     1  package types
     2  
     3  import (
     4  	"github.com/cosmos/cosmos-sdk/codec"
     5  	"github.com/cosmos/cosmos-sdk/codec/legacy"
     6  	"github.com/cosmos/cosmos-sdk/codec/types"
     7  	sdk "github.com/cosmos/cosmos-sdk/types"
     8  	"github.com/cosmos/cosmos-sdk/types/msgservice"
     9  	authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
    10  	"github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
    11  )
    12  
    13  // RegisterLegacyAminoCodec registers the vesting interfaces and concrete types on the
    14  // provided LegacyAmino codec. These types are used for Amino JSON serialization
    15  func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
    16  	cdc.RegisterInterface((*exported.VestingAccount)(nil), nil)
    17  	cdc.RegisterConcrete(&BaseVestingAccount{}, "cosmos-sdk/BaseVestingAccount", nil)
    18  	cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount", nil)
    19  	cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount", nil)
    20  	cdc.RegisterConcrete(&PeriodicVestingAccount{}, "cosmos-sdk/PeriodicVestingAccount", nil)
    21  	cdc.RegisterConcrete(&PermanentLockedAccount{}, "cosmos-sdk/PermanentLockedAccount", nil)
    22  	legacy.RegisterAminoMsg(cdc, &MsgCreateVestingAccount{}, "cosmos-sdk/MsgCreateVestingAccount")
    23  	legacy.RegisterAminoMsg(cdc, &MsgCreatePermanentLockedAccount{}, "cosmos-sdk/MsgCreatePermLockedAccount")
    24  	legacy.RegisterAminoMsg(cdc, &MsgCreatePeriodicVestingAccount{}, "cosmos-sdk/MsgCreatePeriodVestAccount")
    25  }
    26  
    27  // RegisterInterface associates protoName with AccountI and VestingAccount
    28  // Interfaces and creates a registry of it's concrete implementations
    29  func RegisterInterfaces(registry types.InterfaceRegistry) {
    30  	registry.RegisterInterface(
    31  		"cosmos.vesting.v1beta1.VestingAccount",
    32  		(*exported.VestingAccount)(nil),
    33  		&ContinuousVestingAccount{},
    34  		&DelayedVestingAccount{},
    35  		&PeriodicVestingAccount{},
    36  		&PermanentLockedAccount{},
    37  	)
    38  
    39  	registry.RegisterImplementations(
    40  		(*sdk.AccountI)(nil),
    41  		&BaseVestingAccount{},
    42  		&DelayedVestingAccount{},
    43  		&ContinuousVestingAccount{},
    44  		&PeriodicVestingAccount{},
    45  		&PermanentLockedAccount{},
    46  	)
    47  
    48  	registry.RegisterImplementations(
    49  		(*authtypes.GenesisAccount)(nil),
    50  		&BaseVestingAccount{},
    51  		&DelayedVestingAccount{},
    52  		&ContinuousVestingAccount{},
    53  		&PeriodicVestingAccount{},
    54  		&PermanentLockedAccount{},
    55  	)
    56  
    57  	registry.RegisterImplementations(
    58  		(*sdk.Msg)(nil),
    59  		&MsgCreateVestingAccount{},
    60  		&MsgCreatePermanentLockedAccount{},
    61  	)
    62  
    63  	msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
    64  }