Aptos-Farcaster-Frame

The First Farcaster Frame on Aptos to Mint NFTs

This is a Farcaster Frame that allows your Farcaster users to mint an NFT on the Aptos Blockchain directly to their Aptos wallet. All you need to do is like the cast and re-cast it, and then copy paste your Aptos wallet address and click on Mint to mint the NFT. The NFT will then be delivered to your wallet address in a few seconds.

Create and Deploy an NFT Collection on Aptos using Crossmint

The collection that I created and deployed is on Production, i.e., Aptos Mainnet. However, it is recommended that you familiarize yourself with this on Staging (Testnet/Devnet) first before migrating to Production (Mainnet). Click to proceed to Crossmint’s Staging Console. Click to proceed to Crossmint’s Production Console

  1. Create a Developer Account on Crossmint.
  2. Click on Developers -> Click on “API Keys
  3. Click on “Create new key” under Server-side keys.
  4. Enable the following scopes under “Minting API” and then click on “Create server key
    • nfts.create - Mint NFTs
    • nfts.read - Read NFTs
    • collections.create - Create collection
    • collections.read - Read collections
  5. Use this API key (secret) and use Crossmint’s Create Collection API to create a new NFT Collection on Aptos. Refer to the docs here. Set the chain as aptos and format the metadata with the preferred details for your NFT Collection on Aptos.
  6. Now, you will be using Crossmint’s Mint API to create and mint an NFT on Aptos (within the created NFT Collection). Refer to the docs here. Set the chain as aptos and format the metadata with the preferred details for the NFT on Aptos. You can also refer to the sample code below:
    const options = {
    method: "POST",
    headers: {
      "X-API-KEY":
      "<Your-API-Key-Here>",
      "Content-Type": "application/json",
     },
     body: '{"metadata":{"description":"First NFT on Aptos","image":"https://wallpapercave.com/wp/wp9637250.jpg","name":"Aptos NFT"},"recipient":"aptos:0x0f076d7dfd190f07081667451d7a9e7a3f2f542cf9175623b703e3c48c6d437c"}',
    };
    fetch(
    "https://staging.crossmint.com/api/2022-06-09/collections/YOUR_COLLECTION_ID/nfts", //replace `staging` with `www` on Production. Replace YOUR_COLLECTION_ID with your deployed NFT Collection's Id. 
    options
    )
    .then((response) => response.json())
    .then((response) => console.log(response))
    .catch((err) => console.error(err));
    
  7. Refer to this detailed step-by-step guide on How to Create and Mint NFTs on Aptos to further clarification.

Create a Next App - Create and Configure the Farcaster Frame

Refer to the repository’s src for the code that lets you create an NFT Minting Farcaster Frame on Aptos.

Configure the ENV variables

Built using

Special thanks to @avneesh0612 for helping with the Neynar and Onchainkit integration.