The Farcaster Development Kit (FDK) is an SDK to make it easier to manage Farcaster Auth, Farcaster Writes, Farcaster Reads, and Farcaster Frames.

Installation

npm i pinata-fdk
yarn add pinata-fdk

Initialization

If you are going to be using Farcaster Auth you will need to provide your , and if you are using non-sponsored signers you will need to provide your mnemonic phrase as well.

import { PinataFDK } from "pinata-fdk";

const fdk = new PinataFDK({
    pinata_jwt: "<YOUR_PINATA_JWT>",
    pinata_gateway: "", // gateway can be blank in this instance
    appFid: "<YOUR_APP_FID>",
    appMnemonic: "<YOUR_APP_MNEMONIC>"
});

If you are using just Farcaster Writes or Frame Analytics you only need the Pinata JWT in the instance.

import { PinataFDK } from "pinata-fdk";

const fdk = new PinataFDK({
    pinata_jwt: "<YOUR_PINATA_JWT>",
    pinata_gateway: "", // gateway can be blank in this instance
});

If you want to leverage IPFS pinning capabilities, you must enter your Pinata JWT and a Pinata gateway during intialization.

import { PinataFDK } from "pinata-fdk";

const fdk = new PinataFDK({
    pinata_jwt: "<YOUR_PINATA_JWT>",
    pinata_gateway: "<YOUR_PINATA_GATEWAY>"}, 
);

If you are only using the frame metadata functionality, you do not need to enter your credentials.

import { PinataFDK } from "pinata-fdk";

const fdk = new PinataFDK();