github.com/Finschia/finschia-sdk@v0.48.1/x/gov/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  	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 all the necessary types and interfaces for the
    15  // governance module.
    16  func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
    17  	cdc.RegisterInterface((*Content)(nil), nil)
    18  	legacy.RegisterAminoMsg(cdc, &MsgSubmitProposal{}, "cosmos-sdk/MsgSubmitProposal")
    19  	legacy.RegisterAminoMsg(cdc, &MsgDeposit{}, "cosmos-sdk/MsgDeposit")
    20  	legacy.RegisterAminoMsg(cdc, &MsgVote{}, "cosmos-sdk/MsgVote")
    21  	legacy.RegisterAminoMsg(cdc, &MsgVoteWeighted{}, "cosmos-sdk/MsgVoteWeighted")
    22  	cdc.RegisterConcrete(&TextProposal{}, "cosmos-sdk/TextProposal", nil)
    23  }
    24  
    25  func RegisterInterfaces(registry types.InterfaceRegistry) {
    26  	registry.RegisterImplementations((*sdk.Msg)(nil),
    27  		&MsgSubmitProposal{},
    28  		&MsgVote{},
    29  		&MsgVoteWeighted{},
    30  		&MsgDeposit{},
    31  	)
    32  	registry.RegisterInterface(
    33  		"cosmos.gov.v1beta1.Content",
    34  		(*Content)(nil),
    35  		&TextProposal{},
    36  	)
    37  
    38  	msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
    39  }
    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  }