Documentation ¶
Index ¶
- Constants
- Variables
- func MonikerStoreKey(moniker string) []byte
- func ProfileStoreKey(address sdk.AccAddress) []byte
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type GenesisState
- type MsgDeleteProfile
- type MsgSaveProfile
- type Pictures
- type Profile
- func (profile Profile) Equals(other Profile) bool
- func (profile Profile) String() string
- func (profile Profile) Validate() error
- func (profile Profile) WithBio(bio *string) Profile
- func (profile Profile) WithMoniker(moniker string) Profile
- func (profile Profile) WithName(name *string) Profile
- func (profile Profile) WithPictures(profilePic, coverPic *string) Profile
- func (profile Profile) WithSurname(surname *string) Profile
- type Profiles
Constants ¶
const ( EventTypeProfileSaved = "profile_saved" EventTypeProfileDeleted = "profile_deleted" // Profile attributes AttributeProfileMoniker = "profile_moniker" AttributeProfileCreator = "profile_creator" )
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 ¶
var ( TxHashRegEx = regexp.MustCompile("^[a-fA-F0-9]{64}$") URIRegEx = regexp.MustCompile( `^(?:http(s)?://)[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$`) ProfileStorePrefix = []byte("profile") MonikerStorePrefix = []byte("moniker") )
var ModuleCdc = codec.New()
ModuleCdc is the codec
Functions ¶
func MonikerStoreKey ¶
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 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 ¶
NewPictures is a constructor function for 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) WithMoniker ¶ added in v0.6.1
WithMoniker updates profile's moniker with the given one
func (Profile) WithPictures ¶
WithPicture updates profile's pictures with the given one
func (Profile) WithSurname ¶
WithSurname updates profile's surname with the given one