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

Settler avatars

This realm draws a Settler as a picture give an address.

It doesn't own the Settler, or store anything about it, it just looks one up and draws it, fresh, every time it's asked. That's on purpose, keeping the drawing separate from the main collection means any other realm or web app on Gno.land, a forum, a leaderboard, a profile page, can show a Settler next to an address without needing to understand pixel art, traits, or how any of it's put together.

The Settlers nft realm is still the one that actually mints the Settlers and keeps track of who owns what.

Realm paths:

Path Description
svg/{address} The SVG of the Settler of an address.
md/{address} The Markdown that Markdown returns for an address, rendered, with the same parameters.

From a realm

Call it directly from another realm, for example to show a Settler next to an address in your own Render function:

1import "gno.land/r/g17khqpukees4237dtn3astzapmp462vjhsz6st4/settlers/avatar"
2
3func RenderUser(addr address) string {
4	return avatar.Markdown(addr, 32, true) + " " + addr.String()
5}
6
Function Description
Markdown(addr, size, transparent) The image, or an empty text if there is none
SVG(addr, size, transparent) The SVG document, or an empty text if there is none
URI(addr, size, transparent) The same image as a data URI

The size is in pixels, from 32 to 2048, and 0 leaves it to the container. With transparent the image has no background. Every call draws the image again and costs gas (about 6 to 8 million), so use it in Render and not in a transaction.

From a web app

Ask the node for the page of an address, with vm/qrender, and use what it returns as an image: /r/g17khqpukees4237dtn3astzapmp462vjhsz6st4/settlers/avatar:svg/{address}?size=64&transparent=1. It is empty if the address has no Settler.

With gnokey, from a terminal, save it straight to a file:

1gnokey query vm/qrender \
2  -remote <remote> \
3  -data "gno.land/r/g17khqpukees4237dtn3astzapmp462vjhsz6st4/settlers/avatar:svg/{address}?size=256" \
4  | tail -n +2 | sed '1s/^data: //' > settler.svg
5

Last Settlers

Settler #32 g1a5l9gzm2d5zqjnmujs0mnallrpjysp42wz8zxg
Settler #31 g1u4msn6a7tnnes6yynnfm9evceeqsxec0u64t36
Settler #30 g12l0ns2c834uuq4q7wh4yh748sel8fgamsvnhv5
Settler #29 g1ycwf4ncrxzj8vynv8ejqvfx4mfy962phhsqq82
Settler #28 g1ayy8knfdhepp2rws2m8kq5jzjm67fsyl363kch
Settler #27 g15y2jy3uatqlavdmjkfr779dydgjqk43akfad8m