Creating a React minting app
The repository includes a complete example at examples/rainbowkit-mint, demonstrating how to implement minting with Manifold products including Edition Products
Overview
The edition RainbowKit example showcases how to:
Connect wallets with RainbowKit + wagmi
Mint Edition products through the Manifold Client SDK
Run on Next.js 14 with the App Router and TypeScript
Display mint progress, costs, and errors in the UI
Complete example at examples/rainbowkit-mint
Quick start
Install workspace dependencies
pnpm installCreate environment variables
cp .env.example \ env.localFill in:
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_id NEXT_PUBLIC_INSTANCE_ID=your_edition_instance_id NEXT_PUBLIC_RPC_URL_SEPOLIA=your_alchemy_rpc_urlNEXT_PUBLIC_INSTANCE_IDmust point to an Edition product you published in Manifold Studio.NEXT_PUBLIC_WALLETCONNECT_PROJECT_IDis optional but required if you want to support WalletConnect wallets.NEXT_PUBLIC_RPC_URL_SEPOLIAyour Alchemy Sepolia RPC URL.Launch the example
Visit http://localhost:3000 and connect a wallet with RainbowKit’s ConnectButton.
Key implementation steps
Ensure you have the ConnectButton component on your page. This handles wallet connections, which are required to create an Account that the SDK uses for checks and transaction execution.
Implement Minting Logic in MintButton.tsx
Core Steps
a. Create a Manifold Client with a public provider
b. Create an Account representing the connected user.
c. Fetch the product and verify its type
d. Check the product status to ensure it’s still active
e. Prepare the purchase by specifying the amount
f. Execute the purchase
Key points:
createAccountViemwraps wagmi’s wallet client so the SDK can sign and send transactions on the user’s behalf.preparePurchaseperforms all eligibility checks (allowlists, supply, promo codes) and returns the total cost breakdown. Supply the sameaccountso balance checks run against the connected wallet.purchaseexecutes the transaction sequence (ERC-20 approvals, mint, etc.) and returns a Receipt with the final transaction hash and minted tokens.
Display token media and on-chain stats
You can enrich the UI with product art and live supply data directly from the SDK:
Best practices:
Check status with getStatus before attempting a purchase to verify the product is active.
Handle ClientSDKError codes for common cases such as ineligibility, sold-out items, or insufficient funds.
Call
getAllocationswhen you need to show remaining allowlist spots.Inspect
Receipt.orderto display which tokens were minted afterpurchase.
Last updated