PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/akkadia/beta/lotto

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
lotto
Namespace
akkadia / beta
Files
7 (gnomod.toml)
Exported functions
5
Module
gno.land/r/akkadia/beta/lotto
gno
0.9

Files (7)

  • gnomod.tomltoml
  • lotto.gnogno
  • render.gnogno
  • validation.gnogno
  • lotto_test.gnogno
  • render_test.gnogno
  • setup_test.gnogno
render.gnogno
1package lotto23import (4	"net/url"5	"strconv"6)78func Render(path string) string {9	output := `# AKKADIA Lotto1011Look up owners and their quantities for a number.1213<gno-form path="number">14  <gno-input name="number" placeholder="Enter a number" />15</gno-form>1617`18	u, err := url.Parse(path)19	if err != nil {20		return output + "Invalid URL\n"21	}22	query, err := url.ParseQuery(u.RawQuery)23	if err != nil {24		return output + "Invalid query\n"25	}26	switch u.Path {27	case "":28		return output29	case "number":30		raw := query.Get("number")31		if raw == "" {32			return output + "Number is required\n"33		}34		number, err := strconv.ParseUint(raw, 10, 64)35		if err != nil {36			return output + "Invalid number\n"37		}38		afterOwner := query.Get("afterOwner")39		if afterOwner != "" && !address(afterOwner).IsValid() {40			return output + "Invalid cursor address\n"41		}42		numberStr := strconv.FormatUint(number, 10)43		page := ListOwnersByNumber(number, afterOwner, 20)44		output += "## Number " + numberStr + "\n\n"45		output += "[Home](./lotto:)\n\n"46		if afterOwner != "" {47			output += "[First page](./lotto:number?number=" + numberStr + ")\n\n"48		}49		if len(page) == 0 {50			return output + "No owners on this page.\n"51		}52		output += "| Owner | Count |\n| --- | ---: |\n"53		for _, item := range page {54			// Owners are validated addresses and counts are formatted integers.55			output += "| " + item["owner"] + " | " + item["count"] + " |\n"56		}57		if page[0]["nextOwner"] != "" {58			output += "\n[Next](./lotto:number?number=" + numberStr + "&afterOwner=" + url.QueryEscape(page[0]["nextOwner"]) + ")\n"59		}60		return output61	default:62		return output + "Page not found\n"63	}64}65

Functions

  • AddNumber(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}, owner string, number uint64)

  • DeleteAll(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})

  • GetNumberCount(number uint64, owner string) uint64

  • ListOwnersByNumber(number uint64, afterOwner string, limit int) []map[string]string

  • Render(path string) string

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

Rendered

RenderedRawgnoweb ↗

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.