diff --git a/package.json b/package.json index 304ec89..ad92f52 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "docker:run": "docker run --env-file .env -p 3000:3000 stratosphere-points-indexer" }, "dependencies": { - "@ponder/core": "0.8.0-next.1", + "ponder": "0.8.2", "abitype": "0.10.2", "axios": "1.7.7", "dotenv": "^16.4.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 558894c..bb69ee6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ importers: .: dependencies: - '@ponder/core': - specifier: 0.8.0-next.1 - version: 0.8.0-next.1(@opentelemetry/api@1.8.0)(@types/node@20.9.0)(better-sqlite3@9.4.3)(hono@4.6.12)(postgres@3.4.4)(typescript@5.7.2)(viem@2.21.54(typescript@5.7.2)) abitype: specifier: 0.10.2 version: 0.10.2(typescript@5.7.2) @@ -32,6 +29,9 @@ importers: merkletreejs: specifier: ^0.3.11 version: 0.3.11 + ponder: + specifier: 0.8.2 + version: 0.8.2(@opentelemetry/api@1.8.0)(@types/node@20.9.0)(better-sqlite3@9.4.3)(hono@4.6.12)(postgres@3.4.4)(typescript@5.7.2)(viem@2.21.54(typescript@5.7.2)) postgres: specifier: ^3.4.4 version: 3.4.4 @@ -388,20 +388,8 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@ponder/core@0.8.0-next.1': - resolution: {integrity: sha512-1WpSTyvKDZvNFK6HaIzTKsMCtSAKOg3Pew7rgHkAaCuCd/UzihuUnqO76U92bRLcvUH9XMts7n+oxlMcypd5bw==} - engines: {node: '>=18.14'} - hasBin: true - peerDependencies: - hono: '>=4.5' - typescript: '>=5.0.4' - viem: '>=2' - peerDependenciesMeta: - typescript: - optional: true - - '@ponder/utils@0.2.2': - resolution: {integrity: sha512-8+JsJNGIf5FFwZlC02zP6kHtbAs7BUYluSx0GDhK8b2VDRmA4y9AJU7VoBIc0mnwKdBUOVLi9yQ6iDZBR4NLoQ==} + '@ponder/utils@0.2.3': + resolution: {integrity: sha512-QdlRXrn48nRM/QxNHRffO3PnIFvUf9qHE+rXSut44r74E4iiq9UrIPMhSMyCbJN68yU4QyTupZ/qpqE5PNAo8A==} peerDependencies: typescript: '>=5.0.4' viem: '>=2' @@ -955,14 +943,15 @@ packages: resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} engines: {node: '>=12'} - drizzle-orm@0.34.1: - resolution: {integrity: sha512-t+zCwyWWt8xTqtYV4doE/xYmT7hpv1L8pQ66zddEz+3VWyedBBtctjMAp22mAJPfyWurRQXUJ1nrTtqLq+DqNA==} + drizzle-orm@0.36.4: + resolution: {integrity: sha512-1OZY3PXD7BR00Gl61UUOFihslDldfH4NFRH2MbP54Yxi0G/PKn4HfO65JYZ7c16DeP3SpM3Aw+VXVG9j6CRSXA==} peerDependencies: '@aws-sdk/client-rds-data': '>=3' '@cloudflare/workers-types': '>=3' - '@electric-sql/pglite': '>=0.1.1' + '@electric-sql/pglite': '>=0.2.0' '@libsql/client': '>=0.10.0' - '@neondatabase/serverless': '>=0.1' + '@libsql/client-wasm': '>=0.10.0' + '@neondatabase/serverless': '>=0.10.0' '@op-engineering/op-sqlite': '>=2' '@opentelemetry/api': ^1.4.1 '@planetscale/database': '>=1' @@ -976,7 +965,7 @@ packages: '@xata.io/client': '*' better-sqlite3: '>=7' bun-types: '*' - expo-sqlite: '>=13.2.0' + expo-sqlite: '>=14.0.0' knex: '*' kysely: '*' mysql2: '>=2' @@ -995,6 +984,8 @@ packages: optional: true '@libsql/client': optional: true + '@libsql/client-wasm': + optional: true '@neondatabase/serverless': optional: true '@op-engineering/op-sqlite': @@ -1574,10 +1565,6 @@ packages: resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==} engines: {node: 14 || >=16.14} - lru-cache@6.0.0: - resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} - engines: {node: '>=10'} - merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} @@ -1816,6 +1803,18 @@ packages: resolution: {integrity: sha512-oswmokxkav9bADfJ2ifrvfHUwad6MLp73Uat0IkQWY3iAw5xTRoznXbXksZs8oaOUMpmhVWD+PZogNzllWpJaA==} hasBin: true + ponder@0.8.2: + resolution: {integrity: sha512-R/WzwwAR+JqV8Y33MVv4VvgxhognHMSNwAI+N/uIpb6kvVEFJq80G+sxeQHFcg5uTsyoX5LJZFE43E++jdqwrg==} + engines: {node: '>=18.14'} + hasBin: true + peerDependencies: + hono: '>=4.5' + typescript: '>=5.0.4' + viem: '>=2' + peerDependenciesMeta: + typescript: + optional: true + postcss@8.4.35: resolution: {integrity: sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==} engines: {node: ^10 || ^12 || >=14} @@ -1966,11 +1965,6 @@ packages: semver-compare@1.0.0: resolution: {integrity: sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==} - semver@7.6.0: - resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} - engines: {node: '>=10'} - hasBin: true - semver@7.6.3: resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} engines: {node: '>=10'} @@ -2142,9 +2136,6 @@ packages: tslib@2.4.0: resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} - tslib@2.6.2: - resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -2329,18 +2320,6 @@ packages: wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - ws@8.16.0: - resolution: {integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - ws@8.18.0: resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} engines: {node: '>=10.0.0'} @@ -2369,9 +2348,6 @@ packages: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} - yallist@4.0.0: - resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -2412,11 +2388,11 @@ snapshots: '@envelop/core@5.0.2': dependencies: '@envelop/types': 5.0.0 - tslib: 2.6.2 + tslib: 2.8.1 '@envelop/types@5.0.0': dependencies: - tslib: 2.6.2 + tslib: 2.8.1 '@esbuild/aix-ppc64@0.19.12': optional: true @@ -2680,89 +2656,7 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@ponder/core@0.8.0-next.1(@opentelemetry/api@1.8.0)(@types/node@20.9.0)(better-sqlite3@9.4.3)(hono@4.6.12)(postgres@3.4.4)(typescript@5.7.2)(viem@2.21.54(typescript@5.7.2))': - dependencies: - '@babel/code-frame': 7.23.5 - '@commander-js/extra-typings': 12.0.1(commander@12.0.0) - '@electric-sql/pglite': 0.2.14 - '@escape.tech/graphql-armor-max-aliases': 2.6.0 - '@escape.tech/graphql-armor-max-depth': 2.4.0 - '@escape.tech/graphql-armor-max-tokens': 2.5.0 - '@hono/node-server': 1.13.3(hono@4.6.12) - '@ponder/utils': 0.2.2(typescript@5.7.2)(viem@2.21.54(typescript@5.7.2)) - abitype: 0.10.2(typescript@5.7.2) - commander: 12.0.0 - conf: 12.0.0 - dataloader: 2.2.2 - detect-package-manager: 3.0.2 - dotenv: 16.4.5 - drizzle-orm: 0.34.1(@electric-sql/pglite@0.2.14)(@opentelemetry/api@1.8.0)(better-sqlite3@9.4.3)(kysely@0.26.3)(pg@8.11.3)(postgres@3.4.4)(react@18.2.0) - glob: 10.3.10 - graphql: 16.8.1 - graphql-yoga: 5.10.4(graphql@16.8.1) - hono: 4.6.12 - http-terminator: 3.2.0 - ink: 4.4.1(react@18.2.0) - kysely: 0.26.3 - kysely-pglite: 0.6.1(@electric-sql/pglite@0.2.14)(better-sqlite3@9.4.3)(kysely@0.26.3)(pg@8.11.3) - pg: 8.11.3 - pg-connection-string: 2.6.2 - picocolors: 1.0.0 - pino: 8.19.0 - prom-client: 15.1.0 - react: 18.2.0 - stacktrace-parser: 0.1.10 - viem: 2.21.54(typescript@5.7.2) - vite: 5.0.7(@types/node@20.9.0) - vite-node: 1.0.2(@types/node@20.9.0) - vite-tsconfig-paths: 4.3.1(typescript@5.7.2)(vite@5.0.7(@types/node@20.9.0)) - optionalDependencies: - typescript: 5.7.2 - transitivePeerDependencies: - - '@aws-sdk/client-rds-data' - - '@cloudflare/workers-types' - - '@libsql/client' - - '@libsql/kysely-libsql' - - '@neondatabase/serverless' - - '@op-engineering/op-sqlite' - - '@opentelemetry/api' - - '@planetscale/database' - - '@prisma/client' - - '@tediousjs/connection-string' - - '@tidbcloud/serverless' - - '@types/better-sqlite3' - - '@types/node' - - '@types/pg' - - '@types/react' - - '@types/sql.js' - - '@vercel/postgres' - - '@xata.io/client' - - better-sqlite3 - - bufferutil - - bun-types - - expo-sqlite - - knex - - kysely-bun-worker - - less - - lightningcss - - mysql2 - - pg-native - - postgres - - prisma - - react-devtools-core - - sass - - sql.js - - sqlite3 - - stylus - - sugarss - - supports-color - - tarn - - tedious - - terser - - utf-8-validate - - zod - - '@ponder/utils@0.2.2(typescript@5.7.2)(viem@2.21.54(typescript@5.7.2))': + '@ponder/utils@0.2.3(typescript@5.7.2)(viem@2.21.54(typescript@5.7.2))': dependencies: viem: 2.21.54(typescript@5.7.2) optionalDependencies: @@ -2859,12 +2753,12 @@ snapshots: '@typescript-eslint/type-utils': 6.21.0(eslint@8.53.0)(typescript@5.7.2) '@typescript-eslint/utils': 6.21.0(eslint@8.53.0)(typescript@5.7.2) '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.4 + debug: 4.3.7(supports-color@8.1.1) eslint: 8.53.0 graphemer: 1.4.0 ignore: 5.3.1 natural-compare: 1.4.0 - semver: 7.6.0 + semver: 7.6.3 ts-api-utils: 1.3.0(typescript@5.7.2) optionalDependencies: typescript: 5.7.2 @@ -2877,7 +2771,7 @@ snapshots: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.7.2) '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.4 + debug: 4.3.7(supports-color@8.1.1) eslint: 8.53.0 optionalDependencies: typescript: 5.7.2 @@ -2893,7 +2787,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.7.2) '@typescript-eslint/utils': 6.21.0(eslint@8.53.0)(typescript@5.7.2) - debug: 4.3.4 + debug: 4.3.7(supports-color@8.1.1) eslint: 8.53.0 ts-api-utils: 1.3.0(typescript@5.7.2) optionalDependencies: @@ -2907,11 +2801,11 @@ snapshots: dependencies: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.4 + debug: 4.3.7(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 - semver: 7.6.0 + semver: 7.6.3 ts-api-utils: 1.3.0(typescript@5.7.2) optionalDependencies: typescript: 5.7.2 @@ -2927,7 +2821,7 @@ snapshots: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.7.2) eslint: 8.53.0 - semver: 7.6.0 + semver: 7.6.3 transitivePeerDependencies: - supports-color - typescript @@ -3208,7 +3102,7 @@ snapshots: dot-prop: 8.0.2 env-paths: 3.0.0 json-schema-typed: 8.0.1 - semver: 7.6.0 + semver: 7.6.3 uint8array-extras: 0.3.0 consola@3.2.3: {} @@ -3284,7 +3178,7 @@ snapshots: dotenv@16.4.5: {} - drizzle-orm@0.34.1(@electric-sql/pglite@0.2.14)(@opentelemetry/api@1.8.0)(better-sqlite3@9.4.3)(kysely@0.26.3)(pg@8.11.3)(postgres@3.4.4)(react@18.2.0): + drizzle-orm@0.36.4(@electric-sql/pglite@0.2.14)(@opentelemetry/api@1.8.0)(better-sqlite3@9.4.3)(kysely@0.26.3)(pg@8.11.3)(postgres@3.4.4)(react@18.2.0): optionalDependencies: '@electric-sql/pglite': 0.2.14 '@opentelemetry/api': 1.8.0 @@ -3583,7 +3477,7 @@ snapshots: dependencies: foreground-child: 3.1.1 jackspeak: 2.3.6 - minimatch: 9.0.3 + minimatch: 9.0.5 minipass: 7.0.4 path-scurry: 1.10.1 @@ -3711,7 +3605,7 @@ snapshots: type-fest: 0.12.0 widest-line: 4.0.1 wrap-ansi: 8.1.0 - ws: 8.16.0 + ws: 8.18.0 yoga-wasm-web: 0.3.3 transitivePeerDependencies: - bufferutil @@ -3747,7 +3641,7 @@ snapshots: is-lower-case@2.0.2: dependencies: - tslib: 2.6.2 + tslib: 2.8.1 is-number@7.0.0: {} @@ -3757,7 +3651,7 @@ snapshots: is-upper-case@2.0.2: dependencies: - tslib: 2.6.2 + tslib: 2.8.1 is-wsl@2.2.0: dependencies: @@ -3886,10 +3780,6 @@ snapshots: lru-cache@10.2.0: {} - lru-cache@6.0.0: - dependencies: - yallist: 4.0.0 - merge-stream@2.0.0: {} merge2@1.4.1: {} @@ -3958,7 +3848,7 @@ snapshots: node-abi@3.56.0: dependencies: - semver: 7.6.0 + semver: 7.6.3 optional: true node-addon-api@2.0.2: {} @@ -4116,6 +4006,89 @@ snapshots: sonic-boom: 3.8.0 thread-stream: 2.4.1 + ponder@0.8.2(@opentelemetry/api@1.8.0)(@types/node@20.9.0)(better-sqlite3@9.4.3)(hono@4.6.12)(postgres@3.4.4)(typescript@5.7.2)(viem@2.21.54(typescript@5.7.2)): + dependencies: + '@babel/code-frame': 7.23.5 + '@commander-js/extra-typings': 12.0.1(commander@12.0.0) + '@electric-sql/pglite': 0.2.14 + '@escape.tech/graphql-armor-max-aliases': 2.6.0 + '@escape.tech/graphql-armor-max-depth': 2.4.0 + '@escape.tech/graphql-armor-max-tokens': 2.5.0 + '@hono/node-server': 1.13.3(hono@4.6.12) + '@ponder/utils': 0.2.3(typescript@5.7.2)(viem@2.21.54(typescript@5.7.2)) + abitype: 0.10.2(typescript@5.7.2) + commander: 12.0.0 + conf: 12.0.0 + dataloader: 2.2.2 + detect-package-manager: 3.0.2 + dotenv: 16.4.5 + drizzle-orm: 0.36.4(@electric-sql/pglite@0.2.14)(@opentelemetry/api@1.8.0)(better-sqlite3@9.4.3)(kysely@0.26.3)(pg@8.11.3)(postgres@3.4.4)(react@18.2.0) + glob: 10.3.10 + graphql: 16.8.1 + graphql-yoga: 5.10.4(graphql@16.8.1) + hono: 4.6.12 + http-terminator: 3.2.0 + ink: 4.4.1(react@18.2.0) + kysely: 0.26.3 + kysely-pglite: 0.6.1(@electric-sql/pglite@0.2.14)(better-sqlite3@9.4.3)(kysely@0.26.3)(pg@8.11.3) + pg: 8.11.3 + pg-connection-string: 2.6.2 + picocolors: 1.0.0 + pino: 8.19.0 + prom-client: 15.1.0 + react: 18.2.0 + stacktrace-parser: 0.1.10 + viem: 2.21.54(typescript@5.7.2) + vite: 5.0.7(@types/node@20.9.0) + vite-node: 1.0.2(@types/node@20.9.0) + vite-tsconfig-paths: 4.3.1(typescript@5.7.2)(vite@5.0.7(@types/node@20.9.0)) + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - '@aws-sdk/client-rds-data' + - '@cloudflare/workers-types' + - '@libsql/client' + - '@libsql/client-wasm' + - '@libsql/kysely-libsql' + - '@neondatabase/serverless' + - '@op-engineering/op-sqlite' + - '@opentelemetry/api' + - '@planetscale/database' + - '@prisma/client' + - '@tediousjs/connection-string' + - '@tidbcloud/serverless' + - '@types/better-sqlite3' + - '@types/node' + - '@types/pg' + - '@types/react' + - '@types/sql.js' + - '@vercel/postgres' + - '@xata.io/client' + - better-sqlite3 + - bufferutil + - bun-types + - expo-sqlite + - knex + - kysely-bun-worker + - less + - lightningcss + - mysql2 + - pg-native + - postgres + - prisma + - react-devtools-core + - sass + - sql.js + - sqlite3 + - stylus + - sugarss + - supports-color + - tarn + - tedious + - terser + - utf-8-validate + - zod + postcss@8.4.35: dependencies: nanoid: 3.3.7 @@ -4283,10 +4256,6 @@ snapshots: semver-compare@1.0.0: {} - semver@7.6.0: - dependencies: - lru-cache: 6.0.0 - semver@7.6.3: {} shebang-command@2.0.0: @@ -4443,8 +4412,6 @@ snapshots: tslib@2.4.0: {} - tslib@2.6.2: {} - tslib@2.8.1: {} tunnel-agent@0.6.0: @@ -4511,7 +4478,7 @@ snapshots: vite-node@1.0.2(@types/node@20.9.0): dependencies: cac: 6.7.14 - debug: 4.3.4 + debug: 4.3.7(supports-color@8.1.1) pathe: 1.1.2 picocolors: 1.0.0 vite: 5.1.6(@types/node@20.9.0) @@ -4527,7 +4494,7 @@ snapshots: vite-tsconfig-paths@4.3.1(typescript@5.7.2)(vite@5.0.7(@types/node@20.9.0)): dependencies: - debug: 4.3.4 + debug: 4.3.7(supports-color@8.1.1) globrex: 0.1.2 tsconfck: 3.0.3(typescript@5.7.2) optionalDependencies: @@ -4600,16 +4567,12 @@ snapshots: wrappy@1.0.2: {} - ws@8.16.0: {} - ws@8.18.0: {} ws@8.5.0: {} xtend@4.0.2: {} - yallist@4.0.0: {} - yocto-queue@0.1.0: {} yoga-wasm-web@0.3.3: {} diff --git a/ponder.config.ts b/ponder.config.ts index 402e9c8..30b5fc8 100644 --- a/ponder.config.ts +++ b/ponder.config.ts @@ -1,4 +1,4 @@ -import { createConfig, loadBalance } from "@ponder/core"; +import { createConfig, loadBalance } from "ponder"; import { http } from "viem"; import { DexAggregatorAbi } from "./abis/DexAggregatorAbi"; diff --git a/ponder.schema.ts b/ponder.schema.ts index 044cb05..1faddd8 100644 --- a/ponder.schema.ts +++ b/ponder.schema.ts @@ -1,4 +1,4 @@ -import { onchainTable, onchainEnum } from "@ponder/core"; +import { onchainTable, onchainEnum } from "ponder"; /** * Generates an enum of liquid mining season values. diff --git a/src/helpers.ts b/src/helpers.ts index cde0cb4..79e2f19 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,4 +1,3 @@ -import { type Context } from "@/generated"; import { QueryWithAmountIn, Quote, @@ -7,6 +6,7 @@ import { UserLMData, UserVapeStakingData, } from "./types"; +import { Context } from "ponder:registry"; import { StratosphereAbi } from "../abis/StratosphereAbi"; import { addresses, @@ -17,17 +17,7 @@ import { pointsMap, } from "./config/constants"; import axios from "axios"; -import { - userDataTable, - userHistoryTable, - liquidMiningTable, - vapeStakingTable, - tokenIdDataTable, - tokenIdDataWeeklyTable, - walletsPerTierTable, - allProtocolsTable, - pointsTable, -} from "../ponder.schema"; +import schema from "ponder:schema"; /** * Calculates the daily ID based on a given timestamp and the deployed block timestamp of the Stratosphere contract. @@ -77,13 +67,15 @@ export const handleChainFirstWallet = async ( event: any ): Promise => { let { db } = context; - let allProtocols = await db.find(allProtocolsTable, { id: "protocols" }); + let allProtocols = await db.find(schema.allProtocolsTable, { + id: "protocols", + }); if (!allProtocols) { - allProtocols = await db.insert(allProtocolsTable).values({ + allProtocols = await db.insert(schema.allProtocolsTable).values({ id: "protocols", firstWallet: userAddressLowerCase, }); - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${userAddressLowerCase}-chain-first-wallet`, userDataId: `${userAddressLowerCase}-${chainId}`, userHistoryId: `${userAddressLowerCase}-${chainId}`, @@ -94,7 +86,7 @@ export const handleChainFirstWallet = async ( }); userData = await db - .update(userHistoryTable, { id: userData.id }) + .update(schema.userHistoryTable, { id: userData.id }) .set((row) => ({ chainFirstWallet: true, })); @@ -118,7 +110,7 @@ export async function getOrCreateUserData( const { chainId } = context.network; // Attempt to find existing user data - let userHistory = await db.find(userHistoryTable, { + let userHistory = await db.find(schema.userHistoryTable, { id: `${address}-${chainId}`, }); @@ -127,7 +119,7 @@ export async function getOrCreateUserData( // If user data does not exist, create a new entry if (!userHistory) { - userHistory = await db.insert(userHistoryTable).values({ + userHistory = await db.insert(schema.userHistoryTable).values({ id: `${address}-${chainId}`, LMSeasons: [], depositInVS: false, @@ -147,7 +139,7 @@ export async function getOrCreateUserData( chainFirstWallet: false, }); - await db.insert(userDataTable).values({ + await db.insert(schema.userDataTable).values({ id: `${address}-${chainId}`, linkedToTokenId: tokenId, isMainWallet: address === mainWallet, @@ -183,6 +175,7 @@ export async function queryQuote( args: [ quoteParams.amountIn, quoteParams.tokenIn, + // @ts-ignore assets[network.name].USDC as `0x${string}`, quoteParams.maxSteps, ], @@ -221,6 +214,7 @@ export async function getTokenId( try { tokenId = await client.readContract({ abi: StratosphereAbi, + // @ts-ignore address: addresses.Stratosphere![network.name] as `0x${string}`, functionName: "tokenIdOf", args: [address], @@ -249,6 +243,7 @@ export async function getTokenIdOwner( const tokenIdOwner = await client.readContract({ abi: StratosphereAbi, + // @ts-ignore address: addresses.Stratosphere![network.name] as `0x${string}`, functionName: "ownerOf", args: [tokenId], @@ -337,21 +332,23 @@ export async function getOrUpdateTokenIdData( const { db } = context; const { chainId, name } = context.network; - const deployedBlockTimestamp = deployedBlockTimestamps[name].Stratosphere; + const deployedBlockTimestamp = + deployedBlockTimestamps[name as keyof typeof deployedBlockTimestamps] + .Stratosphere; const weeklyId = `${tokenId}-${chainId}-${getWeeklyID( timestamp, deployedBlockTimestamp )}`; - let tokenIdData = await db.find(tokenIdDataTable, { + let tokenIdData = await db.find(schema.tokenIdDataTable, { id: `${tokenId}-${chainId}`, }); - let tokenIdDataWeekly = await db.find(tokenIdDataWeeklyTable, { + let tokenIdDataWeekly = await db.find(schema.tokenIdDataWeeklyTable, { id: weeklyId, }); if (!tokenIdData) { - tokenIdData = await db.insert(tokenIdDataTable).values({ + tokenIdData = await db.insert(schema.tokenIdDataTable).values({ id: `${tokenId}-${chainId}`, tokenId, chainId, @@ -363,7 +360,7 @@ export async function getOrUpdateTokenIdData( } if (!tokenIdDataWeekly) { - tokenIdDataWeekly = await db.insert(tokenIdDataWeeklyTable).values({ + tokenIdDataWeekly = await db.insert(schema.tokenIdDataWeeklyTable).values({ id: weeklyId, tokenId, chainId: chainId, @@ -375,7 +372,7 @@ export async function getOrUpdateTokenIdData( } tokenIdData = await db - .update(tokenIdDataTable, { id: `${tokenId}-${chainId}` }) + .update(schema.tokenIdDataTable, { id: `${tokenId}-${chainId}` }) .set((row) => ({ pointsEarned: row.pointsEarned + pointsEarned, pointsClaimed: row.pointsClaimed + pointsClaimed, @@ -384,7 +381,7 @@ export async function getOrUpdateTokenIdData( })); tokenIdDataWeekly = await db - .update(tokenIdDataWeeklyTable, { id: weeklyId }) + .update(schema.tokenIdDataWeeklyTable, { id: weeklyId }) .set((row) => ({ pointsEarned: row.pointsEarned + pointsEarned, pointsClaimed: row.pointsClaimed + pointsClaimed, @@ -405,10 +402,10 @@ export async function getOrUpdateWalletsPerTier( const id = `${tierId}-${chainId}`; - let walletsPerTier = await db.find(walletsPerTierTable, { id }); + let walletsPerTier = await db.find(schema.walletsPerTierTable, { id }); if (!walletsPerTier) { - walletsPerTier = await db.insert(walletsPerTierTable).values({ + walletsPerTier = await db.insert(schema.walletsPerTierTable).values({ id, wallets: [userAddress], }); @@ -417,7 +414,7 @@ export async function getOrUpdateWalletsPerTier( if (!walletsPerTier.wallets.includes(userAddress)) { walletsPerTier.wallets.push(userAddress); walletsPerTier = await db - .update(walletsPerTierTable, { id }) + .update(schema.walletsPerTierTable, { id }) .set((row) => ({ wallets: row.wallets.concat(userAddress), })); diff --git a/src/index.ts b/src/index.ts index 3d8d817..721a293 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { ponder } from "@/generated"; +import { ponder } from "ponder:registry"; import { getOrCreateUserData, queryQuote, @@ -21,16 +21,7 @@ import { } from "./config/constants"; import { Address } from "viem"; -import { - userDataTable, - userHistoryTable, - liquidMiningTable, - vapeStakingTable, - tokenIdDataTable, - tokenIdDataWeeklyTable, - walletsPerTierTable, - pointsTable, -} from "../ponder.schema"; +import schema, { pointsTable } from "ponder:schema"; ponder.on("Stratosphere:Transfer", async ({ event, context }) => { const { db } = context; @@ -41,7 +32,7 @@ ponder.on("Stratosphere:Transfer", async ({ event, context }) => { const userAddressLowerCase = userAddress?.toLowerCase(); await getOrCreateUserData(context, tokenId, userAddressLowerCase); - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-stratosphere-enrollment`, userDataId: `${userAddressLowerCase}-${chainId}`, userHistoryId: `${userAddressLowerCase}-${chainId}`, @@ -84,15 +75,17 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { event ); - let liquidMiningData = await db.find(liquidMiningTable, { id: seasonId }); + let liquidMiningData = await db.find(schema.liquidMiningTable, { + id: seasonId, + }); if (!liquidMiningData) { - liquidMiningData = await db.insert(liquidMiningTable).values({ + liquidMiningData = await db.insert(schema.liquidMiningTable).values({ id: seasonId, firstWallet: userAddressLowerCase, }); - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-liquid-mining-first-wallet`, userDataId: `${userAddressLowerCase}-${chainId}`, userHistoryId: `${userAddressLowerCase}-${chainId}`, @@ -103,7 +96,9 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { }); userData = await db - .update(userHistoryTable, { id: `${userAddressLowerCase}-${chainId}` }) + .update(schema.userHistoryTable, { + id: `${userAddressLowerCase}-${chainId}`, + }) .set({ firstWalletInVPNDLM: true, }); @@ -114,7 +109,7 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { } if (userData.LMSeasons.length === 0) { - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-liquid-mining-first-deposit`, userDataId: `${userAddressLowerCase}-${chainId}`, userHistoryId: `${userAddressLowerCase}-${chainId}`, @@ -128,7 +123,7 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { pointsEarned: pointsMap.FirstDepositInVPNDLM, }); - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-liquid-mining-one-season`, userDataId: `${userAddressLowerCase}-${chainId}`, userHistoryId: `${userAddressLowerCase}-${chainId}`, @@ -143,7 +138,9 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { }); userData = await db - .update(userHistoryTable, { id: `${userAddressLowerCase}-${chainId}` }) + .update(schema.userHistoryTable, { + id: `${userAddressLowerCase}-${chainId}`, + }) .set({ LMSeasons: [seasonId], LMOneSeasonPointsClaimed: true, @@ -152,7 +149,9 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { if (!userData.LMSeasons.includes(seasonId)) { userData = await db - .update(userHistoryTable, { id: `${userAddressLowerCase}-${chainId}` }) + .update(schema.userHistoryTable, { + id: `${userAddressLowerCase}-${chainId}`, + }) .set({ LMSeasons: [...userData.LMSeasons, seasonId], }); @@ -162,7 +161,7 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { userData.LMSeasons.length === 3 && !userData.LMThreeSeasonsPointsClaimed ) { - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-liquid-mining-three-seasons`, userDataId: `${userAddressLowerCase}-${chainId}`, userHistoryId: `${userAddressLowerCase}-${chainId}`, @@ -177,14 +176,16 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { }); userData = await db - .update(userHistoryTable, { id: `${userAddressLowerCase}-${chainId}` }) + .update(schema.userHistoryTable, { + id: `${userAddressLowerCase}-${chainId}`, + }) .set({ LMThreeSeasonsPointsClaimed: true, }); } if (userData.LMSeasons.length === 6 && !userData.LMSixSeasonsPointsClaimed) { - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-liquid-mining-six-seasons`, userDataId: `${userAddressLowerCase}-${chainId}`, userHistoryId: `${userAddressLowerCase}-${chainId}`, @@ -199,14 +200,16 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { }); userData = await db - .update(userHistoryTable, { id: `${userAddressLowerCase}-${chainId}` }) + .update(schema.userHistoryTable, { + id: `${userAddressLowerCase}-${chainId}`, + }) .set({ LMSixSeasonsPointsClaimed: true, }); } if (userData.LMSeasons.length === 12 && !userData.LMOneYearPointsClaimed) { - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-liquid-mining-twelve-seasons`, userDataId: `${userAddressLowerCase}-${chainId}`, userHistoryId: `${userAddressLowerCase}-${chainId}`, @@ -221,7 +224,9 @@ ponder.on("LiquidMining:Deposit", async ({ event, context }) => { }); userData = await db - .update(userHistoryTable, { id: `${userAddressLowerCase}-${chainId}` }) + .update(schema.userHistoryTable, { + id: `${userAddressLowerCase}-${chainId}`, + }) .set({ LMOneYearPointsClaimed: true, }); @@ -253,18 +258,18 @@ ponder.on("VapeStaking:Deposit", async ({ event, context }) => { event ); - let vapeStakingData = await db.find(vapeStakingTable, { + let vapeStakingData = await db.find(schema.vapeStakingTable, { id: "vape-staking", }); if (!vapeStakingData) { - vapeStakingData = await db.insert(vapeStakingTable).values({ + vapeStakingData = await db.insert(schema.vapeStakingTable).values({ id: "vape-staking", firstWallet: userAddressLowerCase, txnHash: hash, }); - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-vape-staking-first-wallet`, userDataId: userData.id, userHistoryId: userData.id, @@ -274,9 +279,11 @@ ponder.on("VapeStaking:Deposit", async ({ event, context }) => { timestamp: timestamp, }); - userData = await db.update(userHistoryTable, { id: userData.id }).set({ - firstWalletInVAPELM: true, - }); + userData = await db + .update(schema.userHistoryTable, { id: userData.id }) + .set({ + firstWalletInVAPELM: true, + }); await getOrUpdateTokenIdData(context, tokenId, timestamp, { pointsEarned: pointsMap.FirstWalletInVAPELM, @@ -284,7 +291,7 @@ ponder.on("VapeStaking:Deposit", async ({ event, context }) => { } if (!userData.depositInVS) { - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-vape-staking-first-deposit`, userDataId: userData.id, userHistoryId: userData.id, @@ -298,9 +305,11 @@ ponder.on("VapeStaking:Deposit", async ({ event, context }) => { pointsEarned: pointsMap.FirstDepositInVAPELM, }); - userData = await db.update(userHistoryTable, { id: userData.id }).set({ - depositInVS: true, - }); + userData = await db + .update(schema.userHistoryTable, { id: userData.id }) + .set({ + depositInVS: true, + }); } }); @@ -342,7 +351,7 @@ ponder.on("DexAggregator:RouterSwap", async ({ event, context }) => { // For reference: https://github.com/VaporFi/dex-aggregator-v2/blob/cad6410a4cc429df532720bfee209852dbd97be4/src/facets/LegacyRouterFacet.sol#L332 // If we are unable to find a path, usdValueOfTrade is Zero and we don't want to index that if (usdValueOfTrade >= MINIMUM_POINTS) { - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-dex-aggregator-swap`, userDataId: userData.id, userHistoryId: userData.id, @@ -359,10 +368,10 @@ ponder.on("DexAggregator:RouterSwap", async ({ event, context }) => { if (!userData.firstSwap) { userData = await db - .update(userHistoryTable, { id: userData.id }) + .update(schema.userHistoryTable, { id: userData.id }) .set({ firstSwap: true }); - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-dex-aggregator-first-swap`, userDataId: userData.id, userHistoryId: userData.id, @@ -374,7 +383,7 @@ ponder.on("DexAggregator:RouterSwap", async ({ event, context }) => { } // Update total swaps and total USD value of swaps - userData = await db.update(userHistoryTable, { id: userData.id }).set({ + userData = await db.update(schema.userHistoryTable, { id: userData.id }).set({ usdValueOfSwaps: userData.usdValueOfSwaps + usdValueOfTrade, swaps: userData.swaps + BIGINT_ONE, }); @@ -384,7 +393,7 @@ ponder.on("DexAggregator:RouterSwap", async ({ event, context }) => { userData.usdValueOfSwaps >= BIGINT_THOUSAND * MINIMUM_POINTS && !userData.first1kSwaps ) { - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-dex-aggregator-1k-swaps`, userDataId: userData.id, userHistoryId: userData.id, @@ -398,16 +407,18 @@ ponder.on("DexAggregator:RouterSwap", async ({ event, context }) => { pointsEarned: pointsMap.ThousandSwaps, }); - userData = await db.update(userHistoryTable, { id: userData.id }).set({ - first1kSwaps: true, - }); + userData = await db + .update(schema.userHistoryTable, { id: userData.id }) + .set({ + first1kSwaps: true, + }); } if ( userData.usdValueOfSwaps >= BIGINT_TEN_THOUSAND * MINIMUM_POINTS && !userData.first10kSwaps ) { - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-dex-aggregator-10k-swaps`, userDataId: userData.id, userHistoryId: userData.id, @@ -421,16 +432,18 @@ ponder.on("DexAggregator:RouterSwap", async ({ event, context }) => { pointsEarned: pointsMap.TenThousandSwaps, }); - userData = await db.update(userHistoryTable, { id: userData.id }).set({ - first10kSwaps: true, - }); + userData = await db + .update(schema.userHistoryTable, { id: userData.id }) + .set({ + first10kSwaps: true, + }); } if ( userData.usdValueOfSwaps >= BIGINT_HUNDRED_THOUSAND * MINIMUM_POINTS && !userData.first100kSwaps ) { - await db.insert(pointsTable).values({ + await db.insert(schema.pointsTable).values({ id: `${hash}-dex-aggregator-100k-swaps`, userDataId: userData.id, userHistoryId: userData.id, @@ -444,9 +457,11 @@ ponder.on("DexAggregator:RouterSwap", async ({ event, context }) => { pointsEarned: pointsMap.HundredThousandSwaps, }); - userData = await db.update(userHistoryTable, { id: userData.id }).set({ - first100kSwaps: true, - }); + userData = await db + .update(schema.userHistoryTable, { id: userData.id }) + .set({ + first100kSwaps: true, + }); } }); diff --git a/src/types.ts b/src/types.ts index f02c95c..a796ccf 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,3 @@ -import { type Context } from "@/generated"; - export interface QueryWithAmountIn { amountIn: bigint; tokenIn: `0x${string}`;