Skip to content Search Apps Documentation Source Content Run Reset Eval Playground 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.

usernames package

Overview

Package usernames is the toolbox tool for gno.land identities: it turns a username into an address, an address into a username, and tells you which of the two you are actually holding.

It is the page form of

Example
1gnokey query vm/qeval --data 'gno.land/r/sys/users.ResolveName("akkadia")' -remote https://rpc.gno.land

with the three things that query does not tell you: whether the name you asked about is the user's CURRENT name or an alias they renamed away from, what canonical key it collapses to, and whether a lookalike of it is already taken.

Why not r/sys/users.ResolveAny

`ResolveAny` returns `(*UserData, bool)` and the bool does not mean "found". For an input that parses as an address it returns `(ResolveAddress(addr), true)` whatever the lookup produced, so an unregistered address comes back as `(nil, true)`. Every caller that reads the bool and dereferences the pointer panics on the first address nobody claimed. [lookup] branches on the input itself and checks the pointer instead.

Part of r/moul/toolbox(/r/moul/toolbox).

Function

NameOf

func NameOf(input string) string
Ask AI Claude ChatGPT

NameOf returns the current username behind a username or an address, or "" when nobody holds it.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/toolbox/usernames.NameOf()"

Result

Gno Expression Evaluator

Evaluate any read-only Gno expression against gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/toolbox/usernames, for example a function call with arguments.