func (msg MsgAddPostReaction) GetSignBytes() []byte {
	return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
GetSignBytes encodes the message for signing
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
}