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