github.com/gravity-devs/liquidity@v1.5.3/x/liquidity/types/codec.go (about) 1 package types 2 3 import ( 4 "github.com/cosmos/cosmos-sdk/codec" 5 "github.com/cosmos/cosmos-sdk/codec/types" 6 cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" 7 sdk "github.com/cosmos/cosmos-sdk/types" 8 "github.com/cosmos/cosmos-sdk/types/msgservice" 9 ) 10 11 // RegisterLegacyAminoCodec registers concrete types on the codec. 12 func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { 13 cdc.RegisterConcrete(&MsgCreatePool{}, "liquidity/MsgCreatePool", nil) 14 cdc.RegisterConcrete(&MsgDepositWithinBatch{}, "liquidity/MsgDepositWithinBatch", nil) 15 cdc.RegisterConcrete(&MsgWithdrawWithinBatch{}, "liquidity/MsgWithdrawWithinBatch", nil) 16 cdc.RegisterConcrete(&MsgSwapWithinBatch{}, "liquidity/MsgSwapWithinBatch", nil) 17 } 18 19 // RegisterInterfaces registers the x/liquidity interface types with the 20 // interface registry 21 func RegisterInterfaces(registry types.InterfaceRegistry) { 22 registry.RegisterImplementations((*sdk.Msg)(nil), 23 &MsgCreatePool{}, 24 &MsgDepositWithinBatch{}, 25 &MsgWithdrawWithinBatch{}, 26 &MsgSwapWithinBatch{}, 27 ) 28 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) 29 } 30 31 // legacy amino codecs 32 var ( 33 amino = codec.NewLegacyAmino() 34 35 // ModuleCdc references the global x/liquidity module codec. Note, the 36 // codec should ONLY be used in certain instances of tests and for JSON 37 // encoding as Amino is still used for that purpose. 38 // 39 // The actual codec used for serialization should be provided to x/liquidity 40 // and defined at the application level. 41 ModuleCdc = codec.NewAminoCodec(amino) 42 ) 43 44 func init() { 45 RegisterLegacyAminoCodec(amino) 46 cryptocodec.RegisterCrypto(amino) 47 amino.Seal() 48 }