npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

farcaster-hub-utils

v0.1.9

Published

Class to use a signer key for doing hub actions.

Downloads

10

Readme

farcaster-hub-utils - 0.1.9

Simple library to simplify the interaction with the Farcaster Hub. Works with a private an authorized signer key and account fid.

Basic Usage

import { FcHubUtils } from 'farcaster-hub-utils';
import { PK, FID, HUB_URL, HUB_USER, HUB_PASS } from './secret';

const fcHubUtils = new FcHubUtils(PK, FID, HUB_URL?, HUB_USER?, HUB_PASS?);

// Invoke some interaction with the hub

const castText = 'Hello World!';

fcHubUtils.createFarcasterPost({
    content: castText,
})

Available Methods

Methods user should use

  • createFarcasterPost - Create a new cast
  • createCast - Alias for createFarcasterPost
  • deleteCast - Delete a cast
  • getCastsByFid - Get casts for feed in a specific time range, time range can be used to paginate
  • changeHub - Change The instance to use a different hub (useful for balancing)
  • changeSigner - Change The instance to use a different signer (useful to switch between accounts and conserve memory)
  • addLike - Add a like to a cast
  • removeLike - Remove a like from a cast
  • addRecast - Add a recast to a cast
  • removeRecast - Remove a recast from a cast
  • getFidFromUsername - Get the fid from a username

Internal Methods ( lower level )

  • publishCast - Publish a cast to the hub
  • byteLength - Get the byte length of a string
  • parseEmbeds - Parse embeds from a string as { url: string }[]
  • parseFarcasterMentions - Parse mentions from a string as { mentions, mentionsPositions, mentionsText }
  • addReaction - Lower level method to add a reaction to a cast
  • removeReaction - Lower level method to remove a reaction from a cast

Changelog

Changelog

Notes

  • The PK is the private key of the signer.
  • The FID is the account fid.
  • HUB_URL, HUB_USER, HUB_PASS are optional parameters to connect to the hub, if not provided, an public hub will be used.
  • creating cast methods support, posting to channels, and replying to posts and post media if you have supported media public urls.

Upcoming Features

  • add more features
  • add more tests