Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

assets/v1 package

Overview

Package assets is Sinopia's immutable asset store for uploaded collections (docs/uploaded-collections.md §4–§6, §0a). An artist creates a store, declares artworks (on-chain bytes or IPFS CIDs, each with its sha256, editions, a creator-assigned tier and trait values), uploads the on-chain bytes in chunks, and seals it. A sealed store never changes: the upload engine (r/…/engines/upload) binds one sealed store to one Draft collection and reads its art from here.

Guarantees (design §14):

  • only the store's owner writes, and only from a wallet (direct MsgCall, IsUserCall); nothing here accepts or holds coins;
  • a store is Draft until Seal, which is irreversible: records, titles, dictionaries and bytes are immutable afterwards;
  • an "on-chain" artwork is complete only when every byte is stored, its sha256 equals the declared one and media.CheckImage passed (magic + dimensions; SVG through safe.AssertSVG, 16 KiB cap);
  • an "ipfs" artwork always says ipfs; a raw CID's digest is checked against the declared sha256 on chain;
  • every user string passed safe.AssertText; JSON goes through safe.JSONWriter.

Storage is paid by the owner who writes it, and only the owner can free Draft data (Truncate), so refunds go back to the payer (T8).

Functions

AddArtworks

func AddArtworks(cur realm, storeID, batch string) string
Ask AI Claude ChatGPT

AddArtworks declares up to MaxBatch artworks, one per '\n'-separated line:

Example
1kind|mime|size|sha256|cid|editions|tier|title|v1|…|vN

