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
- func ValidateURI(uri string) error
- type GenesisState
- type MsgCreateProfile
- type MsgDeleteProfile
- type MsgEditProfile
- 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) WithName(name *string) Profile
- func (profile Profile) WithPictures(pictures *Pictures) Profile
- func (profile Profile) WithSurname(surname *string) Profile
- type Profiles
Constants ¶
const ( EventTypeProfileCreated = "profile_created" EventTypeProfileEdited = "profile_edited" EventTypeProfileDeleted = "profile_deleted" // Profile attributes AttributeProfileMoniker = "profile_moniker" AttributeProfileCreator = "profile_creator" )
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 ¶
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
func ValidateURI ¶
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) 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 ¶
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(moniker string, creator sdk.AccAddress) Profile
func (Profile) WithPictures ¶
WithPicture updates profile's pictures with the given one
func (Profile) WithSurname ¶
WithSurname updates profile's surname with the given one