ponder 0.16.10 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/esm/bin/commands/codegen.js +3 -12
- package/dist/esm/bin/commands/codegen.js.map +1 -1
- package/dist/esm/bin/commands/createViews.js +2 -5
- package/dist/esm/bin/commands/createViews.js.map +1 -1
- package/dist/esm/bin/commands/dev.js +4 -22
- package/dist/esm/bin/commands/dev.js.map +1 -1
- package/dist/esm/bin/commands/list.js +4 -8
- package/dist/esm/bin/commands/list.js.map +1 -1
- package/dist/esm/bin/commands/prune.js +4 -8
- package/dist/esm/bin/commands/prune.js.map +1 -1
- package/dist/esm/bin/commands/serve.js +5 -20
- package/dist/esm/bin/commands/serve.js.map +1 -1
- package/dist/esm/bin/commands/start.js +4 -20
- package/dist/esm/bin/commands/start.js.map +1 -1
- package/dist/esm/bin/isolatedController.js +3 -3
- package/dist/esm/bin/isolatedController.js.map +1 -1
- package/dist/esm/bin/isolatedWorker.js +0 -5
- package/dist/esm/bin/isolatedWorker.js.map +1 -1
- package/dist/esm/bin/ponder.js.map +1 -1
- package/dist/esm/bin/utils/exit.js +1 -5
- package/dist/esm/bin/utils/exit.js.map +1 -1
- package/dist/esm/build/config.js +2 -2
- package/dist/esm/build/config.js.map +1 -1
- package/dist/esm/build/factory.js +1 -1
- package/dist/esm/build/factory.js.map +1 -1
- package/dist/esm/build/index.js +17 -14
- package/dist/esm/build/index.js.map +1 -1
- package/dist/esm/build/pre.js +2 -2
- package/dist/esm/build/pre.js.map +1 -1
- package/dist/esm/build/schema.js +2 -2
- package/dist/esm/build/schema.js.map +1 -1
- package/dist/esm/build/stacktrace.js +5 -5
- package/dist/esm/build/stacktrace.js.map +1 -1
- package/dist/esm/client/index.js +8 -9
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/database/actions.js +7 -9
- package/dist/esm/database/actions.js.map +1 -1
- package/dist/esm/database/index.js +7 -7
- package/dist/esm/database/index.js.map +1 -1
- package/dist/esm/database/queryBuilder.js +4 -7
- package/dist/esm/database/queryBuilder.js.map +1 -1
- package/dist/esm/drizzle/bigint.js +3 -5
- package/dist/esm/drizzle/bigint.js.map +1 -1
- package/dist/esm/drizzle/bytes.js +3 -5
- package/dist/esm/drizzle/bytes.js.map +1 -1
- package/dist/esm/drizzle/hex.js +3 -5
- package/dist/esm/drizzle/hex.js.map +1 -1
- package/dist/esm/drizzle/index.js.map +1 -1
- package/dist/esm/drizzle/json.js +8 -12
- package/dist/esm/drizzle/json.js.map +1 -1
- package/dist/esm/drizzle/kit/index.js +24 -38
- package/dist/esm/drizzle/kit/index.js.map +1 -1
- package/dist/esm/drizzle/onchain.js +15 -17
- package/dist/esm/drizzle/onchain.js.map +1 -1
- package/dist/esm/drizzle/text.js +3 -5
- package/dist/esm/drizzle/text.js.map +1 -1
- package/dist/esm/graphql/index.js +6 -6
- package/dist/esm/graphql/index.js.map +1 -1
- package/dist/esm/graphql/json.js.map +1 -1
- package/dist/esm/graphql/middleware.js +2 -2
- package/dist/esm/graphql/middleware.js.map +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/indexing/addStackTrace.js +1 -1
- package/dist/esm/indexing/addStackTrace.js.map +1 -1
- package/dist/esm/indexing/client.js +11 -12
- package/dist/esm/indexing/client.js.map +1 -1
- package/dist/esm/indexing/index.js +6 -4
- package/dist/esm/indexing/index.js.map +1 -1
- package/dist/esm/indexing/profile.js +2 -2
- package/dist/esm/indexing/profile.js.map +1 -1
- package/dist/esm/indexing-store/cache.js +4 -4
- package/dist/esm/indexing-store/cache.js.map +1 -1
- package/dist/esm/indexing-store/index.js +10 -13
- package/dist/esm/indexing-store/index.js.map +1 -1
- package/dist/esm/indexing-store/profile.js +3 -3
- package/dist/esm/indexing-store/profile.js.map +1 -1
- package/dist/esm/indexing-store/utils.js +3 -3
- package/dist/esm/indexing-store/utils.js.map +1 -1
- package/dist/esm/internal/logger.js +7 -7
- package/dist/esm/internal/logger.js.map +1 -1
- package/dist/esm/internal/metrics.js +15 -15
- package/dist/esm/internal/metrics.js.map +1 -1
- package/dist/esm/internal/options.js +6 -9
- package/dist/esm/internal/options.js.map +1 -1
- package/dist/esm/internal/shutdown.js.map +1 -1
- package/dist/esm/rpc/actions.js +7 -8
- package/dist/esm/rpc/actions.js.map +1 -1
- package/dist/esm/rpc/http.js +8 -4
- package/dist/esm/rpc/http.js.map +1 -1
- package/dist/esm/rpc/index.js +19 -19
- package/dist/esm/rpc/index.js.map +1 -1
- package/dist/esm/runtime/events.js +7 -9
- package/dist/esm/runtime/events.js.map +1 -1
- package/dist/esm/runtime/filter.js +1 -1
- package/dist/esm/runtime/filter.js.map +1 -1
- package/dist/esm/runtime/fragments.js.map +1 -1
- package/dist/esm/runtime/historical.js +7 -7
- package/dist/esm/runtime/historical.js.map +1 -1
- package/dist/esm/runtime/index.js +2 -2
- package/dist/esm/runtime/index.js.map +1 -1
- package/dist/esm/runtime/isolated.js +4 -4
- package/dist/esm/runtime/isolated.js.map +1 -1
- package/dist/esm/runtime/multichain.js +6 -6
- package/dist/esm/runtime/multichain.js.map +1 -1
- package/dist/esm/runtime/omnichain.js +6 -6
- package/dist/esm/runtime/omnichain.js.map +1 -1
- package/dist/esm/runtime/realtime.js +12 -12
- package/dist/esm/runtime/realtime.js.map +1 -1
- package/dist/esm/server/error.js +1 -1
- package/dist/esm/server/error.js.map +1 -1
- package/dist/esm/server/index.js +4 -4
- package/dist/esm/server/index.js.map +1 -1
- package/dist/esm/sync-historical/index.js +2 -2
- package/dist/esm/sync-historical/index.js.map +1 -1
- package/dist/esm/sync-realtime/bloom.js +1 -1
- package/dist/esm/sync-realtime/bloom.js.map +1 -1
- package/dist/esm/sync-realtime/index.js +1 -1
- package/dist/esm/sync-realtime/index.js.map +1 -1
- package/dist/esm/sync-store/encode.js +1 -1
- package/dist/esm/sync-store/encode.js.map +1 -1
- package/dist/esm/sync-store/index.js +12 -31
- package/dist/esm/sync-store/index.js.map +1 -1
- package/dist/esm/sync-store/migrations.js +1 -1
- package/dist/esm/sync-store/migrations.js.map +1 -1
- package/dist/esm/sync-store/schema.js +2 -2
- package/dist/esm/sync-store/schema.js.map +1 -1
- package/dist/esm/types/db.js.map +1 -1
- package/dist/esm/ui/app.js +2 -2
- package/dist/esm/ui/app.js.map +1 -1
- package/dist/esm/ui/patch.js +1 -2
- package/dist/esm/ui/patch.js.map +1 -1
- package/dist/esm/utils/abi.js +1 -1
- package/dist/esm/utils/abi.js.map +1 -1
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/utils/checkpoint.js.map +1 -1
- package/dist/esm/utils/chunk.js.map +1 -1
- package/dist/esm/utils/copy.js +1 -1
- package/dist/esm/utils/copy.js.map +1 -1
- package/dist/esm/utils/decodeAbiParameters.js +2 -3
- package/dist/esm/utils/decodeAbiParameters.js.map +1 -1
- package/dist/esm/utils/decodeEventLog.js.map +1 -1
- package/dist/esm/utils/duplicates.js.map +1 -1
- package/dist/esm/utils/finality.js.map +1 -1
- package/dist/esm/utils/generators.js.map +1 -1
- package/dist/esm/utils/interval.js.map +1 -1
- package/dist/esm/utils/mutex.js.map +1 -1
- package/dist/esm/utils/offset.js.map +1 -1
- package/dist/esm/utils/order.js.map +1 -1
- package/dist/esm/utils/partition.js.map +1 -1
- package/dist/esm/utils/pg.js +2 -2
- package/dist/esm/utils/pg.js.map +1 -1
- package/dist/esm/utils/pglite.js +4 -6
- package/dist/esm/utils/pglite.js.map +1 -1
- package/dist/esm/utils/port.js.map +1 -1
- package/dist/esm/utils/promiseAllSettledWithThrow.js.map +1 -1
- package/dist/esm/utils/queue.js +7 -7
- package/dist/esm/utils/queue.js.map +1 -1
- package/dist/esm/utils/result.js +1 -1
- package/dist/esm/utils/result.js.map +1 -1
- package/dist/esm/utils/sql-parse.js +10 -10
- package/dist/esm/utils/sql-parse.js.map +1 -1
- package/dist/esm/utils/zipper.js.map +1 -1
- package/dist/types/bin/commands/codegen.d.ts.map +1 -1
- package/dist/types/bin/commands/createViews.d.ts.map +1 -1
- package/dist/types/bin/commands/dev.d.ts.map +1 -1
- package/dist/types/bin/commands/list.d.ts.map +1 -1
- package/dist/types/bin/commands/prune.d.ts.map +1 -1
- package/dist/types/bin/commands/serve.d.ts.map +1 -1
- package/dist/types/bin/commands/start.d.ts.map +1 -1
- package/dist/types/bin/isolatedController.d.ts.map +1 -1
- package/dist/types/bin/isolatedWorker.d.ts.map +1 -1
- package/dist/types/bin/ponder.d.ts +1 -1
- package/dist/types/bin/ponder.d.ts.map +1 -1
- package/dist/types/bin/utils/exit.d.ts +1 -1
- package/dist/types/bin/utils/exit.d.ts.map +1 -1
- package/dist/types/build/config.d.ts +1 -1
- package/dist/types/build/config.d.ts.map +1 -1
- package/dist/types/build/factory.d.ts.map +1 -1
- package/dist/types/build/index.d.ts +1 -1
- package/dist/types/build/index.d.ts.map +1 -1
- package/dist/types/build/plugin.d.ts +1 -1
- package/dist/types/build/plugin.d.ts.map +1 -1
- package/dist/types/build/schema.d.ts.map +1 -1
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/config/address.d.ts +1 -1
- package/dist/types/config/address.d.ts.map +1 -1
- package/dist/types/config/index.d.ts +6 -6
- package/dist/types/config/index.d.ts.map +1 -1
- package/dist/types/database/actions.d.ts +5 -5
- package/dist/types/database/actions.d.ts.map +1 -1
- package/dist/types/database/index.d.ts +2 -2
- package/dist/types/database/index.d.ts.map +1 -1
- package/dist/types/database/queryBuilder.d.ts +4 -4
- package/dist/types/database/queryBuilder.d.ts.map +1 -1
- package/dist/types/drizzle/bigint.d.ts +1 -1
- package/dist/types/drizzle/bigint.d.ts.map +1 -1
- package/dist/types/drizzle/bytes.d.ts +2 -1
- package/dist/types/drizzle/bytes.d.ts.map +1 -1
- package/dist/types/drizzle/hex.d.ts +1 -1
- package/dist/types/drizzle/hex.d.ts.map +1 -1
- package/dist/types/drizzle/index.d.ts.map +1 -1
- package/dist/types/drizzle/json.d.ts.map +1 -1
- package/dist/types/drizzle/kit/index.d.ts.map +1 -1
- package/dist/types/drizzle/onchain.d.ts +1 -1
- package/dist/types/drizzle/onchain.d.ts.map +1 -1
- package/dist/types/drizzle/text.d.ts +1 -1
- package/dist/types/drizzle/text.d.ts.map +1 -1
- package/dist/types/graphql/index.d.ts +2 -2
- package/dist/types/graphql/index.d.ts.map +1 -1
- package/dist/types/graphql/middleware.d.ts +3 -3
- package/dist/types/graphql/middleware.d.ts.map +1 -1
- package/dist/types/index.d.ts +11 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/indexing/addStackTrace.d.ts.map +1 -1
- package/dist/types/indexing/client.d.ts +2 -3
- package/dist/types/indexing/client.d.ts.map +1 -1
- package/dist/types/indexing/index.d.ts +2 -2
- package/dist/types/indexing/index.d.ts.map +1 -1
- package/dist/types/indexing/profile.d.ts.map +1 -1
- package/dist/types/indexing-store/cache.d.ts +2 -2
- package/dist/types/indexing-store/cache.d.ts.map +1 -1
- package/dist/types/indexing-store/index.d.ts +3 -4
- package/dist/types/indexing-store/index.d.ts.map +1 -1
- package/dist/types/indexing-store/profile.d.ts +1 -1
- package/dist/types/indexing-store/profile.d.ts.map +1 -1
- package/dist/types/indexing-store/utils.d.ts.map +1 -1
- package/dist/types/internal/common.d.ts +0 -2
- package/dist/types/internal/common.d.ts.map +1 -1
- package/dist/types/internal/logger.d.ts +1 -1
- package/dist/types/internal/logger.d.ts.map +1 -1
- package/dist/types/internal/metrics.d.ts +1 -1
- package/dist/types/internal/metrics.d.ts.map +1 -1
- package/dist/types/internal/options.d.ts +1 -7
- package/dist/types/internal/options.d.ts.map +1 -1
- package/dist/types/internal/types.d.ts +4 -4
- package/dist/types/internal/types.d.ts.map +1 -1
- package/dist/types/rpc/actions.d.ts.map +1 -1
- package/dist/types/rpc/http.d.ts +1 -1
- package/dist/types/rpc/http.d.ts.map +1 -1
- package/dist/types/rpc/index.d.ts +2 -2
- package/dist/types/rpc/index.d.ts.map +1 -1
- package/dist/types/runtime/events.d.ts +1 -1
- package/dist/types/runtime/events.d.ts.map +1 -1
- package/dist/types/runtime/filter.d.ts +1 -1
- package/dist/types/runtime/filter.d.ts.map +1 -1
- package/dist/types/runtime/fragments.d.ts +1 -1
- package/dist/types/runtime/fragments.d.ts.map +1 -1
- package/dist/types/runtime/historical.d.ts.map +1 -1
- package/dist/types/runtime/index.d.ts +2 -3
- package/dist/types/runtime/index.d.ts.map +1 -1
- package/dist/types/runtime/isolated.d.ts.map +1 -1
- package/dist/types/runtime/multichain.d.ts.map +1 -1
- package/dist/types/runtime/omnichain.d.ts.map +1 -1
- package/dist/types/runtime/realtime.d.ts.map +1 -1
- package/dist/types/server/error.d.ts +1 -1
- package/dist/types/server/error.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +1 -1
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/sync-historical/index.d.ts +1 -1
- package/dist/types/sync-historical/index.d.ts.map +1 -1
- package/dist/types/sync-realtime/bloom.d.ts +1 -1
- package/dist/types/sync-realtime/bloom.d.ts.map +1 -1
- package/dist/types/sync-realtime/index.d.ts +1 -1
- package/dist/types/sync-realtime/index.d.ts.map +1 -1
- package/dist/types/sync-store/encode.d.ts.map +1 -1
- package/dist/types/sync-store/index.d.ts +2 -2
- package/dist/types/sync-store/index.d.ts.map +1 -1
- package/dist/types/sync-store/migrations.d.ts +1 -1
- package/dist/types/sync-store/migrations.d.ts.map +1 -1
- package/dist/types/sync-store/schema.d.ts +2 -2
- package/dist/types/sync-store/schema.d.ts.map +1 -1
- package/dist/types/types/db.d.ts +3 -3
- package/dist/types/types/db.d.ts.map +1 -1
- package/dist/types/ui/app.d.ts +3 -3
- package/dist/types/ui/app.d.ts.map +1 -1
- package/dist/types/ui/patch.d.ts.map +1 -1
- package/dist/types/utils/abi.d.ts.map +1 -1
- package/dist/types/utils/chains.d.ts +2 -0
- package/dist/types/utils/chains.d.ts.map +1 -1
- package/dist/types/utils/checkpoint.d.ts.map +1 -1
- package/dist/types/utils/chunk.d.ts.map +1 -1
- package/dist/types/utils/copy.d.ts.map +1 -1
- package/dist/types/utils/decodeAbiParameters.d.ts.map +1 -1
- package/dist/types/utils/estimate.d.ts.map +1 -1
- package/dist/types/utils/partition.d.ts.map +1 -1
- package/dist/types/utils/pg.d.ts +1 -1
- package/dist/types/utils/pg.d.ts.map +1 -1
- package/dist/types/utils/pglite.d.ts +1 -1
- package/dist/types/utils/pglite.d.ts.map +1 -1
- package/dist/types/utils/port.d.ts.map +1 -1
- package/dist/types/utils/promiseWithResolvers.d.ts.map +1 -1
- package/dist/types/utils/queue.d.ts.map +1 -1
- package/dist/types/utils/result.d.ts.map +1 -1
- package/dist/types/utils/zipper.d.ts +2 -2
- package/dist/types/utils/zipper.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/bin/commands/codegen.ts +3 -13
- package/src/bin/commands/createViews.ts +3 -6
- package/src/bin/commands/dev.ts +5 -25
- package/src/bin/commands/list.ts +6 -9
- package/src/bin/commands/prune.ts +6 -9
- package/src/bin/commands/serve.ts +5 -21
- package/src/bin/commands/start.ts +5 -22
- package/src/bin/isolatedController.ts +1 -1
- package/src/bin/isolatedWorker.ts +0 -6
- package/src/bin/ponder.ts +1 -1
- package/src/bin/utils/exit.ts +1 -9
- package/src/build/config.ts +22 -16
- package/src/build/factory.ts +2 -2
- package/src/build/index.ts +29 -19
- package/src/build/plugin.ts +1 -1
- package/src/build/pre.ts +2 -2
- package/src/build/schema.ts +20 -14
- package/src/build/stacktrace.ts +5 -5
- package/src/client/index.ts +23 -21
- package/src/config/address.ts +1 -1
- package/src/config/index.ts +1 -1
- package/src/database/actions.ts +18 -20
- package/src/database/index.ts +17 -17
- package/src/database/queryBuilder.ts +12 -14
- package/src/drizzle/bigint.ts +4 -4
- package/src/drizzle/bytes.ts +4 -4
- package/src/drizzle/hex.ts +4 -4
- package/src/drizzle/index.ts +1 -1
- package/src/drizzle/json.ts +6 -6
- package/src/drizzle/kit/index.ts +30 -44
- package/src/drizzle/onchain.ts +27 -23
- package/src/drizzle/text.ts +2 -2
- package/src/graphql/index.ts +16 -14
- package/src/graphql/json.ts +1 -1
- package/src/graphql/middleware.ts +6 -4
- package/src/index.ts +75 -83
- package/src/indexing/addStackTrace.ts +3 -3
- package/src/indexing/client.ts +40 -37
- package/src/indexing/index.ts +8 -6
- package/src/indexing/profile.ts +3 -3
- package/src/indexing-store/cache.ts +15 -15
- package/src/indexing-store/index.ts +26 -25
- package/src/indexing-store/profile.ts +4 -4
- package/src/indexing-store/utils.ts +11 -11
- package/src/internal/common.ts +0 -2
- package/src/internal/logger.ts +12 -9
- package/src/internal/metrics.ts +4 -4
- package/src/internal/options.ts +2 -10
- package/src/internal/types.ts +13 -13
- package/src/rpc/actions.ts +16 -17
- package/src/rpc/http.ts +9 -5
- package/src/rpc/index.ts +20 -16
- package/src/runtime/events.ts +22 -21
- package/src/runtime/filter.ts +9 -3
- package/src/runtime/fragments.ts +1 -1
- package/src/runtime/historical.ts +9 -6
- package/src/runtime/index.ts +6 -4
- package/src/runtime/isolated.ts +4 -4
- package/src/runtime/multichain.ts +5 -5
- package/src/runtime/omnichain.ts +5 -5
- package/src/runtime/realtime.ts +9 -11
- package/src/server/error.ts +2 -2
- package/src/server/index.ts +5 -5
- package/src/sync-historical/index.ts +13 -13
- package/src/sync-realtime/bloom.ts +1 -1
- package/src/sync-realtime/index.ts +7 -7
- package/src/sync-store/encode.ts +2 -2
- package/src/sync-store/index.ts +33 -58
- package/src/sync-store/migrations.ts +1 -1
- package/src/sync-store/schema.ts +1 -1
- package/src/types/db.ts +3 -3
- package/src/types.d.ts +2 -0
- package/src/ui/app.ts +1 -1
- package/src/ui/patch.ts +2 -3
- package/src/utils/abi.ts +7 -4
- package/src/utils/checkpoint.ts +1 -1
- package/src/utils/copy.ts +1 -1
- package/src/utils/decodeAbiParameters.ts +5 -7
- package/src/utils/pg.ts +1 -1
- package/src/utils/pglite.ts +5 -6
- package/src/utils/queue.ts +4 -4
- package/src/utils/result.ts +1 -1
- package/src/utils/sql-parse.ts +6 -6
- package/dist/esm/internal/telemetry.js +0 -200
- package/dist/esm/internal/telemetry.js.map +0 -1
- package/dist/types/internal/telemetry.d.ts +0 -43
- package/dist/types/internal/telemetry.d.ts.map +0 -1
- package/src/internal/telemetry.ts +0 -303
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Column, Table } from "drizzle-orm";
|
|
1
2
|
import type { Event } from "@/internal/types.js";
|
|
2
3
|
import { orderObject } from "@/utils/order.js";
|
|
3
|
-
import type { Column, Table } from "drizzle-orm";
|
|
4
4
|
import type { ProfilePattern, Row } from "./cache.js";
|
|
5
5
|
import { getCacheKey } from "./utils.js";
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ export const recordProfilePattern = (
|
|
|
42
42
|
const result: ProfilePattern = {};
|
|
43
43
|
|
|
44
44
|
for (const [js] of cache.get(table)!) {
|
|
45
|
-
// @ts-
|
|
45
|
+
// @ts-expect-error
|
|
46
46
|
const value = key[js]!;
|
|
47
47
|
|
|
48
48
|
const pattern = matchEventParameters(event, value);
|
|
@@ -519,7 +519,7 @@ export const recoverProfilePattern = (
|
|
|
519
519
|
} else {
|
|
520
520
|
let _result: unknown = event.event;
|
|
521
521
|
for (const prop of value) {
|
|
522
|
-
// @ts-
|
|
522
|
+
// @ts-expect-error
|
|
523
523
|
_result = _result[prop];
|
|
524
524
|
}
|
|
525
525
|
|
|
@@ -538,7 +538,7 @@ export const recoverProfilePattern = (
|
|
|
538
538
|
} else {
|
|
539
539
|
let _result: unknown = event.event;
|
|
540
540
|
for (const prop of value) {
|
|
541
|
-
// @ts-
|
|
541
|
+
// @ts-expect-error
|
|
542
542
|
_result = _result[prop];
|
|
543
543
|
}
|
|
544
544
|
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { getPrimaryKeyColumns } from "@/drizzle/index.js";
|
|
2
|
-
import {
|
|
3
|
-
BigIntSerializationError,
|
|
4
|
-
NotNullConstraintError,
|
|
5
|
-
} from "@/internal/errors.js";
|
|
6
|
-
import { prettyPrint } from "@/utils/print.js";
|
|
7
1
|
import {
|
|
8
|
-
type Column,
|
|
9
|
-
type SQL,
|
|
10
|
-
type SQLWrapper,
|
|
11
|
-
type Table,
|
|
12
2
|
and,
|
|
3
|
+
type Column,
|
|
13
4
|
eq,
|
|
14
5
|
getTableColumns,
|
|
15
6
|
getTableName,
|
|
7
|
+
type SQL,
|
|
8
|
+
type SQLWrapper,
|
|
9
|
+
type Table,
|
|
16
10
|
} from "drizzle-orm";
|
|
17
11
|
import { PgArray } from "drizzle-orm/pg-core";
|
|
12
|
+
import { getPrimaryKeyColumns } from "@/drizzle/index.js";
|
|
13
|
+
import {
|
|
14
|
+
BigIntSerializationError,
|
|
15
|
+
NotNullConstraintError,
|
|
16
|
+
} from "@/internal/errors.js";
|
|
17
|
+
import { prettyPrint } from "@/utils/print.js";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Returns true if the column has a "default" value that is used when no value is passed.
|
|
@@ -156,7 +156,7 @@ export const getWhereCondition = (table: Table, key: Object): SQL<unknown> => {
|
|
|
156
156
|
const conditions: SQLWrapper[] = [];
|
|
157
157
|
|
|
158
158
|
for (const { js } of getPrimaryKeyColumns(table)) {
|
|
159
|
-
// @ts-
|
|
159
|
+
// @ts-expect-error
|
|
160
160
|
conditions.push(eq(table[js]!, key[js]));
|
|
161
161
|
}
|
|
162
162
|
|
package/src/internal/common.ts
CHANGED
|
@@ -2,13 +2,11 @@ import type { Logger } from "./logger.js";
|
|
|
2
2
|
import type { MetricsService } from "./metrics.js";
|
|
3
3
|
import type { Options } from "./options.js";
|
|
4
4
|
import type { Shutdown } from "./shutdown.js";
|
|
5
|
-
import type { Telemetry } from "./telemetry.js";
|
|
6
5
|
|
|
7
6
|
export type Common = {
|
|
8
7
|
options: Options;
|
|
9
8
|
logger: Logger;
|
|
10
9
|
metrics: MetricsService;
|
|
11
|
-
telemetry: Telemetry;
|
|
12
10
|
shutdown: Shutdown;
|
|
13
11
|
apiShutdown: Shutdown;
|
|
14
12
|
buildShutdown: Shutdown;
|
package/src/internal/logger.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Prettify } from "@/types/utils.js";
|
|
2
|
-
import { formatEta } from "@/utils/format.js";
|
|
3
1
|
import pc from "picocolors";
|
|
4
2
|
import { type DestinationStream, type LevelWithSilent, pino } from "pino";
|
|
3
|
+
import type { Prettify } from "@/types/utils.js";
|
|
4
|
+
import { formatEta } from "@/utils/format.js";
|
|
5
5
|
|
|
6
6
|
export type LogMode = "pretty" | "json";
|
|
7
7
|
export type LogLevel = Prettify<LevelWithSilent>;
|
|
@@ -55,7 +55,10 @@ const INTERNAL_KEYS = [
|
|
|
55
55
|
export function createLogger({
|
|
56
56
|
level,
|
|
57
57
|
mode = "pretty",
|
|
58
|
-
}: {
|
|
58
|
+
}: {
|
|
59
|
+
level: LogLevel;
|
|
60
|
+
mode?: LogMode;
|
|
61
|
+
}) {
|
|
59
62
|
const stream: DestinationStream = {
|
|
60
63
|
write(logString: string) {
|
|
61
64
|
const log = JSON.parse(logString) as Log;
|
|
@@ -71,7 +74,7 @@ export function createLogger({
|
|
|
71
74
|
printKeys?: (keyof T)[],
|
|
72
75
|
) {
|
|
73
76
|
if (mode === "pretty" && printKeys) {
|
|
74
|
-
// @ts-
|
|
77
|
+
// @ts-expect-error
|
|
75
78
|
options[PRINT_KEYS] = printKeys;
|
|
76
79
|
}
|
|
77
80
|
logger.error(options);
|
|
@@ -81,7 +84,7 @@ export function createLogger({
|
|
|
81
84
|
printKeys?: (keyof T)[],
|
|
82
85
|
) {
|
|
83
86
|
if (mode === "pretty" && printKeys) {
|
|
84
|
-
// @ts-
|
|
87
|
+
// @ts-expect-error
|
|
85
88
|
options[PRINT_KEYS] = printKeys;
|
|
86
89
|
}
|
|
87
90
|
logger.warn(options);
|
|
@@ -91,7 +94,7 @@ export function createLogger({
|
|
|
91
94
|
printKeys?: (keyof T)[],
|
|
92
95
|
) {
|
|
93
96
|
if (mode === "pretty" && printKeys) {
|
|
94
|
-
// @ts-
|
|
97
|
+
// @ts-expect-error
|
|
95
98
|
options[PRINT_KEYS] = printKeys;
|
|
96
99
|
}
|
|
97
100
|
logger.info(options);
|
|
@@ -101,7 +104,7 @@ export function createLogger({
|
|
|
101
104
|
printKeys?: (keyof T)[],
|
|
102
105
|
) {
|
|
103
106
|
if (mode === "pretty" && printKeys) {
|
|
104
|
-
// @ts-
|
|
107
|
+
// @ts-expect-error
|
|
105
108
|
options[PRINT_KEYS] = printKeys;
|
|
106
109
|
}
|
|
107
110
|
logger.debug(options);
|
|
@@ -111,7 +114,7 @@ export function createLogger({
|
|
|
111
114
|
printKeys?: (keyof T)[],
|
|
112
115
|
) {
|
|
113
116
|
if (mode === "pretty" && printKeys) {
|
|
114
|
-
// @ts-
|
|
117
|
+
// @ts-expect-error
|
|
115
118
|
options[PRINT_KEYS] = printKeys;
|
|
116
119
|
}
|
|
117
120
|
logger.trace(options);
|
|
@@ -124,7 +127,7 @@ export function createLogger({
|
|
|
124
127
|
|
|
125
128
|
const errorSerializer = pino.stdSerializers.wrapErrorSerializer((error) => {
|
|
126
129
|
error.meta = Array.isArray(error.meta) ? error.meta.join("\n") : error.meta;
|
|
127
|
-
// @ts-
|
|
130
|
+
// @ts-expect-error
|
|
128
131
|
error.type = undefined;
|
|
129
132
|
return error;
|
|
130
133
|
});
|
package/src/internal/metrics.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type Worker
|
|
1
|
+
import { parentPort, type Worker } from "node:worker_threads";
|
|
2
|
+
import { getTableName, isTable } from "drizzle-orm";
|
|
3
|
+
import prometheus from "prom-client";
|
|
2
4
|
import {
|
|
3
5
|
type PromiseWithResolvers,
|
|
4
6
|
promiseWithResolvers,
|
|
5
7
|
} from "@/utils/promiseWithResolvers.js";
|
|
6
8
|
import { truncate } from "@/utils/truncate.js";
|
|
7
|
-
import { getTableName, isTable } from "drizzle-orm";
|
|
8
|
-
import prometheus from "prom-client";
|
|
9
9
|
import type { IndexingBuild, PreBuild, SchemaBuild } from "./types.js";
|
|
10
10
|
|
|
11
11
|
const sometimesIODurationMs = [
|
|
@@ -970,7 +970,7 @@ function calculateEta(
|
|
|
970
970
|
0,
|
|
971
971
|
);
|
|
972
972
|
|
|
973
|
-
let eta: number | undefined
|
|
973
|
+
let eta: number | undefined;
|
|
974
974
|
|
|
975
975
|
if (completedSeconds > 0) {
|
|
976
976
|
const currentTimestamp = Date.now();
|
package/src/internal/options.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import v8 from "node:v8";
|
|
3
|
-
import type { CliOptions } from "@/bin/ponder.js";
|
|
4
3
|
import type { LevelWithSilent } from "pino";
|
|
5
|
-
import { type SemVer
|
|
4
|
+
import { parse, type SemVer } from "semver";
|
|
5
|
+
import type { CliOptions } from "@/bin/ponder.js";
|
|
6
6
|
|
|
7
7
|
export type Options = {
|
|
8
8
|
command: "dev" | "start" | "serve" | "codegen" | "list" | "prune";
|
|
@@ -20,10 +20,6 @@ export type Options = {
|
|
|
20
20
|
port: number;
|
|
21
21
|
hostname?: string;
|
|
22
22
|
|
|
23
|
-
telemetryUrl: string;
|
|
24
|
-
telemetryDisabled: boolean;
|
|
25
|
-
telemetryConfigDir: string | undefined;
|
|
26
|
-
|
|
27
23
|
logLevel: LevelWithSilent;
|
|
28
24
|
logFormat: "json" | "pretty";
|
|
29
25
|
|
|
@@ -93,10 +89,6 @@ export const buildOptions = ({ cliOptions }: { cliOptions: CliOptions }) => {
|
|
|
93
89
|
port,
|
|
94
90
|
hostname,
|
|
95
91
|
|
|
96
|
-
telemetryUrl: "https://ponder.sh/api/telemetry",
|
|
97
|
-
telemetryDisabled: Boolean(process.env.PONDER_TELEMETRY_DISABLED),
|
|
98
|
-
telemetryConfigDir: undefined,
|
|
99
|
-
|
|
100
92
|
logLevel,
|
|
101
93
|
logFormat: cliOptions.logFormat! as Options["logFormat"],
|
|
102
94
|
|
package/src/internal/types.ts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import type { SqlStatements } from "@/drizzle/kit/index.js";
|
|
2
|
-
import type { Rpc } from "@/rpc/index.js";
|
|
3
|
-
import type {
|
|
4
|
-
Block,
|
|
5
|
-
Log,
|
|
6
|
-
Trace,
|
|
7
|
-
Transaction,
|
|
8
|
-
TransactionReceipt,
|
|
9
|
-
Transfer,
|
|
10
|
-
} from "@/types/eth.js";
|
|
11
|
-
import type { PartialExcept, Prettify } from "@/types/utils.js";
|
|
12
|
-
import type { Trace as DebugTrace } from "@/utils/debug.js";
|
|
13
|
-
import type { PGliteOptions } from "@/utils/pglite.js";
|
|
14
1
|
import type { PGlite } from "@electric-sql/pglite";
|
|
15
2
|
import type { Hono } from "hono";
|
|
16
3
|
import type { PoolConfig } from "pg";
|
|
@@ -29,6 +16,19 @@ import type {
|
|
|
29
16
|
Chain as ViemChain,
|
|
30
17
|
Log as ViemLog,
|
|
31
18
|
} from "viem";
|
|
19
|
+
import type { SqlStatements } from "@/drizzle/kit/index.js";
|
|
20
|
+
import type { Rpc } from "@/rpc/index.js";
|
|
21
|
+
import type {
|
|
22
|
+
Block,
|
|
23
|
+
Log,
|
|
24
|
+
Trace,
|
|
25
|
+
Transaction,
|
|
26
|
+
TransactionReceipt,
|
|
27
|
+
Transfer,
|
|
28
|
+
} from "@/types/eth.js";
|
|
29
|
+
import type { PartialExcept, Prettify } from "@/types/utils.js";
|
|
30
|
+
import type { Trace as DebugTrace } from "@/utils/debug.js";
|
|
31
|
+
import type { PGliteOptions } from "@/utils/pglite.js";
|
|
32
32
|
import type { RetryableError } from "./errors.js";
|
|
33
33
|
|
|
34
34
|
// Database
|
package/src/rpc/actions.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BlockNotFoundError,
|
|
3
|
+
type Hex,
|
|
4
|
+
hexToBigInt,
|
|
5
|
+
hexToNumber,
|
|
6
|
+
isHex,
|
|
7
|
+
TransactionReceiptNotFoundError,
|
|
8
|
+
zeroAddress,
|
|
9
|
+
zeroHash,
|
|
10
|
+
} from "viem";
|
|
1
11
|
import { RpcProviderError } from "@/internal/errors.js";
|
|
2
12
|
import type {
|
|
3
13
|
LightBlock,
|
|
@@ -11,16 +21,6 @@ import type {
|
|
|
11
21
|
import type { RequestParameters, Rpc } from "@/rpc/index.js";
|
|
12
22
|
import { zeroLogsBloom } from "@/sync-realtime/bloom.js";
|
|
13
23
|
import { PG_BIGINT_MAX, PG_INTEGER_MAX } from "@/utils/pg.js";
|
|
14
|
-
import {
|
|
15
|
-
BlockNotFoundError,
|
|
16
|
-
type Hex,
|
|
17
|
-
TransactionReceiptNotFoundError,
|
|
18
|
-
hexToBigInt,
|
|
19
|
-
hexToNumber,
|
|
20
|
-
isHex,
|
|
21
|
-
zeroAddress,
|
|
22
|
-
zeroHash,
|
|
23
|
-
} from "viem";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Helper function for "eth_getBlockByNumber" request.
|
|
@@ -43,7 +43,7 @@ export const eth_getBlockByNumber = <
|
|
|
43
43
|
if (isHex(params[0])) {
|
|
44
44
|
blockNumber = hexToBigInt(params[0]);
|
|
45
45
|
} else {
|
|
46
|
-
// @ts-
|
|
46
|
+
// @ts-expect-error `BlockNotFoundError` expects a bigint, but it also just passes
|
|
47
47
|
// the `blockNumber` directly to the error message, so breaking the type constraint is fine.
|
|
48
48
|
blockNumber = params[0];
|
|
49
49
|
}
|
|
@@ -203,9 +203,9 @@ export const debug_traceBlockByNumber = (
|
|
|
203
203
|
failedTraces.set(frame, error);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
// @ts-
|
|
206
|
+
// @ts-expect-error
|
|
207
207
|
frame.index = index;
|
|
208
|
-
// @ts-
|
|
208
|
+
// @ts-expect-error
|
|
209
209
|
frame.subcalls = frame.calls?.length ?? 0;
|
|
210
210
|
|
|
211
211
|
result.push({ trace: frame as SyncTrace["trace"], transactionHash });
|
|
@@ -280,9 +280,9 @@ export const debug_traceBlockByHash = (
|
|
|
280
280
|
failedTraces.set(frame, error);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
// @ts-
|
|
283
|
+
// @ts-expect-error
|
|
284
284
|
frame.index = index;
|
|
285
|
-
// @ts-
|
|
285
|
+
// @ts-expect-error
|
|
286
286
|
frame.subcalls = frame.calls?.length ?? 0;
|
|
287
287
|
|
|
288
288
|
result.push({ trace: frame as SyncTrace["trace"], transactionHash });
|
|
@@ -886,7 +886,7 @@ export const standardizeTransactions = (
|
|
|
886
886
|
transaction.v = "0x0";
|
|
887
887
|
}
|
|
888
888
|
if (transaction.type === undefined) {
|
|
889
|
-
// @ts-
|
|
889
|
+
// @ts-expect-error
|
|
890
890
|
transaction.type = "0x0";
|
|
891
891
|
}
|
|
892
892
|
if (transaction.gas === undefined) {
|
|
@@ -1301,7 +1301,6 @@ export const standardizeTransactionReceipts = (
|
|
|
1301
1301
|
receipt.root = zeroHash;
|
|
1302
1302
|
}
|
|
1303
1303
|
if (receipt.type === undefined) {
|
|
1304
|
-
// @ts-ignore
|
|
1305
1304
|
receipt.type = "0x0";
|
|
1306
1305
|
}
|
|
1307
1306
|
|
package/src/rpc/http.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { URL } from "node:url";
|
|
2
|
-
import type { Common } from "@/internal/common.js";
|
|
3
|
-
import type { Chain } from "@/internal/types.js";
|
|
4
2
|
import { HttpRequestError, RpcRequestError, TimeoutError } from "viem";
|
|
5
3
|
import {
|
|
6
4
|
type HttpRequestParameters,
|
|
@@ -8,6 +6,8 @@ import {
|
|
|
8
6
|
type HttpRpcClientOptions,
|
|
9
7
|
stringify,
|
|
10
8
|
} from "viem/utils";
|
|
9
|
+
import type { Common } from "@/internal/common.js";
|
|
10
|
+
import type { Chain } from "@/internal/types.js";
|
|
11
11
|
|
|
12
12
|
export type RpcRequest = {
|
|
13
13
|
jsonrpc?: "2.0" | undefined;
|
|
@@ -31,7 +31,7 @@ export function getHttpRpcClient(
|
|
|
31
31
|
let id = 1;
|
|
32
32
|
return {
|
|
33
33
|
async request(params) {
|
|
34
|
-
// biome-ignore lint/suspicious/noAsyncPromiseExecutor:
|
|
34
|
+
// biome-ignore lint/suspicious/noAsyncPromiseExecutor: The Promise executor intentionally wraps async request handling.
|
|
35
35
|
return new Promise(async (resolve, reject) => {
|
|
36
36
|
let isTimeoutRejected = false;
|
|
37
37
|
const { body } = params;
|
|
@@ -56,7 +56,7 @@ export function getHttpRpcClient(
|
|
|
56
56
|
chain: chain.name,
|
|
57
57
|
chain_id: chain.id,
|
|
58
58
|
hostname: new URL(url).hostname,
|
|
59
|
-
// @ts-
|
|
59
|
+
// @ts-expect-error
|
|
60
60
|
request_id: headers ? headers["X-Request-ID"] : undefined,
|
|
61
61
|
method: body.method,
|
|
62
62
|
request: JSON.stringify(body),
|
|
@@ -85,7 +85,11 @@ export function getHttpRpcClient(
|
|
|
85
85
|
const request = new Request(url, init);
|
|
86
86
|
const response = await fetch(request);
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
const responseBody = response.body;
|
|
89
|
+
if (responseBody === null) {
|
|
90
|
+
throw new Error("Response body is missing.");
|
|
91
|
+
}
|
|
92
|
+
reader = responseBody.getReader();
|
|
89
93
|
const chunks: Uint8Array[] = [];
|
|
90
94
|
let totalLength = 0;
|
|
91
95
|
|
package/src/rpc/index.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import crypto, { type UUID } from "node:crypto";
|
|
2
2
|
import url from "node:url";
|
|
3
|
-
import type { Common } from "@/internal/common.js";
|
|
4
|
-
import type { Logger } from "@/internal/logger.js";
|
|
5
|
-
import type { Chain, SyncBlock, SyncBlockHeader } from "@/internal/types.js";
|
|
6
|
-
import { eth_getBlockByNumber, standardizeBlock } from "@/rpc/actions.js";
|
|
7
|
-
import { createQueue } from "@/utils/queue.js";
|
|
8
|
-
import { startClock } from "@/utils/timer.js";
|
|
9
|
-
import { wait } from "@/utils/wait.js";
|
|
10
3
|
import {
|
|
11
4
|
type GetLogsRetryHelperParameters,
|
|
12
5
|
getLogsRetryHelper,
|
|
13
6
|
} from "@ponder/utils";
|
|
14
7
|
import {
|
|
15
8
|
BlockNotFoundError,
|
|
9
|
+
custom,
|
|
16
10
|
type EIP1193Parameters,
|
|
17
11
|
type EIP1193RequestFn,
|
|
18
12
|
type Hash,
|
|
19
13
|
HttpRequestError,
|
|
14
|
+
hexToNumber,
|
|
15
|
+
isHex,
|
|
20
16
|
JsonRpcVersionUnsupportedError,
|
|
21
17
|
MethodNotFoundRpcError,
|
|
22
18
|
MethodNotSupportedRpcError,
|
|
@@ -25,12 +21,16 @@ import {
|
|
|
25
21
|
type RpcError,
|
|
26
22
|
type RpcTransactionReceipt,
|
|
27
23
|
TimeoutError,
|
|
28
|
-
custom,
|
|
29
|
-
hexToNumber,
|
|
30
|
-
isHex,
|
|
31
24
|
webSocket,
|
|
32
25
|
} from "viem";
|
|
33
26
|
import { WebSocket } from "ws";
|
|
27
|
+
import type { Common } from "@/internal/common.js";
|
|
28
|
+
import type { Logger } from "@/internal/logger.js";
|
|
29
|
+
import type { Chain, SyncBlock, SyncBlockHeader } from "@/internal/types.js";
|
|
30
|
+
import { eth_getBlockByNumber, standardizeBlock } from "@/rpc/actions.js";
|
|
31
|
+
import { createQueue } from "@/utils/queue.js";
|
|
32
|
+
import { startClock } from "@/utils/timer.js";
|
|
33
|
+
import { wait } from "@/utils/wait.js";
|
|
34
34
|
import type { DebugRpcSchema } from "../utils/debug.js";
|
|
35
35
|
import { getHttpRpcClient } from "./http.js";
|
|
36
36
|
|
|
@@ -170,7 +170,11 @@ export const createRpc = ({
|
|
|
170
170
|
common,
|
|
171
171
|
chain,
|
|
172
172
|
concurrency = 25,
|
|
173
|
-
}: {
|
|
173
|
+
}: {
|
|
174
|
+
common: Common;
|
|
175
|
+
chain: Chain;
|
|
176
|
+
concurrency?: number;
|
|
177
|
+
}): Rpc => {
|
|
174
178
|
let backends: { request: EIP1193RequestFn<RpcSchema>; hostname: string }[];
|
|
175
179
|
|
|
176
180
|
let requestId: UUID | undefined;
|
|
@@ -511,7 +515,7 @@ export const createRpc = ({
|
|
|
511
515
|
) {
|
|
512
516
|
// Note: Throwing this error will cause the request to be retried.
|
|
513
517
|
throw new BlockNotFoundError({
|
|
514
|
-
// @ts-
|
|
518
|
+
// @ts-expect-error
|
|
515
519
|
blockNumber: body.params[0],
|
|
516
520
|
});
|
|
517
521
|
}
|
|
@@ -576,7 +580,7 @@ export const createRpc = ({
|
|
|
576
580
|
|
|
577
581
|
throw error;
|
|
578
582
|
} else {
|
|
579
|
-
// @ts-
|
|
583
|
+
// @ts-expect-error
|
|
580
584
|
error.meta = [
|
|
581
585
|
"Tip: Use the ethGetLogsBlockRange option to override the default behavior for this chain",
|
|
582
586
|
];
|
|
@@ -586,9 +590,9 @@ export const createRpc = ({
|
|
|
586
590
|
addLatency(bucket, endClock(), false);
|
|
587
591
|
|
|
588
592
|
if (
|
|
589
|
-
// @ts-
|
|
593
|
+
// @ts-expect-error
|
|
590
594
|
error.code === 429 ||
|
|
591
|
-
// @ts-
|
|
595
|
+
// @ts-expect-error
|
|
592
596
|
error.status === 429 ||
|
|
593
597
|
error instanceof TimeoutError
|
|
594
598
|
) {
|
|
@@ -695,7 +699,7 @@ export const createRpc = ({
|
|
|
695
699
|
|
|
696
700
|
const rpc: Rpc = {
|
|
697
701
|
hostnames: backends.map((backend) => backend.hostname),
|
|
698
|
-
// @ts-
|
|
702
|
+
// @ts-expect-error
|
|
699
703
|
request: (parameters, context) => queue.add({ body: parameters, context }),
|
|
700
704
|
subscribe({ onBlock, onError }) {
|
|
701
705
|
(async () => {
|
package/src/runtime/events.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AbiEvent,
|
|
3
|
+
type AbiFunction,
|
|
4
|
+
type Address,
|
|
5
|
+
decodeFunctionData,
|
|
6
|
+
decodeFunctionResult,
|
|
7
|
+
type Hash,
|
|
8
|
+
type Hex,
|
|
9
|
+
hexToBigInt,
|
|
10
|
+
hexToNumber,
|
|
11
|
+
toEventSelector,
|
|
12
|
+
toFunctionSelector,
|
|
13
|
+
} from "viem";
|
|
1
14
|
import type { Common } from "@/internal/common.js";
|
|
2
15
|
import type {
|
|
3
16
|
BlockFilter,
|
|
@@ -30,26 +43,14 @@ import type {
|
|
|
30
43
|
} from "@/types/eth.js";
|
|
31
44
|
import {
|
|
32
45
|
EVENT_TYPES,
|
|
46
|
+
encodeCheckpoint,
|
|
33
47
|
MAX_CHECKPOINT,
|
|
34
48
|
ZERO_CHECKPOINT,
|
|
35
|
-
encodeCheckpoint,
|
|
36
49
|
} from "@/utils/checkpoint.js";
|
|
37
50
|
import { decodeEventLog } from "@/utils/decodeEventLog.js";
|
|
38
51
|
import { toLowerCase } from "@/utils/lowercase.js";
|
|
39
52
|
import {
|
|
40
|
-
|
|
41
|
-
type AbiFunction,
|
|
42
|
-
type Address,
|
|
43
|
-
type Hash,
|
|
44
|
-
type Hex,
|
|
45
|
-
decodeFunctionData,
|
|
46
|
-
decodeFunctionResult,
|
|
47
|
-
hexToBigInt,
|
|
48
|
-
hexToNumber,
|
|
49
|
-
toEventSelector,
|
|
50
|
-
toFunctionSelector,
|
|
51
|
-
} from "viem";
|
|
52
|
-
import {
|
|
53
|
+
isAddressFactory,
|
|
53
54
|
isAddressMatched,
|
|
54
55
|
isBlockFilterMatched,
|
|
55
56
|
isLogFilterMatched,
|
|
@@ -57,7 +58,6 @@ import {
|
|
|
57
58
|
isTransactionFilterMatched,
|
|
58
59
|
isTransferFilterMatched,
|
|
59
60
|
} from "./filter.js";
|
|
60
|
-
import { isAddressFactory } from "./filter.js";
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Create `RawEvent`s from raw data types
|
|
@@ -561,7 +561,7 @@ export const decodeEvents = (
|
|
|
561
561
|
topics: event.log!.topics,
|
|
562
562
|
});
|
|
563
563
|
logDecodeSuccessCount++;
|
|
564
|
-
} catch (
|
|
564
|
+
} catch (_err) {
|
|
565
565
|
logDecodeFailureCount++;
|
|
566
566
|
const selector = toEventSelector(eventCallback.abiItem as AbiEvent);
|
|
567
567
|
if (!logDecodeFailureSelectors.has(selector)) {
|
|
@@ -613,7 +613,7 @@ export const decodeEvents = (
|
|
|
613
613
|
functionName: decodedData.functionName,
|
|
614
614
|
});
|
|
615
615
|
traceDecodeSuccessCount++;
|
|
616
|
-
} catch (
|
|
616
|
+
} catch (_err) {
|
|
617
617
|
traceDecodeFailureCount++;
|
|
618
618
|
const selector = toFunctionSelector(
|
|
619
619
|
eventCallback.abiItem as AbiFunction,
|
|
@@ -726,7 +726,9 @@ export const decodeEvents = (
|
|
|
726
726
|
|
|
727
727
|
export const syncBlockToInternal = ({
|
|
728
728
|
block,
|
|
729
|
-
}: {
|
|
729
|
+
}: {
|
|
730
|
+
block: SyncBlock | SyncBlockHeader;
|
|
731
|
+
}): InternalBlock => ({
|
|
730
732
|
baseFeePerGas: block.baseFeePerGas ? hexToBigInt(block.baseFeePerGas) : null,
|
|
731
733
|
difficulty: hexToBigInt(block.difficulty),
|
|
732
734
|
extraData: block.extraData,
|
|
@@ -798,19 +800,18 @@ export const syncTransactionToInternal = ({
|
|
|
798
800
|
transaction.type === "0x7e"
|
|
799
801
|
? {
|
|
800
802
|
type: "deposit",
|
|
801
|
-
// @ts-
|
|
803
|
+
// @ts-expect-error
|
|
802
804
|
maxFeePerGas: transaction.maxFeePerGas
|
|
803
805
|
? // @ts-ignore
|
|
804
806
|
hexToBigInt(transaction.maxFeePerGas)
|
|
805
807
|
: undefined,
|
|
806
|
-
// @ts-
|
|
808
|
+
// @ts-expect-error
|
|
807
809
|
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas
|
|
808
810
|
? // @ts-ignore
|
|
809
811
|
hexToBigInt(transaction.maxPriorityFeePerGas)
|
|
810
812
|
: undefined,
|
|
811
813
|
}
|
|
812
814
|
: {
|
|
813
|
-
// @ts-ignore
|
|
814
815
|
type: transaction.type,
|
|
815
816
|
}),
|
|
816
817
|
});
|
package/src/runtime/filter.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Address, hexToNumber } from "viem";
|
|
1
2
|
import type {
|
|
2
3
|
BlockFilter,
|
|
3
4
|
Factory,
|
|
@@ -30,7 +31,6 @@ import type {
|
|
|
30
31
|
TransactionReceipt,
|
|
31
32
|
} from "@/types/eth.js";
|
|
32
33
|
import { toLowerCase } from "@/utils/lowercase.js";
|
|
33
|
-
import { type Address, hexToNumber } from "viem";
|
|
34
34
|
|
|
35
35
|
/** Returns true if `address` is an address filter. */
|
|
36
36
|
export const isAddressFactory = (
|
|
@@ -49,7 +49,10 @@ export const isAddressFactory = (
|
|
|
49
49
|
export const getChildAddress = ({
|
|
50
50
|
log,
|
|
51
51
|
factory,
|
|
52
|
-
}: {
|
|
52
|
+
}: {
|
|
53
|
+
log: SyncLog;
|
|
54
|
+
factory: Factory;
|
|
55
|
+
}): Address => {
|
|
53
56
|
if (factory.childAddressLocation.startsWith("offset")) {
|
|
54
57
|
const childAddressOffset = Number(
|
|
55
58
|
factory.childAddressLocation.substring(6),
|
|
@@ -121,7 +124,10 @@ const isValueMatched = <T extends string>(
|
|
|
121
124
|
export const isLogFactoryMatched = ({
|
|
122
125
|
factory,
|
|
123
126
|
log,
|
|
124
|
-
}: {
|
|
127
|
+
}: {
|
|
128
|
+
factory: LogFactory;
|
|
129
|
+
log: InternalLog | SyncLog;
|
|
130
|
+
}): boolean => {
|
|
125
131
|
if (factory.address !== undefined) {
|
|
126
132
|
const addresses = Array.isArray(factory.address)
|
|
127
133
|
? factory.address
|
package/src/runtime/fragments.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
1
2
|
import type {
|
|
2
3
|
BlockFilter,
|
|
3
4
|
Factory,
|
|
@@ -13,7 +14,6 @@ import type {
|
|
|
13
14
|
TransferFilter,
|
|
14
15
|
} from "@/internal/types.js";
|
|
15
16
|
import { dedupe } from "@/utils/dedupe.js";
|
|
16
|
-
import type { Address, Hex } from "viem";
|
|
17
17
|
import { isAddressFactory } from "./filter.js";
|
|
18
18
|
|
|
19
19
|
export const isFragmentAddressFactory = (
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hexToNumber, numberToHex } from "viem";
|
|
1
2
|
import type { Database } from "@/database/index.js";
|
|
2
3
|
import type { Common } from "@/internal/common.js";
|
|
3
4
|
import { ShutdownError } from "@/internal/errors.js";
|
|
@@ -14,13 +15,13 @@ import { eth_getBlockByNumber } from "@/rpc/actions.js";
|
|
|
14
15
|
import type { Rpc } from "@/rpc/index.js";
|
|
15
16
|
import { buildEvents, decodeEvents } from "@/runtime/events.js";
|
|
16
17
|
import { createHistoricalSync } from "@/sync-historical/index.js";
|
|
17
|
-
import { type SyncStore
|
|
18
|
+
import { createSyncStore, type SyncStore } from "@/sync-store/index.js";
|
|
18
19
|
import {
|
|
19
|
-
MAX_CHECKPOINT,
|
|
20
|
-
ZERO_CHECKPOINT,
|
|
21
20
|
decodeCheckpoint,
|
|
22
21
|
encodeCheckpoint,
|
|
22
|
+
MAX_CHECKPOINT,
|
|
23
23
|
min,
|
|
24
|
+
ZERO_CHECKPOINT,
|
|
24
25
|
} from "@/utils/checkpoint.js";
|
|
25
26
|
import { estimate } from "@/utils/estimate.js";
|
|
26
27
|
import { formatPercentage } from "@/utils/format.js";
|
|
@@ -33,13 +34,12 @@ import { type Interval, intervalSum } from "@/utils/interval.js";
|
|
|
33
34
|
import { partition } from "@/utils/partition.js";
|
|
34
35
|
import { promiseWithResolvers } from "@/utils/promiseWithResolvers.js";
|
|
35
36
|
import { startClock } from "@/utils/timer.js";
|
|
36
|
-
import { hexToNumber, numberToHex } from "viem";
|
|
37
37
|
import {
|
|
38
38
|
type CachedIntervals,
|
|
39
39
|
type ChildAddresses,
|
|
40
|
-
type SyncProgress,
|
|
41
40
|
getRequiredIntervals,
|
|
42
41
|
getRequiredIntervalsWithFilters,
|
|
42
|
+
type SyncProgress,
|
|
43
43
|
} from "./index.js";
|
|
44
44
|
import { getOmnichainCheckpoint } from "./omnichain.js";
|
|
45
45
|
|
|
@@ -1243,7 +1243,10 @@ export async function* getLocalSyncGenerator(params: {
|
|
|
1243
1243
|
async function syncInterval({
|
|
1244
1244
|
interval,
|
|
1245
1245
|
promise,
|
|
1246
|
-
}: {
|
|
1246
|
+
}: {
|
|
1247
|
+
interval: Interval;
|
|
1248
|
+
promise: Promise<void>;
|
|
1249
|
+
}): Promise<boolean> {
|
|
1247
1250
|
const endClock = startClock();
|
|
1248
1251
|
|
|
1249
1252
|
const isSyncComplete = interval[1] === hexToNumber(last.number);
|