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

guilds package

Overview

Package guilds records which Discord server a court's moderators chose.

WHY A SEPARATE REALM. kourtv2 is deployed and knows nothing about Discord, and a realm on chain is not edited — adding a field there means a new realm and a migration for every court that exists. This holds one string per court and asks kourtv2 who may set it, so the court's own moderator list stays the only authority and this file never has one of its own.

WHY IT EXISTS AT ALL, when the service could verify a signed message and did. It could, and the signature had to be made at a terminal, because a wallet signs TRANSACTIONS and not arbitrary strings. So the last step of standing up a court's Discord server was a command nobody would ever discover, and the court page said so and stopped. A realm call IS a transaction, which is exactly what a wallet already does — the same button every other action on the page uses.

WHAT IT DOES NOT DO. It does not check that the guild exists, that the bot is in it, or that anybody can join it. Those are the service's to know and it already does; this records a CHOICE, made by an address the court recognises, at a height anybody can read back. A guild id here with no bot behind it is a court pointing at nothing, which is visible rather than dangerous.

Functions

Chosen

func Chosen(courtSlug string) (guildID, by string)

Chosen is the whole record: the server, and the address that chose it.

ONE READ AND NOT TWO, and this exists for that reason alone. kourt.xyz asks both questions together and acts on the pair — it publishes the guild AND records the setter as who signed for it — and two qeval calls can straddle a change. A moderator re-aiming the binding between them hands one decision's guild to another decision's signer, which is then written into the site's database as fact. A pair that cannot be read atomically should not be read as a pair.

BOTH EMPTY OR NEITHER. A court that never chose answers ("", ""), which is the commonest answer and is not an error.

THE SETTER IS WHO ASKED, NOT WHO MODERATES NOW. A court that replaces its moderators does not change this — the choice was made by whoever made it, and rewriting that would destroy the only record of who did. Whether they STILL moderate is a separate question, and kourtv2 is the one to ask it.

STRINGS AND NOT AN address, because the caller is a machine reading qeval's printed output: an address prints as `("g1…" .uverse.address)` and a string as `("g1…" string)`, and the second is the one a parser can hold to.

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/guilds.Chosen()"

Result

Courts

func Courts() []string

Courts lists every court that has chosen a server, in slug order — so the service can reconcile the whole set without knowing what to ask for.

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/guilds.Courts()"

Result

GuildOf

func GuildOf(courtSlug string) string

GuildOf is the court's chosen server, or "" if it has none. Never panics: the service asks this about every court it knows, including ones that never chose.

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/guilds.GuildOf()"

Result

Render

func Render(path string) string

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/guilds.Render()"

Result

Set

func Set(cur realm, courtSlug, guildID string)

Set records the guild for a court, or clears it when guildID is empty.

THE CALLER IS THE MODERATOR, NOT THIS REALM. cur.Previous().Address() is who asked, and kourt.IsCourtMod is the only thing consulted — so a moderator removed by the court loses this at the same moment, with no state here to keep in step. IsCourtMod panics on a court that does not exist, which is the answer we want: there is nothing to bind.

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/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/guilds" -func "Set" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/guilds" -func "Set" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx