Skip to main content
Version: Current

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


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

Transactions


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

Installation


_10
npm install flow-catalog

or


_10
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.


_10
import { getAddressMaps, scripts } from "flow-catalog";
_10
_10
const main = async () => {
_10
const addressMap = await getAddressMaps();
_10
console.log(await scripts.getNftCatalog(addressMap));
_10
};
_10
_10
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 -


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