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 package

Functions

AcceptDraw

func AcceptDraw(caller address, gameID int) error

AcceptDraw accepts a draw offer from the opponent

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.AcceptDraw(,)"

Result

ClaimTimeout

func ClaimTimeout(caller address, gameID int) 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.

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.ClaimTimeout(,)"

Result

ConfirmSettlement

func ConfirmSettlement(caller address, gameID int) error

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

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.ConfirmSettlement(,)"

Result

CreateGame

func CreateGame(caller address, opponent address) error

CreateGame creates a new direct game challenge

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.CreateGame(,)"

Result

DeclineDraw

func DeclineDraw(caller address, gameID int) error

DeclineDraw declines a draw offer from the opponent

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.DeclineDraw(,)"

Result

DisputeSettlement

func DisputeSettlement(caller address, gameID int) error

DisputeSettlement allows opponent to dispute a fraudulent settlement proposal

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.DisputeSettlement(,)"

Result

FinalizeSettlement

func FinalizeSettlement(caller address, gameID int) error

FinalizeSettlement officially finalizes the game after the challenge period has passed

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.FinalizeSettlement(,)"

Result

GetActiveGameForPlayer

func GetActiveGameForPlayer(addr address) int

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.GetActiveGameForPlayer()"

Result

GetBoard

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

GetBoard returns the 8x8 board for a given game ID

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.GetBoard()"

Result

GetChallengeDeadline

func GetChallengeDeadline(gameID int) int64

GetChallengeDeadline returns the deadline unix timestamp for challenging settlement

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.GetChallengeDeadline()"

Result

GetGameStatus

func GetGameStatus(gameID int) string

GetGameStatus returns the game status for a given game ID

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.GetGameStatus()"

Result

GetGamesCount

func GetGamesCount() int

GetGamesCount returns the total number of games

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.GetGamesCount()"

Result

GetLatestGameForPlayer

func GetLatestGameForPlayer(addr address) int

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.GetLatestGameForPlayer()"

Result

GetPendingStatus

func GetPendingStatus(gameID int) string

GetPendingStatus returns the pending status of settlement

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.GetPendingStatus()"

Result

GetQueueCount

func GetQueueCount() int

GetQueueCount returns the number of players waiting in the matchmaking queue

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.GetQueueCount()"

Result

GetTurnDeadline

func GetTurnDeadline(gameID int) int64

GetTurnDeadline returns the deadline unix timestamp for turn timeout

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.GetTurnDeadline()"

Result

IsInQueue

func IsInQueue(addr address) bool

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.IsInQueue()"

Result

IsWhiteTurn

func IsWhiteTurn(gameID int) bool

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.IsWhiteTurn()"

Result

JoinQueue

func JoinQueue(caller address) 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.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.JoinQueue()"

Result

LeaveQueue

func LeaveQueue(caller address) error

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.LeaveQueue()"

Result

MakeMove

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

MakeMove moves a piece (defaults to Queen on promotion)

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.MakeMove(,,,,,)"

Result

MakeMovePromote

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

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

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.MakeMovePromote(,,,,,,)"

Result

OfferDraw

func OfferDraw(caller address, gameID int) error

OfferDraw offers a draw to the opponent

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.OfferDraw(,)"

Result

ProposeSettlement

func ProposeSettlement(caller address, gameID int, movesUCI string) 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.

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.ProposeSettlement(,,)"

Result

Render

func Render(path string) string

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.Render()"

Result

Resign

func Resign(caller address, gameID int) error

Resign resigns the game for the calling player

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.Resign(,)"

Result

SettleGame

func SettleGame(caller address, gameID int, movesUCI string) error

SettleGame proposes settlement and finalizes immediately if challenge window is 0

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.SettleGame(,,)"

Result

StartTurnTimer

func StartTurnTimer(caller address, gameID int, currentMovesUCI string) 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.

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.StartTurnTimer(,,)"

Result

NewGame

func NewGame(id int, white, black address) *Game

NewGame initializes a new game with the standard chess starting layout

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1g7dna0gp4nec5rza4q25htj0cjgswrxefp37ep/kewrchess.NewGame(,,)"

Result