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

releases/v0 package

Overview

Package releases is the registry every version of a project asks "am I the latest, and if not, what am I allowed to do?".

It stores one p/moul/releases Project per name, each owned by the address that opened it, and serves each one's stage homepage at its render path: /r/moul/releases/v0:<project>. The library is gno.land/p/moul/releases/v0; this realm is its state and its demo.

The integration, in a version

Example
1import (
2	"chain/runtime/unsafe"
3	reg "gno.land/r/moul/releases/v0"
4)
5
6var self = unsafe.CurrentRealm().PkgPath() // computed once, at init
7
8func Render(path string) string { return reg.Banner("myproject", self) + body(path) }
9func Post(cur realm, s string) { reg.AssertWritable("myproject", self); … }

The getters take no realm, so a version calls them without crossing. Every lookup is scoped by project name, which the version hard-codes: a path is only ever judged by the project that names it, so nobody can pause someone else's realm by listing its path as yanked in a project of their own.

Functions

AddRelease

func AddRelease(cur realm, project, version, pkgPath, url, notes, status string)

AddRelease lists a version. status is a word: draft, prerelease, supported, deprecated, yanked or vulnerable.

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/releases/v0" -func "AddRelease" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "tcp://127.0.0.1:18899" ADDRESSgnokey query -remote "tcp://127.0.0.1:18899" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/releases/v0" -func "AddRelease" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "tcp://127.0.0.1:18899" call.tx
  

AssertWritable

func AssertWritable(project, pkgPath string)

AssertWritable aborts unless the release at pkgPath still accepts writes: it is not yanked, not vulnerable, and not past a deprecation sunset.

Params

Command

gnokey query vm/qeval -remote "tcp://127.0.0.1:18899" -data "gno.land/r/moul/releases/v0.AssertWritable(,)"

Result

Banner

func Banner(project, pkgPath string) string

Banner is the markdown the release at pkgPath prepends to its Render: "" for the latest or an unlisted path, a one-paragraph notice otherwise.

Params

Command

gnokey query vm/qeval -remote "tcp://127.0.0.1:18899" -data "gno.land/r/moul/releases/v0.Banner(,)"

Result

Deprecate

func Deprecate(cur realm, project, version, reason string, sunset int64)

Deprecate marks a version deprecated: it keeps working, with a banner, until block height sunset, and is read-only from then on. 0 is never.

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/releases/v0" -func "Deprecate" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "tcp://127.0.0.1:18899" ADDRESSgnokey query -remote "tcp://127.0.0.1:18899" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/releases/v0" -func "Deprecate" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "tcp://127.0.0.1:18899" call.tx
  

IsLatest

func IsLatest(project, pkgPath string) bool

IsLatest reports whether pkgPath is project's latest supported release.

Params

Command

gnokey query vm/qeval -remote "tcp://127.0.0.1:18899" -data "gno.land/r/moul/releases/v0.IsLatest(,)"

Result

Latest

func Latest(project string) (version, pkgPath string, ok bool)

Latest returns project's latest supported release.

Param

Command

gnokey query vm/qeval -remote "tcp://127.0.0.1:18899" -data "gno.land/r/moul/releases/v0.Latest()"

Result

NewProject

func NewProject(cur realm, name, description string)

NewProject opens a project owned by the caller. First come, first served: a name is taken for good, which is why a version names its project in code before it ships.

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/releases/v0" -func "NewProject" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "tcp://127.0.0.1:18899" ADDRESSgnokey query -remote "tcp://127.0.0.1:18899" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/releases/v0" -func "NewProject" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "tcp://127.0.0.1:18899" call.tx
  

Render

func Render(path string) string

Render serves the index of projects at "", a project's stage homepage at "<project>", and one release at "<project>/<version>". Every owner string is escaped by the library, which is where the markdown is built.

Param

Command

gnokey query vm/qeval -remote "tcp://127.0.0.1:18899" -data "gno.land/r/moul/releases/v0.Render()"

Result

SetDescription

func SetDescription(cur realm, project, description string)

SetDescription replaces a project's one-line description.

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/releases/v0" -func "SetDescription" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "tcp://127.0.0.1:18899" ADDRESSgnokey query -remote "tcp://127.0.0.1:18899" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/releases/v0" -func "SetDescription" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "tcp://127.0.0.1:18899" call.tx
  

SetStatus

func SetStatus(cur realm, project, version, status, reason string)

SetStatus moves a version to a status word, with the reason readers see.

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/releases/v0" -func "SetStatus" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "tcp://127.0.0.1:18899" ADDRESSgnokey query -remote "tcp://127.0.0.1:18899" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/releases/v0" -func "SetStatus" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "tcp://127.0.0.1:18899" call.tx
  

SetSuccessor

func SetSuccessor(cur realm, project, version, successor string)

SetSuccessor sends readers of version to successor instead of to Latest.

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/releases/v0" -func "SetSuccessor" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "tcp://127.0.0.1:18899" ADDRESSgnokey query -remote "tcp://127.0.0.1:18899" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/releases/v0" -func "SetSuccessor" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "tcp://127.0.0.1:18899" call.tx
  

StageURL

func StageURL(project string) string

StageURL is the link to a project's stage homepage.

Param

Command

gnokey query vm/qeval -remote "tcp://127.0.0.1:18899" -data "gno.land/r/moul/releases/v0.StageURL()"

Result

State

func State(project, pkgPath string) pausable.State

State is the pause state the release at pkgPath is in at the current block, the zero (running) State when it is not listed.

Params

Command

gnokey query vm/qeval -remote "tcp://127.0.0.1:18899" -data "gno.land/r/moul/releases/v0.State(,)"

Result

Status

func Status(project, pkgPath string) (rel.Status, bool)

Status is what project says about the release at pkgPath, with Latest computed. ok is false when the project or the path is not listed.

Params

Command

gnokey query vm/qeval -remote "tcp://127.0.0.1:18899" -data "gno.land/r/moul/releases/v0.Status(,)"

Result

TransferProject

func TransferProject(cur realm, project string, to address)

TransferProject hands a project to another address.

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/releases/v0" -func "TransferProject" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "tcp://127.0.0.1:18899" ADDRESSgnokey query -remote "tcp://127.0.0.1:18899" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/releases/v0" -func "TransferProject" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "tcp://127.0.0.1:18899" call.tx
  

Yank

func Yank(cur realm, project, version, reason string)

Yank withdraws a version for good. It stays listed and accepts nothing.

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/releases/v0" -func "Yank" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "tcp://127.0.0.1:18899" ADDRESSgnokey query -remote "tcp://127.0.0.1:18899" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/releases/v0" -func "Yank" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "tcp://127.0.0.1:18899" call.tx
  

Gno Expression Evaluator

Evaluate any read-only Gno expression against gno.land/r/moul/releases/v0, for example a function call with arguments.