Warpcast

Tips and pointers on how to build a Farcaster-native minting experience

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

Extras

  1. 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)
  2. Unlimited mints — let anyone top-up the custodial EOA to have more fun
  3. 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