diff --git a/types/codec.go b/types/codec.go index 4c4823e..68e9657 100644 --- a/types/codec.go +++ b/types/codec.go @@ -16,6 +16,9 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgTransferONFT{}, "OmniFlix/onft/MsgTransferONFT", nil) cdc.RegisterConcrete(&MsgMintONFT{}, "OmniFlix/onft/MsgMintONFT", nil) cdc.RegisterConcrete(&MsgBurnONFT{}, "OmniFlix/onft/MsgBurnONFT", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "OmniFlix/onft/MsgUpdateParams", nil) + + cdc.RegisterConcrete(&Params{}, "OmniFlix/onft/Params", nil) cdc.RegisterInterface((*exported.ONFTI)(nil), nil) } @@ -29,6 +32,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgTransferONFT{}, &MsgMintONFT{}, &MsgBurnONFT{}, + &MsgUpdateParams{}, ) registry.RegisterInterface( diff --git a/types/msgs.go b/types/msgs.go index 1e526aa..9ebc1c5 100644 --- a/types/msgs.go +++ b/types/msgs.go @@ -20,6 +20,8 @@ const ( ) var ( + _ sdk.Msg = &MsgUpdateParams{} + _ sdk.Msg = &MsgCreateDenom{} _ sdk.Msg = &MsgUpdateDenom{} _ sdk.Msg = &MsgTransferDenom{} @@ -320,3 +322,25 @@ func (msg MsgBurnONFT) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{from} } + +// MsgUpdateParams + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + return m.Params.ValidateBasic() +}