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

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

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

Param

Command

gnokey query vm/qeval -remote "https://gno-staging.moul.p2p.team" -data "gno.land/r/moul/toolbox/usernames.NameOf()"

Result