Skip to content

graphprotocol/token-api

Repository files navigation

The Graph: Token API

.github/workflows/bun-test.yml license

Power your apps & AI agents with real-time token data.

banner

Architecture

flowchart LR
  S1[EVM Tokens.spkg] --> Sink{Substreams SQL Sink}
  S2[SVM Tokens.spkg] --> Sink
  S3[Antelope Tokens.spkg] --> Sink
  Sink --> Clickhouse
  Clickhouse((Clickhouse)) --> Server{MCP Server}
  Clickhouse --> API{Token API}
Loading

Supported Endpoints

  • Balances
  • Holders
  • Tokens
  • Transfers

Supported Networks

  • EVM (Ethereum, Base, Arbitrum, BSC, etc.)
  • SVN (Solana)
  • Antelope (Vaulta, WAX, Telos, Ultra)

Quick start

Install Bun

bun install
bun dev

Tests

bun lint
bun test

.env Environment variables

# API Server
PORT=8000
HOSTNAME=localhost

# MCP Server
SSE_PORT=8080
SSE_ENDPOINT=sse

# Clickhouse Database
URL=http://127.0.0.1:8123
DATABASE=default
USERNAME=default
PASSWORD=
MAX_LIMIT=10000

# Logging
PRETTY_LOGGING=true
VERBOSE=true

Docker environment

  • Pull from GitHub Container registry

For latest tagged release

docker pull ghcr.io/graphprotocol/token-api:latest

For head of main branch

docker pull ghcr.io/graphprotocol/token-api:develop
  • Build from source
docker build \
  --build-arg GIT_COMMIT="$(git rev-parse HEAD)" \
  --build-arg GIT_DATE="$(git log -1 --format=%cd --date=short)"
  -t token-api .
  • Run with .env file
docker run -it --rm --env-file .env -p 8000:8000 ghcr.io/graphprotocol/token-api:develop

Contributing

See CONTRIBUTING.md.