Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

kewrchess state

Back to all declarations

ChallengeWindowSeconds

int64

// 3-minute challenge window for settlement proposals

Value

180

TurnTimeoutSeconds

int64

// 2-minute move timeout when opponent is AFK (Abandonment)

Value

120

getVerifiedCaller

func(caller .uverse.address) (.uverse.address, .uverse.error)
Open
OID
0af112…94af:5
getVerifiedCaller details

Inspect func

games

[]*kewrchess.Game (len=1)

Stores all chess games permanently on the blockchain

Open
OID
0af112…94af:50
games details (len=1)

+1 more Inspect slice

nextGameID

int

Value

1

matchmakingQueue

[].uverse.address

On-chain matchmaking queue (FIFO)

Value

<zero>

CreateGame

func(caller .uverse.address, opponent .uverse.address) .uverse.error

CreateGame creates a new direct game challenge

Open
OID
0af112…94af:11
CreateGame details

Inspect func

JoinQueue

func(caller .uverse.address) .uverse.error

JoinQueue registers a player into the on-chain matchmaking queue. If the queue is empty, the player is added to the queue. If another player is already waiting, both players are immediately matched into a new game.

Open
OID
0af112…94af:12
JoinQueue details

Inspect func

LeaveQueue

func(caller .uverse.address) .uverse.error

LeaveQueue cancels and removes a player from the on-chain matchmaking queue

Open
OID
0af112…94af:13
LeaveQueue details

Inspect func

makeMoveInternal

func(caller .uverse.address, gameID int, fromRow int, fromCol int, toRow int, toCol int, promoPiece string) .uverse.error
Open
OID
0af112…94af:14
makeMoveInternal details

Inspect func

MakeMove

func(caller .uverse.address, gameID int, fromRow int, fromCol int, toRow int, toCol int) .uverse.error

MakeMove moves a piece (defaults to Queen on promotion)

Open
OID
0af112…94af:15
MakeMove details

Inspect func

MakeMovePromote

func(caller .uverse.address, gameID int, fromRow int, fromCol int, toRow int, toCol int, promoPiece string) .uverse.error

MakeMovePromote moves a piece with a specified promotion piece (Q, R, B, N)

Open
OID
0af112…94af:16
MakeMovePromote details

Inspect func

Resign

func(caller .uverse.address, gameID int) .uverse.error

Resign resigns the game for the calling player

Open
OID
0af112…94af:17
Resign details

Inspect func

OfferDraw

func(caller .uverse.address, gameID int) .uverse.error

OfferDraw offers a draw to the opponent

Open
OID
0af112…94af:18
OfferDraw details

Inspect func

AcceptDraw

func(caller .uverse.address, gameID int) .uverse.error

AcceptDraw accepts a draw offer from the opponent

Open
OID
0af112…94af:19
AcceptDraw details

Inspect func

DeclineDraw

func(caller .uverse.address, gameID int) .uverse.error

DeclineDraw declines a draw offer from the opponent

Open
OID
0af112…94af:20
DeclineDraw details

Inspect func

ProposeSettlement

func(caller .uverse.address, gameID int, movesUCI string) .uverse.error

ProposeSettlement submits a victory claim for off-chain chess results. Prevents fraudulent opponent moves: proposal opens a challenge period. Opponent can confirm immediately (ConfirmSettlement), or dispute if cheated (DisputeSettlement). If opponent does not respond, winner can finalize after ChallengeWindowSeconds expires.

Open
OID
0af112…94af:21
ProposeSettlement details

Inspect func

ConfirmSettlement

func(caller .uverse.address, gameID int) .uverse.error

ConfirmSettlement allows opponent to immediately approve final result without waiting for challenge window

Open
OID
0af112…94af:22
ConfirmSettlement details

Inspect func

FinalizeSettlement

func(caller .uverse.address, gameID int) .uverse.error

FinalizeSettlement officially finalizes the game after the challenge period has passed

Open
OID
0af112…94af:23
FinalizeSettlement details

Inspect func

