github.com/InjectiveLabs/sdk-go@v1.53.0/chain/auction/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  )
    11  
    12  // RegisterLegacyAminoCodec registers the necessary x/auction interfaces and concrete types
    13  // on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
    14  func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
    15  	cdc.RegisterConcrete(&MsgBid{}, "auction/MsgBid", nil)
    16  	cdc.RegisterConcrete(&MsgUpdateParams{}, "auction/MsgUpdateParams", nil)
    17  	cdc.RegisterConcrete(&Params{}, "auction/Params", nil)
    18  }
    19  
    20  func RegisterInterfaces(registry types.InterfaceRegistry) {
    21  	registry.RegisterImplementations((*sdk.Msg)(nil),
    22  		&MsgBid{},
    23  		&MsgUpdateParams{},
    24  	)
    25  
    26  	msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
    27  }
    28  
    29  var (
    30  	// ModuleCdc references the global x/auction module codec. Note, the codec should
    31  	// ONLY be used in certain instances of tests and for JSON encoding as Amino is
    32  	// still used for that purpose.
    33  	//
    34  	// The actual codec used for serialization should be provided to x/auction and
    35  	// defined at the application level.
    36  	ModuleCdc = codec.NewLegacyAmino()
    37  )
    38  
    39  func init() {
    40  	RegisterLegacyAminoCodec(ModuleCdc)
    41  	cryptocodec.RegisterCrypto(ModuleCdc)
    42  
    43  	RegisterLegacyAminoCodec(authzcdc.Amino)
    44  	ModuleCdc.Seal()
    45  }