models

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "profiles"
	RouterKey  = ModuleName
	StoreKey   = ModuleName

	ActionSaveProfile        = "save_profile"
	ActionDeleteProfile      = "delete_profile"
	ActionRequestDtag        = "request_dtag"
	ActionAcceptDtagTransfer = "accept_dtag_request"

	//Queries
	QuerierRoute      = ModuleName
	QueryProfile      = "profile"
	QueryProfiles     = "all"
	QueryDTagRequests = "dtag-requests"
	QueryParams       = "params"
)

Variables

View Source
var (
	ProfileStorePrefix         = []byte("profile")
	DtagStorePrefix            = []byte("dtag")
	DTagTransferRequestsPrefix = []byte("transfer_requests")
)
View Source
var ModelsCdc = codec.New()

ModelsCdc is the codec

Functions

func DtagStoreKey

func DtagStoreKey(dtag string) []byte

DtagStoreKey turns a dtag to a key used to store a dtag -> address couple

func DtagTransferRequestStoreKey added in v0.12.0

func DtagTransferRequestStoreKey(address sdk.AccAddress) []byte

DtagTransferRequestStoreKey turns an address to a key used to store a transfer request into the profiles store

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 RegisterModelsCodec

func RegisterModelsCodec(cdc *codec.Codec)

RegisterModelsCodec registers concrete types on the Amino codec

Types

type DTagTransferRequest added in v0.12.0

type DTagTransferRequest struct {
	DTagToTrade   string         `json:"dtag_to_trade" yaml:"dtag_to_trade"`
	CurrentOwner  sdk.AccAddress `json:"current_owner" yaml:"current_owner"`
	ReceivingUser sdk.AccAddress `json:"receiving_user" yaml:"receiving_user"`
}

DTagTransferRequest represent a dtag transfer request between two users

func NewDTagTransferRequest added in v0.12.0

func NewDTagTransferRequest(dtagToTrade string, currentOwner, receivingUser sdk.AccAddress) DTagTransferRequest

func (DTagTransferRequest) Equals added in v0.12.0

func (dtagTR DTagTransferRequest) Equals(other DTagTransferRequest) bool

Equals returns true if the two requests are equals. False otherwise

func (DTagTransferRequest) String added in v0.12.0

func (dtagTR DTagTransferRequest) String() string

String implement fmt.Stringer

func (DTagTransferRequest) Validate added in v0.12.0

func (dtagTR DTagTransferRequest) Validate() error

Validate checks the request validity

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 otherPics

func (Pictures) Validate

func (pic Pictures) Validate() error

Validate check the validity of the 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 NewProfile(dtag string, creator sdk.AccAddress, creationDate time.Time) 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) WithDTag added in v0.12.0

func (profile Profile) WithDTag(dtag string) Profile

WithDTag updates profile's dtag with the given one

func (Profile) WithMoniker

func (profile Profile) WithMoniker(moniker *string) Profile

WithMoniker updates profile's moniker with the given one

func (Profile) WithPictures

func (profile Profile) WithPictures(profilePic, coverPic *string) Profile

WithPicture updates profile's pictures with the given one

type Profiles

type Profiles []Profile

Profiles represents a slice of profile objects

func NewProfiles

func NewProfiles(profiles ...Profile) Profiles

NewProfiles allows to easily create a Profiles object from a list of profiles

Jump to

Keyboard shortcuts

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