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

v1 state

Back to all declarations

pet

type

pet is the persisted record for one owner's tamagotchi.

Value

v1.pet

pets

v0.Tree

// owner address string -> \*pet

Open
OID
0d598d…7f73:4
pets details

Inspect ref

clamp

func(v int, lo int, hi int) int
Open
OID
0d598d…7f73:5
clamp details

Inspect func

get

func(owner .uverse.address) (*v1.pet, bool)
Open
OID
0d598d…7f73:7
get details

Inspect func

project

func(p *v1.pet, height int64) (hunger int, happiness int, energy int, alive bool)

project computes display stats as of height without mutating the pet, so Render can show a live-looking view without writing state on a query.

Open
OID
0d598d…7f73:8
project details

Inspect func

ageStageName

func(born int64, height int64) string
Open
OID
0d598d…7f73:9
ageStageName details

Inspect func

requireLivingPet

func(owner .uverse.address, height int64) *v1.pet

requireLivingPet ticks and fetches the caller's pet, panicking with a friendly message if there is none or it has died.

Open
OID
0d598d…7f73:10
requireLivingPet details

Inspect func

hatch

func(owner .uverse.address, name string, height int64) string

hatch is the non-crossing core of Hatch, kept separate so unit tests can exercise its panics directly without going through a realm-crossing call.

Open
OID
0d598d…7f73:11
hatch details

Inspect func

Hatch

func(name string) string

Hatch creates a new pet for the caller. Lifetime feeds/plays/deaths carry over from any previous pet so the leaderboard tracks long-term care.

Open
OID
0d598d…7f73:12
Hatch details

Inspect func

feed

func(owner .uverse.address, height int64) string

feed is the non-crossing core of Feed.

Open
OID
0d598d…7f73:13
feed details

Inspect func

Feed

func() string

Feed reduces hunger and gives a small energy boost.

Open
OID
0d598d…7f73:14
Feed details

Inspect func

play

func(owner .uverse.address, height int64) string

play is the non-crossing core of Play.

Open
OID
0d598d…7f73:15
play details

Inspect func

Play

func() string

Play boosts happiness at the cost of energy and a bit of hunger. Refuses to run a tired pet into the ground — rest first.

Open
OID
0d598d…7f73:16
Play details

Inspect func

sleep

func(owner .uverse.address, height int64) string

sleep is the non-crossing core of Sleep.

Open
OID
0d598d…7f73:17
sleep details

Inspect func

Sleep

func() string

Sleep restores energy at the cost of a little hunger.

Open
OID
0d598d…7f73:18
Sleep details

Inspect func

byAliveThenOwner

type

byAliveThenOwner ranks living pets before dead ones, then orders each group by owner address so the leaderboard is fully deterministic.

Value

v1.byAliveThenOwner

renderCard

func(p *v1.pet, height int64) string
Open
OID
0d598d…7f73:20
renderCard details

Inspect func

Render

func(path string) string

Render shows either every pet ever hatched (path == "") or a single pet's detail card when path is a bech32 owner address.

Open
OID
0d598d…7f73:21
Render details

Inspect func
pet : type =v1.pet
pets : v0.Tree Inspect
clamp : func(v int, lo int, hi int) int Inspect
get : func(owner .uverse.address) (*v1.pet, bool) Inspect
project : func(p *v1.pet, height int64) (hunger int, happiness int, energy int, alive bool) Inspect
ageStageName : func(born int64, height int64) string Inspect
requireLivingPet : func(owner .uverse.address, height int64) *v1.pet Inspect
hatch : func(owner .uverse.address, name string, height int64) string Inspect
Hatch : func(name string) string Inspect
feed : func(owner .uverse.address, height int64) string Inspect
Feed : func() string Inspect
play : func(owner .uverse.address, height int64) string Inspect
Play : func() string Inspect
sleep : func(owner .uverse.address, height int64) string Inspect
Sleep : func() string Inspect
byAliveThenOwner : type =v1.byAliveThenOwner
bar : func(v int) string Inspect
renderCard : func(p *v1.pet, height int64) string Inspect
Render : func(path string) string Inspect