Skip to content

gear-foundation/signless-gasless-session-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adding Dependencies

To use session-service in your project, add the following dependency to your Cargo.toml:

[dependencies]
session-service = { git = "https://github.com/gear-foundation/signless-gasless-session-service.git" }

Usage

#![no_std]
use sails_rs::prelude::*;
use session_service::*;

pub struct Program(());

#[program]
impl Program {
    pub async fn new(config: Config) -> Self {
        // Initialize your services
        ...
        SessionService::init(config);
        Self(())
    }

    // Define your services
    ...

    pub fn session(&self) -> SessionService {
        SessionService::new()
    }
}

// Define your custom session actions using an enum
#[derive(Debug, Clone, Encode, Decode, TypeInfo, PartialEq, Eq)]
#[codec(crate = sails_rs::scale_codec)]
#[scale_info(crate = sails_rs::scale_info)]
pub enum ActionsForSession {
    StartGame,
    Move,
    Skip,
}

// Use the macro to generate session management structures and logic
generate_session_system!(ActionsForSession);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages