Skip to main content

NFT Catalog

info

The NFT Catalog is in the process of being deprecated. You can still use it for existing collections in the Catalog, but no new collections will be added from now on. Most of the functionality that the Catalog provided is now required and handled by default by the NonFungibleToken standard with Metadata Views.

Additionally, TokenList is a new permissionless tool that provides some of the old aggregation functionality that NFT Catalog provided without requiring approvals.

The NFT Catalog is an on chain registry listing NFT collections that exists on Flow which adhere to the NFT metadata standard. This empowers dApp developers to easily build on top of and discover interoperable NFT collections on Flow.

Live Site

Checkout the catalog site

Contract Addresses

NFTCatalog.cdc: This contract contains the NFT Catalog

NetworkAddress
Mainnet0x49a7cda3a1eecc29
Testnet0x324c34e1c517e4db

NFTRetrieval.cdc: This contract contains helper functions to make it easier to discover NFTs within accounts and from the catalog

NetworkAddress
Mainnet0x49a7cda3a1eecc29
Testnet0x324c34e1c517e4db

Using the Catalog (For marketplaces and other NFT applications)

All of the below examples use the catalog in mainnet, you may replace the imports to the testnet address when using the testnet network.

Example 1 - Retrieve all NFT collections on the catalog

import NFTCatalog from 0x49a7cda3a1eecc29

/*
The catalog is returned as a `String: NFTCatalogMetadata`
The key string is intended to be a unique identifier for a specific collection.
The NFTCatalogMetadata contains collection-level views corresponding to each
collection identifier.
*/
access(all) fun main(): {String : NFTCatalog.NFTCatalogMetadata} {
return NFTCatalog.getCatalog()

}

Example 2 - Retrieve all collection names in the catalog

import NFTCatalog from 0x49a7cda3a1eecc29

access(all) fun main(): [String] {
let catalog: {String : NFTCatalog.NFTCatalogMetadata} = NFTCatalog.getCatalog()
let catalogNames: [String] = []
for collectionIdentifier in catalog.keys {
catalogNames.append(catalog[collectionIdentifier]!.collectionDisplay.name)
}
return catalogNames
}

Example 3 - Retrieve NFT collections and counts owned by an account

import MetadataViews from 0x1d7e57aa55817448
import NFTCatalog from 0x49a7cda3a1eecc29
import NFTRetrieval from 0x49a7cda3a1eecc29

access(all) fun main(ownerAddress: Address) : {String : Number} {
let catalog = NFTCatalog.getCatalog()
let account = getAuthAccount(ownerAddress)
let items : {String : Number} = {}

for key in catalog.keys {
let value = catalog[key]!
let tempPathStr = "catalog".concat(key)
let tempPublicPath = PublicPath(identifier: tempPathStr)!
account.link<&{MetadataViews.ResolverCollection}>(
tempPublicPath,
target: value.collectionData.storagePath
)
let collectionCap = account.capabilities.get<&{MetadataViews.ResolverCollection}>(tempPublicPath)
if !collectionCap.check() {
continue
}
let count = NFTRetrieval.getNFTCountFromCap(collectionIdentifier : key, collectionCap : collectionCap)
if count != 0 {
items[key] = count
}
}

return items
}

Sample Response...

{
"schmoes_prelaunch_token": 1
}

Example 4 - Retrieve all NFTs including metadata owned by an account

import MetadataViews from 0x1d7e57aa55817448
import NFTCatalog from 0x49a7cda3a1eecc29
import NFTRetrieval from 0x49a7cda3a1eecc29

