├── packages ├── shuttle │ ├── src │ │ ├── app.ts │ │ ├── index.ts │ │ ├── example-app │ │ │ ├── tsconfig.json │ │ │ ├── log.ts │ │ │ ├── package.json │ │ │ ├── env.ts │ │ │ ├── migrations │ │ │ │ └── 002_casts.ts │ │ │ └── worker.ts │ │ ├── log.ts │ │ ├── statsd.ts │ │ └── shuttle │ │ │ ├── redis.ts │ │ │ └── index.ts │ ├── architecture.jpg │ ├── tsup.config.ts │ ├── tsconfig.json │ ├── jest.config.ts │ ├── biome.json │ ├── docker-compose.yml │ └── package.json ├── biome-config-custom │ ├── index.js │ ├── CHANGELOG.md │ └── package.json ├── hub-web │ ├── examples │ │ ├── rust-submitmessage │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── Cargo.toml │ │ │ └── build.rs │ │ ├── events │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ ├── tsconfig.json │ │ │ └── index.ts │ │ ├── feed │ │ │ ├── README.md │ │ │ ├── tsconfig.json │ │ │ └── package.json │ │ ├── grpc-web-chron-feed │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ └── tsconfig.json │ │ ├── golang-submitmessage │ │ │ ├── go.mod │ │ │ ├── README.md │ │ │ ├── Makefile │ │ │ └── go.sum │ │ ├── submit-message │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ ├── tsconfig.json │ │ │ └── index.ts │ │ └── profile │ │ │ ├── package.json │ │ │ ├── tsconfig.json │ │ │ ├── README.md │ │ │ └── index.ts │ ├── src │ │ └── index.ts │ ├── tsup.config.ts │ ├── tsconfig.json │ ├── biome.json │ └── package.json ├── core │ ├── src │ │ ├── protobufs │ │ │ ├── generated │ │ │ │ └── rpc.ts │ │ │ └── index.ts │ │ ├── crypto │ │ │ ├── index.ts │ │ │ └── ed25519.ts │ │ ├── eth │ │ │ ├── contracts │ │ │ │ ├── bundler.ts │ │ │ │ ├── storageRegistry.ts │ │ │ │ ├── abis │ │ │ │ │ └── index.ts │ │ │ │ ├── index.ts │ │ │ │ ├── idGateway.ts │ │ │ │ ├── keyRegistry.ts │ │ │ │ └── signedKeyRequestValidator.ts │ │ │ ├── index.ts │ │ │ ├── chains.ts │ │ │ └── clients.ts │ │ ├── errors.test.ts │ │ ├── signers │ │ │ ├── index.ts │ │ │ ├── ethersEip712Signer.test.ts │ │ │ ├── ethersV5Eip712Signer.test.ts │ │ │ ├── viemLocalEip712Signer.test.ts │ │ │ ├── signer.ts │ │ │ ├── ed25519Signer.ts │ │ │ ├── viemWalletEip712Signer.test.ts │ │ │ ├── nobleEd25519Signer.ts │ │ │ └── nobleEd25519Signer.test.ts │ │ ├── index.ts │ │ ├── userNameProof.test.ts │ │ ├── userNameProof.ts │ │ ├── verifications.test.ts │ │ ├── time.test.ts │ │ ├── time.ts │ │ └── limits.ts │ ├── README.md │ ├── tsup.config.ts │ ├── tsconfig.json │ ├── biome.json │ └── jest.config.ts └── hub-nodejs │ ├── examples │ ├── contract-signatures │ │ ├── .gitignore │ │ ├── hardhat.config.cjs │ │ ├── tsconfig.json │ │ ├── package.json │ │ └── README.md │ ├── chron-feed │ │ ├── README.md │ │ ├── tsconfig.json │ │ └── package.json │ ├── README.md │ ├── write-data │ │ ├── package.json │ │ ├── tsconfig.json │ │ └── README.md │ └── hello-world │ │ ├── tsconfig.json │ │ ├── package.json │ │ └── README.md │ ├── tsup.config.ts │ ├── tsconfig.json │ ├── src │ ├── index.test.ts │ └── index.ts │ ├── jest.config.ts │ ├── biome.json │ ├── docs │ └── signers │ │ └── README.md │ └── package.json ├── apps ├── hubble │ ├── src │ │ ├── package.json │ │ ├── addon │ │ │ ├── .gitignore │ │ │ ├── src │ │ │ │ ├── proto │ │ │ │ │ └── protobufs.rs │ │ │ │ ├── db │ │ │ │ │ └── mod.rs │ │ │ │ ├── trie │ │ │ │ │ └── mod.rs │ │ │ │ └── store │ │ │ │ │ └── mod.rs │ │ │ ├── rust-toolchain.toml │ │ │ ├── build.rs │ │ │ └── Cargo.toml │ │ ├── test │ │ │ ├── globalTeardown.js │ │ │ ├── constants.ts │ │ │ ├── bench │ │ │ │ ├── utils.ts │ │ │ │ └── index.ts │ │ │ ├── e2e │ │ │ │ └── testFnameRegistryServer.ts │ │ │ └── globalSetup.js │ │ ├── bootstrapPeers.mainnet.ts │ │ ├── storage │ │ │ ├── db │ │ │ │ ├── jestUtils.ts │ │ │ │ ├── migrations │ │ │ │ │ ├── migrations.test.ts │ │ │ │ │ ├── 3.clearEvents.ts │ │ │ │ │ ├── 4.uniqueVerifications.ts │ │ │ │ │ ├── 9.fnameUserNameProofByFidPrefix.ts │ │ │ │ │ ├── 2.fnameproof.ts │ │ │ │ │ ├── 2.fnameproof.test.ts │ │ │ │ │ └── 1.usernameproof.test.ts │ │ │ │ └── hubState.ts │ │ │ ├── stores │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ ├── jobs │ │ │ │ ├── gossipContactInfoJob.test.ts │ │ │ │ ├── gossipContactInfoJob.ts │ │ │ │ ├── pruneEventsJob.ts │ │ │ │ ├── checkFarcasterVersionJob.ts │ │ │ │ └── checkIncomingPortsJob.ts │ │ │ └── engine │ │ │ │ ├── seed.ts │ │ │ │ └── validation.worker.ts │ │ ├── utils │ │ │ ├── command.ts │ │ │ ├── crypto.ts │ │ │ └── statsd.ts │ │ ├── console │ │ │ ├── rpcClientCommand.ts │ │ │ ├── adminCommand.ts │ │ │ └── protobufCommand.ts │ │ ├── eth │ │ │ ├── utils.ts │ │ │ └── utils.test.ts │ │ └── network │ │ │ ├── p2p │ │ │ ├── gossipNodeWorker.test.ts │ │ │ ├── protocol.ts │ │ │ └── periodicPeerCheck.ts │ │ │ └── sync │ │ │ └── periodicSyncJob.ts │ ├── www │ │ ├── docs │ │ │ ├── .vitepress │ │ │ │ ├── cache │ │ │ │ │ └── deps_temp_dbaaab0d │ │ │ │ │ │ └── package.json │ │ │ │ └── theme │ │ │ │ │ ├── index.js │ │ │ │ │ └── custom.css │ │ │ ├── assets │ │ │ │ └── images │ │ │ │ │ ├── gcp_vm_overview.png │ │ │ │ │ ├── gcp_hubble_running.png │ │ │ │ │ ├── gcp_terraform_plan.png │ │ │ │ │ ├── google_cloud_shell.png │ │ │ │ │ └── gcp_terraform_apply.png │ │ │ ├── intro │ │ │ │ ├── tutorials.md │ │ │ │ ├── networks.md │ │ │ │ ├── hubble.md │ │ │ │ └── monitoring.md │ │ │ ├── docs │ │ │ │ ├── httpapi │ │ │ │ │ ├── fids.md │ │ │ │ │ ├── info.md │ │ │ │ │ ├── storagelimits.md │ │ │ │ │ ├── currentpeers.md │ │ │ │ │ ├── verification.md │ │ │ │ │ ├── userdata.md │ │ │ │ │ └── usernameproof.md │ │ │ │ └── architecture.md │ │ │ └── index.md │ │ ├── package.json │ │ └── README.md │ ├── grafana │ │ └── grafana.ini │ ├── envoy │ │ ├── install-docker.sh │ │ ├── envoy-start.sh │ │ └── README.md │ ├── hubble.code-workspace │ ├── tsconfig.json │ ├── rollup.config.js │ ├── biome.json │ ├── scripts │ │ ├── linter.cjs │ │ ├── clidocs.cjs │ │ └── grafanadash.cjs │ ├── jest.config.ts │ ├── README.md │ └── pm2.config.cjs └── replicator │ ├── .gitignore │ ├── grafana │ └── grafana.ini │ ├── src │ ├── redis.ts │ ├── log.ts │ ├── jobs │ │ ├── processHubEvent.ts │ │ ├── mergeMessage.ts │ │ ├── backfillFidLinks.ts │ │ ├── backfillFidCasts.ts │ │ ├── backfillFidUserData.ts │ │ ├── backfillFidReactions.ts │ │ ├── backfillFidVerifications.ts │ │ ├── backfillFidStorageAllocations.ts │ │ ├── backfillFidUserNameProofs.ts │ │ ├── backfillFidRegistration.ts │ │ └── backfillFidOtherOnChainEvents.ts │ ├── web.ts │ ├── env.ts │ ├── processors │ │ └── userData.ts │ ├── worker.ts │ └── statsd.ts │ ├── .env.sample │ ├── tsconfig.json │ ├── biome.json │ └── package.json ├── .yarnrc ├── .editorconfig ├── .husky └── pre-commit ├── protobufs ├── schemas │ ├── sync_trie.proto │ ├── job.proto │ ├── username_proof.proto │ ├── hub_state.proto │ ├── onchain_event.proto │ └── hub_event.proto └── README.md ├── .dockerignore ├── .changeset ├── config.json └── README.md ├── codecov.yml ├── .vscode └── settings.json ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature.md ├── workflows │ ├── label_issues.yml │ ├── publish.yml │ ├── publish-replicator.yml │ ├── release.yml │ └── release-packages.yml └── PULL_REQUEST_TEMPLATE.md ├── scripts ├── publish-image.sh └── publish-replicator-image.sh ├── .gitignore ├── turbo.json ├── biome.json ├── LICENSE ├── README.md ├── tsconfig.json └── package.json /packages/shuttle/src/app.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /apps/hubble/src/package.json: -------------------------------------------------------------------------------- 1 | ../package.json -------------------------------------------------------------------------------- /apps/replicator/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | grafana/data -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | registry: https://registry.npmjs.org/ 2 | -------------------------------------------------------------------------------- /apps/hubble/src/addon/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | index.node 3 | -------------------------------------------------------------------------------- /packages/biome-config-custom/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | }; -------------------------------------------------------------------------------- /packages/hub-web/examples/rust-submitmessage/.gitignore: -------------------------------------------------------------------------------- 1 | /target -------------------------------------------------------------------------------- /packages/core/src/protobufs/generated/rpc.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/contract-signatures/.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | -------------------------------------------------------------------------------- /apps/hubble/src/addon/src/proto/protobufs.rs: -------------------------------------------------------------------------------- 1 | tonic::include_proto!("_"); 2 | -------------------------------------------------------------------------------- /apps/hubble/src/addon/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "1.70.0" 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root=true 2 | 3 | [*.{js,ts}] 4 | indent_size=2 5 | indent_style=space -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | yarn lint-staged 5 | -------------------------------------------------------------------------------- /packages/core/README.md: -------------------------------------------------------------------------------- 1 | # @farcaster/utils 2 | 3 | Shared hub-related method and classes. 4 | -------------------------------------------------------------------------------- /apps/hubble/www/docs/.vitepress/cache/deps_temp_dbaaab0d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /apps/hubble/src/addon/src/db/mod.rs: -------------------------------------------------------------------------------- 1 | pub use self::rocksdb::*; 2 | 3 | mod multi_chunk_writer; 4 | mod rocksdb; 5 | -------------------------------------------------------------------------------- /packages/core/src/crypto/index.ts: -------------------------------------------------------------------------------- 1 | export * as ed25519 from "./ed25519"; 2 | export * as eip712 from "./eip712"; 3 | -------------------------------------------------------------------------------- /apps/hubble/src/test/globalTeardown.js: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | await globalThis._ANVIL_SHUTDOWN(); 3 | }; 4 | -------------------------------------------------------------------------------- /packages/core/src/eth/contracts/bundler.ts: -------------------------------------------------------------------------------- 1 | export const BUNDLER_ADDRESS = "0x00000000FC04c910A0b5feA33b03E0447AD0B0aA" as const; 2 | -------------------------------------------------------------------------------- /packages/shuttle/architecture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZinkaTrostinka/hub-monorepo/HEAD/packages/shuttle/architecture.jpg -------------------------------------------------------------------------------- /packages/hub-web/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "@farcaster/core"; 2 | 3 | export * from "./generated/rpc"; 4 | export * from "./client"; 5 | -------------------------------------------------------------------------------- /apps/hubble/grafana/grafana.ini: -------------------------------------------------------------------------------- 1 | [auth.anonymous] 2 | enabled = true 3 | org_name = Main Org. 4 | org_role = Viewer 5 | hide_version = true 6 | -------------------------------------------------------------------------------- /apps/replicator/grafana/grafana.ini: -------------------------------------------------------------------------------- 1 | [auth.anonymous] 2 | enabled = true 3 | org_name = Main Org. 4 | org_role = Admin 5 | hide_version = true 6 | -------------------------------------------------------------------------------- /packages/core/src/eth/index.ts: -------------------------------------------------------------------------------- 1 | export * as chains from "./chains"; 2 | export * as clients from "./clients"; 3 | export * from "./contracts"; 4 | -------------------------------------------------------------------------------- /packages/shuttle/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./shuttle"; 2 | export { convertProtobufMessageBodyToJson, protocolBytesToString } from "./utils"; 3 | -------------------------------------------------------------------------------- /packages/biome-config-custom/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # biome-config-custom 2 | 3 | ## 0.0.1 4 | 5 | ### Patch Changes 6 | 7 | - 1e4482e: updated dependencies 8 | -------------------------------------------------------------------------------- /packages/core/src/eth/contracts/storageRegistry.ts: -------------------------------------------------------------------------------- 1 | export const STORAGE_REGISTRY_ADDRESS = "0x00000000fcCe7f938e7aE6D3c335bD6a1a7c593D" as const; 2 | -------------------------------------------------------------------------------- /apps/hubble/www/docs/assets/images/gcp_vm_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZinkaTrostinka/hub-monorepo/HEAD/apps/hubble/www/docs/assets/images/gcp_vm_overview.png -------------------------------------------------------------------------------- /apps/hubble/envoy/install-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo apt update 4 | sudo apt install docker.io -y 5 | sudo snap install docker 6 | sudo usermod -a -G docker ubuntu 7 | -------------------------------------------------------------------------------- /apps/hubble/src/addon/src/trie/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod merkle_trie; 2 | mod trie_node; 3 | 4 | #[cfg(test)] 5 | mod trie_node_tests; 6 | 7 | #[cfg(test)] 8 | mod merkle_trie_tests; 9 | -------------------------------------------------------------------------------- /apps/hubble/www/docs/assets/images/gcp_hubble_running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZinkaTrostinka/hub-monorepo/HEAD/apps/hubble/www/docs/assets/images/gcp_hubble_running.png -------------------------------------------------------------------------------- /apps/hubble/www/docs/assets/images/gcp_terraform_plan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZinkaTrostinka/hub-monorepo/HEAD/apps/hubble/www/docs/assets/images/gcp_terraform_plan.png -------------------------------------------------------------------------------- /apps/hubble/www/docs/assets/images/google_cloud_shell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZinkaTrostinka/hub-monorepo/HEAD/apps/hubble/www/docs/assets/images/google_cloud_shell.png -------------------------------------------------------------------------------- /apps/hubble/www/docs/assets/images/gcp_terraform_apply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZinkaTrostinka/hub-monorepo/HEAD/apps/hubble/www/docs/assets/images/gcp_terraform_apply.png -------------------------------------------------------------------------------- /apps/hubble/www/docs/.vitepress/theme/index.js: -------------------------------------------------------------------------------- 1 | // .vitepress/theme/index.js 2 | import DefaultTheme from 'vitepress/theme' 3 | import './custom.css' 4 | 5 | export default DefaultTheme -------------------------------------------------------------------------------- /packages/core/src/eth/chains.ts: -------------------------------------------------------------------------------- 1 | import { mainnet, goerli, optimism, optimismGoerli } from "viem/chains"; 2 | 3 | export const CHAIN_IDS = [mainnet.id, goerli.id, optimism.id, optimismGoerli.id] as const; 4 | -------------------------------------------------------------------------------- /protobufs/schemas/sync_trie.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | message DbTrieNode { 4 | bytes key = 1; 5 | repeated uint32 childChars = 2; 6 | uint32 items = 3; 7 | bytes hash = 4; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /protobufs/schemas/job.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | message RevokeMessagesBySignerJobPayload { 4 | uint32 fid = 1; 5 | bytes signer = 2; 6 | } 7 | 8 | message UpdateNameRegistryEventExpiryJobPayload { 9 | bytes fname = 1; 10 | } 11 | -------------------------------------------------------------------------------- /packages/biome-config-custom/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "biome-config-custom", 3 | "version": "0.0.1", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "@biomejs/biome": "1.1.0" 8 | }, 9 | "private": true 10 | } 11 | -------------------------------------------------------------------------------- /packages/hub-web/examples/events/README.md: -------------------------------------------------------------------------------- 1 | ## Subscribing to Hub Events 2 | 3 | This example shows how to listen to the firehose of events emitted by the Hubs. 4 | 5 | To run this example, 6 | ```bash 7 | yarn install 8 | yarn start 9 | ``` 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/hub-nodejs/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup'; 2 | 3 | export default defineConfig({ 4 | target: ['node14'], 5 | entryPoints: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | clean: true, 9 | shims: true, 10 | }); 11 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules/ 2 | **/.git 3 | **/README.md 4 | **/LICENSE 5 | **/.vscode 6 | **/npm-debug.log 7 | **/coverage 8 | **/.env 9 | **/.editorconfig 10 | **/.aws 11 | **/.github 12 | **/.hub 13 | **/.rocks 14 | **/build 15 | **/.husky 16 | **/dist 17 | **/Dockerfile* 18 | -------------------------------------------------------------------------------- /packages/core/src/errors.test.ts: -------------------------------------------------------------------------------- 1 | import { HubError } from "./errors"; 2 | 3 | describe("HubError", () => { 4 | test("can be instantiated", () => { 5 | const error = new HubError("bad_request.invalid_param", "test message"); 6 | expect(error).toBeInstanceOf(HubError); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/core/src/eth/contracts/abis/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./bundler"; 2 | export * from "./idGateway"; 3 | export * from "./idRegistry"; 4 | export * from "./keyGateway"; 5 | export * from "./keyRegistry"; 6 | export * from "./signedKeyRequestValidator"; 7 | export * from "./storageRegistry"; 8 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/chron-feed/README.md: -------------------------------------------------------------------------------- 1 | ## Generate a chronological feed 2 | 3 | ### Run locally 4 | 5 | 1. Clone the repo locally 6 | 2. Navigate to this folder with `cd packages/hub-nodejs/examples/chron-feed` 7 | 3. Run `yarn install` to install dependencies 8 | 4. Run `yarn start` 9 | -------------------------------------------------------------------------------- /packages/hub-web/examples/feed/README.md: -------------------------------------------------------------------------------- 1 | ## Generating a chronological feed 2 | 3 | This example generates a chronological feed from a list of FIDs (For eg., the list of FIDs that a user 4 | is following) 5 | 6 | To run this example, 7 | ```bash 8 | yarn install 9 | yarn start 10 | ``` 11 | -------------------------------------------------------------------------------- /apps/hubble/src/bootstrapPeers.mainnet.ts: -------------------------------------------------------------------------------- 1 | // List of bootstrap peers for mainnet 2 | export const MAINNET_BOOTSTRAP_PEERS = [ 3 | "/dns/hoyt.farcaster.xyz/tcp/2282", 4 | "/dns/lamia.farcaster.xyz/tcp/2282", 5 | "/dns/nemes.farcaster.xyz/tcp/2282", 6 | "/dns/bootstrap.neynar.com/tcp/2282", 7 | ]; 8 | -------------------------------------------------------------------------------- /packages/hub-web/examples/grpc-web-chron-feed/README.md: -------------------------------------------------------------------------------- 1 | 2 | **Deprecation Notice:** 3 | grpc-web has been deprecated and is no longer supported. Please use the [HTTP API](../../README.md) instead. This original document has been kept only for historical reference. 4 | 5 | ## Generate a chronological feed 6 | -------------------------------------------------------------------------------- /packages/hub-web/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup'; 2 | 3 | export default defineConfig({ 4 | target: ['chrome79', 'edge109', 'firefox102', 'safari12'], 5 | entryPoints: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | clean: true, 9 | shims: true, 10 | }); 11 | -------------------------------------------------------------------------------- /apps/hubble/hubble.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | }, 6 | { 7 | "path": "src/addon" 8 | } 9 | ], 10 | "settings": { 11 | "[apps/hubble/src/addon]": { 12 | "jest.enable": false 13 | }, 14 | "rust-analyzer.showUnlinkedFileNotification": false 15 | } 16 | } -------------------------------------------------------------------------------- /packages/core/src/eth/contracts/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./bundler"; 2 | export * from "./idGateway"; 3 | export * from "./idRegistry"; 4 | export * from "./keyGateway"; 5 | export * from "./keyRegistry"; 6 | export * from "./signedKeyRequestValidator"; 7 | export * from "./storageRegistry"; 8 | export * from "./abis"; 9 | -------------------------------------------------------------------------------- /packages/hub-web/examples/golang-submitmessage/go.mod: -------------------------------------------------------------------------------- 1 | module golang-submitmessage 2 | 3 | go 1.21.2 4 | 5 | require ( 6 | github.com/golang/protobuf v1.5.0 7 | github.com/zeebo/blake3 v0.2.3 8 | google.golang.org/protobuf v1.33.0 9 | ) 10 | 11 | require github.com/klauspost/cpuid/v2 v2.0.12 // indirect 12 | -------------------------------------------------------------------------------- /packages/hub-web/examples/submit-message/README.md: -------------------------------------------------------------------------------- 1 | ## Submitting messages to a Hub 2 | 3 | This example generates and submits a message to the Hub. You will need a Signer for the user you are submitting a message on behalf of. 4 | 5 | To run this example, 6 | ```bash 7 | yarn install 8 | yarn start 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/core/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "tsup"; 2 | 3 | export default defineConfig({ 4 | target: ["node14", "chrome79", "edge109", "firefox102", "safari12"], 5 | entryPoints: ["src/index.ts"], 6 | format: ["esm", "cjs"], 7 | dts: true, 8 | clean: true, 9 | shims: true, 10 | }); 11 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/contract-signatures/hardhat.config.cjs: -------------------------------------------------------------------------------- 1 | /** @type import('hardhat/config').HardhatUserConfig */ 2 | module.exports = { 3 | networks: { 4 | hardhat: { 5 | chainId: 10, 6 | forking: { 7 | url: "https://mainnet.optimism.io", 8 | }, 9 | }, 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /packages/shuttle/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "tsup"; 2 | 3 | export default defineConfig({ 4 | target: ["node14", "chrome79", "edge109", "firefox102", "safari12"], 5 | entryPoints: ["./src/index.ts"], 6 | format: ["esm", "cjs"], 7 | dts: true, 8 | clean: true, 9 | shims: true, 10 | }); 11 | -------------------------------------------------------------------------------- /apps/hubble/envoy/envoy-start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker run -d -v "$(pwd)"/envoy.yaml:/etc/envoy/envoy.yaml:ro \ 4 | --network=host envoyproxy/envoy:v1.22.0 5 | 6 | # command to run in Mac/Windows 7 | # docker run -d -v "$(pwd)"/envoy.yaml:/etc/envoy/envoy.yaml:ro \ 8 | # -p 2284:2284 -p 9901:9901 envoyproxy/envoy:v1.22.0 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", 3 | "changelog": "@changesets/changelog-git", 4 | "commit": false, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "public", 8 | "baseBranch": "main", 9 | "updateInternalDependencies": "patch", 10 | "ignore": [] 11 | } 12 | -------------------------------------------------------------------------------- /packages/core/src/signers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./ed25519Signer"; 2 | export * from "./eip712Signer"; 3 | export * from "./ethersEip712Signer"; 4 | export * from "./ethersV5Eip712Signer"; 5 | export * from "./nobleEd25519Signer"; 6 | export * from "./viemLocalEip712Signer"; 7 | export * from "./viemWalletEip712Signer"; 8 | export * from "./signer"; 9 | -------------------------------------------------------------------------------- /packages/core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "baseUrl": "./src", 6 | "outDir": "build", 7 | "rootDir": "src", 8 | "isolatedModules": true 9 | }, 10 | "include": ["src/index.ts"], 11 | "exclude": ["build", "node_modules", "jest.config.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /packages/hub-nodejs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "baseUrl": "./src", 6 | "outDir": "build", 7 | "rootDir": "src", 8 | "isolatedModules": true 9 | }, 10 | "include": ["src/index.ts"], 11 | "exclude": ["build", "node_modules", "jest.config.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /apps/replicator/src/redis.ts: -------------------------------------------------------------------------------- 1 | import { Redis, RedisOptions } from "ioredis"; 2 | 3 | export const getRedisClient = (redisUrl: string, redisOpts?: RedisOptions) => { 4 | const client = new Redis(redisUrl, { 5 | connectTimeout: 5_000, 6 | maxRetriesPerRequest: null, // BullMQ wants this set 7 | ...redisOpts, 8 | }); 9 | return client; 10 | }; 11 | -------------------------------------------------------------------------------- /apps/hubble/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "resolveJsonModule": true, 5 | "moduleResolution": "NodeNext", 6 | "module": "NodeNext", 7 | "baseUrl": "./src", 8 | "outDir": "build", 9 | "rootDir": "src" 10 | }, 11 | "exclude": ["node_modules", "jest.config.ts", "src/addon/target"] 12 | } 13 | -------------------------------------------------------------------------------- /packages/hub-web/examples/golang-submitmessage/README.md: -------------------------------------------------------------------------------- 1 | ## Submitting messages to a Hub using Go lang 2 | 3 | This Golang example generates and submits a message to the Hub. You will need a Signer for the user you are submitting a message on behalf of. 4 | 5 | To run this example, 6 | ```bash 7 | make generate 8 | make build 9 | ./golang-submitmessage 10 | ``` 11 | -------------------------------------------------------------------------------- /apps/replicator/src/log.ts: -------------------------------------------------------------------------------- 1 | import { LOG_LEVEL, COLORIZE } from "./env.js"; 2 | import { pino } from "pino"; 3 | 4 | export const log = pino({ 5 | level: LOG_LEVEL, 6 | transport: { 7 | target: "pino-pretty", 8 | options: { 9 | colorize: COLORIZE, 10 | singleLine: true, 11 | }, 12 | }, 13 | }); 14 | 15 | export type Logger = pino.Logger; 16 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | A collection of Typescript examples showcasing the things you can do with `hub-nodejs`. 4 | 5 | - [Generate a chronological feed](./chron-feed/) 6 | - [Creating an account](hello-world/) 7 | - [Writing different types of messages to the hub](write-data/) 8 | 9 | Contributions for other examples are welcome! 10 | -------------------------------------------------------------------------------- /protobufs/schemas/username_proof.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | enum UserNameType { 4 | USERNAME_TYPE_NONE = 0; 5 | USERNAME_TYPE_FNAME = 1; 6 | USERNAME_TYPE_ENS_L1 = 2; 7 | } 8 | 9 | message UserNameProof { 10 | uint64 timestamp = 1; 11 | bytes name = 2; 12 | bytes owner = 3; 13 | bytes signature = 4; 14 | uint64 fid = 5; 15 | UserNameType type = 6; 16 | } -------------------------------------------------------------------------------- /apps/hubble/www/docs/intro/tutorials.md: -------------------------------------------------------------------------------- 1 | # Tutorials 2 | 3 | 4 | Guides to set up a Hubble instance using various cloud providers. 5 | 6 | - [AWS EC2](https://warpcast.notion.site/Set-up-Hubble-on-EC2-Public-23b4e81d8f604ca9bf8b68f4bb086042) 7 | - [Digital Ocean](https://warpcast.notion.site/Set-up-Hubble-on-DigitalOcean-Public-e38173c487874c91828665e73eac94c1) 8 | - [Google Cloud Platform](../tutorials/gcp.md) -------------------------------------------------------------------------------- /apps/replicator/.env.sample: -------------------------------------------------------------------------------- 1 | LOG_LEVEL=info 2 | COLORIZE=true 3 | # Set this higher the further the hub is from the replicator 4 | CONCURRENCY=32 5 | MAX_OLD_SPACE_SIZE=2048 # ram of system 6 | WORKER_TYPE=thread 7 | WEB_UI_PORT=9000 8 | REDIS_URL=redis:6379 9 | POSTGRES_URL=postgres://replicator:password@postgres:5432/replicator 10 | STATSD_HOST=statsd:8125 11 | HUB_HOST=localhost:2283 12 | HUB_SSL=false -------------------------------------------------------------------------------- /packages/hub-nodejs/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { getInsecureClient } from "."; 2 | 3 | test("Client can be constructed", async () => { 4 | const client = getInsecureClient("127.0.0.1:0"); 5 | expect(client).toBeTruthy(); 6 | }); 7 | 8 | test("Reports more helpful error if address unspecified", async () => { 9 | expect(() => getInsecureClient("")).toThrow(new Error("Hub address not specified")); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/shuttle/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "baseUrl": "./", 6 | "outDir": "build", 7 | "rootDir": "./", 8 | "isolatedModules": true, 9 | "exactOptionalPropertyTypes": false, 10 | }, 11 | "include": ["./**/*.ts", "./**/*.d.ts"], 12 | "exclude": ["build", "node_modules", "jest.config.ts"] 13 | } 14 | -------------------------------------------------------------------------------- /apps/hubble/www/docs/.vitepress/theme/custom.css: -------------------------------------------------------------------------------- 1 | /* .vitepress/theme/custom.css */ 2 | :root { 3 | --vp-c-green: #8a63d2; 4 | --vp-c-green-light: #9c83d5; 5 | --vp-c-green-lighter: #c2b2e5; 6 | --vp-c-green-dark: #6950a3; 7 | --vp-c-green-darker: #5d468e; 8 | --vp-c-green-dimm-1: rgba(138, 99, 210, 0.05); 9 | --vp-c-green-dimm-2: rgba(138, 99, 210, 0.2); 10 | --vp-c-green-dimm-3: rgba(138, 99, 210, 0.5); 11 | } 12 | -------------------------------------------------------------------------------- /packages/shuttle/src/example-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "baseUrl": "./src", 6 | "outDir": "build", 7 | "rootDir": "src", 8 | "isolatedModules": true, 9 | "exactOptionalPropertyTypes": false, 10 | }, 11 | "include": ["src/**/*.ts", "src/**/*.d.ts"], 12 | "exclude": ["build", "node_modules", "jest.config.ts"] 13 | } 14 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: 5 | # TODO: make 85% once https://github.com/farcasterxyz/hub/issues/303 is resolved 6 | target: 70% 7 | threshold: 1% 8 | patch: 9 | default: 10 | target: auto 11 | threshold: 0% 12 | base: auto 13 | if_ci_failed: success 14 | ignore: 15 | - '**/generated' 16 | - '**/mocks.ts' 17 | - '**/test' 18 | -------------------------------------------------------------------------------- /packages/core/src/signers/ethersEip712Signer.test.ts: -------------------------------------------------------------------------------- 1 | import { Wallet } from "ethers"; 2 | import { EthersEip712Signer } from "./ethersEip712Signer"; 3 | import { testEip712Signer } from "./testUtils"; 4 | 5 | describe("EthersEip712Signer", () => { 6 | describe("with ethers Wallet", () => { 7 | const wallet = Wallet.createRandom(); 8 | const signer = new EthersEip712Signer(wallet); 9 | testEip712Signer(signer); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /apps/replicator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "resolveJsonModule": true, 5 | "moduleResolution": "node", 6 | // BullMQ doesn't support ESM 7 | // https://github.com/taskforcesh/bullmq/issues/1534 8 | "module": "commonjs", 9 | "baseUrl": "./src", 10 | "outDir": "build", 11 | "rootDir": "src" 12 | }, 13 | "exclude": ["node_modules", "jest.config.ts"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/core/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./protobufs"; 2 | export * from "./builders"; 3 | export * from "./bytes"; 4 | export * from "./crypto"; 5 | export * from "./errors"; 6 | export * from "./eth"; 7 | export * from "./factories"; 8 | export * from "./signers"; 9 | export * from "./time"; 10 | export * as validations from "./validations"; 11 | export * from "./verifications"; 12 | export * from "./userNameProof"; 13 | export * from "./limits"; 14 | -------------------------------------------------------------------------------- /packages/hub-nodejs/src/index.ts: -------------------------------------------------------------------------------- 1 | export { Metadata, Server, ServerCredentials, status } from "@grpc/grpc-js"; 2 | export type { 3 | CallOptions, 4 | Client, 5 | ClientOptions, 6 | ClientReadableStream, 7 | ClientUnaryCall, 8 | sendUnaryData, 9 | ServiceError, 10 | ServerWritableStream, 11 | } from "@grpc/grpc-js"; 12 | 13 | export * from "@farcaster/core"; 14 | 15 | export * from "./generated/rpc"; 16 | export * from "./client"; 17 | -------------------------------------------------------------------------------- /packages/core/src/signers/ethersV5Eip712Signer.test.ts: -------------------------------------------------------------------------------- 1 | import { Wallet } from "ethers5"; 2 | import { EthersV5Eip712Signer } from "./ethersV5Eip712Signer"; 3 | import { testEip712Signer } from "./testUtils"; 4 | 5 | describe("EthersV5Eip712Signer", () => { 6 | describe("with ethers Wallet", () => { 7 | const wallet = Wallet.createRandom(); 8 | const signer = new EthersV5Eip712Signer(wallet); 9 | testEip712Signer(signer); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/hub-web/examples/events/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "profile", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "main": "index.ts", 7 | "scripts": { 8 | "start": "tsx index.ts" 9 | }, 10 | "dependencies": { 11 | "@farcaster/core": "^0.12.10", 12 | "axios": "^1.6.0" 13 | }, 14 | "devDependencies": { 15 | "@types/axios": "^0.14.0", 16 | "tsx": "^3.12.5", 17 | "typescript": "^5.0.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/hub-web/examples/profile/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "profile", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "main": "index.ts", 7 | "scripts": { 8 | "start": "tsx index.ts" 9 | }, 10 | "dependencies": { 11 | "@farcaster/core": "^0.12.10", 12 | "axios": "^1.6.0" 13 | }, 14 | "devDependencies": { 15 | "@types/axios": "^0.14.0", 16 | "tsx": "^3.12.5", 17 | "typescript": "^5.0.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/hub-web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "baseUrl": "./src", 6 | "outDir": "build", 7 | "rootDir": "src", 8 | "isolatedModules": true, 9 | // override this setting to be compatible with grpc-web output 10 | "exactOptionalPropertyTypes": false 11 | }, 12 | "include": ["src/index.ts"], 13 | "exclude": ["build", "node_modules", "jest.config.ts"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/write-data/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-write-data", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "main": "index.ts", 7 | "scripts": { 8 | "start": "tsx index.ts", 9 | "typecheck": "yarn tsc --noEmit" 10 | }, 11 | "dependencies": { 12 | "@farcaster/hub-nodejs": "^0.10.13" 13 | }, 14 | "devDependencies": { 15 | "tsx": "^3.12.5", 16 | "typescript": "^5.0.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/hub-web/examples/grpc-web-chron-feed/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-chron-feed", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "main": "index.ts", 7 | "scripts": { 8 | "start": "tsx index.ts" 9 | }, 10 | "dependencies": { 11 | "@farcaster/hub-web": "^0.4.2", 12 | "javascript-time-ago": "^2.5.9" 13 | }, 14 | "devDependencies": { 15 | "tsx": "^3.12.5", 16 | "typescript": "^5.0.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "search.exclude": { 3 | ".git": true, 4 | ".eslintcache": true, 5 | "build": true, 6 | "node_modules": true, 7 | "yarn.lock": true 8 | }, 9 | "editor.formatOnSave": true, 10 | "editor.defaultFormatter": "biomejs.biome", 11 | "editor.codeActionsOnSave": { 12 | "source.organizeImports.biome": "explicit" 13 | }, 14 | "cSpell.words": [ 15 | "farcaster", 16 | "gossipsub", 17 | "protobufs" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /packages/core/src/signers/viemLocalEip712Signer.test.ts: -------------------------------------------------------------------------------- 1 | import { ViemLocalEip712Signer } from "./viemLocalEip712Signer"; 2 | import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; 3 | import { testEip712Signer } from "./testUtils"; 4 | 5 | describe("ViemLocalEip712Signer", () => { 6 | const privateKeyAccount = privateKeyToAccount(generatePrivateKey()); 7 | const signer = new ViemLocalEip712Signer(privateKeyAccount); 8 | testEip712Signer(signer); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/shuttle/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "jest"; 2 | 3 | const jestConfig: Config = { 4 | testEnvironment: "node", 5 | rootDir: "src", 6 | extensionsToTreatAsEsm: [".ts"], 7 | /** 8 | * For high performance with minimal configuration transform with TS with swc. 9 | * @see https://github.com/farcasterxyz/hubble/issues/314 10 | */ 11 | transform: { 12 | "^.+\\.(t|j)sx?$": "@swc/jest", 13 | }, 14 | }; 15 | 16 | export default jestConfig; 17 | -------------------------------------------------------------------------------- /packages/core/src/protobufs/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./generated/gossip"; 2 | export * from "./generated/hub_event"; 3 | export * from "./generated/hub_state"; 4 | export * from "./generated/job"; 5 | export * from "./generated/message"; 6 | export * from "./generated/onchain_event"; 7 | export * from "./generated/username_proof"; 8 | export * from "./generated/sync_trie"; 9 | export * from "./generated/request_response"; 10 | export * from "./typeguards"; 11 | export * from "./types"; 12 | -------------------------------------------------------------------------------- /packages/hub-nodejs/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | 3 | const jestConfig: Config = { 4 | testEnvironment: 'node', 5 | rootDir: 'src', 6 | extensionsToTreatAsEsm: ['.ts'], 7 | /** 8 | * For high performance with minimal configuration transform with TS with swc. 9 | * @see https://github.com/farcasterxyz/hubble/issues/314 10 | */ 11 | transform: { 12 | '^.+\\.(t|j)sx?$': '@swc/jest', 13 | }, 14 | }; 15 | 16 | export default jestConfig; 17 | -------------------------------------------------------------------------------- /packages/hub-web/examples/submit-message/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "submit-message", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "main": "index.ts", 7 | "scripts": { 8 | "start": "tsx index.ts" 9 | }, 10 | "dependencies": { 11 | "@farcaster/core": "^0.12.10", 12 | "axios": "^1.6.0" 13 | }, 14 | "devDependencies": { 15 | "@types/axios": "^0.14.0", 16 | "tsx": "^3.12.5", 17 | "typescript": "^5.0.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/shuttle/src/log.ts: -------------------------------------------------------------------------------- 1 | import { pino } from "pino"; 2 | 3 | const COLORIZE = 4 | process.env["COLORIZE"] === "true" ? true : process.env["COLORIZE"] === "false" ? false : process.stdout.isTTY; 5 | 6 | export const log = pino({ 7 | level: process.env["LOG_LEVEL"] || "info", 8 | transport: { 9 | target: "pino-pretty", 10 | options: { 11 | colorize: COLORIZE, 12 | singleLine: true, 13 | }, 14 | }, 15 | }); 16 | 17 | export type Logger = pino.Logger; 18 | -------------------------------------------------------------------------------- /apps/hubble/www/docs/docs/httpapi/fids.md: -------------------------------------------------------------------------------- 1 | # FIDs API 2 | 3 | 4 | ## fids 5 | Get a list of all the FIDs 6 | 7 | **Query Parameters** 8 | | Parameter | Description | Example | 9 | | --------- | ----------- | ------- | 10 | | | This endpoint accepts no parameters | | 11 | 12 | 13 | **Example** 14 | ```bash 15 | curl http://127.0.0.1:2281/v1/fids 16 | ``` 17 | 18 | 19 | **Response** 20 | ```json 21 | { 22 | "fids": [1, 2, 3, 4, 5, 6], 23 | "nextPageToken": "AAAnEA==" 24 | } 25 | ``` 26 | -------------------------------------------------------------------------------- /packages/hub-web/examples/events/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "skipLibCheck": true, 10 | "noImplicitReturns": true, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/hub-web/examples/feed/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "skipLibCheck": true, 10 | "noImplicitReturns": true, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/hub-web/examples/profile/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "skipLibCheck": true, 10 | "noImplicitReturns": true, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/shuttle/src/example-app/log.ts: -------------------------------------------------------------------------------- 1 | import { pino } from "pino"; 2 | 3 | const COLORIZE = 4 | process.env["COLORIZE"] === "true" ? true : process.env["COLORIZE"] === "false" ? false : process.stdout.isTTY; 5 | 6 | export const log = pino({ 7 | level: process.env["LOG_LEVEL"] || "info", 8 | transport: { 9 | target: "pino-pretty", 10 | options: { 11 | colorize: COLORIZE, 12 | singleLine: true, 13 | }, 14 | }, 15 | }); 16 | 17 | export type Logger = pino.Logger; 18 | -------------------------------------------------------------------------------- /apps/replicator/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@biomejs/biome/configuration_schema.json", 3 | "organizeImports": { 4 | "enabled": false 5 | }, 6 | "formatter": { 7 | "enabled": true, 8 | "indentSize": 2, 9 | "indentStyle": "space", 10 | "lineWidth": 120 11 | }, 12 | "linter": { 13 | "enabled": true, 14 | "rules": { 15 | "recommended": true, 16 | "complexity": { 17 | "useLiteralKeys": "off" 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/chron-feed/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "skipLibCheck": true, 10 | "noImplicitReturns": true, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/write-data/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "skipLibCheck": true, 10 | "noImplicitReturns": true, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/hub-web/examples/feed/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "feed", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "main": "index.ts", 7 | "scripts": { 8 | "start": "tsx index.ts" 9 | }, 10 | "dependencies": { 11 | "@farcaster/core": "^0.12.10", 12 | "axios": "^1.6.0", 13 | "javascript-time-ago": "^2.5.9" 14 | }, 15 | "devDependencies": { 16 | "@types/axios": "^0.14.0", 17 | "tsx": "^3.12.5", 18 | "typescript": "^5.0.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/hello-world/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "skipLibCheck": true, 10 | "noImplicitReturns": true, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/hub-web/examples/submit-message/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "skipLibCheck": true, 10 | "noImplicitReturns": true, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/chron-feed/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-chron-feed", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "main": "index.ts", 7 | "scripts": { 8 | "start": "tsx index.ts", 9 | "typecheck": "yarn tsc --noEmit" 10 | }, 11 | "dependencies": { 12 | "@farcaster/hub-nodejs": "^0.10.11", 13 | "javascript-time-ago": "^2.5.9" 14 | }, 15 | "devDependencies": { 16 | "tsx": "^3.12.5", 17 | "typescript": "^5.0.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/contract-signatures/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "skipLibCheck": true, 10 | "noImplicitReturns": true, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/hub-web/examples/grpc-web-chron-feed/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "skipLibCheck": true, 10 | "noImplicitReturns": true, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /apps/replicator/src/jobs/processHubEvent.ts: -------------------------------------------------------------------------------- 1 | import { HubEvent } from "@farcaster/hub-nodejs"; 2 | import { registerJob } from "../jobs.js"; 3 | import { processHubEvent } from "../processors/index.js"; 4 | 5 | export const ProcessHubEvent = registerJob({ 6 | name: "ProcessHubEvent", 7 | run: async ({ hubEventJsonStr }: { hubEventJsonStr: string }, { db, log, redis }) => { 8 | const hubEvent = HubEvent.fromJSON(JSON.parse(hubEventJsonStr)); 9 | await processHubEvent(hubEvent, db, log, redis); 10 | }, 11 | }); 12 | -------------------------------------------------------------------------------- /packages/core/src/signers/signer.ts: -------------------------------------------------------------------------------- 1 | import { SignatureScheme } from "../protobufs"; 2 | import { HubAsyncResult } from "../errors"; 3 | 4 | export interface Signer { 5 | readonly scheme: SignatureScheme; 6 | 7 | /** 8 | * Get the key in bytes used to identify this signer. 9 | */ 10 | getSignerKey(): HubAsyncResult; 11 | 12 | /** 13 | * Generates a 256-bit signature for a message hash and returns the bytes. 14 | */ 15 | signMessageHash(hash: Uint8Array): HubAsyncResult; 16 | } 17 | -------------------------------------------------------------------------------- /apps/hubble/src/storage/db/jestUtils.ts: -------------------------------------------------------------------------------- 1 | import RocksDB from "./rocksdb.js"; 2 | 3 | /** Temporary binary version */ 4 | export const jestRocksDB = (name: string) => { 5 | const db = new RocksDB(name); 6 | 7 | beforeAll(async () => { 8 | await expect(db.open()).resolves.not.toThrow(); 9 | }); 10 | 11 | afterEach(async () => { 12 | db.clear(); 13 | }); 14 | 15 | afterAll(async () => { 16 | db.close(); 17 | await expect(db.destroy()).resolves.not.toThrow(); 18 | }); 19 | 20 | return db; 21 | }; 22 | -------------------------------------------------------------------------------- /apps/hubble/src/utils/command.ts: -------------------------------------------------------------------------------- 1 | import { HubError, validations, FarcasterNetwork } from "@farcaster/hub-nodejs"; 2 | 3 | export const parseNetwork = (network: string): FarcasterNetwork => { 4 | const networkId = Number(network); 5 | if (isNaN(networkId)) throw new HubError("bad_request.invalid_param", "network must be a number"); 6 | const isValidNetwork = validations.validateNetwork(networkId); 7 | if (isValidNetwork.isErr()) { 8 | throw isValidNetwork.error; 9 | } 10 | return isValidNetwork.value; 11 | }; 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **What is the bug?** 11 | A concise, high level description of the bug and how it affects you 12 | 13 | **How can it be reproduced? (optional)** 14 | Include steps, code samples, replits, screenshots and anything else that would be helpful to reproduce the problem. 15 | 16 | **Additional context (optional)** 17 | Add any other context about the problem here. 18 | -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /packages/shuttle/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@biomejs/biome/configuration_schema.json", 3 | "organizeImports": { 4 | "enabled": false 5 | }, 6 | "formatter": { 7 | "enabled": true, 8 | "indentSize": 2, 9 | "indentStyle": "space", 10 | "lineWidth": 120, 11 | "ignore": [] 12 | }, 13 | "linter": { 14 | "enabled": true, 15 | "rules": { 16 | "recommended": true, 17 | "complexity": { 18 | "useLiteralKeys": "off" 19 | } 20 | }, 21 | "ignore": [] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/hub-nodejs/examples/hello-world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-hello-world", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "main": "index.ts", 7 | "scripts": { 8 | "start": "tsx index.ts", 9 | "typecheck": "yarn tsc --noEmit" 10 | }, 11 | "dependencies": { 12 | "@farcaster/hub-nodejs": "^0.10.19", 13 | "axios": "^1.6.0", 14 | "viem": "^1.12.2", 15 | "wagmi": "^1.4.3" 16 | }, 17 | "devDependencies": { 18 | "tsx": "^3.12.5", 19 | "typescript": "^5.0.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /apps/hubble/rollup.config.js: -------------------------------------------------------------------------------- 1 | import resolve from '@rollup/plugin-node-resolve'; 2 | import commonjs from '@rollup/plugin-commonjs'; 3 | import json from '@rollup/plugin-json'; 4 | 5 | export default { 6 | input: 'build/cli.js', 7 | output: { 8 | file: 'rollup-bundle.js', 9 | format: 'cjs', // immediately-invoked function expression — suitable for