Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added getInvetory retriever method fixes #30 #32

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bjartek
Copy link

@bjartek bjartek commented Jul 15, 2022

No description provided.

@vercel
Copy link

vercel bot commented Jul 15, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nft-catalog ✅ Ready (Inspect) Visit Preview Jul 18, 2022 at 6:03PM (UTC)

let types = NFTCatalog.getCatalogTypeData()
for nftType in types.keys {
let typeData=types[nftType]!
let collectionKey=typeData.keys[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 0 index here? Do we want to handle the case if one nft type has multiple collections like Mint Store?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the collections are stored in the same path, we just want the ids of them all. Paritioning these into subcollections will take up a lot of gas since you need to borrow each one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

let collectionKey=typeData.keys[0]
let catalogEntry = NFTCatalog.getCatalogEntry(collectionIdentifier:collectionKey)!
let path =catalogEntry.collectionData.publicPath
let cap= account.getCapability<&{MetadataViews.ResolverCollection}>(path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't be guaranteed to exist just a heads up

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will not be guaranteed to not exist? I check if the cap is linked on the next line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The capability is linked

let types = NFTCatalog.getCatalogTypeData()
for nftType in types.keys {
let typeData=types[nftType]!
let collectionKey=typeData.keys[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@bshahid331
Copy link
Contributor

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants