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

home package

Overview

Package home is the realm behind https://gno.land/u/clockwork.

gnoweb builds a user profile page by calling Render("") on the realm at the exact path /r/<username>/home (gno.land/pkg/gnoweb/handler_http.go, GetUserView). That lookup does no version resolution, so this path is the interface with gnoweb and can never carry a /vN suffix. Everything that might want to change therefore lives behind the path, in four layers:

  1. CONTENT is data. The page is assembled from SLOTS: named markdown fragments in an avl tree, each written by its own Set call. Updating one paragraph is one small transaction.
  2. LAYOUT is data. The slot named "layout" is the page template; every :slug: placeholder in it is filled from the slot of that name.
  3. STYLE is data. Slots under the "style." prefix are knobs (colors, header mode) that the theme reads. Changing the accent color is a Set.
  4. RENDERING is code, but replaceable. A THEME is a separate realm nested under this one that implements Theme and registers itself from its own init. The authority accepts it through p/clockwork/upgradeable and can roll it back. The slots never move: an upgrade replaces the code that reads them, not the data. When no theme is live the built-in renderer in render.gno serves the page, and the operator views (system, slots, edit, manifest) are always served by this realm, so a theme that panics can be rolled back from the page it cannot break.

This realm holds state and forwards. It is deliberately small, because it is the one piece that can never be redeployed: it is importable by its themes, so it cannot be private, so AddPackage refuses a second deploy.

Functions

Accept

func Accept(cur realm, pkgPath string)

Accept makes the candidate at pkgPath the live theme. Authority only.

Param

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Accept" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Accept" -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 "https://rpc.gno.land" call.tx
  

Append

func Append(cur realm, slug, body string)

Append adds to the end of a slot, creating it when absent. It exists for a body too large for one transaction: Set the first chunk, Append the rest.

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Append" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Append" -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 "https://rpc.gno.land" call.tx
  

Authority

func Authority() string

Authority returns a human-readable description of who may write and upgrade.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Authority()"

Result

Delete

func Delete(cur realm, slug string)

Delete removes a slot. Deleting the layout slot restores the theme's default layout.

Param

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Delete" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Delete" -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 "https://rpc.gno.land" call.tx
  

Each

func Each(fn func(slug string, s Slot) bool)

Each visits every slot in name order until fn returns true.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Each()"

Result

Fallback

func Fallback(path string) string

Fallback is the built-in renderer. Render routes the operator views here directly, and themes delegate to it for every other path they do not draw themselves, so these views exist under any theme:

Example
1""             the assembled page: the layout slot filled from the slots
2"slots"        the slot index: name, size, revision, height of last write
3"slots/<slug>" one slot's raw markdown, fenced
4"edit"         forms that write slots (they build the gnokey command)
5"edit/<slug>"  the same, prefilled with one slot
6"system"       who may write, which theme is live, pending, history
7"manifest"     Manifest() as plain text, for scripts

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Fallback()"

Result

Forget

func Forget(cur realm)

Forget drops the rollback history and the storage it holds. Authority only.

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Forget" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Forget" -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 "https://rpc.gno.land" call.tx
  

Freeze

func Freeze(cur realm)

Freeze ends theme upgrades permanently. Slots stay editable. Authority only, and there is no way back.

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Freeze" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Freeze" -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 "https://rpc.gno.land" call.tx
  

Frozen

func Frozen() bool

Frozen reports whether theme upgrades have ended.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Frozen()"

Result

Get

func Get(slug string) string

Get returns a slot body, or "" when the slot does not exist.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Get()"

Result

Has

func Has(slug string) bool

Has reports whether a slot exists, empty or not.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Has()"

Result

HistoryPaths

func HistoryPaths() []string

HistoryPaths returns the themes this realm has already served, oldest first, excluding the live one.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.HistoryPaths()"

Result

LastHeight

func LastHeight() int64

LastHeight returns the block height of the most recent write, or 0.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.LastHeight()"

Result

Layout

func Layout() string

Layout returns the layout slot, or "" when none has been set. Themes substitute their own default in that case.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Layout()"

Result

func Link(sub string) string

Link returns the gnoweb path of a render path on this realm: Link("") is "/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home", Link("slots") is "/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home:slots".

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Link()"

Result

LivePath

func LivePath() string

LivePath returns the realm path of the theme currently serving, or "".

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.LivePath()"

Result

Manifest

func Manifest() string

Manifest returns one tab-separated line per slot:

Example
1<slug>\t<rev>\t<bytes>\t<sha256 of body, hex>

It is the diff surface scripts/sync.sh reads: one query tells it exactly which local file is out of date, without downloading any body.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Manifest()"

Result

Path

func Path() string

Path returns this realm's package path, e.g. "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home".

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Path()"

Result

PendingPaths

func PendingPaths() []string

PendingPaths returns the candidate theme paths awaiting acceptance.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.PendingPaths()"

Result

Register

func Register(cur realm, t Theme)

Register records the calling realm's theme as a candidate. The path filed is read off the crossing frame, never taken as an argument, so a candidate cannot claim to live somewhere it does not. Only realms nested under this one are admitted; a direct user call is refused.

Param

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Register" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Register" -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 "https://rpc.gno.land" call.tx
  

Render

func Render(path string) string

Render is what gnoweb calls.

The operator views (system, slots, edit, manifest) are always served here, never through the theme: a panic inside a foreign realm's code aborts the whole call and cannot be recovered from this side, so a theme that panics takes the page down until it is rolled back. These views are what the rollback is done from, and the routing keeps them out of the theme's reach. Every other path, the page itself included, goes to the live theme, or to the built-in renderer when none is accepted.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Render()"

Result

Revision

func Revision() int

Revision returns the total number of writes this realm has accepted. It changes on every mutation, so a client can cheaply tell "nothing moved".

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Revision()"

Result

Rollback

func Rollback(cur realm)

Rollback restores the previous theme and returns the current one to the pending set. Authority only.

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Rollback" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Rollback" -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 "https://rpc.gno.land" call.tx
  

Set

func Set(cur realm, slug, body string)

Set creates or replaces the slot named slug. This is the ordinary update: one slot, one transaction. An empty body keeps the slot but empties it; use Delete to remove it.

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Set" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -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 "https://rpc.gno.land" call.tx
  

Slugs

func Slugs() []string

Slugs returns every slot name, sorted.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Slugs()"

Result

Style

func Style(key, fallback string) string

Style returns the style knob named key (the slot "style."+key), or fallback when it is absent or empty.

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Style(,)"

Result

TransferAuthority

func TransferAuthority(cur realm, to address)

TransferAuthority hands both editing and upgrading to another address.

Param

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "TransferAuthority" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "TransferAuthority" -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 "https://rpc.gno.land" call.tx
  

Withdraw

func Withdraw(cur realm, pkgPath string)

Withdraw drops a candidate. Authority only, except that a theme realm may always drop its own.

Param

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/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Withdraw" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home" -func "Withdraw" -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 "https://rpc.gno.land" call.tx
  

NewFiller

func NewFiller() *Filler

NewFiller returns a Filler with every slot and every computed placeholder registered. A theme adds its own widgets with Add before calling Fill.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.NewFiller()"

Result

Lookup

func Lookup(slug string) (Slot, bool)

Lookup returns a copy of a slot and whether it exists.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/home.Lookup()"

Result