1package item23import (4 "net/url"5 "strconv"6 "strings"78 "gno.land/p/jeronimoalbi/pager/v0"9)1011func Render(iURL string) string {12 assertRenderURLLen(iURL)13 u, err := url.Parse(iURL)14 if err != nil {15 return renderItemError("Invalid URL")16 }1718 switch u.Path {19 case "":20 return renderItemHome()21 case "owner":22 return renderItemOwner(iURL, address(u.Query().Get("address")))23 default:24 return renderItemError("Not found")25 }26}2728func renderItemHome() string {29 return `# AKKADIA Item3031Look up fungible items held by an address.3233<gno-form path="owner">34 <gno-input name="address" placeholder="Enter the address" />35</gno-form>36`37}3839func renderItemOwner(iURL string, owner address) string {40 if !owner.IsValid() {41 return renderItemError("Invalid address")42 }4344 output := `# Item Holdings4546[← Home](./item:)4748* **Address**: ` + owner.String() + `49`5051 total := GetOwnedCount(owner)52 output += "* **Total**: " + strconv.Itoa(total) + "\n\n"53 if total == 0 {54 return output + `*No items held.*55`56 }5758 pageSize := 2059 if pageSize > listLimit {60 pageSize = listLimit61 }62 pages, err := pager.New(iURL, total, pager.WithPageSize(pageSize))63 if err != nil {64 return renderItemError("Invalid page")65 }6667 rows := ListByOwner(owner, pages.Page(), pages.PageSize())68 for _, row := range rows {69 output += "* **" + escapeItemMarkdown(row["tokenId"]) + "**: " + escapeItemMarkdown(row["amount"]) + "\n"70 }71 if pages.HasPages() {72 output += "\n" + pager.Picker(pages)73 }74 return output75}7677func renderItemError(message string) string {78 return `# Error7980> ` + escapeItemMarkdown(message) + `8182[← Home](./item:)83`84}8586func escapeItemMarkdown(value string) string {87 value = strings.ReplaceAll(value, "\\", "\\\\")88 value = strings.ReplaceAll(value, "\n", "\\n")89 value = strings.ReplaceAll(value, "`", "\\`")90 value = strings.ReplaceAll(value, "*", "\\*")91 value = strings.ReplaceAll(value, "_", "\\_")92 value = strings.ReplaceAll(value, "{", "\\{")93 value = strings.ReplaceAll(value, "}", "\\}")94 value = strings.ReplaceAll(value, "[", "\\[")95 value = strings.ReplaceAll(value, "]", "\\]")96 value = strings.ReplaceAll(value, "(", "\\(")97 value = strings.ReplaceAll(value, ")", "\\)")98 value = strings.ReplaceAll(value, "#", "\\#")99 value = strings.ReplaceAll(value, "+", "\\+")100 value = strings.ReplaceAll(value, "-", "\\-")101 value = strings.ReplaceAll(value, ".", "\\.")102 value = strings.ReplaceAll(value, "!", "\\!")103 value = strings.ReplaceAll(value, "|", "\\|")104 value = strings.ReplaceAll(value, ">", "\\>")105 return value106}107BalanceOf(owner string, tokenID string) int64
Burn(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}, from string, tokenID string, amount int64)
BurnFromRealm(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}, from string, tokenID string, amount int64)
GetListLimit() int
GetOwnedCount(owner string) int
IsApprovedForAll(owner string, operator string) bool
IsMinterRealm(addr string) bool
ListByOwner(owner string, page int, count int) []map[string]string
Render(iURL string) string
SafeMint(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}, recipient string, tokenID string, amount int64)
SafeMintFromRealm(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}, recipient string, tokenID string, amount int64)
SafeTransferFrom(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}, from string, to string, tokenID string, amount int64)
SetApprovalForAll(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}, operator string, approved bool)
SetListLimit(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}, limit int)
SetMinterRealm(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)
TotalSupply(tokenID string) int64
UnsetMinterRealm(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)
Uri() 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.