func (msg MsgRegisterReaction) GetSigners() []sdk.AccAddress {
	addr, _ := sdk.AccAddressFromBech32(msg.Creator)
	return []sdk.AccAddress{addr}
}
GetSigners defines whose signature is required
package types
import (
	"encoding/json"
	"strings"
	subspacestypes "github.com/desmos-labs/desmos/v2/x/staging/subspaces/types"
	emoji "github.com/desmos-labs/Go-Emoji-Utils"
	commonerrors "github.com/desmos-labs/desmos/v2/x/commons/types/errors"
	sdk "github.com/cosmos/cosmos-sdk/types"
	sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
	"github.com/desmos-labs/desmos/v2/x/commons"
)
func NewMsgCreatePost(
	message string, parentID string, commentsState CommentsState, subspace string,
	additionalAttributes []Attribute, owner string, attachments Attachments, poll *Poll,
) *MsgCreatePost {
	return &MsgCreatePost{
		Message:              message,
		ParentID:             parentID,
		CommentsState:        commentsState,
		Subspace:             subspace,
		AdditionalAttributes: additionalAttributes,
		Creator:              owner,
		Attachments:          attachments,
		Poll:                 poll,
	}
}
func (msg MsgCreatePost) Route() string { return RouterKey }
func (msg MsgCreatePost) Type() string { return ActionCreatePost }
func (msg MsgCreatePost) ValidateBasic() error {
	_, err := sdk.AccAddressFromBech32(msg.Creator)
	if err != nil {
		return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator")
	}
	if msg.ParentID != "" && !IsValidPostID(msg.ParentID) {
		return sdkerrors.Wrap(ErrInvalidPostID, msg.ParentID)
	}
	if len(strings.TrimSpace(msg.Message)) == 0 && len(msg.Attachments) == 0 && msg.Poll == nil {
		return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest,
			"post message, attachments or poll are required and cannot be all blank or empty")
	}
	if !subspacestypes.IsValidSubspace(msg.Subspace) {
		return sdkerrors.Wrap(ErrInvalidSubspace, "post subspace must be a valid sha-256 hash")
	}
	for _, attachment := range msg.Attachments {
		err := attachment.Validate()
		if err != nil {
			return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
		}
	}
	if msg.Poll != nil {
		if err := msg.Poll.Validate(); err != nil {
			return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
		}
	}
	return nil
}
func (msg MsgCreatePost) GetSignBytes() []byte {
	return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
func (msg MsgCreatePost) GetSigners() []sdk.AccAddress {
	addr, _ := sdk.AccAddressFromBech32(msg.Creator)
	return []sdk.AccAddress{addr}
}
func (msg MsgCreatePost) MarshalJSON() ([]byte, error) {
	type temp MsgCreatePost
	return json.Marshal(temp(msg))
}
func NewMsgEditPost(
	postID string, message string, commentsState CommentsState, attachments Attachments, poll *Poll, owner string,
) *MsgEditPost {
	return &MsgEditPost{
		PostID:        postID,
		Message:       message,
		CommentsState: commentsState,
		Attachments:   attachments,
		Poll:          poll,
		Editor:        owner,
	}
}
func (msg MsgEditPost) Route() string { return RouterKey }
func (msg MsgEditPost) Type() string { return ActionEditPost }
func (msg MsgEditPost) ValidateBasic() error {
	if !IsValidPostID(msg.PostID) {
		return sdkerrors.Wrap(ErrInvalidPostID, msg.PostID)
	}
	_, err := sdk.AccAddressFromBech32(msg.Editor)
	if err != nil {
		return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid editor")
	}
	if len(strings.TrimSpace(msg.Message)) == 0 && len(msg.Attachments) == 0 && msg.Poll == nil {
		return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest,
			"post message, attachments or poll are required and cannot be all blank or empty")
	}
	for _, attachment := range msg.Attachments {
		err := attachment.Validate()
		if err != nil {
			return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
		}
	}
	if msg.Poll != nil {
		err := msg.Poll.Validate()
		if err != nil {
			return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
		}
	}
	return nil
}
func (msg MsgEditPost) GetSignBytes() []byte {
	return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
func (msg MsgEditPost) GetSigners() []sdk.AccAddress {
	addr, _ := sdk.AccAddressFromBech32(msg.Editor)
	return []sdk.AccAddress{addr}
}
func NewMsgReportPost(id string, reportType, message string, user string) *MsgReportPost {
	return &MsgReportPost{
		PostID:     id,
		ReportType: reportType,
		Message:    message,
		User:       user,
	}
}
func (msg MsgReportPost) Route() string { return RouterKey }
func (msg MsgReportPost) Type() string { return ActionReportPost }
func (msg MsgReportPost) ValidateBasic() error {
	if !IsValidPostID(msg.PostID) {
		return sdkerrors.Wrapf(ErrInvalidPostID, msg.PostID)
	}
	if strings.TrimSpace(msg.ReportType) == "" {
		return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "report type cannot be empty")
	}
	if strings.TrimSpace(msg.Message) == "" {
		return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "report message cannot be empty")
	}
	_, err := sdk.AccAddressFromBech32(msg.User)
	if err != nil {
		return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid report creator: %s", msg.User)
	}
	return nil
}
func (msg MsgReportPost) GetSignBytes() []byte {
	return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
func (msg MsgReportPost) GetSigners() []sdk.AccAddress {
	addr, _ := sdk.AccAddressFromBech32(msg.User)
	return []sdk.AccAddress{addr}
}
func NewMsgAddPostReaction(postID string, value string, user string) *MsgAddPostReaction {
	return &MsgAddPostReaction{
		PostID:   postID,
		User:     user,
		Reaction: value,
	}
}
func (msg MsgAddPostReaction) Route() string { return RouterKey }
func (msg MsgAddPostReaction) Type() string { return ActionAddPostReaction }
func (msg MsgAddPostReaction) ValidateBasic() error {
	if !IsValidPostID(msg.PostID) {
		return sdkerrors.Wrap(ErrInvalidPostID, msg.PostID)
	}
	_, err := sdk.AccAddressFromBech32(msg.User)
	if err != nil {
		return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid user")
	}
	_, err = emoji.LookupEmoji(msg.Reaction)
	if !IsValidReactionCode(msg.Reaction) && err != nil {
		return sdkerrors.Wrap(ErrInvalidReactionCode, msg.Reaction)
	}
	return nil
}
func (msg MsgAddPostReaction) GetSignBytes() []byte {
	return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
func (msg MsgAddPostReaction) GetSigners() []sdk.AccAddress {
	addr, _ := sdk.AccAddressFromBech32(msg.User)
	return []sdk.AccAddress{addr}
}
func NewMsgRemovePostReaction(postID string, user string, value string) *MsgRemovePostReaction {
	return &MsgRemovePostReaction{
		PostID:   postID,
		User:     user,
		Reaction: value,
	}
}
func (msg MsgRemovePostReaction) Route() string { return RouterKey }
func (msg MsgRemovePostReaction) Type() string { return ActionRemovePostReaction }
func (msg MsgRemovePostReaction) ValidateBasic() error {
	if !IsValidPostID(msg.PostID) {
		return sdkerrors.Wrap(ErrInvalidPostID, msg.PostID)
	}
	_, err := sdk.AccAddressFromBech32(msg.User)
	if err != nil {
		return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid user")
	}
	_, err = emoji.LookupEmoji(msg.Reaction)
	if !IsValidReactionCode(msg.Reaction) && err != nil {
		return sdkerrors.Wrap(ErrInvalidReactionCode, msg.Reaction)
	}
	return nil
}
func (msg MsgRemovePostReaction) GetSignBytes() []byte {
	return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
func (msg MsgRemovePostReaction) GetSigners() []sdk.AccAddress {
	addr, _ := sdk.AccAddressFromBech32(msg.User)
	return []sdk.AccAddress{addr}
}
func NewMsgAnswerPoll(id string, providedAnswers []string, answerer string) *MsgAnswerPoll {
	return &MsgAnswerPoll{
		PostID:   id,
		Answers:  providedAnswers,
		Answerer: answerer,
	}
}
func (msg MsgAnswerPoll) Route() string { return RouterKey }
func (msg MsgAnswerPoll) Type() string { return ActionAnswerPoll }
func (msg MsgAnswerPoll) ValidateBasic() error {
	if !IsValidPostID(msg.PostID) {
		return sdkerrors.Wrap(ErrInvalidPostID, msg.PostID)
	}
	_, err := sdk.AccAddressFromBech32(msg.Answerer)
	if err != nil {
		return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid answerer")
	}
	if len(msg.Answers) == 0 {
		return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "provided answer must contains at least one answer")
	}
	for _, answer := range msg.Answers {
		if strings.TrimSpace(answer) == "" {
			return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid answer")
		}
	}
	return nil
}
func (msg MsgAnswerPoll) GetSignBytes() []byte {
	return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
func (msg MsgAnswerPoll) GetSigners() []sdk.AccAddress {
	addr, _ := sdk.AccAddressFromBech32(msg.Answerer)
	return []sdk.AccAddress{addr}
}
func NewMsgRegisterReaction(creator string, shortCode, value, subspace string) *MsgRegisterReaction {
	return &MsgRegisterReaction{
		ShortCode: shortCode,
		Value:     value,
		Subspace:  subspace,
		Creator:   creator,
	}
}
func (msg MsgRegisterReaction) Route() string { return RouterKey }
func (msg MsgRegisterReaction) Type() string { return ActionRegisterReaction }
func (msg MsgRegisterReaction) ValidateBasic() error {
	_, err := sdk.AccAddressFromBech32(msg.Creator)
	if err != nil {
		return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid creator")
	}
	if !IsValidReactionCode(msg.ShortCode) {
		return sdkerrors.Wrap(ErrInvalidReactionCode, msg.ShortCode)
	}
	if !commons.IsURIValid(msg.Value) {
		return sdkerrors.Wrap(commonerrors.ErrInvalidURI, "reaction value should be a valid uri")
	}
	if !subspacestypes.IsValidSubspace(msg.Subspace) {
		return sdkerrors.Wrap(ErrInvalidSubspace, "reaction subspace must be a valid sha-256 hash")
	}
	return nil
}
func (msg MsgRegisterReaction) GetSignBytes() []byte {
	return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}