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

golf package

Overview

Package golf is the game realm: it keeps the holes, the players' rounds, the records and the rankings. Every hole is data (a GG1 string, p/…/course), never code: golf decodes it and plays it with p/…/physics. The owner publishes the course's holes into slots of a cup ("garden/7"), each publish a new version ("garden/7/v2"); once the owner opens publishing, anyone can publish a community hole ("<address>/<slug>/v1", PublishMine), playable and recorded but outside the course and its ranking.

Reads take a version's id or its alias ("garden/7", "<address>/<slug>"), its current version. Writes take the exact id only, as HoleState or Holes gave it: a round cannot be replayed on a version it was not played on.

Who can change what (in full on the hub page): the owner holds one power, the course itself: its holes (Publish), what the lists show (Hide), and whether anyone can publish (SetPublishing).

Function

Publish

func Publish(cur realm, slot, hexData, note string) string

Publish puts a course hole's data into its slot as its next version and returns the new id ("garden/7/v2"). Only the owner can. hexData is the hole as course.Encode wrote it, in hex. slot must be the data's own world and order ("garden/7", order 1 to 999), so a mis-edited file cannot replace the wrong hole; the course holds at most 9999 slots (maxCourse). Data identical to the current version's is refused. The version it replaces is archived: its records stay, its bests leave the course standings. note (at most 140 characters, cleaned) says why.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-alexiscolin000/gnogolf/golf" -func "Publish" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-alexiscolin000/gnogolf/golf" -func "Publish" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx