From ba1ff8e5311257db549c0ef7e124bd347e83d261 Mon Sep 17 00:00:00 2001 From: 0xkenj1 Date: Thu, 3 Oct 2024 14:11:10 -0300 Subject: [PATCH] fix: comments --- .env.example | 31 +++++ .npmrc | 7 +- README.md | 8 ++ apps/indexer/config.yaml | 236 ++++++++++++++++++------------------ apps/indexer/package.json | 4 +- apps/indexer/pnpm-lock.yaml | 12 +- docker-compose.yaml | 32 ++--- pnpm-lock.yaml | 12 +- 8 files changed, 180 insertions(+), 162 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..61ebc6a --- /dev/null +++ b/.env.example @@ -0,0 +1,31 @@ +############################################ +############### POSTGRES ################### +############################################ +POSTGRES_EXPOSED_PORT=5433 +POSTGRES_PASSWORD=testing +POSTGRES_USER=postgres +POSTGRES_DB=envio-dev + +############################################ +############### HASURA ##################### +############################################ +HASURA_EXPOSED_PORT=8080 +HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:testing@envio-postgres:5432/envio-dev +HASURA_GRAPHQL_ENABLE_CONSOLE=true +HASURA_GRAPHQL_ENABLED_LOG_TYPES=startup, http-log, webhook-log, websocket-log, query-log +HASURA_GRAPHQL_NO_OF_RETRIES=10 +HASURA_GRAPHQL_ADMIN_SECRET=testing +HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES="true" +PORT=8080 +HASURA_GRAPHQL_UNAUTHORIZED_ROLE=public + +############################################ +############### INDEXER #################### +############################################ +ENVIO_PG_HOST=envio-postgres +ENVIO_PG_PORT=5432 +ENVIO_POSTGRES_PASSWORD=testing +ENVIO_PG_USER=postgres +ENVIO_PG_DATABASE=envio-dev +HASURA_GRAPHQL_ENDPOINT=http://graphql-engine:8080/v1/metadata +TUI_OFF=true \ No newline at end of file diff --git a/.npmrc b/.npmrc index 132f02c..449691b 100644 --- a/.npmrc +++ b/.npmrc @@ -1,6 +1 @@ -save-exact=true -# Needed for ts build folder to have -# access to rescript node_modules -shamefully-hoist=true -# Needed so users can run `pnpm install` in the root of the repo without requiring the `-w` flag. -ignore-workspace-root-check=true \ No newline at end of file +save-exact=true \ No newline at end of file diff --git a/README.md b/README.md index be5351a..60c3adc 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,14 @@ To deploy locally with Docker, run the following command: docker-compose up -d --build ``` +Once the deployment is complete, you can access Hasura by navigating to: + +``` +http://localhost:8080/ +``` + +Use the default password: `testing`. + ## Contributing Wonderland is a team of top Web3 researchers, developers, and operators who believe that the future needs to be open-source, permissionless, and decentralized. diff --git a/apps/indexer/config.yaml b/apps/indexer/config.yaml index 92a7991..0ac8873 100644 --- a/apps/indexer/config.yaml +++ b/apps/indexer/config.yaml @@ -105,16 +105,16 @@ networks: ####################### # MAINNET # ####################### - - id: 1 # mainnet - start_block: 18486688 - contracts: - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - name: Strategy - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - id: 1 # mainnet + # start_block: 18486688 + # contracts: + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + # - name: Strategy + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - id: 10 # optimism start_block: 111678968 @@ -127,93 +127,93 @@ networks: address: - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - id: 11155111 # sepolia - start_block: 4617051 - contracts: - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - - name: Strategy - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - - id: 250 # fantom - start_block: 77624278 - contracts: - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - - name: Strategy - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - - id: 42161 # arbitrum - start_block: 146489425 - contracts: - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - - name: Strategy - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - - id: 137 # polygon - start_block: 49466006 - contracts: - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - - name: Strategy - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - - id: 8453 # base - start_block: 6083365 - contracts: - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - - name: Strategy - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - - id: 324 # zksync-era-mainnet - start_block: 31154341 - contracts: - - name: Registry - address: - - 0xaa376Ef759c1f5A8b0B5a1e2FEC5C23f3bF30246 - - name: Strategy - - name: Allo - address: - - 0x9D1D1BF2835935C291C0f5228c86d5C4e235A249 - - - id: 43114 # avalanche - start_block: 34540051 - contracts: - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - - name: Strategy - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - - id: 534352 # scroll - start_block: 2683205 - contracts: - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - - name: Strategy - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + # - id: 11155111 # sepolia + # start_block: 4617051 + # contracts: + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - name: Strategy + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + + # - id: 250 # fantom + # start_block: 77624278 + # contracts: + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - name: Strategy + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + + # - id: 42161 # arbitrum + # start_block: 146489425 + # contracts: + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - name: Strategy + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + + # - id: 137 # polygon + # start_block: 49466006 + # contracts: + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - name: Strategy + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + + # - id: 8453 # base + # start_block: 6083365 + # contracts: + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - name: Strategy + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + + # - id: 324 # zksync-era-mainnet + # start_block: 31154341 + # contracts: + # - name: Registry + # address: + # - 0xaa376Ef759c1f5A8b0B5a1e2FEC5C23f3bF30246 + # - name: Strategy + # - name: Allo + # address: + # - 0x9D1D1BF2835935C291C0f5228c86d5C4e235A249 + + # - id: 43114 # avalanche + # start_block: 34540051 + # contracts: + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - name: Strategy + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + + # - id: 534352 # scroll + # start_block: 2683205 + # contracts: + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - name: Strategy + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 # - id: 1329 # sei-mainnet # rpc_config: @@ -228,27 +228,27 @@ networks: # address: # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - id: 42220 # celo-mainnet - start_block: 22257475 - contracts: - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - - name: Strategy - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 - - - id: 42 # lukso-mainnet - start_block: 2400000 - contracts: - - name: Registry - address: - - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 - - name: Strategy - - name: Allo - address: - - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + # - id: 42220 # celo-mainnet + # start_block: 22257475 + # contracts: + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - name: Strategy + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 + + # - id: 42 # lukso-mainnet + # start_block: 2400000 + # contracts: + # - name: Registry + # address: + # - 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3 + # - name: Strategy + # - name: Allo + # address: + # - 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 ####################### # TESTNET # ####################### diff --git a/apps/indexer/package.json b/apps/indexer/package.json index 6965277..eb5f5c7 100644 --- a/apps/indexer/package.json +++ b/apps/indexer/package.json @@ -17,11 +17,11 @@ "yaml": "2.5.1" }, "devDependencies": { - "@types/chai": "^4.3.11", + "@types/chai": "4.3.11", "@types/mocha": "10.0.6", "@types/node": "20.8.8", "mocha": "10.2.0", - "ts-mocha": "^10.0.0", + "ts-mocha": "10.0.0", "ts-node": "10.9.1", "typescript": "5.2.2" }, diff --git a/apps/indexer/pnpm-lock.yaml b/apps/indexer/pnpm-lock.yaml index 89068ea..c60513e 100644 --- a/apps/indexer/pnpm-lock.yaml +++ b/apps/indexer/pnpm-lock.yaml @@ -21,8 +21,8 @@ importers: version: 2.5.1 devDependencies: "@types/chai": - specifier: ^4.3.11 - version: 4.3.20 + specifier: 4.3.11 + version: 4.3.11 "@types/mocha": specifier: 10.0.6 version: 10.0.6 @@ -33,7 +33,7 @@ importers: specifier: 10.2.0 version: 10.2.0 ts-mocha: - specifier: ^10.0.0 + specifier: 10.0.0 version: 10.0.0(mocha@10.2.0) ts-node: specifier: 10.9.1 @@ -330,10 +330,10 @@ packages: integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==, } - "@types/chai@4.3.20": + "@types/chai@4.3.11": resolution: { - integrity: sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==, + integrity: sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==, } "@types/json5@0.0.29": @@ -2674,7 +2674,7 @@ snapshots: "@tsconfig/node16@1.0.4": {} - "@types/chai@4.3.20": {} + "@types/chai@4.3.11": {} "@types/json5@0.0.29": optional: true diff --git a/docker-compose.yaml b/docker-compose.yaml index 733641b..5ec4734 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,33 +3,23 @@ services: image: postgres:16 restart: always ports: - - "5433:5432" + - "${POSTGRES_PORT:-5433}:5432" volumes: - db_data:/var/lib/postgresql/data - environment: - POSTGRES_PASSWORD: testing - POSTGRES_USER: postgres - POSTGRES_DB: envio-dev + env_file: + - .env networks: - indexer-service graphql-engine: image: hasura/graphql-engine:v2.23.0 ports: - - "8080:8080" + - "${HASURA_EXPOSED_PORT:-8080}:${PORT:-8080}" user: 1001:1001 depends_on: - "envio-postgres" restart: always - environment: - HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:testing@envio-postgres:5432/envio-dev - HASURA_GRAPHQL_ENABLE_CONSOLE: true - HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, - query-log - HASURA_GRAPHQL_NO_OF_RETRIES: 10 - HASURA_GRAPHQL_ADMIN_SECRET: testing - HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES: "true" - PORT: 8080 - HASURA_GRAPHQL_UNAUTHORIZED_ROLE: public + env_file: + - .env healthcheck: test: timeout 1s bash -c ':> /dev/tcp/127.0.0.1/8080' || exit 1 interval: 5s @@ -46,14 +36,8 @@ services: - "envio-postgres" - "graphql-engine" restart: always - environment: - ENVIO_PG_HOST: envio-postgres - ENVIO_PG_PORT: 5432 - ENVIO_POSTGRES_PASSWORD: testing - ENVIO_PG_USER: postgres - ENVIO_PG_DATABASE: envio-dev - HASURA_GRAPHQL_ENDPOINT: http://graphql-engine:8080/v1/metadata - TUI_OFF: true + env_file: + - .env networks: - indexer-service volumes: diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4333b92..3a9a1b3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,8 +75,8 @@ importers: version: 2.5.1 devDependencies: "@types/chai": - specifier: ^4.3.11 - version: 4.3.20 + specifier: 4.3.11 + version: 4.3.11 "@types/mocha": specifier: 10.0.6 version: 10.0.6 @@ -87,7 +87,7 @@ importers: specifier: 10.2.0 version: 10.2.0 ts-mocha: - specifier: ^10.0.0 + specifier: 10.0.0 version: 10.0.0(mocha@10.2.0) ts-node: specifier: 10.9.1 @@ -945,10 +945,10 @@ packages: integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==, } - "@types/chai@4.3.20": + "@types/chai@4.3.11": resolution: { - integrity: sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==, + integrity: sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==, } "@types/conventional-commits-parser@5.0.0": @@ -4316,7 +4316,7 @@ snapshots: "@tsconfig/node16@1.0.4": {} - "@types/chai@4.3.20": {} + "@types/chai@4.3.11": {} "@types/conventional-commits-parser@5.0.0": dependencies: