FORGE Header

Plugins

NFT Plugin

Comprehensive NFT operations using Metaplex standards

Overview

The NFT Plugin provides full-featured NFT functionality following Metaplex standards. Create, transfer, and manage NFTs with support for collections, metadata, and royalties.

Installation

npm install @solana-agent-kit/plugin-nft

Core Methods

mintNFT()

Mint a new NFT with metadata and optional collection.

import { mintNFT } from '@solana-agent-kit/plugin-nft'; const nft = await mintNFT({ name: 'My NFT', symbol: 'MNFT', uri: 'https://arweave.net/...', sellerFeeBasisPoints: 500, // 5% royalty creators: [ { address: CREATOR_ADDRESS, share: 100 } ], collection: COLLECTION_ADDRESS // optional });

transferNFT()

Transfer an NFT to another wallet.

import { transferNFT } from '@solana-agent-kit/plugin-nft'; await transferNFT({ mintAddress: 'NFT_MINT_ADDRESS', recipient: 'RECIPIENT_ADDRESS' });

getNFTsByOwner()

Fetch all NFTs owned by a wallet address.

import { getNFTsByOwner } from '@solana-agent-kit/plugin-nft'; const nfts = await getNFTsByOwner({ ownerAddress: 'WALLET_ADDRESS' }); console.log(`Found ${nfts.length} NFTs`);

createCollection()

Create an NFT collection for grouping related NFTs.

import { createCollection } from '@solana-agent-kit/plugin-nft'; const collection = await createCollection({ name: 'My Collection', symbol: 'MCOL', uri: 'https://arweave.net/collection-metadata' });

Metadata Format

NFT metadata follows the Metaplex standard JSON format:

{ "name": "NFT Name", "symbol": "SYMBOL", "description": "NFT description", "image": "https://arweave.net/image.png", "attributes": [ { "trait_type": "Background", "value": "Blue" }, { "trait_type": "Rarity", "value": "Legendary" } ], "properties": { "files": [ { "uri": "https://arweave.net/image.png", "type": "image/png" } ], "category": "image" } }

Advanced Features

Verified Collections

Verify NFTs as part of an official collection:

import { verifyCollection } from '@solana-agent-kit/plugin-nft'; await verifyCollection({ nftMint: 'NFT_MINT_ADDRESS', collectionMint: 'COLLECTION_MINT_ADDRESS' });

Update NFT Metadata

Update metadata for existing NFTs (requires update authority):

import { updateNFTMetadata } from '@solana-agent-kit/plugin-nft'; await updateNFTMetadata({ mintAddress: 'NFT_MINT_ADDRESS', newUri: 'https://arweave.net/new-metadata.json' });

Burn NFT

Permanently destroy an NFT:

import { burnNFT } from '@solana-agent-kit/plugin-nft'; await burnNFT({ mintAddress: 'NFT_MINT_ADDRESS' });

Compressed NFTs (cNFTs)

Cost-Effective NFTs

Compressed NFTs use state compression to reduce minting costs by 1000x:

import { mintCompressedNFT } from '@solana-agent-kit/plugin-nft'; const cNFT = await mintCompressedNFT({ name: 'Compressed NFT', uri: 'https://arweave.net/metadata.json', treeAddress: 'MERKLE_TREE_ADDRESS' });

Best Practices

  • • Use Arweave or IPFS for permanent metadata storage
  • • Set appropriate royalty percentages (5-10% is standard)
  • • Always verify collection NFTs before minting
  • • Include high-quality images (1000x1000px minimum)
  • • Add meaningful attributes for rarity tracking
  • • Test on devnet before mainnet minting
  • • Consider compressed NFTs for large collections
  • • Keep update authority until collection is complete