Default

Initialize a new game tier

post

Creates a new GlobalState PDA for the given tier_id with the provided game configuration. Can only be called once per tier. The admin becomes the tier authority.

Accounts:

Name
Type
Description

global_state

PDA (init)

["global_state", tier_id]

admin

Signer (mut)

Pays rent, becomes admin

protocol_treasury

AccountInfo

Treasury for protocol fees

system_program

Program

System program

Body
tier_idinteger · uint8Required

Unique tier identifier (0–255)

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/initialize
200

Transaction succeeded

No content

Initialize a new round

post

Creates a new RoundState PDA for round current_round + 1. Admin only.

Accounts:

Name
Type
Description

global_state

PDA (mut)

Tier global state

round_state

PDA (init)

["round", tier_id, round_number]

admin

Signer (mut)

Must match global_state.admin

system_program

Program

System program

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/init-round
200

Transaction succeeded

No content

Join the current round

post

Player joins the active round. Entry fee is deducted from user_vault. Team is assigned round-robin (total_players % 3). If total_players >= min_players, countdown starts automatically.

Allowed when status is Waiting or during Countdown (before countdown expires).

Accounts:

Name
Type
Description

round_state

PDA (mut)

Current round

global_state

PDA

Tier config

user_vault

PDA (mut)

["vault", authority] — pays entry fee

player_state

PDA (init)

["player", tier_id, round, authority]

signer

Signer (mut)

Authority or delegate

authority

AccountInfo

Vault owner

system_program

Program

System program

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/join-game
200

Transaction succeeded

No content

Switch to a different team

post

Switches the player to new_team (0, 1, or 2). Only allowed during Active status and before game_end_at.

Fee logic:

  • Free if within free_switch_window seconds of game start AND switches_used < free_switches

  • Otherwise: base_switch_fee * paid_switches (escalating cost)

Accounts:

Name
Type
Description

round_state

PDA (mut)

Current round

global_state

PDA

Tier config

user_vault

PDA (mut)

Pays switch fee

player_state

PDA (mut)

Player's round state

signer

Signer (mut)

Authority or delegate

authority

AccountInfo

Vault owner

system_program

Program

System program

Body
new_teaminteger · enumRequired

Target team index

Possible values:
Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/switch-team
200

Transaction succeeded

No content

Transition from Countdown to Active

post

Starts the game after countdown expires. Awards starter_reward to the caller's vault. Sets game_start_at and game_end_at.

Accounts:

Name
Type
Description

round_state

PDA (mut)

Must be in Countdown

global_state

PDA

Tier config

user_vault

PDA (mut)

Receives starter reward

authority

AccountInfo

Vault owner

starter

Signer (mut)

Authority or delegate

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/start-game
200

Transaction succeeded

No content

End the current round and initialize the next

post

Ends the game after game_end_at has passed. Determines winners by fewest players (ties broken by fewest defections; 3-way tie = no winners, full rollover).

Distributes: protocol fee to treasury, closer reward to caller's vault, reward per winner (capped at max_payout_multiple_bps), surplus rolls to next round.

Automatically initializes next_round_state.

Accounts:

Name
Type
Description

round_state

PDA (mut)

Current round

protocol_treasury

AccountInfo (mut)

Receives protocol fee

global_state

PDA (mut)

Updates current_round

user_vault

PDA (mut)

Receives closer reward

authority

AccountInfo

Vault owner

next_round_state

PDA (init)

Next round

closer

Signer (mut)

Authority or delegate

system_program

Program

System program

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/end-game
200

Transaction succeeded

No content

Claim winnings from an ended round

post

Claims reward_per_winner from the round pot into the player's vault. Uses bitmask verification: winning_team_mask & (1 << current_team) != 0.

Accounts:

Name
Type
Description

round_state

PDA (mut)

Must be Ended

global_state

PDA

Tier config

player_state

PDA (mut)

Must not have claimed

user_vault

PDA (mut)

Receives reward

authority

AccountInfo

Player's authority

signer

Signer (mut)

Authority or delegate

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/claim-prize
200

Transaction succeeded

No content

Deposit SOL into user vault

post

Deposits amount lamports from the authority's wallet into their vault PDA. Creates the vault if it doesn't exist (init_if_needed).

Accounts:

Name
Type
Description

user_vault

PDA (init_if_needed, mut)

["vault", authority]

authority

Signer (mut)

Depositor

system_program

Program

System program

Body
amountinteger · uint64Required

Lamports to deposit

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/deposit
200

Transaction succeeded

No content

Withdraw all available SOL from vault

post

Withdraws all lamports above rent-exempt minimum from the vault to the authority wallet. Authority only (no delegate).

Accounts:

Name
Type
Description

user_vault

PDA (mut)

["vault", authority]

authority

Signer (mut)

Must be vault owner

system_program

Program

System program

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/withdraw-vault
200

Transaction succeeded

No content

Withdraw from a round during Waiting phase

post

Allows a player to leave a round that hasn't started yet. Refunds entry_fee - withdrawal_fee. The player_state account is closed (rent returned to vault).

Accounts:

Name
Type
Description

player_state

PDA (mut, close)

Closed after withdrawal

round_state

PDA (mut)

Must be Waiting

global_state

PDA

Tier config

user_vault

PDA (mut)

Receives refund

authority

AccountInfo

Vault owner

signer

Signer (mut)

Authority or delegate

protocol_treasury

AccountInfo

Required by context

system_program

Program

System program

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/withdraw-game
200

Transaction succeeded

No content

Approve a delegate (session key) for the vault

post

Sets a delegate public key and nonce on the vault. The delegate can then act on behalf of the authority for game actions (join, switch, start, end, claim).

Accounts:

Name
Type
Description

user_vault

PDA (mut)

["vault", authority]

authority

Signer

Must be vault owner

Body
delegatestringRequired

Base58 public key of the delegate

nonceinteger · uint64Required

Monotonically increasing nonce to prevent replay

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/approve-delegate
200

Transaction succeeded

No content

Fund the delegate wallet from vault

post

Transfers lamports from the vault PDA to the delegate wallet to cover transaction fees. Only tops up if delegate balance is below target_lamports. Authority only.

Accounts:

Name
Type
Description

user_vault

PDA (mut)

Source of funds

delegate

AccountInfo (mut)

Must match vault.delegate

authority

Signer

Must be vault owner

Body
target_lamportsinteger · uint64Required

Desired delegate balance in lamports

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/fund-delegate
200

Transaction succeeded

No content

Update tier game configuration (admin only)

post

Updates selected fields of the GameConfig for a tier. All fields are optional; only provided values are changed.

Accounts:

Name
Type
Description

global_state

PDA (mut)

Tier to update

admin

Signer

Must match global_state.admin

Body
min_playersinteger · uint32 · nullableOptional
game_durationinteger · int64 · nullableOptional

Seconds

countdown_durationinteger · int64 · nullableOptional

Seconds

entry_feeinteger · uint64 · nullableOptional

Lamports

Responses
chevron-right
200

Transaction succeeded

No content

post
/solana/update-game-config
200

Transaction succeeded

No content

Last updated