Metaplex/Candy Machine
Candy Machine Form
A Metaplex Core Candy Machine creation component with shadcn UI styling
Candy Machine Form
Create Candy Machine
Set up your NFT collection launchpad
Loading...
Installation
Install dependencies
Start by installing required Metaplex Core Candy Machine dependencies
pnpm add @solana/web3.js @solana/wallet-adapter-react @metaplex-foundation/umi-bundle-defaults @metaplex-foundation/umi-signer-wallet-adapters @metaplex-foundation/mpl-core @metaplex-foundation/mpl-core-candy-machine @metaplex-foundation/umi
Add Wallet Provider
Make sure you have added the Wallet Provider to your application. If not, follow the steps in the Connect Wallet Button guide first.
Add Candy Machine Form
pnpm dlx shadcn@canary add https://www.murphyai.dev/r/candy-machine-form.json
Basic Usage
import { CandyMachineForm } from "@/components/ui/murphy/candy-machine-form";
export default function MyPage() {
return (
<div>
<h1 className="text-xl font-bold mb-2">Create Candy Machine</h1>
<CandyMachineForm className="max-w-md" />
</div>
);
}
Features
- Core Candy Machine: Uses Metaplex Core standard for next-gen NFTs
- Configurable Guards: SOL payment, bot tax, start/end dates
- Config Lines: Multiple NFT metadata configurations
- Collection Support: Optional collection integration
- Real-time Network Detection: Automatically detects devnet/mainnet
- Multi-stage UI: Input, confirmation, success, error states
- Transaction Links: Direct links to view transactions on explorers
- Error Handling: Comprehensive error handling with retry capability
- Wallet Integration: Seamless integration with Solana wallet adapters
Advanced Usage
You can specify a collection and handle creation callbacks:
export default function MyPage() {
const handleCandyMachineCreated = (candyMachine: string, signature: string) => {
console.log(`Candy Machine created: ${candyMachine}`);
console.log(`Transaction: ${signature}`);
};
return (
<div>
<h1 className="text-xl font-bold mb-2">Create Candy Machine</h1>
<CandyMachineForm
className="max-w-md"
collection="YourCollectionMintAddress"
onCandyMachineCreated={handleCandyMachineCreated}
/>
</div>
);
}
Props
Prop | Type | Default | Description |
---|---|---|---|
collection | string | undefined | Pre-populate collection mint address |
onCandyMachineCreated | (candyMachine: string, signature: string) => void | undefined | Callback fired when Candy Machine is created |
className | string | undefined | Additional CSS classes |
Configuration Options
Basic Settings
- Items Available: Total number of NFTs in the collection
- Price: Price per NFT in SOL
- Symbol: Collection symbol (max 10 characters)
- Collection: Optional existing collection to add NFTs to
Guards
- SOL Payment: Require SOL payment for minting
- Bot Tax: Add bot protection with small fee
- Start Date: Set when minting begins
- End Date: Set when minting ends
Config Lines
Define metadata for each NFT:
- Name: NFT name template
- URI: Metadata JSON URI
Notes
- Requires Solana wallet connection
- Uses Metaplex Core standard (next-gen NFT standard)
- Automatically handles transaction signing and confirmation
- Config lines define the metadata for each NFT in the collection
- Guards provide various access controls and payment mechanisms
- Collection is optional but recommended for organized NFT series
Related Components
- Create Collection Form - Create NFT collections
- Mint NFT Form - Mint individual NFTs
- Connect Wallet Button - Wallet connection