From 51f35d4bb3689b69650bbdb86f5b205c46427f14 Mon Sep 17 00:00:00 2001 From: Denis Carriere Date: Wed, 25 Oct 2023 00:24:43 -0400 Subject: [PATCH] Update readme --- README.md | 65 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 666ab28..b899b73 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,24 @@ # [`Substreams`](https://substreams.streamingfast.io/) ERC20 API -## REST API +[![.github/workflows/bun-test.yml](https://github.com/pinax-network/substreams-erc20-api/actions/workflows/bun-test.yml/badge.svg)](https://github.com/pinax-network/substreams-erc20-api/actions/workflows/bun-test.yml) -| Pathname | Description | -| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------- | -| GET `/` | Banner | -| GET `/supply?address=&block=` | Returns the total supply of a contract | -| GET `/contract?address=` | Returns Contract information (name,symbol,decimals) | -| GET `/balance?wallet?&address=&block=` | Returns the wallet balance | -| GET `/openapi` | [OpenAPI v3 JSON](https://spec.openapis.org/oas/v3.0.0) | -| GET `/swagger` | [Swagger UI](https://swagger.io/resources/open-api/) | +> ERC-20 Balance, Supply, Contract API -## Requirements +## REST API -- [Clickhouse](clickhouse.com/) +| Pathname | Description | +| ----------------------|-------------------------------------------------------- | +| GET `/` | [Swagger UI](https://swagger.io/resources/open-api/) +| GET `/chains` | Available `chains` +| GET `/supply` | ERC20 total supply of a contract +| GET `/contract` | ERC20 contract information (name,symbol,decimals) +| GET `/balance` | ERC20 balance changes of address +| GET `/openapi` | [OpenAPI v3 JSON](https://spec.openapis.org/oas/v3.0.0) -Additionnaly to pull data directly from a substream: +## Requirements -- [Substreams Sink Clickhouse](https://github.com/pinax-network/substreams-sink-clickhouse/) +- [ClickHouse](clickhouse.com/) +- [Substreams Sink ClickHouse](https://github.com/pinax-network/substreams-sink-clickhouse/) ## Quickstart @@ -38,13 +39,19 @@ $ chmod +x ./substreams-erc20-api ## `.env` Environment variables ```env -# Optional +# API Server PORT=8080 HOSTNAME=localhost -DB_HOST=http://localhost:8123 -DB_NAME=demo -DB_USERNAME=default -DB_PASSWORD= + +# Clickhouse Database +HOST=http://127.0.0.1:8123 +DATABASE=default +USERNAME=default +PASSWORD= +MAX_LIMIT=500 + +# Logging +VERBOSE=true ``` ## Help @@ -53,19 +60,19 @@ DB_PASSWORD= $ ./substreams-erc20-api --help Usage: substreams-erc20-api [options] -Timestamps <> Block numbers conversion for your favorite chains +ERC20 API powered by Substreams Options: - --port Server listen on HTTP port (default: "8080", env: PORT) - --hostname Server listen on HTTP hostname (default: "localhost", env: HOST) - --db-host Clickhouse DB HTTP hostname (default: "http://localhost:8123", env: dbHost) - --name Clickhouse DB table name (default: "demo", env: DB_NAME) - --username Clickhouse DB username (default: "default", env: DB_USERNAME) - --password Clickhouse DB password (default: "", env: DB_PASSWORD) - --max-elements-queried Maximum number of query elements when using arrays as parameters (default: 10, env: MAX_ELEMENTS_QUERIED) - --verbose Enable verbose logging (default: false, env: VERBOSE) - -V, --version output the version number - -h, --help display help for command + -V, --version output the version number + -p, --port HTTP port on which to attach the API (default: "8080", env: PORT) + -v, --verbose Enable verbose logging (choices: "true", "false", default: false, env: VERBOSE) + --hostname Server listen on HTTP hostname (default: "localhost", env: HOSTNAME) + --host Database HTTP hostname (default: "http://localhost:8123", env: HOST) + --username Database user (default: "default", env: USERNAME) + --password Password associated with the specified username (default: "", env: PASSWORD) + --database The database to use inside ClickHouse (default: "default", env: DATABASE) + --max-limit Maximum LIMIT queries (default: 10000, env: MAX_LIMIT) + -h, --help display help for command ``` ## Docker environment