hoodkit
    Preparing search index...

    Class Indexer

    A local, incremental SQLite indexer for Robinhood Chain. Syncs Transfer and Uniswap v3 Swap events for a token set, resumes from the last synced block, and answers holder / OHLCV / volume queries from local data with no RPC.

    Requires the optional better-sqlite3 peer dependency; construct via createIndexer.

    Index
    • get database(): Database

      Underlying better-sqlite3 handle for advanced queries.

      Returns Database

    • OHLCV candles for token at interval, built from indexed swaps on its primary pool (or options.pool). Prices are token-denominated in the pool's quote asset. Sparse by default; pass fill: true to forward-fill gaps.

      Parameters

      • token: `0x${string}`
      • interval: Interval
      • options: { fill?: boolean; pool?: `0x${string}` } = {}

      Returns Candle[]

    • Number of holders with a positive balance (see Indexer.holders accuracy note).

      Parameters

      • token: `0x${string}`

      Returns number

    • Current holders of token, computed as net (inbound − outbound) transfer flow per address. Accurate against the on-chain holder set only when the token was synced from its first transfer (sync({ fromBlock: 0n })). The zero address is excluded.

      Parameters

      • token: `0x${string}`
      • options: { minBalance?: bigint } = {}

      Returns Holder[]

    • The most-traded indexed pool for token, or null if none indexed.

      Parameters

      • token: `0x${string}`

      Returns `0x${string}` | null

    • Row counts for a quick health check.

      Returns { blocks: number; pools: number; swaps: number; transfers: number }

    • Sync all tokens from their last synced block to the head (incremental). Pass fromBlock on the first run to backfill history — required for holder counts to match the full-history on-chain state.

      Parameters

      • options: {
            fromBlock?: bigint;
            onProgress?: (p: SyncProgress) => void;
            swapFromBlock?: bigint;
            toBlock?: bigint;
        } = {}
        • OptionalfromBlock?: bigint
        • OptionalonProgress?: (p: SyncProgress) => void
        • OptionalswapFromBlock?: bigint

          Independent backfill start for swaps (defaults to fromBlock). Lets you pull full holder history without re-scanning a memecoin's entire swap history for candles.

        • OptionaltoBlock?: bigint

      Returns Promise<SyncResult>

    • Rolling 24-hour token-denominated swap volume across all indexed pools of token. Uses cached block timestamps; now overridable for testing.

      Parameters

      • token: `0x${string}`
      • now: number = ...

      Returns number