Flowty Developers
  • NFT Metadata Standard
    • Overview
    • Display
    • Traits
    • Royalties
    • Collection Metadata
      • Collection Display
      • Collection Data
  • Flow NFT Catalog
  • Hybrid Custody
    • Overview
    • Applications
    • Resources and Transactions
  • Contract Addresses
Powered by GitBook
On this page
  1. NFT Metadata Standard
  2. Collection Metadata

Collection Data

How do I store, send, or withdraw from this collection?

PreviousCollection DisplayNextFlow NFT Catalog

Last updated 1 year ago

The describes information critical to understanding how to talk to your collection. Without it, Flowty might not be able to ingest your collection or permit listings.

NFTCollectionData has a few key fields that Flowty relies on:

  1. storagePath: Where should this collection be saved if we are configuring an account's storage for this collection?

  2. publicPath: Where do we borrow public capabilities for this collection? This is primarily used for actions like transfers.

  3. providerPath: What is this collection's recommended path to withdraw items from? NOTE: This field is required to work with Hybrid Custody (Section coming soon)

  4. createEmptyCollection: A helper function that lets us initialize your collection from a metadata view. This function should return a resource that implements NonFungibleToken.Collection and be capable of storing your collection.

NOTE: While this metadata view does describe how to link your full collection type, Flowty will only set up standard interfaces on these paths. If you create an application that relies on other interfaces being linked, you will need to handle incomplete links and correct them, if detected.

pub contract Avataaars: NonFungibleToken, ViewResolver {
    // ...

    pub resource NFT: NonFungibleToken.INFT, MetadataViews.ResolverCollection {
        pub fun resolveView(_ view: Type): AnyStruct? {
            switch view {
                // ...
                case Type<MetadataViews.NFTCollectionData>():
                    return Avataaars.resolveView(view)
                // ...
            }
            return nil
        }
    }

    pub fun resolveView(_ view: Type): AnyStruct? {
        switch view {
            case Type<MetadataViews.NFTCollectionData>():
                return MetadataViews.NFTCollectionData(
                    storagePath: Avataaars.CollectionStoragePath,
                    publicPath: Avataaars.CollectionPublicPath,
                    providerPath: Avataaars.CollectionProviderPath,
                    publicCollection: Type<&Avataaars.Collection{Avataaars.AvataaarsCollectionPublic}>(),
                    publicLinkedType: Type<&Avataaars.Collection{Avataaars.AvataaarsCollectionPublic,NonFungibleToken.CollectionPublic,NonFungibleToken.Receiver,MetadataViews.ResolverCollection}>(),
                    providerLinkedType: Type<&Avataaars.Collection{Avataaars.AvataaarsCollectionPublic,NonFungibleToken.CollectionPublic,NonFungibleToken.Provider,MetadataViews.ResolverCollection}>(),
                    createEmptyCollectionFunction: (fun (): @NonFungibleToken.Collection {
                        return <-Avataaars.createEmptyCollection()
                    })
                )
            // ...
        }
        return nil
    }
}
pub struct NFTCollectionData {
    /// Path in storage where this NFT is recommended to be stored.
    pub let storagePath: StoragePath

    /// Public path which must be linked to expose public capabilities of this NFT
    /// including standard NFT interfaces and metadataviews interfaces
    pub let publicPath: PublicPath

    /// Private path which should be linked to expose the provider
    /// capability to withdraw NFTs from the collection holding NFTs
    pub let providerPath: PrivatePath

    /// Public collection type that is expected to provide sufficient read-only access to standard
    /// functions (deposit + getIDs + borrowNFT)
    /// This field is for backwards compatibility with collections that have not used the standard
    /// NonFungibleToken.CollectionPublic interface when setting up collections. For new
    /// collections, this may be set to be equal to the type specified in `publicLinkedType`.
    pub let publicCollection: Type

    /// Type that should be linked at the aforementioned public path. This is normally a
    /// restricted type with many interfaces. Notably the `NFT.CollectionPublic`,
    /// `NFT.Receiver`, and `MetadataViews.ResolverCollection` interfaces are required.
    pub let publicLinkedType: Type

    /// Type that should be linked at the aforementioned private path. This is normally
    /// a restricted type with at a minimum the `NFT.Provider` interface
    pub let providerLinkedType: Type

    /// Function that allows creation of an empty NFT collection that is intended to store
    /// this NFT.
    pub let createEmptyCollection: ((): @NonFungibleToken.Collection)

    // init truncated...
}
NFTCollectionData view