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/moul.

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) and embedding the result as the profile body. There is no version resolution in that lookup, which is why this realm (alone in this repo) carries no /vN suffix: the bare path IS the interface with gnoweb, and gno.land/r/moul/home/v0 would never be found.

Slots

The page is not hard-coded. It is assembled from SLOTS: named markdown fragments in an avl tree, each written by its own Set call, so updating one paragraph is one small transaction instead of a redeploy.

The layout is itself a slot ("layout"), so the shape of the page (headings, order, what appears at all) changes without touching the code. p/moul/dynreplacer fills every :slug: placeholder found in the layout, lazily: a slot whose placeholder is absent from the layout costs nothing to render.

Substitution is SINGLE-PASS and non-recursive. A placeholder inside a slot body is left alone, so no slot can expand into another and no cycle exists. Two registered placeholders can never be prefixes of one another either (every one is :slug: and a slug may not contain ':'), so the result does not depend on registration order.

A placeholder with no matching slot survives into the output verbatim. That is deliberate: a missing section should be visible, not silently blank.

Versioning

gnomod.toml declares private = true, which lets the creator re-add the package at this path. That redeploy re-runs init() and RESETS everything here, so the markdown under content/ is the source of truth and tools/gnohome pushes the slots back afterwards. The intended path is that this never happens: slots cover content, and the layout slot covers presentation.

Functions

Append

func Append(cur realm, slug, body string)

Append adds to the end of a slot, creating it when absent. It exists for content too large to fit in one transaction: Set the first chunk, Append the rest. Ordinary updates should use Set, which is idempotent.

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/moul/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/moul/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
  

Delete

func Delete(cur realm, slug string)

Delete removes a slot. Deleting the layout slot restores the built-in 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/moul/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/moul/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
  

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/moul/home.Get()"

Result

Manifest

func Manifest() string

Manifest returns one tab-separated line per slot:

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

It is the diff surface tools/gnohome queries with vm/qeval: one read 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/moul/home.Manifest()"

Result

Render

func Render(path string) string

Render serves three views:

Example
1""            the assembled page, what https://gno.land/u/moul shows
2"slots"       the slot index: name, size, revision, last write
3"slots/<slug>" one slot's raw markdown, fenced

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/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/moul/home.Revision()"

Result

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. Passing the 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/moul/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/moul/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