github.com/Finschia/finschia-sdk@v0.48.1/x/authz/codec.go (about) 1 package authz 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 sdk "github.com/Finschia/finschia-sdk/types" 8 "github.com/Finschia/finschia-sdk/types/msgservice" 9 authzcodec "github.com/Finschia/finschia-sdk/x/authz/codec" 10 fdncodec "github.com/Finschia/finschia-sdk/x/foundation/codec" 11 govcodec "github.com/Finschia/finschia-sdk/x/gov/codec" 12 ) 13 14 // RegisterLegacyAminoCodec registers the necessary x/authz interfaces and concrete types 15 // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. 16 func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { 17 legacy.RegisterAminoMsg(cdc, &MsgGrant{}, "cosmos-sdk/MsgGrant") 18 legacy.RegisterAminoMsg(cdc, &MsgRevoke{}, "cosmos-sdk/MsgRevoke") 19 legacy.RegisterAminoMsg(cdc, &MsgExec{}, "cosmos-sdk/MsgExec") 20 21 cdc.RegisterInterface((*Authorization)(nil), nil) 22 cdc.RegisterConcrete(&GenericAuthorization{}, "cosmos-sdk/GenericAuthorization", nil) 23 } 24 25 // RegisterInterfaces registers the interfaces types with the interface registry 26 func RegisterInterfaces(registry types.InterfaceRegistry) { 27 registry.RegisterImplementations((*sdk.Msg)(nil), 28 &MsgGrant{}, 29 &MsgRevoke{}, 30 &MsgExec{}, 31 ) 32 33 registry.RegisterInterface( 34 "cosmos.v1beta1.Authorization", 35 (*Authorization)(nil), 36 &GenericAuthorization{}, 37 ) 38 39 msgservice.RegisterMsgServiceDesc(registry, MsgServiceDesc()) 40 } 41 func init() { 42 // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be 43 // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances 44 RegisterLegacyAminoCodec(authzcodec.Amino) 45 RegisterLegacyAminoCodec(govcodec.Amino) 46 RegisterLegacyAminoCodec(fdncodec.Amino) 47 }