Files
Aditi Srinivasan e48efa354a chore: pull in latest snapchain protos and release new versions (#2656)
## 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 -->
2025-10-13 11:58:37 -04:00
..

@farcaster/hub-web

A fast and easy REST-like interface to work with Farcaster Hubs. Designed to work with Hubble and any other Hub that implements the Farcaster protocol.

Features

  • Call any endpoint using a simple HTTP API, including from a browser environment
  • Responses are plain JSON
  • Written entirely in Typescript, with strict types for safety.

Installation

The examples in this package use axios to make HTTP requests, but you can use any library. It is also useful to install the @farcaster/core library which has several helper methods that are useful while working with Farcaster messages.

yarn add axios @farcaster/core
yarn add -D @types/axios 

Documentation

The HTTP API endpoints are documented here.

Getting started: fetching casts

import axios from "axios";

const fid = 2;
const server = "http://nemes.farcaster.xyz:2281";

try {
    const response = await axios.get(`${server}/v1/castsByFid?fid=${fid}`);

    console.log(`API Returned HTTP status ${response.status}`);    
    console.log(`The first cast's text is ${response.messages[0].data.castAddBody.text}`);
} catch (e) {
    // Handle errors
    console.log(response);
}

Get the username by FID

const getFnameFromFid = async (
  fid: number,
  client: HubRpcClient
): HubAsyncResult<string> => {
  const result = await client.getUserData({
    fid: fid,
    userDataType: UserDataType.FNAME,
  });
  return result.map((message) => {
    if (isUserDataAddMessage(message)) {
      return message.data.userDataBody.value;
    } else {
      return '';
    }
  });
};

Running the examples

There are several examples in the examples/ folder. To run the examples, please look at the individual README files in the examples directory. Most examples can be run by

yarn install
yarn start

grpc-Web

grpc-web was an older way of proxying to the grpc API from web environments. This has been deprecated and is no longer supported. You can read the original grpc-web documentation and examples here.

Contributing

Please see our contributing guidelines before making a pull request.

License

MIT License