access(all) struct NFT {
access(all) let id : UInt64
access(all) let name : String
access(all) let description : String
access(all) let thumbnail : String
access(all) let externalURL : String
access(all) let storagePath : StoragePath
access(all) let publicPath : PublicPath
access(all) let privatePath: PrivatePath
access(all) let publicLinkedType: Type
access(all) let privateLinkedType: Type
access(all) let collectionName : String
access(all) let collectionDescription: String
access(all) let collectionSquareImage : String
access(all) let collectionBannerImage : String
access(all) let royalties: [MetadataViews.Royalty]

init(
id: UInt64,
name : String,
description : String,
thumbnail : String,
externalURL : String,
storagePath : StoragePath,
publicPath : PublicPath,
privatePath : PrivatePath,
publicLinkedType : Type,
privateLinkedType : Type,
collectionIdentifier: String,
collectionName : String,
collectionDescription : String,
collectionSquareImage : String,
collectionBannerImage : String,
royalties : [MetadataViews.Royalty]
) {
self.id = id
self.name = name
self.description = description
self.thumbnail = thumbnail
self.externalURL = externalURL
self.storagePath = storagePath
self.publicPath = publicPath
self.privatePath = privatePath
self.publicLinkedType = publicLinkedType
self.privateLinkedType = privateLinkedType
self.collectionIdentifier = collectionIdentifier
self.collectionName = collectionName
self.collectionDescription = collectionDescription
self.collectionSquareImage = collectionSquareImage
self.collectionBannerImage = collectionBannerImage
self.royalties = royalties
}
}

access(all) fun main(ownerAddress: Address) : { String : [NFT] } {
let catalog = NFTCatalog.getCatalog()
let account = getAuthAccount<auth(Capabilities) &Account>(ownerAddress)
let items : [NFTRetrieval.BaseNFTViewsV1] = []

let data : {String : [NFT] } = {}

for key in catalog.keys {
let value = catalog[key]!
let tempPathStr = "catalog".concat(key)
let tempPublicPath = PublicPath(identifier: tempPathStr)!
let newCap = account.capabilities.issue<&{MetadataViews.ResolverCollection}>
(value.collectionData.storagePath)
account.capabilities.publish(newCap, tempPublicPath)

let collectionCap = account.capabilities.get<&{MetadataViews.ResolverCollection}>(tempPublicPath)
if !collectionCap.check() {
continue
}
let views = NFTRetrieval.getNFTViewsFromCap(collectionIdentifier : key, collectionCap : collectionCap)

let items : [NFT] = []
for view in views {
let displayView = view.display
let externalURLView = view.externalURL
let collectionDataView = view.collectionData
let collectionDisplayView = view.collectionDisplay
let royaltyView = view.royalties
if (displayView == nil || externalURLView == nil || collectionDataView == nil || collectionDisplayView == nil || royaltyView == nil) {
// This NFT does not have the proper views implemented. Skipping....
continue
}

items.append(
NFT(
id: view.id,
name : displayView!.name,
description : displayView!.description,
thumbnail : displayView!.thumbnail.uri(),
externalURL : externalURLView!.url,
storagePath : collectionDataView!.storagePath,
publicPath : collectionDataView!.publicPath,
privatePath : collectionDataView!.providerPath,
publicLinkedType : collectionDataView!.publicLinkedType,
privateLinkedType : collectionDataView!.providerLinkedType,
collectionIdentifier: key,
collectionName : collectionDisplayView!.name,
collectionDescription : collectionDisplayView!.description,
collectionSquareImage : collectionDisplayView!.squareImage.file.uri(),
collectionBannerImage : collectionDisplayView!.bannerImage.file.uri(),
royalties : royaltyView!.getRoyalties()
)
)
}
data[key] = items
}
return data
}

Sample Response...

