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

Resolve

func Resolve(input string) (name string, addr string, found bool)

Resolve returns the current username and the address behind any input, a username or a `g1` address.

found is false when nobody holds it, which is also the answer for a deleted user: `r/sys/users` keeps the tombstone and resolves it to nothing.

Example
1gnokey query vm/qeval -data 'gno.land/r/moul/toolbox/usernames.Resolve("moul")'

Param

Command

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

Result