From a55e95bed58ef0a37d5be2dbb42d080a7bd696ea Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:18:59 -0800 Subject: [PATCH 01/25] Add metadata views doc --- .../build/advanced-concepts/metadata-views.md | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 docs/build/advanced-concepts/metadata-views.md diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md new file mode 100644 index 0000000000..1ab1c38ec4 --- /dev/null +++ b/docs/build/advanced-concepts/metadata-views.md @@ -0,0 +1,226 @@ +--- +title: NFT Metadata Views +sidebar_label: NFT Metadata Views +--- + +# About NFT MetadataViews on Flow + +`MetadataViews` on Flow offers a standardized way to represent metadata across different NFTs. With its integration, developers can ensure that different platforms and marketplaces can interpret the NFT metadata in a unified manner. This means that when you go to a marketplace, it looks and reads the same on this marketplace as it does on another, providing a consistent user experience across different platforms. + +> If you want to follow along on a real contract as we talk through the below concepts you can do so on this [ExampleNFT contract](https://github.com/onflow/flow-nft/blob/master/contracts/ExampleNFT.cdc) and also here is the source for the [MetadataViews contract](https://github.com/onflow/flow-nft/blob/master/contracts/MetadataViews.cdc). + +## Two Levels of Metadata: An Overview + +Metadata in Cadence is structured at two distinct levels: + +1. **Contract-Level Metadata**: This provides an overarching description of the entire NFT collection. +2. **NFT-Level Metadata**: Diving deeper, this metadata relates to individual NFTs. It provides context, describes rarity, and other unique characteristics that differentiate one NFT from another within the same collection. + +## Understanding `ViewResolver` and `MetadataViews.Resolver` + +In the context of Flow and its treatment of metadata for NFTs, there are two essential interfaces to grasp: `ViewResolver` and `MetadataViews.Resolver`. Interfaces are like blueprints that outline the necessary variables and methods your contract needs to implement for the interface to be considered implemented. This ensures that any contract claiming to adhere to these interfaces will have a consistent set of functionalities that other applications or contracts can rely on. + +1. **`ViewResolver` for Contract-Level Metadata**: + - This interface ensures that contracts, primarily those encapsulating NFT collections, adhere to the metadata views' standards. + - By adopting this interface, contracts can provide dynamic metadata outputs that encapsulate the collection as a whole. +2. **`MetadataViews.Resolver` for NFT-Level Metadata**: + - Used within individual NFT resources, this interface ensures each token adheres to a standardized metadata format. + - It focuses on the unique aspects of an individual NFT, such as its unique ID, name, description, and other defining characteristics. + +### Core Functions + +Both the `ViewResolver` and `MetadataViews.Resolver` utilize the following core functions: + +### `getViews` Function + +This function offers a list of metadata view types supported either by the contract (for `ViewResolver`) or by an individual NFT (for `MetadataViews.Resolver`). + +```cadence +pub fun getViews(): [Type] { + return [ + Type(), + ... + ] +} +``` + +### `resolveView` Function + +Regardless of whether it's used at the contract or NFT level, this function's role is to deliver the actual metadata associated with a given view type. + +```cadence +pub fun resolveView(_ view: Type): AnyStruct? { + switch view { + case Type(): + ... + ... + } + return nil +} +``` + +## NFT-Level Metadata Implementation + +NFT-level metadata addresses the unique attributes of individual tokens within a collection. It provides structured information for each NFT, including its identifier, descriptive elements, royalties, and other associated metadata. Implementing this level of detail ensures consistency and standardization across individual NFTs, making them interoperable and recognizable across various platforms and marketplaces. + +### Core Properties + +Every NFT has core properties that define its basic attributes. For example, in the provided code, an NFT has properties like its unique ID, name, description, and more. When we add the `MetadataViews.Resolver` to our NFT resource, we are indicating that these variables will align with the specifications defined in the `MetadataViews` contract for each of these properties. This ensures interoperability within the Flow ecosystem and guarantees that the metadata of our NFT can be consistently accessed and understood by various platforms and services that interact with NFTs. + +```cadence +pub resource NFT: NonFungibleToken.INFT, MetadataViews.Resolver { + pub let id: UInt64 + pub let name: String + pub let description: String + pub let thumbnail: String + access(self) let royalties: [MetadataViews.Royalty] + access(self) let metadata: {String: AnyStruct} + ... +} +``` + +### Metadata Views for NFTs + +`MetadataViews` types define how the NFT presents its data. When called upon, the system knows precisely which view to render, ensuring that the relevant information is presented consistently across various platforms: + +### Display + +This view provides basic information about the NFT suitable for listing or display purposes. When the `Display` type is invoked, it dynamically assembles the visual and descriptive information that is typically needed for showcasing the NFT in marketplaces or collections. + +```cadence +case Type(): + return MetadataViews.Display( + name: self.name, + description: self.description, + thumbnail: MetadataViews.HTTPFile( + url: self.thumbnail + ) + ) +``` + +### Editions + +The `Editions` view provides intricate details regarding the particular release of an NFT. This can include information about the number of copies in an edition, the sequence number of the specific NFT within that edition, or if it is part of a limited series. When the `Editions` view is queried, it retrieves this data, essential for collectors to understand the rarity and exclusivity of the NFT they are interested in. + +```cadence +case Type(): + let editionInfo = MetadataViews.Edition( + name: "Example NFT Edition", + number: self.id, + max: nil + ) + return MetadataViews.Editions([editionInfo]) +``` + +### Serial Number Metadata + +The `Serial` metadata provides the unique serial number of the NFT, akin to a serial number on a currency note or a VIN on a car. This serial number is a fundamental attribute that certifies the individuality of each NFT and is critical for identification and verification processes. + +```cadence +case Type(): + return MetadataViews.Serial(self.id) +``` + +### Royalties Metadata + +Royalty information is vital for the sustainable economics of the creators in the NFT space. The `Royalties` metadata view spells out the specifics of any royalty agreements in place, detailing the percentage of sales revenue that will go to the original creator or other stakeholders on secondary sales. + +```cadence +case Type(): + // Assuming each 'Royalty' in the 'royalties' array has 'cut' and 'description' fields + let detailedRoyalties = self.royalties.map { royalty -> + MetadataViews.Royalty( + receiver: royalty.receiver, // The beneficiary of the royalty + cut: royalty.cut, // The percentage cut of each sale + description: royalty.description // A description of the royalty terms + ) + } + return MetadataViews.Royalties(detailedRoyalties) +``` + +### External URL Metadata + +The ExternalURL view directs to an associated webpage, providing additional content or information about the NFT. + +```cadence +case Type(): + return MetadataViews.ExternalURL("".concat(self.id.toString())) +``` + +### Traits Metadata + +Traits in NFT metadata encapsulate the unique attributes of an NFT, like its visual aspects or any other category-defining properties. These can be essential for marketplaces that need to sort or filter NFTs based on these characteristics. + +The `dictToTraits` function in Cadence is designed to convert a dictionary of metadata into a standard array of `Trait` structures. This function helps in preparing the traits data for the `MetadataViews.Traits` view, which can be understood by platforms within the Flow ecosystem. + +Here's a more detailed look at how you might implement the `dictToTraits` function and the `Traits` view: + +```cadence +case Type(): + // Exclude certain traits from being displayed + let excludedTraits = ["mintedTime", "foo"] + + // Convert the remaining metadata into an array of `Trait` objects + let traitsArray = MetadataViews.dictToTraits(dict: self.metadata, excludedNames: excludedTraits) + + return traitsArray +``` + +## Contract-Level Metadata Implementation + +Contract-level metadata provides a holistic view of an NFT collection, capturing overarching attributes and contextual information about the entire set, rather than specifics of individual tokens. These views describe attributes at the collection or series level rather than individual NFTs. + +### NFTCollectionData + +This view provides paths and types related to the NFT collection's storage and access within the smart contract. + +```cadence +case Type(): + return MetadataViews.NFTCollectionData( + storagePath: ExampleNFT.CollectionStoragePath, + publicPath: ExampleNFT.CollectionPublicPath, + providerPath: /private/exampleNFTCollection, + publicCollection: Type<&ExampleNFT.Collection{ExampleNFT.ExampleNFTCollectionPublic}>(), + publicLinkedType: Type<&ExampleNFT.Collection{ExampleNFT.ExampleNFTCollectionPublic,NonFungibleToken.CollectionPublic,NonFungibleToken.Receiver,MetadataViews.ResolverCollection}>(), + providerLinkedType: Type<&ExampleNFT.Collection{ExampleNFT.ExampleNFTCollectionPublic,NonFungibleToken.CollectionPublic,NonFungibleToken.Provider,MetadataViews.ResolverCollection}>(), + createEmptyCollectionFunction: (fun (): @NonFungibleToken.Collection { + return <-ExampleNFT.createEmptyCollection() + }) + ) +``` + +Here, `NFTCollectionData` is specifying several important elements related to how the collection is stored and accessed on the Flow blockchain. It provides information on storage paths and access control paths for both public and private data, as well as linked types that specify what capabilities are publicly available (like collection, receiver, or provider interfaces). + +### NFTCollectionDisplay + +This view describes the collection with visual elements and metadata that are useful for display purposes, such as in a marketplace or gallery. + +```cadence +case Type(): + let media = MetadataViews.Media( + file: MetadataViews.HTTPFile( + url: "" + ), + mediaType: "image/svg+xml" + ) + return MetadataViews.NFTCollectionDisplay( + name: "The Example Collection", + description: "This collection is used as an example to help you develop your next Flow NFT.", + externalURL: MetadataViews.ExternalURL(""), + squareImage: media, + bannerImage: media, + socials: { + "twitter": MetadataViews.ExternalURL("") + } + ) +``` + +In this case, the `NFTCollectionDisplay` provides not just the basic metadata like the name and description of the collection, but also URLs to visual representations of the collection (`squareImage` and `bannerImage`) and external URLs including social media links. + +## More + +Understanding `MetadataViews` and the core functions associated with it is crucial for developers aiming to deploy NFTs on Flow. With these views and functions, NFTs can maintain a consistent presentation across various platforms and marketplaces in the Flow ecosystem. If you want to learn more about implementing them read the NFT guide to get an introduction to adding them to your NFT contracts. + +- See the [API reference for a complete list of Metadata functions](https://developers.flow.com/references/core-contracts/flow-nft/MetdataViews/MetadataViews) +- Check out [an Example NFT project](https://github.com/onflow/flow-nft/blob/master/contracts/ExampleNFT.cdc) implementing `MetadataViews` +- Read [the NFT Guide](../../guides/nft.md) for an introduction to implementation \ No newline at end of file From 98c547f8cdee256bb3ba0bb7832bcc01cf65a276 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 14 Nov 2023 09:43:38 -0800 Subject: [PATCH 02/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 1ab1c38ec4..d27ceaa8b4 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -5,7 +5,7 @@ sidebar_label: NFT Metadata Views # About NFT MetadataViews on Flow -`MetadataViews` on Flow offers a standardized way to represent metadata across different NFTs. With its integration, developers can ensure that different platforms and marketplaces can interpret the NFT metadata in a unified manner. This means that when you go to a marketplace, it looks and reads the same on this marketplace as it does on another, providing a consistent user experience across different platforms. +`MetadataViews` on Flow offer a standardized way to represent metadata across different NFTs. Through its integration, developers can ensure that different platforms and marketplaces can interpret the NFT metadata in a unified manner. This means that when users visit different websites, wallets, and marketplaces, the NFT metadata will be presented in a consistent manner, ensuring a uniform experience across various platforms. > If you want to follow along on a real contract as we talk through the below concepts you can do so on this [ExampleNFT contract](https://github.com/onflow/flow-nft/blob/master/contracts/ExampleNFT.cdc) and also here is the source for the [MetadataViews contract](https://github.com/onflow/flow-nft/blob/master/contracts/MetadataViews.cdc). From 0cf395ec0a0d9450f867fcbed8ff8bda216b2d18 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 14 Nov 2023 09:45:19 -0800 Subject: [PATCH 03/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index d27ceaa8b4..7e7450eceb 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -14,7 +14,7 @@ sidebar_label: NFT Metadata Views Metadata in Cadence is structured at two distinct levels: 1. **Contract-Level Metadata**: This provides an overarching description of the entire NFT collection. -2. **NFT-Level Metadata**: Diving deeper, this metadata relates to individual NFTs. It provides context, describes rarity, and other unique characteristics that differentiate one NFT from another within the same collection. +2. **NFT-Level Metadata**: Diving deeper, this metadata relates to individual NFTs. It provides context, describes rarity, and highlights other distinctive attributes that distinguish one NFT from another within the same collection. ## Understanding `ViewResolver` and `MetadataViews.Resolver` From 8e44553ad01515720c38c53b68eba03514e4e900 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 14 Nov 2023 09:45:27 -0800 Subject: [PATCH 04/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 7e7450eceb..816270413a 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -7,7 +7,7 @@ sidebar_label: NFT Metadata Views `MetadataViews` on Flow offer a standardized way to represent metadata across different NFTs. Through its integration, developers can ensure that different platforms and marketplaces can interpret the NFT metadata in a unified manner. This means that when users visit different websites, wallets, and marketplaces, the NFT metadata will be presented in a consistent manner, ensuring a uniform experience across various platforms. -> If you want to follow along on a real contract as we talk through the below concepts you can do so on this [ExampleNFT contract](https://github.com/onflow/flow-nft/blob/master/contracts/ExampleNFT.cdc) and also here is the source for the [MetadataViews contract](https://github.com/onflow/flow-nft/blob/master/contracts/MetadataViews.cdc). +> If you'd like to follow along while we discuss the concepts below, you can do so by referring to the [ExampleNFT contract](https://github.com/onflow/flow-nft/blob/master/contracts/ExampleNFT.cdc). Additionally, here is the source code for the [MetadataViews contract](https://github.com/onflow/flow-nft/blob/master/contracts/MetadataViews.cdc). ## Two Levels of Metadata: An Overview From e65ff6842e2bb90a93294fc67090e445d17a67a0 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 14 Nov 2023 09:45:33 -0800 Subject: [PATCH 05/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 816270413a..5f07cc8296 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -149,7 +149,7 @@ case Type(): ### Traits Metadata -Traits in NFT metadata encapsulate the unique attributes of an NFT, like its visual aspects or any other category-defining properties. These can be essential for marketplaces that need to sort or filter NFTs based on these characteristics. +Traits view type encapsulates the unique attributes of an NFT, like any visual aspects or category-defining properties. These can be essential for marketplaces that need to sort or filter NFTs based on these characteristics. The `dictToTraits` function in Cadence is designed to convert a dictionary of metadata into a standard array of `Trait` structures. This function helps in preparing the traits data for the `MetadataViews.Traits` view, which can be understood by platforms within the Flow ecosystem. From 543da62c6d254b32be7d8ccd2863ae7f2e9d1a8f Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 14 Nov 2023 09:45:39 -0800 Subject: [PATCH 06/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 5f07cc8296..af85ed7cdd 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -151,7 +151,7 @@ case Type(): Traits view type encapsulates the unique attributes of an NFT, like any visual aspects or category-defining properties. These can be essential for marketplaces that need to sort or filter NFTs based on these characteristics. -The `dictToTraits` function in Cadence is designed to convert a dictionary of metadata into a standard array of `Trait` structures. This function helps in preparing the traits data for the `MetadataViews.Traits` view, which can be understood by platforms within the Flow ecosystem. +The `dictToTraits` helper function in Cadence is designed to convert a dictionary of metadata into a standard array of `Trait` structures. This function helps in preparing the traits data for the `MetadataViews.Traits` view, which can be understood by platforms within the Flow ecosystem. Here's a more detailed look at how you might implement the `dictToTraits` function and the `Traits` view: From 0e91262bb7ef52e8219d9bc5a57b7ccef25b24f5 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 14 Nov 2023 09:45:46 -0800 Subject: [PATCH 07/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index af85ed7cdd..218c7c1af4 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -215,7 +215,7 @@ case Type(): ) ``` -In this case, the `NFTCollectionDisplay` provides not just the basic metadata like the name and description of the collection, but also URLs to visual representations of the collection (`squareImage` and `bannerImage`) and external URLs including social media links. +In the example above, the `NFTCollectionDisplay` not only offers fundamental metadata like the collection's name and description but also provides image URLs for visual representations of the collection (`squareImage` and `bannerImage`) and external links, including social media profiles. ## More From 4e30f90425ee6af5bd54e7ab19deb5c9c61460de Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 14 Nov 2023 09:45:52 -0800 Subject: [PATCH 08/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 218c7c1af4..e59317170f 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -219,7 +219,7 @@ In the example above, the `NFTCollectionDisplay` not only offers fundamental met ## More -Understanding `MetadataViews` and the core functions associated with it is crucial for developers aiming to deploy NFTs on Flow. With these views and functions, NFTs can maintain a consistent presentation across various platforms and marketplaces in the Flow ecosystem. If you want to learn more about implementing them read the NFT guide to get an introduction to adding them to your NFT contracts. +Understanding `MetadataViews` and the core functions associated with it is crucial for developers aiming to deploy NFTs on Flow. With these views and functions, NFTs can maintain a consistent presentation across various platforms and marketplaces and foster interoperability between contracts and applications in the Flow ecosystem. To gain a deeper understanding of implementing the MetadataView standard, Check out our documentation on "How to Create an NFT Project on Flow". It provides an introduction to integrating these standards into your NFT contracts. - See the [API reference for a complete list of Metadata functions](https://developers.flow.com/references/core-contracts/flow-nft/MetdataViews/MetadataViews) - Check out [an Example NFT project](https://github.com/onflow/flow-nft/blob/master/contracts/ExampleNFT.cdc) implementing `MetadataViews` From dee312bba047c6aafb04017887a66bc41f0e1053 Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 14 Nov 2023 09:46:19 -0800 Subject: [PATCH 09/25] Remove about --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 1ab1c38ec4..629ea91361 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -3,7 +3,7 @@ title: NFT Metadata Views sidebar_label: NFT Metadata Views --- -# About NFT MetadataViews on Flow +# NFT MetadataViews on Flow `MetadataViews` on Flow offers a standardized way to represent metadata across different NFTs. With its integration, developers can ensure that different platforms and marketplaces can interpret the NFT metadata in a unified manner. This means that when you go to a marketplace, it looks and reads the same on this marketplace as it does on another, providing a consistent user experience across different platforms. From dae6c92f08b165cd1c34c5021881e08cf212373c Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:37:27 -0800 Subject: [PATCH 10/25] Add intro link --- docs/build/guides/nft.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/guides/nft.md b/docs/build/guides/nft.md index e3b06e0e92..8a7da158ce 100644 --- a/docs/build/guides/nft.md +++ b/docs/build/guides/nft.md @@ -741,5 +741,5 @@ Congrats, you did it! You’re now ready to launch the next fun NFT project on F - Explore [an example NFT repository](https://github.com/nvdtf/flow-nft-scaffold/blob/main/cadence/contracts/exampleNFT/ExampleNFT.cdc) - Watch a [video tutorial on creating an NFT project in the Flow Playground](https://www.youtube.com/watch?v=bQVXSpg6GE8) - Dive into the details of [the NFT Standard](https://github.com/onflow/flow-nft) -- For a deeper dive into `MetadataViews`, consult the [API documentation](https://developers.flow.com/references/core-contracts/flow-nft/MetdataViews/MetadataViews#docusaurus_skipToContent_fallback) or [the FLIP that introduced this feature](https://github.com/onflow/flips/blob/main/application/20210916-nft-metadata.md). +- For a deeper dive into `MetadataViews`, consult the [introduction guide](../advanced-concepts/metadata-views.md), [API documentation](https://developers.flow.com/references/core-contracts/flow-nft/MetdataViews/MetadataViews#docusaurus_skipToContent_fallback) or [the FLIP that introduced this feature](https://github.com/onflow/flips/blob/main/application/20210916-nft-metadata.md). - Use a [no code tool for creating NFT projects on Flow](https://www.touchstone.city/) \ No newline at end of file From 6b791af0da5f6794cef20b0fec69d8b8c487b924 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:38:09 -0800 Subject: [PATCH 11/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index d7309a402e..7341b1d93f 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -140,7 +140,7 @@ case Type(): ### External URL Metadata -The ExternalURL view directs to an associated webpage, providing additional content or information about the NFT. +The ExternalURL view returns to an associated webpage URL, providing additional content or information about the NFT. ```cadence case Type(): From be2ffa501e41d2c2531980cbe49128f5ccfd1b3a Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:39:33 -0800 Subject: [PATCH 12/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 7341b1d93f..8fc921198e 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -130,8 +130,8 @@ case Type(): // Assuming each 'Royalty' in the 'royalties' array has 'cut' and 'description' fields let detailedRoyalties = self.royalties.map { royalty -> MetadataViews.Royalty( - receiver: royalty.receiver, // The beneficiary of the royalty - cut: royalty.cut, // The percentage cut of each sale + receiver: royalty.receiver, // The beneficiary of the royalty + cut: royalty.cut, // The percentage cut of each sale description: royalty.description // A description of the royalty terms ) } From 8a747beb710297abcfcc03e4802e5b002e21b3f3 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:39:46 -0800 Subject: [PATCH 13/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 8fc921198e..558d9a1e55 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -100,7 +100,7 @@ case Type(): ### Editions -The `Editions` view provides intricate details regarding the particular release of an NFT. This can include information about the number of copies in an edition, the sequence number of the specific NFT within that edition, or if it is part of a limited series. When the `Editions` view is queried, it retrieves this data, essential for collectors to understand the rarity and exclusivity of the NFT they are interested in. +The `Editions` view provides intricate details regarding the particular release of an NFT. This can include information about the number of copies in an edition, the specific NFT's sequence number within that edition, or its inclusion in a limited series. When the `Editions` view is queried, it retrieves this data, providing collectors with the information they need to comprehend the rarity and exclusivity of the NFT they are interested in. ```cadence case Type(): From 5f224672d66e32911b78a8370031c3b6749bec6a Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:39:58 -0800 Subject: [PATCH 14/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 558d9a1e55..10263de7a2 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -81,7 +81,7 @@ pub resource NFT: NonFungibleToken.INFT, MetadataViews.Resolver { ### Metadata Views for NFTs -`MetadataViews` types define how the NFT presents its data. When called upon, the system knows precisely which view to render, ensuring that the relevant information is presented consistently across various platforms: +`MetadataViews` types define how the NFT presents its data. When invoked, the system knows precisely which view to return, ensuring that the relevant information is presented consistently across various platforms: ### Display From e54e4c553b416975b6367b5a7fa26843671b2fed Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:40:06 -0800 Subject: [PATCH 15/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 10263de7a2..662fe669c5 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -123,7 +123,7 @@ case Type(): ### Royalties Metadata -Royalty information is vital for the sustainable economics of the creators in the NFT space. The `Royalties` metadata view spells out the specifics of any royalty agreements in place, detailing the percentage of sales revenue that will go to the original creator or other stakeholders on secondary sales. +Royalty information is vital for the sustainable economics of the creators in the NFT space. The `Royalties` metadata view defines the specifics of any royalty agreements in place, including the percentage of sales revenue that will go to the original creator or other stakeholders on secondary sales. ```cadence case Type(): From 6fa195f6dad209e88a8638ecb06fb4c21fe02b9b Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:40:15 -0800 Subject: [PATCH 16/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 662fe669c5..5fcac5ad21 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -65,7 +65,7 @@ NFT-level metadata addresses the unique attributes of individual tokens within a ### Core Properties -Every NFT has core properties that define its basic attributes. For example, in the provided code, an NFT has properties like its unique ID, name, description, and more. When we add the `MetadataViews.Resolver` to our NFT resource, we are indicating that these variables will align with the specifications defined in the `MetadataViews` contract for each of these properties. This ensures interoperability within the Flow ecosystem and guarantees that the metadata of our NFT can be consistently accessed and understood by various platforms and services that interact with NFTs. +For instance, in the code below, an NFT has properties such as its unique ID, name, description, and others. When we add the `MetadataViews.Resolver` to our NFT resource, we are indicating that these variables will adhere to the specifications outlined in the MetadataViews contract for each of these properties. This facilitates interoperability within the Flow ecosystem and assures that the metadata of our NFT can be consistently accessed and understood by various platforms and services that interact with NFTs. ```cadence pub resource NFT: NonFungibleToken.INFT, MetadataViews.Resolver { From 91ade56c722ef298fa165d3fea9563cb1cc8bbb6 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:40:26 -0800 Subject: [PATCH 17/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 5fcac5ad21..cb8dc11677 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -46,7 +46,7 @@ pub fun getViews(): [Type] { ### `resolveView` Function -Regardless of whether it's used at the contract or NFT level, this function's role is to deliver the actual metadata associated with a given view type. +Whether utilized at the contract or NFT level, this function's role is to deliver the actual metadata associated with a given view type. ```cadence pub fun resolveView(_ view: Type): AnyStruct? { From 9b652928063f6efd1d7d57e3c71b2b16fa20a1f4 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:41:39 -0800 Subject: [PATCH 18/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index cb8dc11677..4be718ce35 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -61,7 +61,7 @@ pub fun resolveView(_ view: Type): AnyStruct? { ## NFT-Level Metadata Implementation -NFT-level metadata addresses the unique attributes of individual tokens within a collection. It provides structured information for each NFT, including its identifier, descriptive elements, royalties, and other associated metadata. Implementing this level of detail ensures consistency and standardization across individual NFTs, making them interoperable and recognizable across various platforms and marketplaces. +NFT-level metadata addresses the unique attributes of individual tokens within a collection. It provides structured information for each NFT, including its identifier, descriptive elements, royalties, and other associated metadata. Incorporating this level of detail ensures consistency and standardization among individual NFTs, making them interoperable and recognizable across various platforms and marketplaces. ### Core Properties From 0b8becb14725c46181abb63ae7f56fa2fe36e211 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:41:58 -0800 Subject: [PATCH 19/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 4be718ce35..50c7599510 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -33,7 +33,7 @@ Both the `ViewResolver` and `MetadataViews.Resolver` utilize the following core ### `getViews` Function -This function offers a list of metadata view types supported either by the contract (for `ViewResolver`) or by an individual NFT (for `MetadataViews.Resolver`). +This function provides a list of supported metadata view types, which can be applied either by the contract (in the case of `ViewResolver`) or by an individual NFT (in the case of `MetadataViews.Resolver`). ```cadence pub fun getViews(): [Type] { From 8475770f2d910d51aeb2c56e7e711078b047ad12 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:42:07 -0800 Subject: [PATCH 20/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 50c7599510..762e60deff 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -22,7 +22,7 @@ In the context of Flow and its treatment of metadata for NFTs, there are two ess 1. **`ViewResolver` for Contract-Level Metadata**: - This interface ensures that contracts, primarily those encapsulating NFT collections, adhere to the metadata views' standards. - - By adopting this interface, contracts can provide dynamic metadata outputs that encapsulate the collection as a whole. + - Through the adoption of this interface, contracts can provide dynamic metadata that represents the entirety of the collection. 2. **`MetadataViews.Resolver` for NFT-Level Metadata**: - Used within individual NFT resources, this interface ensures each token adheres to a standardized metadata format. - It focuses on the unique aspects of an individual NFT, such as its unique ID, name, description, and other defining characteristics. From d296bcfdaa75c2d4879239414de1fe290938a778 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:42:17 -0800 Subject: [PATCH 21/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 762e60deff..0c486d2ef0 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -21,7 +21,7 @@ Metadata in Cadence is structured at two distinct levels: In the context of Flow and its treatment of metadata for NFTs, there are two essential interfaces to grasp: `ViewResolver` and `MetadataViews.Resolver`. Interfaces are like blueprints that outline the necessary variables and methods your contract needs to implement for the interface to be considered implemented. This ensures that any contract claiming to adhere to these interfaces will have a consistent set of functionalities that other applications or contracts can rely on. 1. **`ViewResolver` for Contract-Level Metadata**: - - This interface ensures that contracts, primarily those encapsulating NFT collections, adhere to the metadata views' standards. + - This interface ensures that contracts, particularly those encapsulating NFT collections, conform to the Metadata Views standard. - Through the adoption of this interface, contracts can provide dynamic metadata that represents the entirety of the collection. 2. **`MetadataViews.Resolver` for NFT-Level Metadata**: - Used within individual NFT resources, this interface ensures each token adheres to a standardized metadata format. From 9d4212993a59d8756b9d686ccd37b7f1b59259a7 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:42:23 -0800 Subject: [PATCH 22/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 0c486d2ef0..47172e68e6 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -25,7 +25,7 @@ In the context of Flow and its treatment of metadata for NFTs, there are two ess - Through the adoption of this interface, contracts can provide dynamic metadata that represents the entirety of the collection. 2. **`MetadataViews.Resolver` for NFT-Level Metadata**: - Used within individual NFT resources, this interface ensures each token adheres to a standardized metadata format. - - It focuses on the unique aspects of an individual NFT, such as its unique ID, name, description, and other defining characteristics. + - It focuses on the distinct attributes of an individual NFT, such as its unique ID, name, description, and other defining characteristics. ### Core Functions From 65fe5ddf683afa3c4d2ff8a29e40b8344d0d84fa Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:42:32 -0800 Subject: [PATCH 23/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 47172e68e6..dab1ad91b7 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -18,7 +18,7 @@ Metadata in Cadence is structured at two distinct levels: ## Understanding `ViewResolver` and `MetadataViews.Resolver` -In the context of Flow and its treatment of metadata for NFTs, there are two essential interfaces to grasp: `ViewResolver` and `MetadataViews.Resolver`. Interfaces are like blueprints that outline the necessary variables and methods your contract needs to implement for the interface to be considered implemented. This ensures that any contract claiming to adhere to these interfaces will have a consistent set of functionalities that other applications or contracts can rely on. +When considering Flow and how it handles metadata for NFTs, it's crucial to understand two essential interfaces: `ViewResolver` and `MetadataViews.Resolver`. Interfaces serve as blueprints that specify the required variables and methods that your contract must adhere to for the interface to be deemed properly implemented. This guarantees that any contract asserting adherence to these interfaces will possess a consistent set of functionalities that other applications or contracts can rely on. 1. **`ViewResolver` for Contract-Level Metadata**: - This interface ensures that contracts, particularly those encapsulating NFT collections, conform to the Metadata Views standard. From 9c6fc54deb7317ec224d43c4b7d5ea50231a3c9c Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 21 Nov 2023 10:42:39 -0800 Subject: [PATCH 24/25] Update docs/build/advanced-concepts/metadata-views.md Co-authored-by: Greg Santos --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index dab1ad91b7..9d6068d4c3 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -24,7 +24,7 @@ When considering Flow and how it handles metadata for NFTs, it's crucial to unde - This interface ensures that contracts, particularly those encapsulating NFT collections, conform to the Metadata Views standard. - Through the adoption of this interface, contracts can provide dynamic metadata that represents the entirety of the collection. 2. **`MetadataViews.Resolver` for NFT-Level Metadata**: - - Used within individual NFT resources, this interface ensures each token adheres to a standardized metadata format. + - Used within individual NFT resources, this interface ensures each token adheres to the Metadata standard format. - It focuses on the distinct attributes of an individual NFT, such as its unique ID, name, description, and other defining characteristics. ### Core Functions From bdfecfee25a97f8fd6f30605cc68cd34539352dc Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:04:59 -0800 Subject: [PATCH 25/25] Fix link --- docs/build/advanced-concepts/metadata-views.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/advanced-concepts/metadata-views.md b/docs/build/advanced-concepts/metadata-views.md index 9d6068d4c3..065ce87caa 100644 --- a/docs/build/advanced-concepts/metadata-views.md +++ b/docs/build/advanced-concepts/metadata-views.md @@ -223,4 +223,4 @@ Understanding `MetadataViews` and the core functions associated with it is cruci - See the [API reference for a complete list of Metadata functions](https://developers.flow.com/references/core-contracts/flow-nft/MetdataViews/MetadataViews) - Check out [an Example NFT project](https://github.com/onflow/flow-nft/blob/master/contracts/ExampleNFT.cdc) implementing `MetadataViews` -- Read [the NFT Guide](../../guides/nft.md) for an introduction to implementation \ No newline at end of file +- Read [the NFT Guide](../guides/nft.md) for an introduction to implementation \ No newline at end of file