Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

name.gno

0.94 Kb · 39 lines
 1// Package agentid is the Agent ID name standard.
 2//
 3// A registry realm stores which wallet owns a name. This package only
 4// decides which strings are names. The display suffix is not part of the
 5// on-chain key.
 6package agentid
 7
 8const (
 9	// MinLen is the shortest claimable name.
10	MinLen = 3
11	// MaxLen is the longest claimable name.
12	MaxLen = 15
13	// Suffix is the label shown to people. Claim and Pay use the bare name.
14	Suffix = ".agent"
15)
16
17// Valid reports whether name is 3–15 lowercase letters or digits.
18func Valid(name string) bool {
19	if len(name) < MinLen || len(name) > MaxLen {
20		return false
21	}
22	for i := 0; i < len(name); i++ {
23		c := name[i]
24		if (c < 'a' || c > 'z') && (c < '0' || c > '9') {
25			return false
26		}
27	}
28	return true
29}
30
31// Reserved reports whether name is held back from claims.
32func Reserved(name string) bool {
33	switch name {
34	case "gno", "admin", "root", "sys", "system", "ugnot":
35		return true
36	default:
37		return false
38	}
39}