saberistic-team / snakesAndLadders

0 stars 0 forks source link

View List of Invitations #3

Open saberistic opened 1 year ago

saberistic commented 1 year ago

Title: View Game Invitations As a: Player I want to: Be able to view a list of game invitations I've received So that: I can decide which games to join.

saberistic commented 1 year ago
// This might be more of a client-side function where you fetch the relevant accounts and filter by invitations.
// However, if you want to handle it on-chain:
#[derive(Accounts)]
pub struct ViewInvitations<'info> {
    pub player: Signer<'info>,
    pub game_sessions: Vec<Account<'info, GameSession>>,
}

pub fn view_invitations(ctx: Context<ViewInvitations>) -> ProgramResult {
    // Logic to filter game_sessions by invitations for the player.
    Ok(())
}