github.com/InjectiveLabs/sdk-go@v1.53.0/chain/wasmx/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 authzcdc "github.com/cosmos/cosmos-sdk/x/authz/codec" 10 govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" 11 ) 12 13 // RegisterLegacyAminoCodec registers the necessary x/wasmx interfaces and concrete types 14 // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. 15 func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { 16 cdc.RegisterConcrete(&MsgUpdateContract{}, "wasmx/MsgUpdateContract", nil) 17 cdc.RegisterConcrete(&MsgActivateContract{}, "wasmx/MsgActivateContract", nil) 18 cdc.RegisterConcrete(&MsgDeactivateContract{}, "wasmx/MsgDeactivateContract", nil) 19 cdc.RegisterConcrete(&MsgExecuteContractCompat{}, "wasmx/MsgExecuteContractCompat", nil) 20 cdc.RegisterConcrete(&MsgUpdateParams{}, "wasmx/MsgUpdateParams", nil) 21 22 cdc.RegisterConcrete(&ContractRegistrationRequestProposal{}, "wasmx/ContractRegistrationRequestProposal", nil) 23 cdc.RegisterConcrete(&BatchContractRegistrationRequestProposal{}, "wasmx/BatchContractRegistrationRequestProposal", nil) 24 cdc.RegisterConcrete(&BatchContractDeregistrationProposal{}, "wasmx/BatchContractDeregistrationProposal", nil) 25 cdc.RegisterConcrete(&BatchStoreCodeProposal{}, "wasmx/BatchStoreCodeProposal", nil) 26 27 cdc.RegisterConcrete(&Params{}, "wasmx/Params", nil) 28 29 } 30 31 func RegisterInterfaces(registry types.InterfaceRegistry) { 32 registry.RegisterImplementations( 33 (*govtypes.Content)(nil), 34 &ContractRegistrationRequestProposal{}, 35 &BatchContractRegistrationRequestProposal{}, 36 &BatchContractDeregistrationProposal{}, 37 &BatchStoreCodeProposal{}, 38 ) 39 40 registry.RegisterImplementations((*sdk.Msg)(nil), 41 &MsgUpdateContract{}, 42 &MsgActivateContract{}, 43 &MsgActivateContract{}, 44 &MsgDeactivateContract{}, 45 &MsgUpdateParams{}, 46 ) 47 48 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) 49 } 50 51 var ( 52 // ModuleCdc references the global x/wasmx module codec. Note, the codec should 53 // ONLY be used in certain instances of tests and for JSON encoding as Amino is 54 // still used for that purpose. 55 // 56 // The actual codec used for serialization should be provided to x/wasmx and 57 // defined at the application level. 58 ModuleCdc = codec.NewLegacyAmino() 59 ) 60 61 func init() { 62 RegisterLegacyAminoCodec(ModuleCdc) 63 cryptocodec.RegisterCrypto(ModuleCdc) 64 ModuleCdc.Seal() 65 66 RegisterLegacyAminoCodec(authzcdc.Amino) 67 68 // TODO: Check 69 // RegisterLegacyAminoCodec(govcdc.Amino) 70 // RegisterLegacyAminoCodec(groupcdc.Amino) 71 }