types

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeProfileCreated = "profile_created"
	EventTypeProfileEdited  = "profile_edited"
	EventTypeProfileDeleted = "profile_deleted"

	// Profile attributes
	AttributeProfileMoniker = "profile_moniker"
	AttributeProfileCreator = "profile_creator"
)
View Source
const (
	ModuleName = "profile"
	RouterKey  = ModuleName
	StoreKey   = ModuleName

	MinNameSurnameLength = 2
	MaxNameSurnameLength = 500
	MaxMonikerLength     = 30
	MaxBioLength         = 1000

	ActionCreateProfile = "create_profile"
	ActionEditProfile   = "edit_profile"
	ActionDeleteProfile = "delete_profile"

	//Queries
	QuerierRoute  = ModuleName
	QueryProfile  = "profile"
	QueryProfiles = "all"
)

Variables

View Source
var (
	TxHashRegEx = regexp.MustCompile("^[a-fA-F0-9]{64}$")
	URIRegEx    = regexp.MustCompile(
		`^(?:http(s)?://)[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$`)

	ProfileStorePrefix = []byte("profile")
	MonikerStorePrefix = []byte("moniker")
)
View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec

Functions

func MonikerStoreKey

func MonikerStoreKey(moniker string) []byte

MonikerStoreKey turns a moniker to a key used to store a moniker -> address couple

func ProfileStoreKey

func ProfileStoreKey(address sdk.AccAddress) []byte

ProfileStoreKey turns an address to a key used to store a profile into the profiles store

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the given genesis state and returns an error if something is invalid

func ValidateURI

func ValidateURI(uri string) error

ValidateURI checks if the given uri string is well-formed according to the regExp and return and error otherwise

Types

type GenesisState

type GenesisState struct {
	Profiles []Profile `json:"profiles"`
}

GenesisState contains the data of the genesis state for the profile module

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default GenesisState

func NewGenesisState

func NewGenesisState(profiles []Profile) GenesisState

NewGenesisState creates a new genesis state

type MsgCreateProfile

type MsgCreateProfile struct {
	Moniker  string         `json:"moniker" yaml:"moniker"`
	Name     *string        `json:"name,omitempty" yaml:"name,omitempty"`
	Surname  *string        `json:"surname,omitempty" yaml:"surname,omitempty"`
	Bio      *string        `json:"bio,omitempty" yaml:"bio,omitempty"`
	Pictures *Pictures      `json:"pictures,omitempty" yaml:"pictures,omitempty"`
	Creator  sdk.AccAddress `json:"creator" yaml:"creator"`
}

MsgCreateProfile defines a CreateProfile message

func NewMsgCreateProfile

func NewMsgCreateProfile(moniker string, name, surname, bio *string, pictures *Pictures,
	creator sdk.AccAddress) MsgCreateProfile

NewMsgCreateProfile is a constructor function for MsgCreateProfile

func (MsgCreateProfile) GetSignBytes

func (msg MsgCreateProfile) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgCreateProfile) GetSigners

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

GetSigners defines whose signature is required

func (MsgCreateProfile) Route

func (msg MsgCreateProfile) Route() string

Route should return the name of the module

func (MsgCreateProfile) Type

func (msg MsgCreateProfile) Type() string

Type should return the action

func (MsgCreateProfile) ValidateBasic

func (msg MsgCreateProfile) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type MsgDeleteProfile

type MsgDeleteProfile struct {
	Creator sdk.AccAddress `json:"creator" yaml:"creator"`
}

MsgDeleteProfile defines a DeleteProfile message

func NewMsgDeleteProfile

func NewMsgDeleteProfile(creator sdk.AccAddress) MsgDeleteProfile

NewMsgDeleteProfile is a constructor function for MsgDeleteProfile

func (MsgDeleteProfile) GetSignBytes

func (msg MsgDeleteProfile) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgDeleteProfile) GetSigners

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

GetSigners defines whose signature is required

func (MsgDeleteProfile) Route

