Repository navigation
feat(nfts): Read the display metadata of minted NFTs by instance id - #426
Merged
Merged
Conversation
📦 Bundle size impactComparing
Thresholds — 🟡 ≥10% or ≥5.0 KB · 🟠 ≥20% or ≥15.0 KB (bundled). Percentage only applies once the baseline is ≥ 10 KB. Informational — this check never blocks merge. |
piggydoughnut
marked this pull request as draft
October 2, 2026 07:08
getInstanceDisplays / getInstanceDisplay: positional per-instance reads of name, collectionName, rarity, imageRef, the three-layer attributes bag, the resolved (collection, item), and transferability/supply/liveSupply from the item definition. Capped at MAX_INSTANCES_PER_READ (128), refused above it rather than paged. name is the instance's own (instance layer, else item layer) and never inherits the collection's, which is reported beside it as collectionName.
piggydoughnut
force-pushed
the
feat/nfts-getItemDisplay
branch
from
October 5, 2026 09:48
cf07e77 to
3473d2f
Compare
piggydoughnut
marked this pull request as ready for review
October 5, 2026 09:48
TarikGul
reviewed
Oct 5, 2026
TarikGul
reviewed
Oct 5, 2026
…ability behavior change On a metadata_batch TooLarge the read now re-chunks only the instances that refusal covered rather than re-running the whole list, keeping the chunks that already answered. Observable behavior is unchanged for the single-chunk public path; the saving shows if the input cap ever exceeds the runtime cap. Also calls out the getCollectionItems Transferability refusal in the changeset as a behavior change for consumers.
TarikGul
approved these changes
Oct 6, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Today every app that shows a minted NFT re-implements the same three-layer metadata resolution by hand, e.g. scarcity-stash has ~200 lines of it — and each one independently re-derives the instance→item mapping, the precedence rules, and the text-or-bytes decoding that this package already does internally for catalogues and
previews. getInstanceDisplaysexposes that existing resolution for minted instances, so owned items, catalogue entries and mint previews finally render identically instead of drifting.What
Closes the
getItemDisplay/getItemDisplaysitems of#318. Named for this package's vocabulary, where an item
is a catalogue definition and an instance is a minted NFT.
NftsInstancesChain, separate so a catalogue-only app'swhitelist does not grow. Apps calling this read must whitelist
api.ScarcityApi.metadata_batchandquery.Scarcity.ItemDefs.NftsIdErrornow also reports out-of-range u64 instance ids; its id fieldwidened from number to number | bigint.
@parity/product-sdk-nftsand the umbrella per the RELEASES.md rule.
Verification
the Found-with-empty-bag case, chunking at 128, the adaptive re-chunk on a
smaller reported cap, dedup of definition keys, and a definition missing under
a live instance.
the hand-written contract against the real descriptors. Added a positive
assertion for paseo and a @ts-expect-error negative control for devnet,
which carries no ScarcityApi.
design rests on: instances 0/1/2 resolve to (0,3), (0,1), (2,3) and
their definitions read Transferable with supplies 3/3, 5/5, 2/2, while u64
max comes back unresolved.
new Playwright assertion in catalogue.spec.ts is the one piece here that has
not executed.