Warpcast
Tips and pointers on how to build a Farcaster-native minting experience
- Don’t build your smart contract. Reuse MintFactory hyperstructure
- It works the same on different chains and has already been reviewed/battle-tested
- Creating the NFT
- A simple React/NextJS website
- The user uploads an image, sets the title, and description
- The backend stores the data on IPFS
- Can use Pinata or Infura — free for the first 5GB
- The API is really simple, just HTTP POST to a URL, get the hash back
- Connecting wallet: RainbowKit, ConnectKit, or any other connector
- The user submits a transaction to MintFactory’s
createBasicEdition_efficient_d3ea1b36
with the NFT metadata
- Use a
BasicMintModule
as the mintModuleAddresses
, and configure it to your liking (e.g. max mints, etc.)
- See MintFactory’s transactions for more examples
- Create a server-side custodial wallet (EOA or AA) and ask the user to top it up
- Estimate tx fees ✕ mint amount as a suggested top-up
- Create the frame minting experience
- Full documentation Farcaster Frames
- A route
/mint/[address]
- The backend fetches the contract’s metadata from the blockchain
- Renders OpenGraph tags with name/description/image
- Should display NFT’s artwork inside OG image. Use
@vercel/og
or simple image manipulation libraries
- Include
fc:frame
metatag with vNext
(see docs)
- Include “Mint” button
fc:frame:post_url
optionally points to a page that’ll take the POST
request
- When Farcaster sends a
POST
with the data
- Get a hub (e.g. https://neynar.com/, offering 75% off)
- Use the sample from the Frame doc to validate
trustedData
using a hub’s API
- Fetch the user’s connected wallet addresses by the Farcaster account’s
fid
- Optionally, check if that wallet address has already minted the NFT
- From the custodial EOA, call
mint_efficient_7e80c46e
on the BaseiMintModule
, specifying _to
as user’s wallet address
- Return a simple HTML response that has new metatags pointing to a new OG image that displays that the NFT has been minted
Extras
- Optionally, ask the user to recast before minting. Use the castId from the callback and user’s fid to make sure they actually recasted (or liked, or commented, or followed the account)
- Unlimited mints — let anyone top-up the custodial EOA to have more fun
- Drop the minting website, and instead build a Farcaster bot. DM an image to a bot (or post and tag the bot), it turns the image into a Frame