Documentation
¶
Index ¶
- Constants
- Variables
- func DtagStoreKey(dtag string) []byte
- func ParamKeyTable() paramsModule.KeyTable
- func ProfileStoreKey(address sdk.AccAddress) []byte
- func RegisterCodec(cdc *codec.Codec)
- func ValidateBioParams(i interface{}) error
- func ValidateDtagParams(i interface{}) error
- func ValidateGenesis(data GenesisState) error
- func ValidateMonikerParams(i interface{}) error
- type DtagParams
- type GenesisState
- type MonikerParams
- type MsgDeleteProfile
- type MsgSaveProfile
- type Params
- 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) WithPictures(profilePic, coverPic *string) Profile
- type Profiles
Constants ¶
const ( EventTypeProfileSaved = "profile_saved" EventTypeProfileDeleted = "profile_deleted" // Profile attributes AttributeProfileDtag = "profile_dtag" AttributeProfileCreator = "profile_creator" AttributeProfileCreationTime = "profile_creation_time" )
const ( ModuleName = "profiles" RouterKey = ModuleName StoreKey = ModuleName ActionSaveProfile = "save_profile" ActionDeleteProfile = "delete_profile" //Queries QuerierRoute = ModuleName QueryProfile = "profile" QueryProfiles = "all" QueryParams = "params" )
const ( // default paramspace for paramsModule keeper DefaultParamspace = ModuleName )
Variables ¶
var ( URIRegEx = regexp.MustCompile(`^(?:http(s)?://)[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]+$`) ProfileStorePrefix = []byte("profile") DtagStorePrefix = []byte("dtag") )
var ( DefaultMinMonikerLength = sdk.NewInt(2) DefaultMaxMonikerLength = sdk.NewInt(1000) //longest name on earth count 954 chars DefaultRegEx = `^[A-Za-z0-9_]+$` DefaultMinDTagLength = sdk.NewInt(3) DefaultMaxDTagLength = sdk.NewInt(30) DefaultMaxBioLength = sdk.NewInt(1000) )
Default profile paramsModule
var ( MonikerLenParamsKey = []byte("MonikerParams") DtagLenParamsKey = []byte("DtagParams") MaxBioLenParamsKey = []byte("MaxBioLen") )
Parameters store keys
var ModuleCdc = codec.New()
ModuleCdc is the codec used inside the whole profile module
Functions ¶
func DtagStoreKey ¶
DtagStoreKey turns a dtag to a key used to store a dtag -> address couple
func ParamKeyTable ¶
func ParamKeyTable() paramsModule.KeyTable
ParamKeyTable Key declaration for parameters
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 ValidateBioParams ¶
func ValidateBioParams(i interface{}) error
func ValidateDtagParams ¶
func ValidateDtagParams(i interface{}) error
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the given genesis state and returns an error if something is invalid
func ValidateMonikerParams ¶
func ValidateMonikerParams(i interface{}) error
Types ¶
type DtagParams ¶
type DtagParams struct { RegEx string `json:"reg_ex" yaml:"reg_ex"` MinDtagLen sdk.Int `json:"min_length" yaml:"min_length"` MaxDtagLen sdk.Int `json:"max_length" yaml:"max_length"` }
DtagParams defines the paramsModule around profiles' dtag
func DefaultDtagParams ¶
func DefaultDtagParams() DtagParams
DefaultDtagParams return default paramsModule
func NewDtagParams ¶
func NewDtagParams(regEx string, minLen, maxLen sdk.Int) DtagParams
NewDtagParams creates a new DtagParams obj
func (DtagParams) String ¶
func (params DtagParams) String() string
String implements stringer interface
type GenesisState ¶
type GenesisState struct { Profiles []Profile `json:"profiles" yaml:"profiles"` Params Params `json:"params" yaml:"params"` }
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, params Params) GenesisState
NewGenesisState creates a new genesis state
type MonikerParams ¶
type MonikerParams struct { MinMonikerLen sdk.Int `json:"min_length" yaml:"min_length"` MaxMonikerLen sdk.Int `json:"max_length" yaml:"max_length"` }
MonikerParams defines the paramsModule around moniker len
func DefaultMonikerParams ¶
func DefaultMonikerParams() MonikerParams
DefaultMonikerParams return default moniker params
func NewMonikerParams ¶
func NewMonikerParams(minLen, maxLen sdk.Int) MonikerParams
NewMonikerParams creates a new MonikerParams obj
func (MonikerParams) String ¶
func (params MonikerParams) String() string
String implements stringer interface
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 ¶
type MsgSaveProfile struct { Dtag string `json:"dtag" yaml:"dtag"` Moniker *string `json:"moniker,omitempty" yaml:"moniker,omitempty"` Bio *string `json:"bio,omitempty" yaml:"bio,omitempty"` ProfilePic *string `json:"profile_picture,omitempty" yaml:"profile_pic,omitempty"` CoverPic *string `json:"cover_picture,omitempty" yaml:"cover_pic,omitempty"` Creator sdk.AccAddress `json:"creator" yaml:"creator"` }
MsgSaveProfile defines a SaveProfile message
func NewMsgSaveProfile ¶
func NewMsgSaveProfile(dtag string, moniker, bio, profilePic, coverPic *string, creator sdk.AccAddress) MsgSaveProfile
NewMsgSaveProfile is a constructor function for MsgSaveProfile
func (MsgSaveProfile) GetSignBytes ¶
func (msg MsgSaveProfile) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgSaveProfile) GetSigners ¶
func (msg MsgSaveProfile) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgSaveProfile) Route ¶
func (msg MsgSaveProfile) Route() string
Route should return the name of the module
func (MsgSaveProfile) ValidateBasic ¶
func (msg MsgSaveProfile) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type Params ¶
type Params struct { MonikerParams MonikerParams `json:"moniker_params" yaml:"moniker_params"` DtagParams DtagParams `json:"dtag_params" yaml:"dtag_params"` MaxBioLen sdk.Int `json:"max_bio_length" yaml:"max_bio_length"` }
func NewParams ¶
func NewParams(monikerLen MonikerParams, dtagLen DtagParams, maxBioLen sdk.Int) Params
NewParams creates a new ProfileParams obj
func (*Params) ParamSetPairs ¶
func (params *Params) ParamSetPairs() paramsModule.ParamSetPairs
ParamSetPairs implements the ParamSet interface and returns the key/value pairs of profile module's parameters.
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 { DTag string `json:"dtag" yaml:"dtag"` Moniker *string `json:"moniker,omitempty" yaml:"moniker,omitempty"` Bio *string `json:"bio,omitempty" yaml:"bio,omitempty"` Pictures *Pictures `json:"pictures,omitempty" yaml:"pictures,omitempty"` Creator sdk.AccAddress `json:"creator" yaml:"creator"` CreationDate time.Time `json:"creation_date" yaml:"creation_date"` }
Profile represents a generic first on Desmos, containing the information of a single user
func NewProfile ¶
func (Profile) WithMoniker ¶
WithMoniker updates profile's moniker with the given one
func (Profile) WithPictures ¶
WithPicture updates profile's pictures with the given one