1package registry23import (4 pm "gno.land/p/moul/gnopm/v0"5 "gno.land/p/nt/testutils/v0"6)78// Deterministic, checksum-valid test addresses. Made rather than typed: the9// address-namespace rule turns on the bech32 alphabet, which drops 1, b, i and10// o, so a plausible-looking hand-written "g1..." fails the check for a reason11// that has nothing to do with what is under test.12var (13 alice = testutils.TestAddress("alice")14 bob = testutils.TestAddress("bob")1516 // alicePkg sits in alice's OWN address namespace, which is the only17 // ownership a test can create: r/sys/users is not writable from a unit18 // test, so a name namespace can never resolve to a test account.19 alicePkg = "gno.land/r/" + alice.String() + "/scratch/v0"20)2122const (23 repoURL = "https://github.com/moul/gno-contracts"24 sha1Zero = "0000000000000000000000000000000000000000"25 sha1One = "1111111111111111111111111111111111111111"26 otherPkg = "gno.land/p/moul/md/v1"27)2829// reset puts the realm back to its initial state. Realm globals persist for the30// whole test binary and examples run after every Test, so anything that renders31// starts from a known tree or its pinned output silently depends on test order.32func reset() { reg = pm.New() }3334// seedFixture builds a deterministic registry straight through the library: no35// chain context needed, which is what lets an Example use it. Going through the36// library rather than through Register also skips the crossing call, which an37// example cannot make.38func seedFixture() {39 reset()40 reg.Register(alice, 100, alicePkg, repoURL, sha1Zero, "scratch", "refs/tags/v0.1.0")41 reg.Register(bob, 110, alicePkg, "https://github.com/bob/impostor", sha1One, "", "")42 reg.Register(alice, 120, otherPkg, repoURL, sha1One, "p/moul/md", "")43}44ClaimCount() int
HasClaims(pkgPath string) bool
OwnerClaim(pkgPath string) (repo string, commit string, dir string, ok bool)
PackageCount() int
Register(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, pkgPath string, repo string, commit string, dir string, ref string)
Render(path string) string
Withdraw(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, pkgPath string)
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.