Realm

avatar

gno.land/r/g17khqpukees4237dtn3astzapmp462vjhsz6st4/settlers/avatar

Render

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:

PathDescription
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:

import "gno.land/r/g17khqpukees4237dtn3astzapmp462vjhsz6st4/settlers/avatar"

func RenderUser(addr address) string {
	return avatar.Markdown(addr, 32, true) + " " + addr.String()
}

FunctionDescription
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:

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

Last Settlers

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

Transactions

No indexed transactions for this realm yet.

Calls, deploys, and child packages in indexed history.

Call function

Source (qfile)