types

package
v0.6.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	EventTypeProfileSaved   = "profile_saved"
	EventTypeProfileDeleted = "profile_deleted"

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

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

	ActionSaveProfile   = "save_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

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 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 MsgSaveProfile added in v0.6.1

type MsgSaveProfile 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"`
	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"`
}

MsgSaveProfile defines a SaveProfile message

func NewMsgSaveProfile added in v0.6.1

func NewMsgSaveProfile(moniker string, name, surname, bio, profilePic,
	profileCov *string, creator sdk.AccAddress) MsgSaveProfile

NewMsgSaveProfile is a constructor function for MsgSaveProfile

func (MsgSaveProfile) GetSignBytes added in v0.6.1

func (msg MsgSaveProfile) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgSaveProfile) GetSigners added in v0.6.1

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

GetSigners defines whose signature is required

func (MsgSaveProfile) Route added in v0.6.1

func (msg MsgSaveProfile) Route() string

Route should return the name of the module

func (MsgSaveProfile) Type added in v0.6.1

func (msg MsgSaveProfile) Type() string

Type should return the action

func (MsgSaveProfile) ValidateBasic added in v0.6.1

func (msg MsgSaveProfile) 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(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) WithMoniker added in v0.6.1

func (profile Profile) WithMoniker(moniker string) Profile

WithMoniker updates profile's moniker 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(profilePic, coverPic *string) 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