{"id":13767228,"url":"https://github.com/standard-crypto/farcaster-js","last_synced_at":"2025-05-16T08:03:31.630Z","repository":{"id":37077342,"uuid":"404462749","full_name":"standard-crypto/farcaster-js","owner":"standard-crypto","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-16T19:22:47.000Z","size":5902,"stargazers_count":124,"open_issues_count":18,"forks_count":26,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-05-13T03:59:18.829Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/standard-crypto.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-08T18:58:59.000Z","updated_at":"2025-03-29T10:51:59.000Z","dependencies_parsed_at":"2024-01-11T23:48:04.567Z","dependency_job_id":"9efe994d-71f8-4292-89cc-76a4d001f0f6","html_url":"https://github.com/standard-crypto/farcaster-js","commit_stats":{"total_commits":759,"total_committers":7,"mean_commits":"108.42857142857143","dds":"0.33596837944664026","last_synced_commit":"bf376526afeda5f7fb8c5cd5826ea3d5e2515829"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/standard-crypto%2Ffarcaster-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/standard-crypto%2Ffarcaster-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/standard-crypto%2Ffarcaster-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/standard-crypto%2Ffarcaster-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/standard-crypto","download_url":"https://codeload.github.com/standard-crypto/farcaster-js/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254254038,"owners_count":22039792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T16:01:06.349Z","updated_at":"2025-05-16T08:03:31.606Z","avatar_url":"https://github.com/standard-crypto.png","language":"TypeScript","funding_links":[],"categories":["Developer Resources","Uncategorized"],"sub_categories":["Repos","Uncategorized"],"readme":"# Farcaster.js\n\nA collection of tools for interacting with the Farcaster social network.\n\n![NPM](https://img.shields.io/npm/l/@standard-crypto/farcaster-js?no-cache)\n![NPM](https://img.shields.io/npm/v/@standard-crypto/farcaster-js?no-cache)\n![GitHub Workflow Status](https://github.com/standard-crypto/farcaster-js/actions/workflows/farcaster-js.yml/badge.svg?branch=main)\n\n\u003c!-- AUTO-GENERATED-CONTENT:START (TOC) --\u003e\n- [Farcaster Hub REST API](#farcaster-hub-rest-api)\n- [Neynar REST APIs](#neynar-rest-apis)\n- [Signers](#signers)\n  - [Privy](#privy)\n\u003c!-- AUTO-GENERATED-CONTENT:END --\u003e\n\n## Farcaster Hub REST API\n\nFarcaster hubs expose a public REST API which can be used for simple queries.\n\n***Setup:***\n\n```sh\n# Install all farcaster-js tools\nnpm install axios @standard-crypto/farcaster-js\n\n# ...or install only the Hub REST API client\nnpm install axios @standard-crypto/farcaster-js-hub-rest\n```\n\n***Example:***\n\n\u003c!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/hubRest.ts) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/hubRest.ts --\u003e\n```ts\nimport { HubRestAPIClient, ExternalEd25519Signer } from '@standard-crypto/farcaster-js';\n\nimport { NobleEd25519Signer } from '@farcaster/core';\n\nconst client = new HubRestAPIClient();\nconsole.log(await client.getHubInfo());\n\n// Use a private key\nconst signerPrivateKey = '0x...';\nconst fid = 111;\nconst writeClient = new HubRestAPIClient({ hubUrl: 'https://hub.farcaster.standardcrypto.vc:2281' });\n\nconst publishCastResponse = await writeClient.submitCast({ text: 'This is a test cast submitted from farcaster-js' }, fid, signerPrivateKey);\nconsole.log(`new cast hash: ${publishCastResponse.hash}`);\n\n// Use an external signer\nconst nobleSigner = new NobleEd25519Signer(new Uint8Array([]));\nconst _signMessage = async(messageHash: Uint8Array): Promise\u003cUint8Array\u003e =\u003e {\n  const res = await nobleSigner.signMessageHash(messageHash);\n  if (res.isErr()) {\n    throw res.error;\n  }\n  return res._unsafeUnwrap();\n};\nconst _getPublicKey = async(): Promise\u003cUint8Array\u003e =\u003e {\n  const res = await nobleSigner.getSignerKey();\n  if (res.isErr()) {\n    throw res.error;\n  }\n  return res._unsafeUnwrap();\n};\nconst externalSigner = new ExternalEd25519Signer(_signMessage, _getPublicKey);\n\nconst publishCastExternalSignerResponse = await writeClient.submitCast({ text: 'This is a test cast submitted from farcaster-js using an external signer' }, fid, externalSigner);\nconsole.log(`new cast hash with external signer: ${publishCastExternalSignerResponse.hash}`);\n```\n\u003c!-- AUTO-GENERATED-CONTENT:END --\u003e\n\nSee the [@standard-crypto/farcaster-js-hub-rest](./packages/farcaster-js-hub-rest/README.md)\npackage for more info.\n\n## Neynar REST APIs\n\n***Setup:***\n\n```sh\n# Install all farcaster-js tools\nnpm install axios @standard-crypto/farcaster-js\n\n# ...or install only the Neynar API client\nnpm install axios @standard-crypto/farcaster-js-neynar\n```\n\n***Example:***\n\n\u003c!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/neynar.ts) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/neynar.ts --\u003e\n```ts\nimport { NeynarAPIClient, NeynarV2 } from '@standard-crypto/farcaster-js';\n\nconst signerUuid = 'approvedSignerUUID';\nconst client = new NeynarAPIClient('apiKey');\n\n// Publish cast\nconst cast = await client.v2.publishCast(signerUuid, 'This is a test cast.');\n\n// React to cast\nawait client.v2.reactToCast(signerUuid, NeynarV2.ReactionType.Like, cast.hash);\n```\n\u003c!-- AUTO-GENERATED-CONTENT:END --\u003e\n\n## Signers\n\nSigners are required to write data to Farcaster. You can learn more about signers from these resources ([Farcaster](https://docs.farcaster.xyz/developers/guides/accounts/create-account-key), [Neynar](https://docs.neynar.com/docs/write-to-farcaster-with-neynar-managed-signers), [Privy](https://docs.privy.io/guide/react/recipes/misc/farcaster-writes#_2-create-an-embedded-farcaster-signer)).\n\nThis package includes a CLI for creating signers. You can run the code below to generate a signer:\n```\nfarcaster-js create-signer\n```\n\nRead more about the CLI in [farcaster-js-cli](./packages/farcaster-js-cli/README.md).\n\nAdditionally, signers may be created programmatically without use of the CLI. See the examples in [farcaster-js-neynar](./packages/farcaster-js-neynar/README.md#create-a-signer) or follow [this guide](https://docs.privy.io/guide/react/recipes/misc/farcaster-writes#_1-login-with-farcaster) from Privy for logging users in with Farcaster and authorizing a signer.\n\n### Privy\n\n[Privy](https://privy.io) enables users to easily log in to your app using their Farcaster account. Follow [this guide](https://docs.privy.io/guide/react/recipes/misc/farcaster-writes) to enable Farcaster login and begin writing messages. See the example below for usage once logging in with Farcaster is integrated.\n\n```\nimport { HubRestAPIClient, ExternalEd25519Signer } from '@standard-crypto/farcaster-js';\nimport { useExperimentalFarcasterSigner, usePrivy } from '@privy-io/react-auth';\n\nconst client = new HubRestAPIClient();\nconsole.log(await client.getHubInfo());\n\nconst { user } = usePrivy();\nconst { getFarcasterSignerPublicKey, signFarcasterMessage } = useExperimentalFarcasterSigner();\n\n// Use a Privy embedded signer\nconst privySigner = new ExternalEd25519Signer(signFarcasterMessage, getFarcasterSignerPublicKey);\nconst fid = user.farcaster.fid!;\n\nconst publishCastExternalSignerResponse = await client.submitCast({ text: 'This is a test cast submitted from farcaster-js using an external signer' }, fid, privySigner);\nconsole.log(`new cast hash with privy embedded signer signer: ${publishCastExternalSignerResponse.hash}`);\n```\n\n***Usage Versus Hub APIs:***\n\nThe 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.\n\nNeynar 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.\n\nNeynar 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.\n\nSee \u003chttps://neynar.com/\u003e for API access and more details.\n\nSee the [@standard-crypto/farcaster-js-neynar](./packages/farcaster-js-neynar/README.md)\npackage for more on the Neynar API client.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstandard-crypto%2Ffarcaster-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstandard-crypto%2Ffarcaster-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstandard-crypto%2Ffarcaster-js/lists"}