Costco

2024-10-04


View on Warpcast
Costco

Mint your COSTCO membership on Solana via a Farcaster frame. I wrote a frame endpoint to create a COSTCO gold membership card with your Farcaster FID as your Mbr#, your Farcaster display name as your name and your pfp as your photo. I used metaplex and the solana web3.js to mint the image to the Solana blockchain. Check out my minted COSTCO card here.

How It Works

I loaded a Solana wallet with about $100 USD for transaction fees. I learned it's quite expensive to pay for transaction fees of minting the NFT using metaplex, so it will likely be only a short run for the frame. I limited the minting to people that follow me to try to keep the frame alive for longer. Here are the steps the frame takes:

  1. Get user FID and get info about user from Neynar.
  2. If user follows me, continue.
  3. If user has connected Solana address, continue.
  4. Add user's FID, display name and photo to the Costco card template using canvas js.
  5. Upload the image to IPFS, generate json metadata and upload json to IPFS. All using Pinata.
  6. Initiate connection to Solana cluster.
  7. Use metaplex findAllByOwner method to check if user already holds COSTCO card, if no, then continue.
  8. Mint NFT using metaplex, does not await because I learned this takes longer than the alloted 5 seconds response time requirement for frames.
  9. Return frame with link for user to check their NFT holdings on Solana NFT scan.

FCTwitterZora
© 2024