forked from cerc-io/laconicd-deprecated
unpack interface
This commit is contained in:
parent
75bcf1f5a5
commit
82b2c32575
@ -11,6 +11,8 @@ import (
|
|||||||
// RegisterLegacyAminoCodec registers the necessary x/bond interfaces and concrete types
|
// RegisterLegacyAminoCodec registers the necessary x/bond interfaces and concrete types
|
||||||
// on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
|
// on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
|
||||||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||||
|
// legacy.RegisterAminoMsg(cdc, &MsgSetRecord{}, "registry/SetRecord")
|
||||||
|
|
||||||
cdc.RegisterConcrete(&MsgSetName{}, "registry/SetName", nil)
|
cdc.RegisterConcrete(&MsgSetName{}, "registry/SetName", nil)
|
||||||
cdc.RegisterConcrete(&MsgReserveAuthority{}, "registry/ReserveAuthority", nil)
|
cdc.RegisterConcrete(&MsgReserveAuthority{}, "registry/ReserveAuthority", nil)
|
||||||
cdc.RegisterConcrete(&MsgDeleteNameAuthority{}, "registry/DeleteAuthority", nil)
|
cdc.RegisterConcrete(&MsgDeleteNameAuthority{}, "registry/DeleteAuthority", nil)
|
||||||
@ -22,6 +24,10 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
|||||||
cdc.RegisterConcrete(&MsgDissociateBond{}, "registry/DissociateBond", nil)
|
cdc.RegisterConcrete(&MsgDissociateBond{}, "registry/DissociateBond", nil)
|
||||||
cdc.RegisterConcrete(&MsgDissociateRecords{}, "registry/DissociateRecords", nil)
|
cdc.RegisterConcrete(&MsgDissociateRecords{}, "registry/DissociateRecords", nil)
|
||||||
cdc.RegisterConcrete(&MsgReAssociateRecords{}, "registry/ReassociateRecords", nil)
|
cdc.RegisterConcrete(&MsgReAssociateRecords{}, "registry/ReassociateRecords", nil)
|
||||||
|
|
||||||
|
cdc.RegisterInterface((*Attributes)(nil), nil)
|
||||||
|
cdc.RegisterConcrete(&WebsiteRegistrationRecord{}, "registry/WebsiteRegistrationRecord", nil)
|
||||||
|
cdc.RegisterConcrete(&ServiceProviderRegistration{}, "registry/ServiceProviderRegistration", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterInterfaces(registry types.InterfaceRegistry) {
|
func RegisterInterfaces(registry types.InterfaceRegistry) {
|
||||||
|
@ -3,6 +3,9 @@ package types
|
|||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
|
|
||||||
|
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -12,6 +15,11 @@ var (
|
|||||||
_ sdk.Msg = &MsgDissociateBond{}
|
_ sdk.Msg = &MsgDissociateBond{}
|
||||||
_ sdk.Msg = &MsgDissociateRecords{}
|
_ sdk.Msg = &MsgDissociateRecords{}
|
||||||
_ sdk.Msg = &MsgReAssociateRecords{}
|
_ sdk.Msg = &MsgReAssociateRecords{}
|
||||||
|
|
||||||
|
// // For amino support.
|
||||||
|
_ legacytx.LegacyMsg = &MsgSetRecord{}
|
||||||
|
|
||||||
|
_ cdctypes.UnpackInterfacesMessage = &MsgSetRecord{}
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewMsgSetRecord is the constructor function for MsgSetRecord.
|
// NewMsgSetRecord is the constructor function for MsgSetRecord.
|
||||||
@ -57,6 +65,31 @@ func (msg MsgSetRecord) GetSignBytes() []byte {
|
|||||||
return sdk.MustSortJSON(bz)
|
return sdk.MustSortJSON(bz)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
|
||||||
|
func (msg MsgSetRecord) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error {
|
||||||
|
x := msg.Payload.Record.Attributes
|
||||||
|
switch x.TypeUrl {
|
||||||
|
case "/vulcanize.registry.v1beta1.WebsiteRegistrationRecord":
|
||||||
|
{
|
||||||
|
var attr WebsiteRegistrationRecord
|
||||||
|
err := unpacker.UnpackAny(x, &attr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "/vulcanize.registry.v1beta1.ServiceProviderRegistration":
|
||||||
|
{
|
||||||
|
var attr ServiceProviderRegistration
|
||||||
|
err := unpacker.UnpackAny(x, &attr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// NewMsgRenewRecord is the constructor function for MsgRenewRecord.
|
// NewMsgRenewRecord is the constructor function for MsgRenewRecord.
|
||||||
func NewMsgRenewRecord(recordID string, signer sdk.AccAddress) MsgRenewRecord {
|
func NewMsgRenewRecord(recordID string, signer sdk.AccAddress) MsgRenewRecord {
|
||||||
return MsgRenewRecord{
|
return MsgRenewRecord{
|
||||||
|
Loading…
Reference in New Issue
Block a user