with exactly one value per trait type of the store (N = len(traitTypes)):

  • kind "chain" | "ipfs"; mime "svg" | "png" | "webp" | "jpeg";
  • size: decimal bytes, chain svg <= 16,384, chain raster <= 262,144, ipfs raw <= 1 MiB, ipfs dag-pb <= 50 MiB; the store's on-chain total stays <= 4 MiB;
  • sha256: 64 lower-case hex of the file bytes, unique in the store (use editions for copies);
  • cid: "" for chain; for ipfs a CIDv1 (media.ParseCIDv1): raw codec ⇒ its digest must equal sha256 (verified binding), dag-pb ⇒ digest stored;
  • editions 1..10,000 (the store's slots stay <= 10,000);
  • tier "" or one of the store's tiers; title <= 64 bytes;
  • values "" (none) or <= 32 bytes, no leading/trailing space; at most 100 distinct values per trait type and 255 over all types of a store.

Returns "first-last" (0-based indexes). Event ArtworkAdded per line.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "AddArtworks" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "AddArtworks" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

AppendBytes

func AppendBytes(cur realm, storeID string, idx, offset int64, chunk []byte)
Ask AI Claude ChatGPT

AppendBytes stores the next chunk of an on-chain artwork. Bytes arrive in artwork order: idx must be the lowest incomplete on-chain artwork and offset its Have (resume = read Have). chunk is a []byte argument (the keeper decodes the MsgCall's base64 natively, WP0), 1..MaxChunk bytes. When the artwork is complete its sha256 must equal the declared one and media.CheckImage must pass, else the call panics and nothing is stored. Event ArtworkComplete{store, idx}.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "AppendBytes" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "AppendBytes" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

ArtworkAt

func ArtworkAt(storeID string, idx int64) media.Artwork
Ask AI Claude ChatGPT

ArtworkAt is the typed artwork record (a copy).

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.ArtworkAt(,)"

Result

ArtworkBytes

func ArtworkBytes(storeID string, idx int64) string
Ask AI Claude ChatGPT

ArtworkBytes is the raw file of a complete on-chain artwork, "" for an incomplete or IPFS one. Only complete files passed sha256 + CheckImage.

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.ArtworkBytes(,)"

Result

ArtworkDataURI

func ArtworkDataURI(storeID string, idx int64) string
Ask AI Claude ChatGPT

ArtworkDataURI is "data:<mime>;base64,…" for a complete on-chain artwork, "" otherwise. mime is one of the four checked types (ENG-I3: no free-form media type ever reaches a data URI).

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.ArtworkDataURI(,)"

Result

ArtworkJSON

func ArtworkJSON(storeID string, idx int64) string
Ask AI Claude ChatGPT

ArtworkJSON is the JSON object of one artwork (also used by the upload engine's reads so both realms emit one shape).

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.ArtworkJSON(,)"

Result

ArtworkMeta

func ArtworkMeta(storeID string, idx int64) media.Artwork
Ask AI Claude ChatGPT

ArtworkMeta is ArtworkAt without SHA256, Digest and CID (left ""): the cheap form for trait reads (a CID costs ~1.4M gas to encode in the VM).

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.ArtworkMeta(,)"

Result

Artworks

func Artworks(storeID string, offset, limit int64) string
Ask AI Claude ChatGPT

Artworks is one page of records as JSON (limit <= MaxPage = 20): [{index, kind, mime, mimeType, size, have, complete, editions, slotStart, slotEnd, sha256, digest, cid, title, tier, traits:[{trait_type,value}]}]. kind is "chain" | "ipfs"; digest is the dag-pb root ("" otherwise); cid is "" for on-chain artworks. Built from parts escaped once at write time (type names, tiers, trait values) and joined once (UP-M1).

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.Artworks(,,)"

Result

Composition

func Composition(storeID string) string
Ask AI Claude ChatGPT

Composition is the set composition (design §8, D8 "drop table") as JSON: {store, sealed, artworks, slots,

Example
1tiers:[{name, artworks, slots}] (low -> high), untiered:{artworks, slots},
2traits:[{trait_type, values:[{value, artworks, slots}], none:{artworks, slots}}]}.

"slots" counts editions, i.e. the odds of a token: slots/total slots. O(tiers + distinct values): the counters are kept by AddArtworks / Truncate and the names are escaped once, so the largest store the limits allow stays far below the query gas cap (UP-M1).

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.Composition()"

Result

CountsJSON

func CountsJSON(storeID string, idx, edition []int64) string
Ask AI Claude ChatGPT

CountsJSON aggregates the real-name trait counts of a set of tokens, given each token's artwork index and edition (from SlotArtwork), as the members of a JSON object: "Tier":{tier:n}, then each creator trait type {value:n} in store order, "Edition":{"e/E":n} (artworks with E > 1) and "Storage":{"On-chain"|"IPFS":n}; types and values with no count are left out. Names are the JSON escaped once at write time, values in dictionary order (review UP-M1: no per-read escaping, integer counters only).

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.CountsJSON(,,)"

Result

Info

func Info(storeID string) media.StoreInfo
Ask AI Claude ChatGPT

Info is the typed store header for other realms (a copy).

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.Info()"

Result

NewStore

func NewStore(cur realm, label, traitTypes, tiers string) string
Ask AI Claude ChatGPT

NewStore creates an empty Draft store owned by the calling wallet. traitTypes and tiers are '|'-separated name lists ("" = none): at most 16 trait types and 8 tiers (tiers ordered low -> high), names 1..20 bytes, no ':' and no leading/trailing space, unique ignoring case; "Tier", "Edition", "Storage", "Status" and "Artwork" are reserved trait types. Returns the store id. Event StoreCreated{store, owner}.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "NewStore" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "NewStore" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Render

func Render(path string) string
Ask AI Claude ChatGPT

Render stays minimal and prints no creator text; uploaded collections are browsed in the gallery realm.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.Render()"

Result

Seal

func Seal(cur realm, storeID string)
Ask AI Claude ChatGPT

Seal freezes a store for good. It needs at least one artwork and every on-chain artwork complete. Event StoreSealed{store, artworks, slots, onchainN, ipfsN, onchainBytes}.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "Seal" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "Seal" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

SlotArtwork

func SlotArtwork(storeID string, slot int64) (idx, edition int64)
Ask AI Claude ChatGPT

SlotArtwork maps a slot (0..slots-1) to its artwork index and 1-based edition: artwork i covers [slotEnd(i-1), slotEnd(i)). O(log n).

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.SlotArtwork(,)"

Result

Store

func Store(storeID string) string
Ask AI Claude ChatGPT

Store is the store header as JSON: {id, owner, label, state, createdHeight, sealedHeight, artworks, slots, onchainN, ipfsN, onchainBytes, received, complete, nextUpload, badge, traitTypes, tiers}. received = on-chain bytes stored so far; nextUpload = index of the artwork AppendBytes expects next (-1 when every on-chain artwork is complete); badge = media.Badge.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.Store()"

Result

StoreCount

func StoreCount() int64
Ask AI Claude ChatGPT

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.StoreCount()"

Result

TierSlots

func TierSlots(storeID string) (tiers []string, slots []int64, untiered int64)
Ask AI Claude ChatGPT

TierSlots is the typed tier part of Composition: tier names (low -> high), the slots each holds, and the slots of untiered artworks. O(tiers).

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1.TierSlots()"

Result

Truncate

func Truncate(cur realm, storeID string, keep int64)
Ask AI Claude ChatGPT

Truncate drops artworks keep..n-1 of a Draft store and cuts the byte log back, freeing their storage (the chain refunds the signer, i.e. the owner who paid it). Trait values first used by dropped artworks stay in the dictionary (with zero counts; they still count towards MaxStoreValues). Event StoreTruncated{store, keep}.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "Truncate" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1" -func "Truncate" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Gno Expression Evaluator

Evaluate any read-only Gno expression against gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia3/assets/v1, for example a function call with arguments.