1package skins23// The string rules below are what makes the hand-built JSON and the markdown4// of this realm safe: every string that is stored and later printed went5// through one of them, and none of them lets a quote, a backslash, a pipe, a6// bracket or a control character in.78const (9 maxIDLen = 3210 maxModelLen = 1611 maxNameLen = 4012)1314// validID reports whether s matches [a-z0-9-]{1,32}.15func validID(s string) bool {16 return isSlug(s, maxIDLen)17}1819// validModel reports whether s matches [a-z0-9-]{1,16}.20func validModel(s string) bool {21 return isSlug(s, maxModelLen)22}2324// validName reports whether s matches [A-Za-z0-9 '.!-]{1,40}. The charset is25// deliberately narrow so that a name can be embedded in JSON and markdown26// without escaping.27func validName(s string) bool {28 if len(s) == 0 || len(s) > maxNameLen {29 return false30 }31 for i := 0; i < len(s); i++ {32 c := s[i]33 switch {34 case c >= 'a' && c <= 'z', c >= 'A' && c <= 'Z', c >= '0' && c <= '9':35 case c == ' ', c == '\'', c == '.', c == '!', c == '-':36 default:37 return false38 }39 }40 return true41}4243// validColor reports whether s is "#rrggbb" with lowercase hex digits.44func validColor(s string) bool {45 if len(s) != 7 || s[0] != '#' {46 return false47 }48 for i := 1; i < len(s); i++ {49 c := s[i]50 if !(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f') {51 return false52 }53 }54 return true55}5657// validAddress reports whether addr is a valid address in its canonical,58// lowercase form.59//60// Bech32 can also be written in all capitals, and address.IsValid accepts61// that. To this realm the capitals would be a second key for the same62// account: a second player record, a second line on a leaderboard, an admin63// who can never be matched to a caller. Bech32 does not allow mixing cases,64// so looking at the first character is enough.65func validAddress(addr address) bool {66 return addr.IsValid() && addr[0] == 'g'67}6869// isSlug reports whether s is 1 to max characters of [a-z0-9-].70func isSlug(s string, max int) bool {71 if len(s) == 0 || len(s) > max {72 return false73 }74 for i := 0; i < len(s); i++ {75 c := s[i]76 if !(c >= 'a' && c <= 'z') && !(c >= '0' && c <= '9') && c != '-' {77 return false78 }79 }80 return true81}82BalanceOf(addr string) (int64, interface {Error func() string})
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}, id int64)
Buy(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}, skinID string) int64
CatalogJSON() string
OwnerOf(tid string) (string, interface {Error func() string})
Render(path string) string
SetSkin(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}, id string, name string, model string, pilot string, body string, wing string, accent string, price int64, maxSupply int64)
SetSkinListed(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}, id string, listed bool)
SkinOf(id int64) string
SkinsOf(addr string) string
TokenMetadata(tid string) (string, interface {Error func() string})
TokenURI(tid string) (string, interface {Error func() 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.