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

1
checkForRecommendedV1Views
2
genTx
3
getAllNftsInAccount
4
getExamplenftCollectionLength
5
getExamplenftType
6
getNftCatalog
7
getNftCatalogProposals
8
getNftCollectionsForNftType
9
getNftIdsInAccount
10
getNftInAccount
11
getNftInAccountFromPath
12
getNftMetadataForCollectionIdentifier
13
getNftProposalForId
14
getNftsCountInAccount
15
getNftsInAccount
16
getNftsInAccountFromIds
17
getNftsInAccountFromPath
18
getSupportedGeneratedTransactions
19
hasAdminProxy
20
isCatalogAdmin

Transactions

1
addToNftCatalog
2
addToNftCatalogAdmin
3
approveNftCatalogProposal
4
mintExampleNft
5
mintNonstandardNft
6
proposeNftToCatalog
7
rejectNftCatalogProposal
8
removeFromNftCatalog
9
removeNftCatalogProposal
10
sendAdminCapabilityToProxy
11
setupExamplenftCollection
12
setupNftCatalogAdminProxy
13
setupNonstandardnftCollection
14
setupStorefront
15
transferExamplenft
16
updateNftCatalogEntry
17
withdrawNftProposalFromCatalog

Installation

1
npm install flow-catalog

or

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

1
import { getAddressMaps, scripts } from "flow-catalog";
2
3
const main = async () => {
4
const addressMap = await getAddressMaps();
5
console.log(await scripts.getNftCatalog(addressMap));
6
};
7
8
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 -

1
[
2
{
3
BILPlayerCollection: {
4
contractName: 'Player',
5
contractAddress: '0x9e6cdb88e34fa1f3',
6
nftType: [Object],
7
collectionData: [Object],
8
collectionDisplay: [Object]
9
},
10
...
11
SoulMadeComponent: {
12
contractName: 'SoulMadeComponent',
13
contractAddress: '0x421c19b7dc122357',
14
nftType: [Object],
15
collectionData: [Object],
16
collectionDisplay: [Object]
17
}
18
},
19
null
20
]