types

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "community"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey to be used for routing msgs
	RouterKey = ModuleName

	// QuerierRoute to be used for querierer msgs
	QuerierRoute = ModuleName

	FlagModeratorAddr = "community-moderator-addr"
)

Variables

View Source
var (
	PostPrefix = []byte{0x00} // prefix for keys that store posts
	LikePrefix = []byte{0x01} // prefix for keys that store likes
)

Key prefixes

View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec for the module

Functions

func IsPreviewImageValid

func IsPreviewImageValid(str string) bool

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec

Types

type Category

type Category uint8
const (
	UndefinedCategory Category = iota
	WorldNewsCategory
	TravelAndTourismCategory
	ScienceAndTechnologyCategory
	StrangeWorldCategory
	ArtsAndEntertainmentCategory
	WritersAndWritingCategory
	HealthAndFitnessCategory
	CryptoAndBlockchainCategory
)

type Like

type Like struct {
	Owner     sdk.AccAddress `json:"owner"`
	PostOwner sdk.AccAddress `json:"postOwner"`
	PostUUID  uuid.UUID      `json:"postUuid"`
	Weight    LikeWeight     `json:"weight"`
}

type LikeWeight

type LikeWeight int8
const (
	LikeWeightUp   LikeWeight = 1
	LikeWeightZero LikeWeight = 0
	LikeWeightDown LikeWeight = -1
)

type MsgCreatePost

type MsgCreatePost struct {
	UUID         string         `json:"uuid"`
	Owner        sdk.AccAddress `json:"owner"`
	Title        string         `json:"title"`
	Category     Category       `json:"category"`
	PreviewImage string         `json:"previewImage"`
	Text         string         `json:"text"`
}

MsgCreatePost defines a CreatePost message

func NewMsgCreatePost

func NewMsgCreatePost(title string, category Category, previewImage string, text string, owner sdk.AccAddress) MsgCreatePost

NewMsgCreatePost is a constructor function for MsgCreatePost

func (MsgCreatePost) GetSignBytes

func (msg MsgCreatePost) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgCreatePost) GetSigners

func (msg MsgCreatePost) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgCreatePost) Route

func (msg MsgCreatePost) Route() string

Route should return the name of the module

func (MsgCreatePost) Type

func (msg MsgCreatePost) Type() string

Type should return the action

func (MsgCreatePost) ValidateBasic

func (msg MsgCreatePost) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type MsgDeletePost

type MsgDeletePost struct {
	PostUUID  string         `json:"postUUID"`
	PostOwner sdk.AccAddress `json:"postOwner"`
	Owner     sdk.AccAddress `json:"owner"`
}

MsgDeletePost defines a DeletePost message

func NewMsgDeletePost

func NewMsgDeletePost(owner sdk.AccAddress, postUUID uuid.UUID, postOwner sdk.AccAddress) MsgDeletePost

NewMsgDeletePost is a constructor function for MsgDeletePost

func (MsgDeletePost) GetSignBytes

func (msg MsgDeletePost) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgDeletePost) GetSigners

func (msg MsgDeletePost) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgDeletePost) Route

func (msg MsgDeletePost) Route() string

Route should return the name of the module

func (MsgDeletePost) Type

func (msg MsgDeletePost) Type() string

Type should return the action

func (MsgDeletePost) ValidateBasic

func (msg MsgDeletePost) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type MsgSetLike

type MsgSetLike struct {
	PostOwner sdk.AccAddress `json:"postOwner"`
	PostUUID  string         `json:"postUuid"`
	Owner     sdk.AccAddress `json:"owner"`
	Weight    LikeWeight     `json:"weight"`
}

MsgSetLike defines a SetLike message

func NewMsgSetLike

func NewMsgSetLike(postOwner sdk.AccAddress, postUUID uuid.UUID, owner sdk.AccAddress, weight LikeWeight) MsgSetLike

NewMsgSetLike is a constructor function for MsgSetLike

func (MsgSetLike) GetSignBytes

func (msg MsgSetLike) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgSetLike) GetSigners

func (msg MsgSetLike) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgSetLike) Route

func (msg MsgSetLike) Route() string

Route should return the name of the module

func (MsgSetLike) Type

func (msg MsgSetLike) Type() string

Type should return the action

func (MsgSetLike) ValidateBasic

func (msg MsgSetLike) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type Post

type Post struct {
	UUID          uuid.UUID      `json:"uuid"`
	Owner         sdk.AccAddress `json:"owner"`
	Title         string         `json:"title"`
	PreviewImage  string         `json:"previewImage"`
	Category      Category       `json:"category"`
	Text          string         `json:"text"`
	LikesCount    uint32         `json:"likesCount"`
	DislikesCount uint32         `json:"dislikesCount"`
	PDV           sdk.Int        `json:"pdv"`
	CreatedAt     uint64         `json:"createdAt"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL