Skip to content Search Apps Documentation Source Content Run Reset Eval Playground 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.

toolbox source realm

Package toolbox is the directory of moul's small gno.land utilities: one page listing every tool, each tool a realm o...

Readme View source

gno.land/r/moul/toolbox

A home for small utilities on gno.land. One page listing every tool; each tool is its own realm at r/moul/toolbox/<slug>.

A tool composes contracts that are already on chain and renders the answer, so you open a page instead of composing a query. The toolbox adds the view, not the data.

/r/moul/toolbox                  the directory
/r/moul/toolbox?tag=identity     the directory, filtered to one tag
/r/moul/toolbox:usernames        one tool

The catalog is compiled in, and that is the interesting part

The obvious design is the opposite one: each tool calls Register on this realm from its own init, and the directory assembles itself. That design is unavailable here, and the reason is not a preference.

private = true buys redeploy-in-place at the same path and costs the ability to be imported: the type checker refuses any realm importing a private one (ImportPrivateError). A private hub therefore cannot be imported by its tools, and a hub that accepts registration has to be public. A public realm can never be redeployed at its own path, so a public hub would be frozen at v0 and the first bug in it would move the directory's URL.

A stable URL is the whole point of a directory, so the trade goes the other way: everything here is private and redeployable, and adding a tool is one entry in tools plus a redeploy. The catalog is rebuilt from source every time, so the redeploy wipe costs nothing. There is no state to lose.

p/moul/toolbox's Catalog stays mutable for whoever wants the other trade.

And that is also why the path carries no /vN

/vN exists because a public path can never be redeployed, so a fix there means a new path. This realm is private and redeployable, so its version could never increment and the suffix would be a promise it cannot keep. The URL is the product here, bookmarked the way a blog post is, so it is the one that should not carry it. unversionedContracts in tools/gnocontracts/model.go is the allowlist, with the reason per entry.

Adding a tool

One entry in tools, then redeploy. buildCatalog panics at deploy, not at read, if the slug and the path disagree, so a copy-pasted entry that kept the wrong path fails the publish rather than shipping a dead link.

The read API

Flat strings, because a nested value inside a persisted object prints as an opaque ref(...) over vm/qeval:

1gnokey query vm/qeval -remote https://rpc.gno.land \
2  -data 'gno.land/r/moul/toolbox.Slugs()'
3gnokey query vm/qeval -remote https://rpc.gno.land \
4  -data 'gno.land/r/moul/toolbox.PathOf("usernames")'

Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

On mainnet: deployment status transactions unique callers deployed revision

Dependency graph:

gno.land/r/moul/toolbox dependency graph

⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.

Overview

Package toolbox is the directory of moul's small gno.land utilities: one page listing every tool, each tool a realm of its own at `r/moul/toolbox/<slug>`.

It holds no logic. A tool composes other contracts (resolve a username, read a DAO, decode a denom) and renders the answer; this realm only says which tools exist and where they are. The model, the rendering and the query-form builder are p/moul/toolbox(/p/moul/toolbox/v0).

Why the catalog is compiled in and not registered

The obvious design is the opposite one: each tool calls `Register` on this realm from its own init, and the directory assembles itself. That design is unavailable here, and the reason is worth stating because it is not a preference.

`private = true` buys redeploy-in-place at the same path and costs the ability to be imported: the type checker refuses any realm importing a private one (`ImportPrivateError`, `gnovm/pkg/gnolang/gotypecheck.go`). So a private hub cannot be imported by its tools, and a hub that accepts registration has to be public. A public realm can never be redeployed, which would freeze this path at v0 and move the directory's URL on the first bug in it.

A stable URL is the whole point of a directory, so the trade goes the other way: everything here is private and redeployable, and adding a tool is one entry in [tools] plus a redeploy. The catalog is rebuilt from source every time, so the redeploy wipe costs nothing: there is no state to lose.

p/moul/toolbox.Catalog stays mutable for whoever wants the other trade.

Functions 8

func DescOf

Action
1func DescOf(slug string) string
source

DescOf returns the one-line description of one tool, or "".

func Has

Action
1func Has(slug string) bool
source

Has reports whether a tool with that slug is listed.

func PathOf

Action
1func PathOf(slug string) string
source

PathOf returns the package path of one tool, or "" when there is no such tool. Flat strings rather than the struct: a nested value inside a persisted object prints as an opaque `ref(...)` over `vm/qeval`, so a read API that is meant to be queried returns scalars.

Example
1gnokey query vm/qeval -data 'gno.land/r/moul/toolbox.PathOf("usernames")'

func Render

1func Render(path string) string
source

Render routes gnoweb paths:

Example
1/                 the directory
2/?tag=identity    the directory, filtered to one tag
3/<slug>           one tool

func Slugs

Action
1func Slugs() []string
source

Slugs lists every tool's slug, in directory order.

Example
1gnokey query vm/qeval -data 'gno.land/r/moul/toolbox.Slugs()'

func Tags

Action
1func Tags() []string
source

Tags lists every tag any tool carries, each once.

func TitleOf

Action
1func TitleOf(slug string) string
source

TitleOf returns the human name of one tool, or "".

Dependencies

Source Files 6

Directories 1