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

add NFT Metadata queries #39

Merged
merged 10 commits into from
May 24, 2023
Merged

add NFT Metadata queries #39

merged 10 commits into from
May 24, 2023

Conversation

sisyphusSmiling
Copy link
Collaborator

@sisyphusSmiling sisyphusSmiling commented May 17, 2023

Related: #25

Note about tests:
I had to replace a script-defined struct with MetadataViews.NFTCollectionDisplay & create assertion scripts to validate return values against expected. This doesn't feel like a great way to write tests as it's fragile, and I'd prefer to construct comparison values from within the tests themselves. Definitely open to other ideas here.

@sisyphusSmiling sisyphusSmiling changed the title add nft metadata resolution scripts add NFT Metadata queries May 17, 2023
@sisyphusSmiling sisyphusSmiling self-assigned this May 17, 2023
@austinkline
Copy link
Collaborator

Replace custom struct with MetadataViews.NFTCollectionDisplay & create assertion script to test return value

Glad you came to the same conclusion, seems like for current purposes we need to use scripts as our actual tests and can't return any structs for now to any actual test cases

@sisyphusSmiling sisyphusSmiling marked this pull request as ready for review May 18, 2023 22:36
Copy link
Collaborator

@austinkline austinkline left a comment

Choose a reason for hiding this comment

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

Nice! It's good to see we aren't needing to make adjustments to the contract itself to cover these cases. Left some minor comments but I don't think they're blocking at all

let viewType: Type = Type<MetadataViews.NFTCollectionData>()

// Iterate over each public path
account.forEachStored(fun (path: StoragePath, type: Type): Bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

My only concern here is that we might want a second script which makes sure to only return what you can actually get to. This script will return everything but that doesn't mean you can actually withdraw every nfts from every collection that comes back

I'm perfectly find with us tackling those separately though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Very true. I figure we can leverage the code from #43 for that query

@sisyphusSmiling sisyphusSmiling merged commit e5a0541 into main May 24, 2023
@sisyphusSmiling sisyphusSmiling deleted the query-nft-metadata branch May 24, 2023 23:37
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