func (msg MsgDeleteProfile) Route() string

Route should return the name of the module

func (MsgDeleteProfile) Type

func (msg MsgDeleteProfile) Type() string

Type should return the action

func (MsgDeleteProfile) ValidateBasic

func (msg MsgDeleteProfile) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type MsgEditProfile

type MsgEditProfile struct {
	NewMoniker *string        `json:"new_moniker" yaml:"new_moniker"`
	Name       *string        `json:"name,omitempty" yaml:"name,omitempty"`
	Surname    *string        `json:"surname,omitempty" yaml:"surname,omitempty"`
	Bio        *string        `json:"bio,omitempty" yaml:"bio,omitempty"`
	ProfilePic *string        `json:"profile_pic,omitempty" yaml:"profile_pic,omitempty"`
	ProfileCov *string        `json:"profile_cov,omitempty" yaml:"profile_cov,omitempty"`
	Creator    sdk.AccAddress `json:"creator" yaml:"creator"`
}

MsgEditProfile defines a EditProfile message

func NewMsgEditProfile

func NewMsgEditProfile(newMoniker, name, surname, bio, profilePic,
	profileCov *string, creator sdk.AccAddress) MsgEditProfile

NewMsgEditProfile is a constructor function for MsgEditProfile

func (MsgEditProfile) GetSignBytes

func (msg MsgEditProfile) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgEditProfile) GetSigners

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

GetSigners defines whose signature is required

func (MsgEditProfile) Route

func (msg MsgEditProfile) Route() string

Route should return the name of the module

func (MsgEditProfile) Type

func (msg MsgEditProfile) Type() string

Type should return the action

func (MsgEditProfile) ValidateBasic

func (msg MsgEditProfile) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type Pictures

type Pictures struct {
	Profile *string `json:"profile,omitempty" yaml:"profile,omitempty"`
	Cover   *string `json:"cover,omitempty" yaml:"cover,omitempty"`
}

Pictures contains the data of a user profile's related pictures

func NewPictures

func NewPictures(profile, cover *string) *Pictures

NewPictures is a constructor function for Pictures

func (Pictures) Equals

func (pic Pictures) Equals(otherPic *Pictures) bool

Equals allows to check whether the contents of pic are the same of otherPic

func (Pictures) Validate

func (pic Pictures) Validate() error

Validate check the validity of the Pictures

type Profile

type Profile struct {
	Moniker  string         `json:"moniker" yaml:"moniker"`
	Name     *string        `json:"name,omitempty" yaml:"name,omitempty"`
	Surname  *string        `json:"surname,omitempty" yaml:"surname,omitempty"`
	Bio      *string        `json:"bio,omitempty" yaml:"bio,omitempty"`
	Pictures *Pictures      `json:"pictures,omitempty" yaml:"pictures,omitempty"`
	Creator  sdk.AccAddress `json:"creator" yaml:"creator"`
}

Profile represents a generic account on Desmos, containing the information of a single user

func NewProfile

func NewProfile(moniker string, creator sdk.AccAddress) Profile

func (Profile) Equals

func (profile Profile) Equals(other Profile) bool

Equals allows to check whether the contents of acc are the same of other

func (Profile) String

func (profile Profile) String() string

String implements fmt.Stringer

func (Profile) Validate

func (profile Profile) Validate() error

Validate check the validity of the Profile

func (Profile) WithBio

func (profile Profile) WithBio(bio *string) Profile

WithBio updates profile's bio with the given one

func (Profile) WithName

func (profile Profile) WithName(name *string) Profile

WithSurname updates profile's name with the given one

func (Profile) WithPictures

func (profile Profile) WithPictures(pictures *Pictures) Profile

WithPicture updates profile's pictures with the given one

func (Profile) WithSurname

func (profile Profile) WithSurname(surname *string) Profile

WithSurname updates profile's surname with the given one

type Profiles

type Profiles []Profile

Jump to

Keyboard shortcuts

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