Skip to content

pinax-network/substreams-erc20-api

Repository files navigation

Substreams ERC20 API

.github/workflows/bun-test.yml

ERC-20 Balance, Supply, Contract API

REST API

Pathname Description
GET / Swagger UI
GET /chains Available chains
GET /supply ERC20 total supply
GET /contract ERC20 contract information (name,symbol,decimals)
GET /balance ERC20 balance changes
GET /holders ERC20 contract's holders
GET /health Health check
GET /metrics Prometheus metrics
GET /openapi OpenAPI v3 JSON

Requirements

Quickstart

$ bun install
$ bun dev

Linux Only

$ wget https://github.com/pinax-network/substreams-erc20-api/releases/download/v0.0.1/substreams-erc20-api
$ chmod +x ./substreams-erc20-api

.env Environment variables

# API Server
PORT=8080
HOSTNAME=localhost

# Clickhouse Database
HOST=http://127.0.0.1:8123
DATABASE=default
USERNAME=default
PASSWORD=
MAX_LIMIT=500

# Logging
VERBOSE=true

Help

$ ./substreams-erc20-api --help
Usage: substreams-erc20-api [options]

ERC20 API powered by Substreams

Options:
  -V, --version            output the version number
  -p, --port <number>      HTTP port on which to attach the API (default: "8080", env: PORT)
  -v, --verbose <boolean>  Enable verbose logging (choices: "true", "false", default: false, env: VERBOSE)
  --hostname <string>      Server listen on HTTP hostname (default: "localhost", env: HOSTNAME)
  --host <string>          Database HTTP hostname (default: "http://localhost:8123", env: HOST)
  --username <string>      Database user (default: "default", env: USERNAME)
  --password <string>      Password associated with the specified username (default: "", env: PASSWORD)
  --database <string>      The database to use inside ClickHouse (default: "default", env: DATABASE)
  --max-limit <number>     Maximum LIMIT queries (default: 10000, env: MAX_LIMIT)
  -h, --help               display help for command

Docker environment

Pull from GitHub Container registry

docker pull ghcr.io/pinax-network/substreams-erc20-api:latest

Build from source

docker build -t substreams-erc20-api .

Run with .env file

docker run -it --rm --env-file .env ghcr.io/pinax-network/substreams-erc20-api