Simple script that runs on devnet and:
- Uploads image to IPFS using Pinata
- Uploads metadata to IPFS using Pinata
- Mints NFT using @metaplex/js
Install dependencies:
yarn
You'll need Pinata secrets to upload to Pinata. Create an account and generate API keys.
Add the following environment variables to your .env
file:
API_KEY=<Your API key>
API_SECRET=<Your API secret>
Run:
yarn start
Example output:
Image URL: https://gateway.pinata.cloud/ipfs/QmZD7yDhMYPYbviUBi1SbxeoqcSpLdhaHbewuAJ7z9xFuj
Metadata URL: https://gateway.pinata.cloud/ipfs/QmVrRwghWqmUMo3HPQ5rMftS3CuWPjjMbJStHoJx3Zde91
Solscan URL: https://explorer.solana.com/address/5sgmdQpNr2M1wzkTedGfB3GtbtDL6LFonYFJ2ZjnFfiV?cluster=devnet
- Handles the uploading of image and metadata
- image url is hardcoded from the asset folder
- Handles minting of NFT with given metadata
- Creates and returns simple metadata for NFT
- Handles key creation. Orchestrates NFT creation.