The Standard NFT template generates a contract that can mint simple one-of-a-kind NFTs.
In this model, NFT metadata is attached directly to each NFT at mint time.
The template requires the following inputs when generating a contract:
contractName
- the name of the contract.fields
- the metadata fields to include on the contract.views
- the metadata views to include on the contract.saveAdminResourceToContractAccount
- a special boolean flag that indicates whether theAdmin
resource should be saved to the contract account at mint time. If false, the deployer must pass to the contract initializer anAuthAccount
that will receive theAdmin
resource.
This template has an accompanying TypeScript wrapper in @freshmint/core
implemented in StandardNFTContract.ts
.
The wrapper contains functions to generate a contract, deploy it and mint NFTs.
See the Standard NFTs section in the Node.js documentation for more documentation and examples.
Use the mint.cdc
transaction to mint NFTs with this contract.
This transaction accepts one argument for each field defined in your metadata schema. It accepts an array of values for each field to support batch minting.
Tests are implemented in TypeScript in StandardNFTContract.test.ts
and use @onflow/flow-js-testing
to run on the Flow Emulator.