Documentation ¶
Index ¶
Constants ¶
const ( EventTypeCreateSession = "create_session" AttributeKeySessionID = "session_id" AttributeKeyNamespace = "namespace" AttributeKeyExternalOwner = "external_owner" AttributeKeyExpiry = "expiry" AttributeValueCategory = ModuleName )
Magpie module event types
const ( ModuleName = "magpie" RouterKey = ModuleName StoreKey = ModuleName ActionCreationSession = "create_session" )
Variables ¶
var ( SessionLengthKey = []byte("default_session_length") LastSessionIDStoreKey = []byte("last_session_id") SessionStorePrefix = []byte("session") )
var ModuleCdc = codec.New()
ModuleCdc is the codec
Functions ¶
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec
func SessionStoreKey ¶ added in v0.3.0
SessionStoreKey turns a session id to a key used to store a session into the sessions store nolint: interfacer
func ValidateGenesis ¶ added in v0.3.0
func ValidateGenesis(state GenesisState) error
ValidateGenesis validates the given genesis state and returns an error if something is invalid
Types ¶
type GenesisState ¶ added in v0.3.0
type GenesisState struct { DefaultSessionLength int64 `json:"default_session_length"` Sessions Sessions `json:"sessions"` }
GenesisState represents the genesis state for the magpie module
func DefaultGenesisState ¶ added in v0.3.0
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default GenesisState
func NewGenesisState ¶ added in v0.3.0
func NewGenesisState(defaultSessionLength int64, sessions Sessions) GenesisState
NewGenesisState allows to create a new genesis state containing the given default session length and sessions
type MsgCreateSession ¶
type MsgCreateSession struct { Owner sdk.AccAddress `json:"owner" yaml:"owner"` Namespace string `json:"namespace" yaml:"namespace"` ExternalOwner string `json:"external_owner" yaml:"external_owner"` PubKey string `json:"pub_key" yaml:"pub_key"` Signature string `json:"signature" yaml:"signature"` }
MsgCreateSession defines the MsgCreateSession message
func NewMsgCreateSession ¶
func NewMsgCreateSession(owner sdk.AccAddress, namespace string, externalOwner string, pubkey string, signature string) MsgCreateSession
NewMsgCreateSession is the constructor of MsgCreateSession
func (MsgCreateSession) GetSignBytes ¶
func (msg MsgCreateSession) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgCreateSession) GetSigners ¶
func (msg MsgCreateSession) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgCreateSession) Route ¶
func (msg MsgCreateSession) Route() string
Route should return the name of the module
func (MsgCreateSession) Type ¶
func (msg MsgCreateSession) Type() string
Type should return the action
func (MsgCreateSession) ValidateBasic ¶
func (msg MsgCreateSession) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type Session ¶
type Session struct { SessionID SessionID `json:"id,string" yaml:"id,string"` // Id of the session Owner sdk.AccAddress `json:"owner" yaml:"owner"` // Desmos owner of this session Created int64 `json:"creation_time,string" yaml:"creation_time"` // Block height at which the session has been created Expiry int64 `json:"expiration_time,string" yaml:"expiration_time"` // Block height at which the session will expire Namespace string `json:"namespace" yaml:"namespace"` // External chain identifier ExternalOwner string `json:"external_owner" yaml:"external_owner"` // External chain owner address PubKey string `json:"pub_key" yaml:"pub_key"` // External chain owner public key Signature string `json:"signature" yaml:"signature"` // Session signature }
Session is a struct of a user session
func NewSession ¶
func NewSession(id SessionID, owner sdk.AccAddress, created, expiry int64, namespace, externalOwner, pubKey, signature string) Session
NewSession return a new session containing the given parameters
type SessionID ¶
type SessionID uint64
SessionID represents a unique session id
func ParseSessionID ¶
ParseSessionID take the given string value and parses it returning a SessionID. If the given value is not valid, returns an error instead