DisputeSettlement

func(caller .uverse.address, gameID int) .uverse.error

DisputeSettlement allows opponent to dispute a fraudulent settlement proposal

Open
OID
0af112…94af:24
DisputeSettlement details

Inspect func

SettleGame

func(caller .uverse.address, gameID int, movesUCI string) .uverse.error

SettleGame proposes settlement and finalizes immediately if challenge window is 0

Open
OID
0af112…94af:25
SettleGame details

Inspect func

StartTurnTimer

func(caller .uverse.address, gameID int, currentMovesUCI string) .uverse.error

StartTurnTimer is initiated when opponent goes AFK or closes browser (Rage Quit) during an off-chain game. Player submits current move history (currentMovesUCI). Smart contract validates the board and ensures it is the OPPONENT'S TURN.

Open
OID
0af112…94af:26
StartTurnTimer details

Inspect func

ClaimTimeout

func(caller .uverse.address, gameID int) .uverse.error

ClaimTimeout allows the challenger to win the game after the opponent goes AFK/rage quits and turnDeadline has passed without a response move from the opponent.

Open
OID
0af112…94af:27
ClaimTimeout details

Inspect func

GetGamesCount

func() int

GetGamesCount returns the total number of games

Open
OID
0af112…94af:28
GetGamesCount details

Inspect func

GetBoard

func(gameID int) [8][8]string

GetBoard returns the 8x8 board for a given game ID

Open
OID
0af112…94af:29
GetBoard details

Inspect func

GetWhitePlayer

func(gameID int) .uverse.address
Open
OID
0af112…94af:30
GetWhitePlayer details

Inspect func

GetBlackPlayer

func(gameID int) .uverse.address
Open
OID
0af112…94af:31
GetBlackPlayer details

Inspect func

IsWhiteTurn

func(gameID int) bool

IsWhiteTurn returns whether it is White's turn for a given game ID

Open
OID
0af112…94af:32
IsWhiteTurn details

Inspect func

GetGameStatus

func(gameID int) string

GetGameStatus returns the game status for a given game ID

Open
OID
0af112…94af:33
GetGameStatus details

Inspect func

GetDrawOfferedBy

func(gameID int) .uverse.address
Open
OID
0af112…94af:34
GetDrawOfferedBy details

Inspect func

GetResignedBy

func(gameID int) .uverse.address
Open
OID
0af112…94af:35
GetResignedBy details

Inspect func

GetQueueCount

func() int

GetQueueCount returns the number of players waiting in the matchmaking queue

Open
OID
0af112…94af:36
GetQueueCount details

Inspect func

IsInQueue

func(addr .uverse.address) bool

IsInQueue checks if an address is currently waiting in the matchmaking queue

Open
OID
0af112…94af:37
IsInQueue details

Inspect func

GetActiveGameForPlayer

func(addr .uverse.address) int

GetActiveGameForPlayer searches for the latest active game ("PLAYING") for a given address. Returns -1 if no active game found.

Open
OID
0af112…94af:38
GetActiveGameForPlayer details

Inspect func

GetLatestGameForPlayer

func(addr .uverse.address) int

GetLatestGameForPlayer returns the latest game ID involving the player, or -1 if none.

Open
OID
0af112…94af:39
GetLatestGameForPlayer details

Inspect func

GetSettledBy

func(gameID int) .uverse.address
Open
OID
0af112…94af:40
GetSettledBy details

Inspect func

GetProposedBy

func(gameID int) .uverse.address
Open
OID
0af112…94af:41
GetProposedBy details

Inspect func

GetPendingStatus

func(gameID int) string

GetPendingStatus returns the pending status of settlement

Open
OID
0af112…94af:42
GetPendingStatus details

Inspect func

GetChallengeDeadline

func(gameID int) int64

GetChallengeDeadline returns the deadline unix timestamp for challenging settlement

Open
OID
0af112…94af:43
GetChallengeDeadline details

Inspect func

GetTurnDeadline

func(gameID int) int64

