mirror of
https://github.com/farcasterxyz/hub-monorepo.git
synced 2026-04-18 03:00:22 -04:00
* refactor: update ethers to v6.1 from v5.7 * refactor: generic signer classes * remove neverthrow from crypto and signers * update docs * rm signer util fns * add comment to getSignerKey * rm not present methods from signers * fix doc * fix docs * simplify Eip712Factory * add changeset --------- Co-authored-by: Varun Srinivasan <varunsrin@gmail.com>
@farcaster/hub-nodejs
A lightweight, fast Typescript interface for Farcaster Hubs. Designed to work with Hubble and any other Hub that implements the Farcaster protocol.
Features
- Call any Hub endpoint from a NodeJS environment.
- Serializes and deserializes Farcaster protobufs into Javascript objects.
- Has helpers to create and sign Farcaster messages.
- Written entirely in TypeScript, with strict types for safety.
Read the documentation, see more examples or get started with the guide below.
Installation
Install @farcaster/hub-nodejs with the package manager of your choice
npm install @farcaster/hub-nodejs
yarn add @farcaster/hub-nodejs
pnpm install @farcaster/hub-nodejs
Quickstart
Fetching Data from Hubs
import { getHubRpcClient } from '@farcaster/hub-nodejs';
(async () => {
const client = await getHubRpcClient('127.0.0.1:8080');
const castsResult = await client.getCastsByFid({ fid: 2 });
castsResult.map((casts) =>
casts.messages.map((cast) => {
console.log(cast.data?.castAddBody?.text);
})
);
})();
Contributing
Please see our contributing guidelines before making a pull request.
License
MIT License