mirror of
https://github.com/farcasterxyz/hub-monorepo.git
synced 2026-01-08 20:58:06 -05:00
## Why is this change needed? Pull in latest snapchain protos for storage lending backfill. ## Merge Checklist _Choose all relevant options below by adding an `x` now or at any time before submitting for review_ - [x] PR title adheres to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard - [x] PR has a [changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets) - [x] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore) - [ ] PR includes [documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs) if necessary. <!-- start pr-codex --> --- ## PR-Codex overview This PR primarily updates the versioning of several packages, introduces a new request interface for on-chain events migration, and enhances the `ShardInfo` structure by adding a `numOnchainEvents` field. It also updates dependencies across various packages. ### Detailed summary - Updated `@farcaster/core` version to `0.18.9` and other package versions accordingly. - Added `numOnchainEvents` field to `ShardInfo` in multiple generated files. - Introduced `RunOnchainEventsMigrationRequest` interface in `admin_rpc.ts`. - Added RPC methods for `getAllLendStorageMessagesByFid` and `runOnchainEventsMigration`. - Updated changelogs for `core`, `hub-web`, `hub-nodejs`, and `shuttle` packages. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
@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 { getSSLHubRpcClient } from '@farcaster/hub-nodejs';
client.$.waitForReady(Date.now() + 5000, async (e) => {
if (e) {
console.error(`Failed to connect to ${hubRpcEndpoint}:`, e);
process.exit(1);
} else {
console.log(`Connected to ${hubRpcEndpoint}`);
const castsResult = await client.getCastsByFid({ fid: 8928 });
castsResult.map((casts) => casts.messages.map((cast) => console.log(cast.data?.castAddBody?.text)));
client.close();
}
});
Documentation
The HTTP API endpoints are documented here.
An OpenAPI spec is provided here.
Contributing
Please see our contributing guidelines before making a pull request.
License
MIT License