Skip to content

Implement core NFT views to conform to Flow NFT Metadata standard #16

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

Merged
merged 8 commits into from
Oct 26, 2022

Conversation

EricLin-wk
Copy link
Contributor

Implement Core NFT Views from the MetadataViews contract to conform to the Flow NFT Metadata standard https://www.flow-nft-catalog.com/

@EricLin-wk EricLin-wk requested a review from a team as a code owner October 20, 2022 23:18
@EricLin-wk EricLin-wk requested review from a team, judezhu and sadief October 20, 2022 23:18
//------------------------------------------------------------

// The address to which royalties should be deposited
pub fun RoyaltyAddress() : Address {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to have a RoyaltyAddress in order to implement the metadata views?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I'll get rid of this method and move the variable into resolveView()

mediasView := result[3]
editions := mediasView.Fields[0].(cadence.Array)
assert.Equal(t, "https://assets.nflallday.com/editions/1/media/image?format=jpeg&width=512",
editions.Values[0].(cadence.Struct).Fields[0].(cadence.Struct).Fields[0].ToGoValue())
Copy link
Contributor

Choose a reason for hiding this comment

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

nice tests! You could have a helper func that takes in the index and editions and returns the result of

editions.Values[0].(cadence.Struct).Fields[0].(cadence.Struct).Fields[0].ToGoValue())

that you could use in the assert.Equal just to make the tests a little less verbose

@EricLin-wk EricLin-wk requested a review from sadief October 21, 2022 20:20
@bshahid331
Copy link
Contributor

The Metadata Views implementations LGTM

Copy link
Contributor

@sadief sadief left a comment

Choose a reason for hiding this comment

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

Nice! Non blocking, but would you mind adding some info to the Readme about the metadata views as well?

@EricLin-wk EricLin-wk merged commit bc04f0d into main Oct 26, 2022
@EricLin-wk EricLin-wk deleted the ewlin/metadata_views branch October 26, 2022 21:34
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.

3 participants