{
"FlovatarComponent": [],
"schmoes_prelaunch_token": [
s.aa16be98aac20e8073f923261531cbbdfae1464f570f5be796b57cdc97656248.NFT(
id: 1006,
name: "Schmoes Pre Launch Token #1006",
description: "",
thumbnail: "https://gateway.pinata.cloud/ipfs/QmXQ1iBke5wjcjYG22ACVXsCvtMJKEkwFiMf96UChP8uJq",
externalURL: "https://schmoes.io",
storagePath: /storage/SchmoesPreLaunchTokenCollection,
publicPath: /public/SchmoesPreLaunchTokenCollection,
privatePath: /private/SchmoesPreLaunchTokenCollection,
publicLinkedType: Type<&A.6c4fe48768523577.SchmoesPreLaunchToken.Collection{A.1d7e57aa55817448.NonFungibleToken.CollectionPublic,A. 1d7e57aa55817448.NonFungibleToken.Receiver,A.1d7e57aa55817448.MetadataViews.ResolverCollection}>(),
privateLinkedType: Type<&A.6c4fe48768523577.SchmoesPreLaunchToken.Collection{A.1d7e57aa55817448.NonFungibleToken.CollectionPublic,A.1d7e57aa55817448.NonFungibleToken.Provider,A.1d7e57aa55817448.MetadataViews.ResolverCollection}>(),
collectionName: "Schmoes Pre Launch Token",
collectionDescription: "",
collectionSquareImage: "https://gateway.pinata.cloud/ipfs/QmXQ1iBke5wjcjYG22ACVXsCvtMJKEkwFiMf96UChP8uJq",
collectionBannerImage: "https://gateway.pinata.cloud/ipfs/QmXQ1iBke5wjcjYG22ACVXsCvtMJKEkwFiMf96UChP8uJq",
royalties: []
)
],
"Flovatar": []
}

Example 5 - Retrieve all NFTs including metadata owned by an account for large wallets

For Wallets that have a lot of NFTs you may run into memory issues. The common pattern to get around this for now is to retrieve just the ID's in a wallet by calling the following script

import MetadataViews from 0x1d7e57aa55817448
import NFTCatalog from 0x49a7cda3a1eecc29
import NFTRetrieval from 0x49a7cda3a1eecc29

access(all) fun main(ownerAddress: Address) : {String : [UInt64]} {
let catalog = NFTCatalog.getCatalog()
let account = getAuthAccount<auth(Capabilities) &Account>(ownerAddress)

let items : {String : [UInt64]} = {}

for key in catalog.keys {
let value = catalog[key]!
let tempPathStr = "catalogIDs".concat(key)
let tempPublicPath = PublicPath(identifier: tempPathStr)!
let newCap = account.capabilities.issue<&{MetadataViews.ResolverCollection}>
(value.collectionData.storagePath)
account.capabilities.publish(newCap, tempPublicPath)

let collectionCap = account.capabilities.get<&{MetadataViews.ResolverCollection}>(tempPublicPath)
if !collectionCap.check() {
continue
}

let ids = NFTRetrieval.getNFTIDsFromCap(collectionIdentifier : key, collectionCap : collectionCap)

if ids.length > 0 {
items[key] = ids
}
}
return items

}

and then use the ids to retrieve the full metadata for only those ids by calling the following script and passing in a map of collectlionIdentifer -> [ids]

import MetadataViews from 0x1d7e57aa55817448
import NFTCatalog from 0x49a7cda3a1eecc29
import NFTRetrieval from 0x49a7cda3a1eecc29

access(all) struct NFT {
access(all) let id : UInt64
access(all) let name : String
access(all) let description : String
access(all) let thumbnail : String
access(all) let externalURL : String
access(all) let storagePath : StoragePath
access(all) let publicPath : PublicPath
access(all) let privatePath: PrivatePath
access(all) let publicLinkedType: Type
access(all) let privateLinkedType: Type
access(all) let collectionName : String
access(all) let collectionDescription: String
access(all) let collectionSquareImage : String
access(all) let collectionBannerImage : String
access(all) let royalties: [MetadataViews.Royalty]

init(
id: UInt64,
name : String,
description : String,
thumbnail : String,
externalURL : String,
storagePath : StoragePath,
publicPath : PublicPath,
privatePath : PrivatePath,
publicLinkedType : Type,
privateLinkedType : Type,
collectionName : String,
collectionDescription : String,
collectionSquareImage : String,
collectionBannerImage : String,
royalties : [MetadataViews.Royalty]
) {
self.id = id
self.name = name
self.description = description
self.thumbnail = thumbnail
self.externalURL = externalURL
self.storagePath = storagePath
self.publicPath = publicPath
self.privatePath = privatePath
self.publicLinkedType = publicLinkedType
self.privateLinkedType = privateLinkedType
self.collectionName = collectionName
self.collectionDescription = collectionDescription
self.collectionSquareImage = collectionSquareImage
self.collectionBannerImage = collectionBannerImage
self.royalties = royalties
}
}

