You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Chain-read support for collectibles, credits & collections #318
fetch image by CID/digest, verify against on-chain hash.
Credits
Warning
Credit reads are scoped by the player's identity. AccountOrPerson: either an account or a person Alias. Needs clarification which one is used for awarding credits. Note: account-era and person-era credits live under separate keys with no on-chain link, so reading a full history may require querying both.
Get a user's credits to show in the UI, getCredits(identity) → Credit[]
All credits awarded to the player, newest first, each carrying its state (earned / claimable / claimed).
Get a collection's full item catalogue — getCollectionItems(id) → CollectionDetail
Every item defined in a collection, with per-item display metadata.
storage Scarcity.Collections (the record), Scarcity.ItemDefs (getEntries per collection — the item list); per-item name/image/rarity via ScarcityApi.metadata_batch (Item queries)
Below are our use cases for Scarcity and I am sure other apps can reuse those too in the future.
Warning
Currently the purses are not implemented. Most of the following functionality depends on purses being available.
Implementable today:
getItemDisplay(instance)- read by instance. No purse/identity dependency. (feat(nfts): Read the display metadata of minted NFTs by instance id #426)getVerifiedArtwork(imageRef)- IPFS fetch + verify; the gateway origin is a config question, not a blocker.previewClaim(credit, collections)- takes a credit hash + collection ids.getCollections()- reads the registry. (part of feat(nfts): collections #329)getCollectionItems(id)- reads a collection's catalogue. (part of feat(nfts): collections #329)getCredits->getClaimsThe rest has to wait for purses etc.
NFTs
Get NFTs a user holds.
getOwnedNfts(identity)→OwnedNft[]Scarcity.NftsByOwner(map AccountId → Nft, one per purse)Get metadata for an NFT or a batch of NFTs.
getItemDisplay(instance)→{ hash?, name?, imageUrl?, rarity? }ScarcityApi.metadata_batchgetItemDisplays(instances[])Fetch Artwork bytes + verification.
getVerifiedArtwork(imageRef)→ Blob | nullCredits
Warning
Credit reads are scoped by the player's identity. AccountOrPerson: either an account or a person Alias. Needs clarification which one is used for awarding credits. Note: account-era and person-era credits live under separate keys with no on-chain link, so reading a full history may require querying both.
Get a user's credits to show in the UI,
getCredits(identity)→Credit[]storage
NftCredits.NftClaimCreditBlocks,NftClaimCreditAwards;runtime
NftCreditsApi.nft_claim_credit_roots,nft_claim_credit_proofs(ref: fetchCredits)
storage
NftClaims.CreditTrees,NftClaims.ClaimedCredits(ref: fetchClaimStates)
CreditShow mint preview.
previewClaim(credit, collections)→MintPreview[]What a single credit would mint in each of the given collections (one result per collection) - powers the collection picker.
NftClaimsApi.preview_mintspreviewMintsCollections
Get information about collections —
getCollections()→MintCollection[]{ id, name?, selection, itemCount? }).NftClaims.CollectionMinters,Scarcity.Collections; names viaScarcityApi.metadata_batchfetchMintCollectionsGet a collection's full item catalogue —
getCollectionItems(id)→CollectionDetailScarcity.Collections(the record),Scarcity.ItemDefs(getEntries per collection — the item list); per-item name/image/rarity viaScarcityApi.metadata_batch(Item queries)CollectionItem ≈ { index, supply, liveSupply, transferability, name?, imageRef?, rarity? }
Purse related calls
Purse - set of addresses, where a user can store an NFT at.
One address holds exactly one NFT.
Get the next empty address for a user.
getNextEmptyPurse(identity)→ addressFind which address holds a given NFT.
findPurseHolding(identity, hash)→ address | nullGet signer for a purse