For the complete documentation index, see llms.txt. This page is also available as Markdown.

Indexer API

The indexer exposes the indexed data through a GraphQL API and a RESTful search endpoint.

GraphQL API

The primary way to query data is through the GraphQL endpoint, available at /graphql. It is strongly typed and supports complex queries, filtering, and pagination.

Example Queries

  1. Fetch top 5 pools on Base Sepolia by USD liquidity:

    query TopPoolsByLiquidity {
      pools(
        where: { chainId: 84532 }
        orderBy: "dollarLiquidity"
        orderDirection: "desc"
        limit: 5
      ) {
        items {
          address
          dollarLiquidity
          volumeUsd
          baseToken {
            symbol
          }
          quoteToken {
            symbol
          }
        }
      }
    }
  2. Get recent swaps for a specific pool:

    query RecentSwaps {
      swaps(
        where: { pool: "0x..." }
        orderBy: "timestamp"
        orderDirection: "desc"
        limit: 10
      ) {
        items {
          txHash
          timestamp
          type
          amountIn
          amountOut
          swapValueUsd
        }
      }
    }
  3. Fetch detailed information for a single token:

    query TokenDetails {
      token(address: "0x...", chainId: 84532) {
        address
        name
        symbol
        decimals
        image
        volumeUsd
        holderCount
        pool {
          address
          price
        }
      }
    }

REST API

A simple REST endpoint is available for searching tokens.

Search Endpoint

  • URL: /search/:query

  • Method: GET

  • Description: Searches for tokens by name, symbol, or address.

  • URL Parameters:

    • query: The search term (e.g., "MyToken", "MTK", or "0x...").

  • Query Parameters:

    • chain_ids: A comma-separated list of chain IDs to filter the search (e.g., ?chain_ids=84532,130).

Example Usage:

Direct SQL Access (Development)

For development and debugging, you can connect directly to the PostgreSQL database. Use pnpm db shell to get an interactive psql session. You can also use any standard SQL client with the connection string from your .env.local file.

Last updated