access(all) fun main(ownerAddress: Address, collections: {String : [UInt64]}) : {String : [NFT] } {
let data : {String : [NFT] } = {}

let catalog = NFTCatalog.getCatalog()
let account = getAuthAccount<auth(Capabilities) &Account>(ownerAddress)
for collectionIdentifier in collections.keys {
if catalog.containsKey(collectionIdentifier) {
let value = catalog[collectionIdentifier]!
let tempPathStr = "catalog".concat(collectionIdentifier)
let tempPublicPath = PublicPath(identifier: tempPathStr)!
let newCap = account.capabilities.issue<&{MetadataViews.ResolverCollection}>
(value.collectionData.storagePath)
account.capabilities.publish(newCap, tempPublicPath)

let collectionCap = account.capabilities.get<&{MetadataViews.ResolverCollection}>(tempPublicPath)

if !collectionCap.check() {
return data
}

let views = NFTRetrieval.getNFTViewsFromIDs(collectionIdentifier : collectionIdentifier, ids: collections[collectionIdentifier]!, collectionCap : collectionCap)

let items : [NFT] = []

for view in views {
let displayView = view.display
let externalURLView = view.externalURL
let collectionDataView = view.collectionData
let collectionDisplayView = view.collectionDisplay
let royaltyView = view.royalties
if (displayView == nil || externalURLView == nil || collectionDataView == nil || collectionDisplayView == nil || royaltyView == nil) {
// Bad NFT. Skipping....
continue
}

items.append(
NFT(
id: view.id,
name : displayView!.name,
description : displayView!.description,
thumbnail : displayView!.thumbnail.uri(),
externalURL : externalURLView!.url,
storagePath : collectionDataView!.storagePath,
publicPath : collectionDataView!.publicPath,
privatePath : collectionDataView!.providerPath,
publicLinkedType : collectionDataView!.publicLinkedType,
privateLinkedType : collectionDataView!.providerLinkedType,
collectionName : collectionDisplayView!.name,
collectionDescription : collectionDisplayView!.description,
collectionSquareImage : collectionDisplayView!.squareImage.file.uri(),
collectionBannerImage : collectionDisplayView!.bannerImage.file.uri(),
royalties : royaltyView!.getRoyalties()
)
)
}

data[collectionIdentifier] = items
}
}


return data
}

Example 6 - Retrieve all MetadataViews for NFTs in a wallet

If you're looking for some MetadataViews that aren't in the core view list you can leverage this script to grab all the views each NFT supports. Note: You lose some typing here but get more data.

import MetadataViews from 0x1d7e57aa55817448
import NFTCatalog from 0x49a7cda3a1eecc29
import NFTRetrieval from 0x49a7cda3a1eecc29

access(all) struct NFTCollectionData {
access(all) let storagePath : StoragePath
access(all) let publicPath : PublicPath
access(all) let publicLinkedType: Type

init(
storagePath : StoragePath,
publicPath : PublicPath,
publicLinkedType : Type,
) {
self.storagePath = storagePath
self.publicPath = publicPath
self.publicLinkedType = publicLinkedType
}
}

