1package craft23import (4 "chain"5 "chain/banker"6 "testing"78 "gno.land/p/nt/testutils/v0"9 "gno.land/r/akkadia/beta/admin"10 "gno.land/r/akkadia/beta/equipment"11 "gno.land/r/akkadia/beta/item"12)1314var craftTest = struct {15 Admin, Owner, Other, FeeCollector, PkgAddr address16 SetupDone bool17}{18 Admin: testutils.TestAddress("craftAdmin"),19 Owner: testutils.TestAddress("craftOwner"),20 Other: testutils.TestAddress("craftOther"),21 FeeCollector: testutils.TestAddress("craftFeeCollector"),22 PkgAddr: chain.PackageAddress("gno.land/r/akkadia/beta/craft"),23}2425func setupCraftTest(cur realm, t *testing.T) {26 t.Helper()27 resetCraftState()28 testing.SetOriginSend(chain.Coins{})29 if !craftTest.SetupDone {30 originalAdmin := admin.GetAdmin()31 testing.SetOriginCaller(originalAdmin)32 testing.SetRealm(testing.NewUserRealm(originalAdmin))33 admin.TransferAdmin(cross(cur), craftTest.Admin)34 testing.SetOriginCaller(craftTest.Admin)35 testing.SetRealm(testing.NewUserRealm(craftTest.Admin))36 admin.AcceptAdmin(cross(cur))37 admin.SetFeeCollector(cross(cur), craftTest.FeeCollector)38 craftTest.SetupDone = true39 }4041 testing.SetOriginCaller(craftTest.Admin)42 testing.SetRealm(testing.NewUserRealm(craftTest.Admin))43 item.SetMinterRealm(cross(cur), "gno.land/r/akkadia/beta/craft")44 equipment.SetMinterRealm(cross(cur), "gno.land/r/akkadia/beta/craft")45}4647func mintCraftItem(cur realm, tokenID string, amount int64) {48 testing.SetOriginCaller(craftTest.Admin)49 testing.SetRealm(testing.NewUserRealm(craftTest.Admin))50 item.SafeMint(cross(cur), craftTest.Owner, tokenID, amount)51}5253func defaultCraftFeeCoins() chain.Coins {54 return chain.Coins{{"ugnot", defaultCraftFee}}55}5657func payCraftFee(coins chain.Coins) {58 if len(coins) > 0 {59 testing.IssueCoins(craftTest.PkgAddr, coins)60 }61 testing.SetOriginSend(coins)62}6364func ugnotBalanceForTest(addr address) int64 {65 return banker.NewReadonlyBanker().GetCoins(addr).AmountOf("ugnot")66}67Craft(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, recipe string) uint64
DeleteRecipe(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, recipe string)
DeleteRecipes(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, recipesCSV string)
GetCraftFee() int64
GetListLimit() int
GetRecipe(recipe string) uint32
GetRecipeCount() int
HasRecipe(recipe string) bool
ListRecipes(page int, count int) []map[string]string
Render(iURL string) string
SetCraftFee(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, fee int64)
SetListLimit(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, limit int)
SetRecipe(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, recipe string, itemID uint32)
SetRecipes(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, recipesCSV string, itemIDsCSV string)
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.