Awesome
Farcaster.js
A collection of tools for interacting with the Farcaster social network.
<!-- AUTO-GENERATED-CONTENT:START (TOC) --> <!-- AUTO-GENERATED-CONTENT:END -->
Farcaster Hub REST API
Farcaster hubs expose a public REST API which can be used for simple queries.
Setup:
# Install all farcaster-js tools
npm install axios @standard-crypto/farcaster-js
# ...or install only the Hub REST API client
npm install axios @standard-crypto/farcaster-js-hub-rest
Example:
<!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/hubRest.ts) --> <!-- The below code snippet is automatically added from ./examples/hubRest.ts -->import { HubRestAPIClient } from '@standard-crypto/farcaster-js';
const client = new HubRestAPIClient();
console.log(await client.getHubInfo());
<!-- AUTO-GENERATED-CONTENT:END -->
See the @standard-crypto/farcaster-js-hub-rest package for more info.
Neynar REST APIs
Setup:
# Install all farcaster-js tools
npm install axios @standard-crypto/farcaster-js
# ...or install only the Neynar API client
npm install axios @standard-crypto/farcaster-js-neynar
Example:
<!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/neynar.ts) --> <!-- The below code snippet is automatically added from ./examples/neynar.ts -->import { NeynarAPIClient, NeynarV2 } from '@standard-crypto/farcaster-js';
const signerUuid = 'approvedSignerUUID';
const client = new NeynarAPIClient('apiKey');
// Publish cast
const cast = await client.v2.publishCast(signerUuid, 'This is a test cast.');
// React to cast
await client.v2.reactToCast(signerUuid, NeynarV2.ReactionType.Like, cast.hash);
<!-- AUTO-GENERATED-CONTENT:END -->
Usage Versus Hub APIs:
The REST APIs exposed by a Farcaster hub are designed to provide protocol entities optimized for the transport and indexing layer. Neynar APIs are designed for building at the application-layer.
Neynar v1 APIs are designed to replicate the deprecated Warpcast APIs to ensure that the ecosystem of products built on those APIs can continue thriving with minimal switching costs. The Neynar v1 APIs should act serve a drop-in replacement for applications using farcaster-js
pre-version 6.0.
Neynar v2 APIs bring in additional support for new Farcaster protocol primitives like channels and signer management with much more support for storage, sign in with farcaster and new features delivered regularly.
See https://neynar.com/ for API access and more details.
See the @standard-crypto/farcaster-js-neynar package for more on the Neynar API client.