access(all) fun main(ownerAddress: Address) : { String : {String : AnyStruct} } {
let catalog = NFTCatalog.getCatalog()
let account = getAuthAccount<auth(Capabilities) &Account>(ownerAddress)
let items : [MetadataViews.NFTView] = []

let data : { String : {String : AnyStruct} } = {}

for key in catalog.keys {
let value = catalog[key]!
let tempPathStr = "catalog".concat(key)
let tempPublicPath = PublicPath(identifier: tempPathStr)!
let newCap = account.capabilities.issue<&{MetadataViews.ResolverCollection}>
(value.collectionData.storagePath)
account.capabilities.publish(newCap, tempPublicPath)
let collectionCap = account.capabilities.get<&{MetadataViews.ResolverCollection}>(tempPublicPath)
if !collectionCap.check() {
continue
}

var views = NFTRetrieval.getAllMetadataViewsFromCap(collectionIdentifier : key, collectionCap : collectionCap)

if views.keys.length == 0 {
continue
}

// Cadence doesn't support function return types, lets manually get rid of it
let nftCollectionDisplayView = views[Type<MetadataViews.NFTCollectionData>().identifier] as! MetadataViews.NFTCollectionData?
let collectionDataView = NFTCollectionData(
storagePath : nftCollectionDisplayView!.storagePath,
publicPath : nftCollectionDisplayView!.publicPath,
publicLinkedType : nftCollectionDisplayView!.publicLinkedType,
)
views.insert(key: Type<MetadataViews.NFTCollectionData>().identifier, collectionDataView)

data[key] = views
}

return data
}

Example 7 - Setup a user’s account to receive a specific collection

  1. Run the following script to retrieve some collection-level information for an NFT collection identifier from the catalog
import MetadataViews from 0x1d7e57aa55817448
import NFTCatalog from 0x49a7cda3a1eecc29
import NFTRetrieval from 0x49a7cda3a1eecc29

access(all) struct NFTCollection {
access(all) let storagePath : StoragePath
access(all) let publicPath : PublicPath
access(all) let privatePath: PrivatePath
access(all) let publicLinkedType: Type
access(all) let privateLinkedType: Type
access(all) let collectionName : String
access(all) let collectionDescription: String
access(all) let collectionSquareImage : String
access(all) let collectionBannerImage : String

init(
storagePath : StoragePath,
publicPath : PublicPath,
privatePath : PrivatePath,
publicLinkedType : Type,
privateLinkedType : Type,
collectionName : String,
collectionDescription : String,
collectionSquareImage : String,
collectionBannerImage : String
) {
self.storagePath = storagePath
self.publicPath = publicPath
self.privatePath = privatePath
self.publicLinkedType = publicLinkedType
self.privateLinkedType = privateLinkedType
self.collectionName = collectionName
self.collectionDescription = collectionDescription
self.collectionSquareImage = collectionSquareImage
self.collectionBannerImage = collectionBannerImage
}
}

access(all) fun main(collectionIdentifier : String) : NFT? {
let catalog = NFTCatalog.getCatalog()

assert(catalog.containsKey(collectionIdentifier), message: "Invalid Collection")

return NFTCollection(
storagePath : collectionDataView!.storagePath,
publicPath : collectionDataView!.publicPath,
privatePath : collectionDataView!.providerPath,
publicLinkedType : collectionDataView!.publicLinkedType,
privateLinkedType : collectionDataView!.providerLinkedType,
collectionName : collectionDisplayView!.name,
collectionDescription : collectionDisplayView!.description,
collectionSquareImage : collectionDisplayView!.squareImage.file.uri(),
collectionBannerImage : collectionDisplayView!.bannerImage.file.uri()
)
}

panic("Invalid Token ID")
}
  1. This script result can then be used to form a transaction by inserting the relevant variables from above into a transaction template like the following:
import NonFungibleToken from 0x1d7e57aa55817448
import MetadataViews from 0x1d7e57aa55817448
{ADDITIONAL_IMPORTS}