GetTurnDeadline returns the deadline unix timestamp for turn timeout

Open
OID
0af112…94af:44
GetTurnDeadline details

Inspect func

GetTurnChallengedBy

func(gameID int) .uverse.address
Open
OID
0af112…94af:45
GetTurnChallengedBy details

Inspect func

Game

type

Game represents an on-chain chess game session

Value

kewrchess.Game

NewGame

func(id int, white .uverse.address, black .uverse.address) *kewrchess.Game

NewGame initializes a new game with the standard chess starting layout

Open
OID
0af112…94af:48
NewGame details

Inspect func
ChallengeWindowSeconds : int64 =180
TurnTimeoutSeconds : int64 =120
getVerifiedCaller : func(caller .uverse.address) (.uverse.address, .uverse.error) Inspect
games : []*kewrchess.Game (len=1) Inspect
nextGameID : int =1
matchmakingQueue : [].uverse.address =<zero>
init.6 : func() Inspect
CreateGame : func(caller .uverse.address, opponent .uverse.address) .uverse.error Inspect
JoinQueue : func(caller .uverse.address) .uverse.error Inspect
LeaveQueue : func(caller .uverse.address) .uverse.error Inspect
makeMoveInternal : func(caller .uverse.address, gameID int, fromRow int, fromCol int, toRow int, toCol int, promoPiece string) .uverse.error Inspect
MakeMove : func(caller .uverse.address, gameID int, fromRow int, fromCol int, toRow int, toCol int) .uverse.error Inspect
MakeMovePromote : func(caller .uverse.address, gameID int, fromRow int, fromCol int, toRow int, toCol int, promoPiece string) .uverse.error Inspect
Resign : func(caller .uverse.address, gameID int) .uverse.error Inspect
OfferDraw : func(caller .uverse.address, gameID int) .uverse.error Inspect
AcceptDraw : func(caller .uverse.address, gameID int) .uverse.error Inspect
DeclineDraw : func(caller .uverse.address, gameID int) .uverse.error Inspect
ProposeSettlement : func(caller .uverse.address, gameID int, movesUCI string) .uverse.error Inspect
ConfirmSettlement : func(caller .uverse.address, gameID int) .uverse.error Inspect
FinalizeSettlement : func(caller .uverse.address, gameID int) .uverse.error Inspect
DisputeSettlement : func(caller .uverse.address, gameID int) .uverse.error Inspect
SettleGame : func(caller .uverse.address, gameID int, movesUCI string) .uverse.error Inspect
StartTurnTimer : func(caller .uverse.address, gameID int, currentMovesUCI string) .uverse.error Inspect
ClaimTimeout : func(caller .uverse.address, gameID int) .uverse.error Inspect
GetGamesCount : func() int Inspect
GetBoard : func(gameID int) [8][8]string Inspect
GetWhitePlayer : func(gameID int) .uverse.address Inspect
GetBlackPlayer : func(gameID int) .uverse.address Inspect
IsWhiteTurn : func(gameID int) bool Inspect
GetGameStatus : func(gameID int) string Inspect
GetDrawOfferedBy : func(gameID int) .uverse.address Inspect
GetResignedBy : func(gameID int) .uverse.address Inspect
GetQueueCount : func() int Inspect
IsInQueue : func(addr .uverse.address) bool Inspect
GetActiveGameForPlayer : func(addr .uverse.address) int Inspect
GetLatestGameForPlayer : func(addr .uverse.address) int Inspect
GetSettledBy : func(gameID int) .uverse.address Inspect
GetProposedBy : func(gameID int) .uverse.address Inspect
GetPendingStatus : func(gameID int) string Inspect
GetChallengeDeadline : func(gameID int) int64 Inspect
GetTurnDeadline : func(gameID int) int64 Inspect
GetTurnChallengedBy : func(gameID int) .uverse.address Inspect
Render : func(path string) string Inspect
Game : type =kewrchess.Game
NewGame : func(id int, white .uverse.address, black .uverse.address) *kewrchess.Game Inspect