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

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

devtools/v0 package

Overview

Package devtools is the worked example of wiring moul's developer packages into one realm: what a new realm should copy.

Everything here is a COMBINATION. Any one of these packages has its own demo showing it alone; the thing that is hard to find is what they look like used together, which is the only form a real realm ever meets them in. So this realm imports ten of them and every one earns its place in the output:

Example
 1r/moul/config     the notice block, the pause switch, the explorer to link
 2p/moul/mygnoscan  the explorer routes themselves
 3p/moul/debug      a metadata panel behind ?debug=1
 4p/moul/realmpath  reading the query string Render was handed
 5p/moul/kit/ui     escaping what a caller typed, and the tables
 6p/moul/md         the markdown, without hand-rolled strings
 7p/moul/txlink     the "call this function" link
 8p/moul/fifo       the bounded note list, so the state cannot grow forever
 9p/moul/kit/tally  the note leaderboard, ties ordered rather than arbitrary
10p/moul/kit/num    pricing that list in GNOT rather than raw ugnot

The three lines worth copying

A realm that does nothing else should still do these:

Example
1func Render(path string) string {
2	return config.TopBlockFor(realmPath) + body + config.BottomBlockFor(realmPath)
3}
4
5func Mutate(cur realm, s string) {
6	config.AssertWritableFor(realmPath)  // honours the pause switch
7	notes.Append(ui.Inline(s))           // escapes what a caller typed
8}

The first gives every realm a place to put a warning and a pause banner without shipping banner code. The second is two separate guards that both have to be there: the pause one so an incident can stop writes from outside the realm, and the escaping one because a string a caller typed is the oldest way to break a page.

Function

Reset

func Reset(cur realm)
Ask AI Claude ChatGPT

Reset empties the list, so the realm can be put back to a known state without a redeploy. Not gated by the pause switch: clearing up is the thing you still want to do while paused.

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/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/x/allinone/devtools/v0" -func "Reset" -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/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/x/allinone/devtools/v0" -func "Reset" -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