transaction {

prepare(signer: auth(BorrowValue, IssueStorageCapabilityController, PublishCapability, SaveValue, UnpublishCapability) &Account) {

let collectionData = {CONTRACT_NAME}.resolveContractView(resourceType: nil, viewType: Type<MetadataViews.NFTCollectionData>()) as! MetadataViews.NFTCollectionData?
?? panic("Could not resolve NFTCollectionData view. The {CONTRACT_NAME} contract needs to implement the NFTCollectionData Metadata view in order to execute this transaction")

// Return early if the account already has a collection
if signer.storage.borrow<&{CONTRACT_NAME}.Collection>(from: collectionData.storagePath) != nil {
return
}

// Create a new empty collection
let collection <- {CONTRACT_NAME}.createEmptyCollection(nftType: Type<@{CONTRACT_NAME}.NFT>())

// save it to the account
signer.storage.save(<-collection, to: collectionData.storagePath)

// create a public capability for the collection
signer.capabilities.unpublish(collectionData.publicPath)
let collectionCap = signer.capabilities.storage.issue<&{CONTRACT_NAME}.Collection>(collectionData.storagePath)
signer.capabilities.publish(collectionCap, at: collectionData.publicPath)
}
}

An even easier way to setup an account without relying on the NFT Catalog is to just use the generic setup account transaction. All you need is the name and address of the contract!

import "NonFungibleToken"
import "MetadataViews"

/// This transaction is what an account would run
/// to set itself up to receive NFTs. This function
/// uses views to know where to set up the collection
/// in storage and to create the empty collection.
///
/// @param contractAddress: The address of the contract that defines the token being initialized
/// @param contractName: The name of the contract that defines the token being initialized. Ex: "ExampleNFT"

transaction(contractAddress: Address, contractName: String) {

prepare(signer: auth(IssueStorageCapabilityController, PublishCapability, SaveValue) &Account) {
// Borrow a reference to the nft contract deployed to the passed account
let resolverRef = getAccount(contractAddress)
.contracts.borrow<&{NonFungibleToken}>(name: contractName)
?? panic("Could not borrow NonFungibleToken reference to the contract. Make sure the provided contract name ("
.concat(contractName).concat(") and address (").concat(contractAddress.toString()).concat(") are correct!"))

// Use that reference to retrieve the NFTCollectionData view
let collectionData = resolverRef.resolveContractView(resourceType: nil, viewType: Type<MetadataViews.NFTCollectionData>()) as! MetadataViews.NFTCollectionData?
?? panic("Could not resolve NFTCollectionData view. The ".concat(contractName).concat(" contract needs to implement the NFTCollectionData Metadata view in order to execute this transaction"))

// Create a new empty collections
let emptyCollection <- collectionData.createEmptyCollection()

// save it to the account
signer.storage.save(<-emptyCollection, to: collectionData.storagePath)

// create a public capability for the collection
let collectionCap = signer.capabilities.storage.issue<&{NonFungibleToken.Collection}>(
collectionData.storagePath
)
signer.capabilities.publish(collectionCap, at: collectionData.publicPath)
}
}

Developer Usage

1. Install the Flow CLI

2. Install Node

3. Clone the project

git clone --depth=1 https://github.com/onflow/nft-catalog.git

4. Install packages

  • Run npm install in the root of the project

5. Run Test Suite

  • Run npm test in the root of the project

Cadence Generation

Using the NFT Catalog, you can generate common scripts and transactions to be run against the Flow Blockchain to support your application.

Generate from Javascript

Installation

npm install @onflow/fcl
npm install flow-catalog

or

yarn add @onflow/fcl
yarn add flow-catalog

Usage

1. Retrieve a list of transactions available for code generation: NOTE: In order to properly bootstrap the method, you will need to run and await on the getAddressMaps() method, passing it into all of the methods as shown below.

import { getAddressMaps, scripts } from "flow-catalog";
import * as fcl from "@onflow/fcl"

const main = async () => {
const addressMap = await getAddressMaps();
console.log(await scripts.getSupportedGeneratedTransactions(addressMap));
};

main();

2. Provide a Catalog collection identifier to generate code

const getTemplatedTransactionCode = async function() {
const catalogAddressMap = await getAddressMaps()
const result = await cadence.scripts.genTx({

/*
'CollectionInitialization' is one of the available transactions from step 1.
'Flunks' is the collection identifier in this case
'Flow' is a fungible token identifier (if applicable to the transaction being used)
*/

args: ['CollectionInitialization', 'Flunks', 'flow'],
addressMap: catalogAddressMap
})
return result
}

3. Use the generated code in a transaction

const txId = await fcl.mutate({
cadence: await getTemplatedTransactionCode()[0],
limit: 9999,
args: (arg: any, t: any) => []
});
const transaction = await fcl.tx(txId).onceSealed()
return transaction

Generate from non-Javascript environments

Cadence scripts and transactions can be generated directly on-chain via scripts. You will need to be able to run cadence scripts to continue.

1. Retrieve a list of transactions available for code generation

Run the following script to retrieve available code generation methods: https://github.com/dapperlabs/nft-catalog/blob/main/cadence/scripts/get_supported_generated_transactions.cdc

2. Provide a catalog collection identifier to generate code

You may use the following script to generate code: https://github.com/dapperlabs/nft-catalog/blob/main/cadence/scripts/gen_tx.cdc

For example, from the CLI this may be run like the following: flow -n mainnet scripts execute ./get_tx.cdc CollectionInitialization Flunks flow

In the above example, CollectionInitialization is one of the supported transactions returned from step 1, Flunks is the name of an entry on the catalog (https://www.flow-nft-catalog.com/catalog/mainnet/Flunks), and flow is a fungible token identifier.

NPM Module

We exposed an interface to the catalog via a consumable NPM module. This library will expose a number of methods that can be called to interact with the catalog.

Methods

Method signatures and their associating parameters/responses can be found in the cadence/ folder of this repo.

Scripts

checkForRecommendedV1Views
genTx
getAllNftsInAccount
getExamplenftCollectionLength
getExamplenftType
getNftCatalog
getNftCatalogProposals
getNftCollectionsForNftType
getNftIdsInAccount
getNftInAccount
getNftInAccountFromPath
getNftMetadataForCollectionIdentifier
getNftProposalForId
getNftsCountInAccount
getNftsInAccount
getNftsInAccountFromIds
getNftsInAccountFromPath
getSupportedGeneratedTransactions
hasAdminProxy
isCatalogAdmin

Transactions

addToNftCatalog
addToNftCatalogAdmin
approveNftCatalogProposal
mintExampleNft
mintNonstandardNft
proposeNftToCatalog
rejectNftCatalogProposal
removeFromNftCatalog
removeNftCatalogProposal
sendAdminCapabilityToProxy
setupExamplenftCollection
setupNftCatalogAdminProxy
setupNonstandardnftCollection
setupStorefront
transferExamplenft
updateNftCatalogEntry
withdrawNftProposalFromCatalog

Installation

npm install flow-catalog

or

yarn add flow-catalog

Usage

Methods can be imported as follows, all nested methods live under the scripts or transactions variable.

NOTE: In order to properly bootstrap the method, you will need to run and await on the getAddressMaps() method, passing it into all of the methods as shown below.

import { getAddressMaps, scripts } from "flow-catalog";

const main = async () => {
const addressMap = await getAddressMaps();
console.log(await scripts.getNftCatalog(addressMap));
};

main();

The response of any method is a tuple-array, with the first element being the result, and the second being the error (if applicable).

For example, the result of the method above would look like -

[
{
BILPlayerCollection: {
contractName: 'Player',
contractAddress: '0x9e6cdb88e34fa1f3',
nftType: [Object],
collectionData: [Object],
collectionDisplay: [Object]
},
...
SoulMadeComponent: {
contractName: 'SoulMadeComponent',
contractAddress: '0x421c19b7dc122357',
nftType: [Object],
collectionData: [Object],
collectionDisplay: [Object]
}
},
null
]

License

The works in these files:

are under the Unlicense.