ponder 0.9.5-debug.1 → 0.9.5
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/dist/{types/bin → bin}/ponder.d.ts +6 -5
- package/dist/bin/ponder.js +12933 -0
- package/dist/bin/ponder.js.map +1 -0
- package/dist/chunk-K2TLRLX3.js +163 -0
- package/dist/chunk-K2TLRLX3.js.map +1 -0
- package/dist/chunk-LHCA5XFV.js +257 -0
- package/dist/chunk-LHCA5XFV.js.map +1 -0
- package/dist/{types/drizzle → drizzle}/onchain.d.ts +96 -49
- package/dist/drizzle/onchain.js +19 -0
- package/dist/drizzle/onchain.js.map +1 -0
- package/dist/index.d.ts +819 -0
- package/dist/index.js +2217 -0
- package/dist/index.js.map +1 -0
- package/dist/utils-ceNucOJb.d.ts +14 -0
- package/package.json +17 -17
- package/src/bin/commands/dev.ts +1 -1
- package/src/bin/ponder.ts +1 -1
- package/src/build/configAndIndexingFunctions.ts +1 -1
- package/src/build/factory.ts +1 -1
- package/src/client/index.ts +1 -1
- package/src/indexing-store/historical.ts +1 -1
- package/src/indexing-store/realtime.ts +1 -1
- package/src/internal/telemetry.ts +1 -1
- package/src/sync/fragments.ts +1 -1
- package/src/sync-realtime/index.ts +1 -1
- package/src/utils/generators.ts +1 -1
- package/src/utils/mutex.ts +1 -1
- package/src/utils/requestQueue.ts +1 -1
- package/CHANGELOG.md +0 -2201
- package/dist/esm/bin/commands/codegen.js +0 -37
- package/dist/esm/bin/commands/codegen.js.map +0 -1
- package/dist/esm/bin/commands/dev.js +0 -242
- package/dist/esm/bin/commands/dev.js.map +0 -1
- package/dist/esm/bin/commands/list.js +0 -103
- package/dist/esm/bin/commands/list.js.map +0 -1
- package/dist/esm/bin/commands/serve.js +0 -123
- package/dist/esm/bin/commands/serve.js.map +0 -1
- package/dist/esm/bin/commands/start.js +0 -136
- package/dist/esm/bin/commands/start.js.map +0 -1
- package/dist/esm/bin/ponder.js +0 -118
- package/dist/esm/bin/ponder.js.map +0 -1
- package/dist/esm/bin/utils/codegen.js +0 -26
- package/dist/esm/bin/utils/codegen.js.map +0 -1
- package/dist/esm/bin/utils/exit.js +0 -69
- package/dist/esm/bin/utils/exit.js.map +0 -1
- package/dist/esm/bin/utils/run.js +0 -247
- package/dist/esm/bin/utils/run.js.map +0 -1
- package/dist/esm/bin/utils/runServer.js +0 -8
- package/dist/esm/bin/utils/runServer.js.map +0 -1
- package/dist/esm/build/configAndIndexingFunctions.js +0 -654
- package/dist/esm/build/configAndIndexingFunctions.js.map +0 -1
- package/dist/esm/build/factory.js +0 -43
- package/dist/esm/build/factory.js.map +0 -1
- package/dist/esm/build/index.js +0 -431
- package/dist/esm/build/index.js.map +0 -1
- package/dist/esm/build/plugin.js +0 -43
- package/dist/esm/build/plugin.js.map +0 -1
- package/dist/esm/build/pre.js +0 -112
- package/dist/esm/build/pre.js.map +0 -1
- package/dist/esm/build/schema.js +0 -89
- package/dist/esm/build/schema.js.map +0 -1
- package/dist/esm/build/stacktrace.js +0 -137
- package/dist/esm/build/stacktrace.js.map +0 -1
- package/dist/esm/client/index.js +0 -124
- package/dist/esm/client/index.js.map +0 -1
- package/dist/esm/client/validate.js +0 -1151
- package/dist/esm/client/validate.js.map +0 -1
- package/dist/esm/config/address.js +0 -2
- package/dist/esm/config/address.js.map +0 -1
- package/dist/esm/config/eventFilter.js +0 -2
- package/dist/esm/config/eventFilter.js.map +0 -1
- package/dist/esm/config/index.js +0 -2
- package/dist/esm/config/index.js.map +0 -1
- package/dist/esm/config/networks.js +0 -120
- package/dist/esm/config/networks.js.map +0 -1
- package/dist/esm/config/utilityTypes.js +0 -2
- package/dist/esm/config/utilityTypes.js.map +0 -1
- package/dist/esm/database/index.js +0 -914
- package/dist/esm/database/index.js.map +0 -1
- package/dist/esm/drizzle/bigint.js +0 -36
- package/dist/esm/drizzle/bigint.js.map +0 -1
- package/dist/esm/drizzle/hex.js +0 -38
- package/dist/esm/drizzle/hex.js.map +0 -1
- package/dist/esm/drizzle/index.js +0 -43
- package/dist/esm/drizzle/index.js.map +0 -1
- package/dist/esm/drizzle/kit/index.js +0 -658
- package/dist/esm/drizzle/kit/index.js.map +0 -1
- package/dist/esm/drizzle/onchain.js +0 -102
- package/dist/esm/drizzle/onchain.js.map +0 -1
- package/dist/esm/graphql/index.js +0 -704
- package/dist/esm/graphql/index.js.map +0 -1
- package/dist/esm/graphql/json.js +0 -42
- package/dist/esm/graphql/json.js.map +0 -1
- package/dist/esm/graphql/middleware.js +0 -80
- package/dist/esm/graphql/middleware.js.map +0 -1
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/indexing/addStackTrace.js +0 -54
- package/dist/esm/indexing/addStackTrace.js.map +0 -1
- package/dist/esm/indexing/index.js +0 -10
- package/dist/esm/indexing/index.js.map +0 -1
- package/dist/esm/indexing/ponderActions.js +0 -60
- package/dist/esm/indexing/ponderActions.js.map +0 -1
- package/dist/esm/indexing/service.js +0 -312
- package/dist/esm/indexing/service.js.map +0 -1
- package/dist/esm/indexing-store/historical.js +0 -591
- package/dist/esm/indexing-store/historical.js.map +0 -1
- package/dist/esm/indexing-store/index.js +0 -19
- package/dist/esm/indexing-store/index.js.map +0 -1
- package/dist/esm/indexing-store/metadata.js +0 -46
- package/dist/esm/indexing-store/metadata.js.map +0 -1
- package/dist/esm/indexing-store/realtime.js +0 -295
- package/dist/esm/indexing-store/realtime.js.map +0 -1
- package/dist/esm/internal/common.js +0 -2
- package/dist/esm/internal/common.js.map +0 -1
- package/dist/esm/internal/errors.js +0 -175
- package/dist/esm/internal/errors.js.map +0 -1
- package/dist/esm/internal/logger.js +0 -96
- package/dist/esm/internal/logger.js.map +0 -1
- package/dist/esm/internal/metrics.js +0 -569
- package/dist/esm/internal/metrics.js.map +0 -1
- package/dist/esm/internal/options.js +0 -69
- package/dist/esm/internal/options.js.map +0 -1
- package/dist/esm/internal/shutdown.js +0 -18
- package/dist/esm/internal/shutdown.js.map +0 -1
- package/dist/esm/internal/telemetry.js +0 -199
- package/dist/esm/internal/telemetry.js.map +0 -1
- package/dist/esm/internal/types.js +0 -2
- package/dist/esm/internal/types.js.map +0 -1
- package/dist/esm/server/error.js +0 -55
- package/dist/esm/server/error.js.map +0 -1
- package/dist/esm/server/index.js +0 -107
- package/dist/esm/server/index.js.map +0 -1
- package/dist/esm/sync/abi.js +0 -67
- package/dist/esm/sync/abi.js.map +0 -1
- package/dist/esm/sync/events.js +0 -607
- package/dist/esm/sync/events.js.map +0 -1
- package/dist/esm/sync/filter.js +0 -356
- package/dist/esm/sync/filter.js.map +0 -1
- package/dist/esm/sync/fragments.js +0 -300
- package/dist/esm/sync/fragments.js.map +0 -1
- package/dist/esm/sync/index.js +0 -1001
- package/dist/esm/sync/index.js.map +0 -1
- package/dist/esm/sync/transport.js +0 -94
- package/dist/esm/sync/transport.js.map +0 -1
- package/dist/esm/sync-historical/index.js +0 -590
- package/dist/esm/sync-historical/index.js.map +0 -1
- package/dist/esm/sync-realtime/bloom.js +0 -75
- package/dist/esm/sync-realtime/bloom.js.map +0 -1
- package/dist/esm/sync-realtime/index.js +0 -794
- package/dist/esm/sync-realtime/index.js.map +0 -1
- package/dist/esm/sync-store/encoding.js +0 -157
- package/dist/esm/sync-store/encoding.js.map +0 -1
- package/dist/esm/sync-store/index.js +0 -727
- package/dist/esm/sync-store/index.js.map +0 -1
- package/dist/esm/sync-store/migrations.js +0 -1186
- package/dist/esm/sync-store/migrations.js.map +0 -1
- package/dist/esm/types/db.js +0 -2
- package/dist/esm/types/db.js.map +0 -1
- package/dist/esm/types/eth.js +0 -2
- package/dist/esm/types/eth.js.map +0 -1
- package/dist/esm/types/sync.js +0 -2
- package/dist/esm/types/sync.js.map +0 -1
- package/dist/esm/types/utils.js +0 -2
- package/dist/esm/types/utils.js.map +0 -1
- package/dist/esm/types/virtual.js +0 -2
- package/dist/esm/types/virtual.js.map +0 -1
- package/dist/esm/ui/ProgressBar.js +0 -11
- package/dist/esm/ui/ProgressBar.js.map +0 -1
- package/dist/esm/ui/Table.js +0 -50
- package/dist/esm/ui/Table.js.map +0 -1
- package/dist/esm/ui/app.js +0 -113
- package/dist/esm/ui/app.js.map +0 -1
- package/dist/esm/ui/graphiql.html.js +0 -59
- package/dist/esm/ui/graphiql.html.js.map +0 -1
- package/dist/esm/ui/index.js +0 -21
- package/dist/esm/ui/index.js.map +0 -1
- package/dist/esm/utils/bigint.js +0 -37
- package/dist/esm/utils/bigint.js.map +0 -1
- package/dist/esm/utils/chains.js +0 -3
- package/dist/esm/utils/chains.js.map +0 -1
- package/dist/esm/utils/checkpoint.js +0 -114
- package/dist/esm/utils/checkpoint.js.map +0 -1
- package/dist/esm/utils/chunk.js +0 -8
- package/dist/esm/utils/chunk.js.map +0 -1
- package/dist/esm/utils/date.js +0 -27
- package/dist/esm/utils/date.js.map +0 -1
- package/dist/esm/utils/debug.js +0 -2
- package/dist/esm/utils/debug.js.map +0 -1
- package/dist/esm/utils/dedupe.js +0 -33
- package/dist/esm/utils/dedupe.js.map +0 -1
- package/dist/esm/utils/duplicates.js +0 -19
- package/dist/esm/utils/duplicates.js.map +0 -1
- package/dist/esm/utils/estimate.js +0 -6
- package/dist/esm/utils/estimate.js.map +0 -1
- package/dist/esm/utils/extend.js +0 -28
- package/dist/esm/utils/extend.js.map +0 -1
- package/dist/esm/utils/format.js +0 -20
- package/dist/esm/utils/format.js.map +0 -1
- package/dist/esm/utils/generators.js +0 -77
- package/dist/esm/utils/generators.js.map +0 -1
- package/dist/esm/utils/hash.js +0 -11
- package/dist/esm/utils/hash.js.map +0 -1
- package/dist/esm/utils/interval.js +0 -171
- package/dist/esm/utils/interval.js.map +0 -1
- package/dist/esm/utils/lowercase.js +0 -7
- package/dist/esm/utils/lowercase.js.map +0 -1
- package/dist/esm/utils/mutex.js +0 -25
- package/dist/esm/utils/mutex.js.map +0 -1
- package/dist/esm/utils/never.js +0 -4
- package/dist/esm/utils/never.js.map +0 -1
- package/dist/esm/utils/offset.js +0 -73
- package/dist/esm/utils/offset.js.map +0 -1
- package/dist/esm/utils/order.js +0 -18
- package/dist/esm/utils/order.js.map +0 -1
- package/dist/esm/utils/partition.js +0 -37
- package/dist/esm/utils/partition.js.map +0 -1
- package/dist/esm/utils/pg.js +0 -126
- package/dist/esm/utils/pg.js.map +0 -1
- package/dist/esm/utils/pglite.js +0 -80
- package/dist/esm/utils/pglite.js.map +0 -1
- package/dist/esm/utils/port.js +0 -30
- package/dist/esm/utils/port.js.map +0 -1
- package/dist/esm/utils/print.js +0 -23
- package/dist/esm/utils/print.js.map +0 -1
- package/dist/esm/utils/promiseWithResolvers.js +0 -13
- package/dist/esm/utils/promiseWithResolvers.js.map +0 -1
- package/dist/esm/utils/queue.js +0 -145
- package/dist/esm/utils/queue.js.map +0 -1
- package/dist/esm/utils/range.js +0 -8
- package/dist/esm/utils/range.js.map +0 -1
- package/dist/esm/utils/requestQueue.js +0 -127
- package/dist/esm/utils/requestQueue.js.map +0 -1
- package/dist/esm/utils/result.js +0 -10
- package/dist/esm/utils/result.js.map +0 -1
- package/dist/esm/utils/rpc.js +0 -202
- package/dist/esm/utils/rpc.js.map +0 -1
- package/dist/esm/utils/serialize.js +0 -23
- package/dist/esm/utils/serialize.js.map +0 -1
- package/dist/esm/utils/timer.js +0 -17
- package/dist/esm/utils/timer.js.map +0 -1
- package/dist/esm/utils/wait.js +0 -8
- package/dist/esm/utils/wait.js.map +0 -1
- package/dist/esm/utils/zipper.js +0 -67
- package/dist/esm/utils/zipper.js.map +0 -1
- package/dist/types/bin/commands/codegen.d.ts +0 -5
- package/dist/types/bin/commands/codegen.d.ts.map +0 -1
- package/dist/types/bin/commands/dev.d.ts +0 -5
- package/dist/types/bin/commands/dev.d.ts.map +0 -1
- package/dist/types/bin/commands/list.d.ts +0 -5
- package/dist/types/bin/commands/list.d.ts.map +0 -1
- package/dist/types/bin/commands/serve.d.ts +0 -5
- package/dist/types/bin/commands/serve.d.ts.map +0 -1
- package/dist/types/bin/commands/start.d.ts +0 -5
- package/dist/types/bin/commands/start.d.ts.map +0 -1
- package/dist/types/bin/ponder.d.ts.map +0 -1
- package/dist/types/bin/utils/codegen.d.ts +0 -6
- package/dist/types/bin/utils/codegen.d.ts.map +0 -1
- package/dist/types/bin/utils/exit.d.ts +0 -9
- package/dist/types/bin/utils/exit.d.ts.map +0 -1
- package/dist/types/bin/utils/run.d.ts +0 -14
- package/dist/types/bin/utils/run.d.ts.map +0 -1
- package/dist/types/bin/utils/runServer.d.ts +0 -12
- package/dist/types/bin/utils/runServer.d.ts.map +0 -1
- package/dist/types/build/configAndIndexingFunctions.d.ts +0 -37
- package/dist/types/build/configAndIndexingFunctions.d.ts.map +0 -1
- package/dist/types/build/factory.d.ts +0 -10
- package/dist/types/build/factory.d.ts.map +0 -1
- package/dist/types/build/index.d.ts +0 -70
- package/dist/types/build/index.d.ts.map +0 -1
- package/dist/types/build/plugin.d.ts +0 -4
- package/dist/types/build/plugin.d.ts.map +0 -1
- package/dist/types/build/pre.d.ts +0 -35
- package/dist/types/build/pre.d.ts.map +0 -1
- package/dist/types/build/schema.d.ts +0 -18
- package/dist/types/build/schema.d.ts.map +0 -1
- package/dist/types/build/stacktrace.d.ts +0 -13
- package/dist/types/build/stacktrace.d.ts.map +0 -1
- package/dist/types/client/index.d.ts +0 -27
- package/dist/types/client/index.d.ts.map +0 -1
- package/dist/types/client/validate.d.ts +0 -2
- package/dist/types/client/validate.d.ts.map +0 -1
- package/dist/types/config/address.d.ts +0 -14
- package/dist/types/config/address.d.ts.map +0 -1
- package/dist/types/config/eventFilter.d.ts +0 -18
- package/dist/types/config/eventFilter.d.ts.map +0 -1
- package/dist/types/config/index.d.ts +0 -143
- package/dist/types/config/index.d.ts.map +0 -1
- package/dist/types/config/networks.d.ts +0 -30
- package/dist/types/config/networks.d.ts.map +0 -1
- package/dist/types/config/utilityTypes.d.ts +0 -43
- package/dist/types/config/utilityTypes.d.ts.map +0 -1
- package/dist/types/database/index.d.ts +0 -91
- package/dist/types/database/index.d.ts.map +0 -1
- package/dist/types/drizzle/bigint.d.ts +0 -25
- package/dist/types/drizzle/bigint.d.ts.map +0 -1
- package/dist/types/drizzle/hex.d.ts +0 -25
- package/dist/types/drizzle/hex.d.ts.map +0 -1
- package/dist/types/drizzle/index.d.ts +0 -14
- package/dist/types/drizzle/index.d.ts.map +0 -1
- package/dist/types/drizzle/kit/index.d.ts +0 -49
- package/dist/types/drizzle/kit/index.d.ts.map +0 -1
- package/dist/types/drizzle/onchain.d.ts.map +0 -1
- package/dist/types/graphql/index.d.ts +0 -14
- package/dist/types/graphql/index.d.ts.map +0 -1
- package/dist/types/graphql/json.d.ts +0 -3
- package/dist/types/graphql/json.d.ts.map +0 -1
- package/dist/types/graphql/middleware.d.ts +0 -29
- package/dist/types/graphql/middleware.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -18
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/indexing/addStackTrace.d.ts +0 -3
- package/dist/types/indexing/addStackTrace.d.ts.map +0 -1
- package/dist/types/indexing/index.d.ts +0 -575
- package/dist/types/indexing/index.d.ts.map +0 -1
- package/dist/types/indexing/ponderActions.d.ts +0 -47
- package/dist/types/indexing/ponderActions.d.ts.map +0 -1
- package/dist/types/indexing/service.d.ts +0 -73
- package/dist/types/indexing/service.d.ts.map +0 -1
- package/dist/types/indexing-store/historical.d.ts +0 -19
- package/dist/types/indexing-store/historical.d.ts.map +0 -1
- package/dist/types/indexing-store/index.d.ts +0 -10
- package/dist/types/indexing-store/index.d.ts.map +0 -1
- package/dist/types/indexing-store/metadata.d.ts +0 -10
- package/dist/types/indexing-store/metadata.d.ts.map +0 -1
- package/dist/types/indexing-store/realtime.d.ts +0 -10
- package/dist/types/indexing-store/realtime.d.ts.map +0 -1
- package/dist/types/internal/common.d.ts +0 -13
- package/dist/types/internal/common.d.ts.map +0 -1
- package/dist/types/internal/errors.d.ts +0 -55
- package/dist/types/internal/errors.d.ts.map +0 -1
- package/dist/types/internal/logger.d.ts +0 -26
- package/dist/types/internal/logger.d.ts.map +0 -1
- package/dist/types/internal/metrics.d.ts +0 -77
- package/dist/types/internal/metrics.d.ts.map +0 -1
- package/dist/types/internal/options.d.ts +0 -59
- package/dist/types/internal/options.d.ts.map +0 -1
- package/dist/types/internal/shutdown.d.ts +0 -8
- package/dist/types/internal/shutdown.d.ts.map +0 -1
- package/dist/types/internal/telemetry.d.ts +0 -43
- package/dist/types/internal/telemetry.d.ts.map +0 -1
- package/dist/types/internal/types.d.ts +0 -328
- package/dist/types/internal/types.d.ts.map +0 -1
- package/dist/types/server/error.d.ts +0 -5
- package/dist/types/server/error.d.ts.map +0 -1
- package/dist/types/server/index.d.ts +0 -13
- package/dist/types/server/index.d.ts.map +0 -1
- package/dist/types/sync/abi.d.ts +0 -54
- package/dist/types/sync/abi.d.ts.map +0 -1
- package/dist/types/sync/events.d.ts +0 -24
- package/dist/types/sync/events.d.ts.map +0 -1
- package/dist/types/sync/filter.d.ts +0 -71
- package/dist/types/sync/filter.d.ts.map +0 -1
- package/dist/types/sync/fragments.d.ts +0 -21
- package/dist/types/sync/fragments.d.ts.map +0 -1
- package/dist/types/sync/index.d.ts +0 -112
- package/dist/types/sync/index.d.ts.map +0 -1
- package/dist/types/sync/transport.d.ts +0 -8
- package/dist/types/sync/transport.d.ts.map +0 -1
- package/dist/types/sync-historical/index.d.ts +0 -28
- package/dist/types/sync-historical/index.d.ts.map +0 -1
- package/dist/types/sync-realtime/bloom.d.ts +0 -19
- package/dist/types/sync-realtime/bloom.d.ts.map +0 -1
- package/dist/types/sync-realtime/index.d.ts +0 -48
- package/dist/types/sync-realtime/index.d.ts.map +0 -1
- package/dist/types/sync-store/encoding.d.ts +0 -151
- package/dist/types/sync-store/encoding.d.ts.map +0 -1
- package/dist/types/sync-store/index.d.ts +0 -104
- package/dist/types/sync-store/index.d.ts.map +0 -1
- package/dist/types/sync-store/migrations.d.ts +0 -13
- package/dist/types/sync-store/migrations.d.ts.map +0 -1
- package/dist/types/types/db.d.ts +0 -213
- package/dist/types/types/db.d.ts.map +0 -1
- package/dist/types/types/eth.d.ts +0 -196
- package/dist/types/types/eth.d.ts.map +0 -1
- package/dist/types/types/sync.d.ts +0 -15
- package/dist/types/types/sync.d.ts.map +0 -1
- package/dist/types/types/utils.d.ts +0 -22
- package/dist/types/types/utils.d.ts.map +0 -1
- package/dist/types/types/virtual.d.ts +0 -95
- package/dist/types/types/virtual.d.ts.map +0 -1
- package/dist/types/ui/ProgressBar.d.ts +0 -7
- package/dist/types/ui/ProgressBar.d.ts.map +0 -1
- package/dist/types/ui/Table.d.ts +0 -24
- package/dist/types/ui/Table.d.ts.map +0 -1
- package/dist/types/ui/app.d.ts +0 -14
- package/dist/types/ui/app.d.ts.map +0 -1
- package/dist/types/ui/graphiql.html.d.ts +0 -2
- package/dist/types/ui/graphiql.html.d.ts.map +0 -1
- package/dist/types/ui/index.d.ts +0 -5
- package/dist/types/ui/index.d.ts.map +0 -1
- package/dist/types/utils/bigint.d.ts +0 -15
- package/dist/types/utils/bigint.d.ts.map +0 -1
- package/dist/types/utils/chains.d.ts +0 -3
- package/dist/types/utils/chains.d.ts.map +0 -1
- package/dist/types/utils/checkpoint.d.ts +0 -40
- package/dist/types/utils/checkpoint.d.ts.map +0 -1
- package/dist/types/utils/chunk.d.ts +0 -2
- package/dist/types/utils/chunk.d.ts.map +0 -1
- package/dist/types/utils/date.d.ts +0 -7
- package/dist/types/utils/date.d.ts.map +0 -1
- package/dist/types/utils/debug.d.ts +0 -105
- package/dist/types/utils/debug.d.ts.map +0 -1
- package/dist/types/utils/dedupe.d.ts +0 -20
- package/dist/types/utils/dedupe.d.ts.map +0 -1
- package/dist/types/utils/duplicates.d.ts +0 -7
- package/dist/types/utils/duplicates.d.ts.map +0 -1
- package/dist/types/utils/estimate.d.ts +0 -11
- package/dist/types/utils/estimate.d.ts.map +0 -1
- package/dist/types/utils/extend.d.ts +0 -13
- package/dist/types/utils/extend.d.ts.map +0 -1
- package/dist/types/utils/format.d.ts +0 -3
- package/dist/types/utils/format.d.ts.map +0 -1
- package/dist/types/utils/generators.d.ts +0 -23
- package/dist/types/utils/generators.d.ts.map +0 -1
- package/dist/types/utils/hash.d.ts +0 -11
- package/dist/types/utils/hash.d.ts.map +0 -1
- package/dist/types/utils/interval.d.ts +0 -53
- package/dist/types/utils/interval.d.ts.map +0 -1
- package/dist/types/utils/lowercase.d.ts +0 -5
- package/dist/types/utils/lowercase.d.ts.map +0 -1
- package/dist/types/utils/mutex.d.ts +0 -8
- package/dist/types/utils/mutex.d.ts.map +0 -1
- package/dist/types/utils/never.d.ts +0 -2
- package/dist/types/utils/never.d.ts.map +0 -1
- package/dist/types/utils/offset.d.ts +0 -3
- package/dist/types/utils/offset.d.ts.map +0 -1
- package/dist/types/utils/order.d.ts +0 -2
- package/dist/types/utils/order.d.ts.map +0 -1
- package/dist/types/utils/partition.d.ts +0 -22
- package/dist/types/utils/partition.d.ts.map +0 -1
- package/dist/types/utils/pg.d.ts +0 -5
- package/dist/types/utils/pg.d.ts.map +0 -1
- package/dist/types/utils/pglite.d.ts +0 -25
- package/dist/types/utils/pglite.d.ts.map +0 -1
- package/dist/types/utils/port.d.ts +0 -5
- package/dist/types/utils/port.d.ts.map +0 -1
- package/dist/types/utils/print.d.ts +0 -2
- package/dist/types/utils/print.d.ts.map +0 -1
- package/dist/types/utils/promiseWithResolvers.d.ts +0 -10
- package/dist/types/utils/promiseWithResolvers.d.ts.map +0 -1
- package/dist/types/utils/queue.d.ts +0 -33
- package/dist/types/utils/queue.d.ts.map +0 -1
- package/dist/types/utils/range.d.ts +0 -8
- package/dist/types/utils/range.d.ts.map +0 -1
- package/dist/types/utils/requestQueue.d.ts +0 -21
- package/dist/types/utils/requestQueue.d.ts.map +0 -1
- package/dist/types/utils/result.d.ts +0 -17
- package/dist/types/utils/result.d.ts.map +0 -1
- package/dist/types/utils/rpc.d.ts +0 -57
- package/dist/types/utils/rpc.d.ts.map +0 -1
- package/dist/types/utils/serialize.d.ts +0 -19
- package/dist/types/utils/serialize.d.ts.map +0 -1
- package/dist/types/utils/timer.d.ts +0 -11
- package/dist/types/utils/timer.d.ts.map +0 -1
- package/dist/types/utils/wait.d.ts +0 -6
- package/dist/types/utils/wait.d.ts.map +0 -1
- package/dist/types/utils/zipper.d.ts +0 -36
- package/dist/types/utils/zipper.d.ts.map +0 -1
- package/src/utils/dedupe.ts +0 -40
- package/src/utils/promiseWithResolvers.ts +0 -20
- package/src/utils/queue.ts +0 -250
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,819 @@
|
|
|
1
|
+
import { P as Prettify, a as PonderTypeError } from './utils-ceNucOJb.js';
|
|
2
|
+
import { Abi, AbiEvent as AbiEvent$1, AbiFunction, AbiParametersToPrimitiveTypes, FormatAbiItem } from 'abitype';
|
|
3
|
+
import { AbiEvent, GetEventArgs, ParseAbiItem, Abi as Abi$1, Narrow, Transport, Hex, Hash, Address, AccessList, TransactionType, Chain, Client, PublicRpcSchema, publicActions, MulticallParameters, MulticallReturnType, ContractFunctionName, ContractFunctionArgs, ReadContractParameters, ReadContractReturnType, SimulateContractParameters, SimulateContractReturnType, GetBlockReturnType, GetTransactionCountReturnType, GetBlockTransactionCountReturnType, PublicActions } from 'viem';
|
|
4
|
+
import { onchain, OnchainTable, PrimaryKeyBuilder } from './drizzle/onchain.js';
|
|
5
|
+
export { bigint, hex, onchainEnum, onchainTable, primaryKey } from './drizzle/onchain.js';
|
|
6
|
+
import { Table, InferSelectModel, InferInsertModel, GetColumnData, Column } from 'drizzle-orm';
|
|
7
|
+
export { and, asc, avg, avgDistinct, between, count, countDistinct, desc, eq, exists, gt, gte, ilike, inArray, isNotNull, isNull, like, lt, lte, max, min, ne, not, notBetween, notExists, notIlike, notInArray, notLike, or, relations, sql, sum, sumDistinct } from 'drizzle-orm';
|
|
8
|
+
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
9
|
+
import { TableConfig, PgTableExtraConfig } from 'drizzle-orm/pg-core';
|
|
10
|
+
export { alias, boolean, char, cidr, date, doublePrecision, except, exceptAll, foreignKey, index, inet, bigint as int8, integer, intersect, intersectAll, interval, json, jsonb, line, macaddr, macaddr8, numeric, point, real, smallint, text, time, timestamp, union, unionAll, uniqueIndex, uuid, varchar } from 'drizzle-orm/pg-core';
|
|
11
|
+
import { PgliteDatabase } from 'drizzle-orm/pglite';
|
|
12
|
+
export { MergeAbis, ReplaceBigInts, loadBalance, mergeAbis, rateLimit, replaceBigInts } from '@ponder/utils';
|
|
13
|
+
import * as hono from 'hono';
|
|
14
|
+
import 'drizzle-orm/pg-core/columns/all';
|
|
15
|
+
|
|
16
|
+
type Factory<event extends AbiEvent = AbiEvent> = {
|
|
17
|
+
/** Address of the factory contract that creates this contract. */
|
|
18
|
+
address: `0x${string}` | readonly `0x${string}`[];
|
|
19
|
+
/** ABI event that announces the creation of a new instance of this contract. */
|
|
20
|
+
event: event;
|
|
21
|
+
/** Name of the factory event parameter that contains the new child contract address. */
|
|
22
|
+
parameter: Exclude<event["inputs"][number]["name"], undefined>;
|
|
23
|
+
};
|
|
24
|
+
declare const factory: <event extends AbiEvent>(factory: Factory<event>) => Factory<event>;
|
|
25
|
+
type AddressConfig = {
|
|
26
|
+
address?: `0x${string}` | readonly `0x${string}`[] | Factory;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type ExtractAbiEvents<abi extends Abi, events = Extract<abi[number], {
|
|
30
|
+
type: "event";
|
|
31
|
+
}>> = [events] extends [never] ? AbiEvent$1 : events;
|
|
32
|
+
type ExtractAbiFunctions<abi extends Abi, functions = Extract<abi[number], {
|
|
33
|
+
type: "function";
|
|
34
|
+
}>> = [functions] extends [never] ? AbiFunction : functions;
|
|
35
|
+
/** Return the abi event given the abi and compact signature. */
|
|
36
|
+
type ParseAbiEvent<abi extends Abi, signature extends string, abiEvents extends AbiEvent$1 = ExtractAbiEvents<abi>, noOverloadEvent = Extract<abiEvents, {
|
|
37
|
+
name: signature;
|
|
38
|
+
}>, overloadEvent = Extract<abiEvents, ParseAbiItem<`event ${signature}`>>> = [noOverloadEvent] extends [never] ? [overloadEvent] extends [never] ? AbiEvent$1 : overloadEvent : noOverloadEvent;
|
|
39
|
+
/** Return the abi function given the abi and compact signature. */
|
|
40
|
+
type ParseAbiFunction<abi extends Abi, signature extends string, abiFunctions extends AbiFunction = ExtractAbiFunctions<abi>, noOverloadFunction = Extract<abiFunctions, {
|
|
41
|
+
name: signature extends `${infer _signature}()` ? _signature : never;
|
|
42
|
+
}>, overloadFunction = Extract<abiFunctions, ParseAbiItem<`function ${signature}`>>> = [overloadFunction] extends [never] ? [noOverloadFunction] extends [never] ? AbiFunction : noOverloadFunction : overloadFunction;
|
|
43
|
+
/** Return the compact signature given the abi and abi event. */
|
|
44
|
+
type FormatAbiEvent<abi extends Abi, event extends AbiEvent$1, abiEvents extends AbiEvent$1 = ExtractAbiEvents<abi>, matchingNameEvents extends AbiEvent$1 = Extract<abiEvents, {
|
|
45
|
+
name: event["name"];
|
|
46
|
+
}>> = [matchingNameEvents] extends [never] ? Abi extends abi ? event["name"] : never : [Exclude<matchingNameEvents, event>] extends [never] ? event["name"] : FormatAbiItem<event> extends `event ${infer signature}` ? signature : never;
|
|
47
|
+
/** Return the compact signature given the abi and abi function. */
|
|
48
|
+
type FormatAbiFunction<abi extends Abi, _function extends AbiFunction, abiFunctions extends AbiFunction = ExtractAbiFunctions<abi>, matchingNameFunctions extends AbiFunction = Extract<abiFunctions, {
|
|
49
|
+
name: _function["name"];
|
|
50
|
+
}>> = [matchingNameFunctions] extends [never] ? Abi extends abi ? `${_function["name"]}()` : never : [Exclude<matchingNameFunctions, _function>] extends [never] ? `${_function["name"]}()` : FormatAbiItem<_function> extends `function ${infer signature}` ? signature : never;
|
|
51
|
+
/**
|
|
52
|
+
* Return an union of safe event names that handle event overridding.
|
|
53
|
+
*/
|
|
54
|
+
type SafeEventNames<abi extends Abi, abiEvents extends AbiEvent$1 = ExtractAbiEvents<abi>> = abiEvents extends abiEvents ? FormatAbiEvent<abi, abiEvents> : never;
|
|
55
|
+
/**
|
|
56
|
+
* Return an union of safe function names that handle function overridding.
|
|
57
|
+
*/
|
|
58
|
+
type SafeFunctionNames<abi extends Abi, abiFunctions extends AbiFunction = ExtractAbiFunctions<abi>> = abiFunctions extends abiFunctions ? FormatAbiFunction<abi, abiFunctions> : never;
|
|
59
|
+
type FormatEventArgs<abi extends Abi, signature extends string> = GetEventArgs<Abi, string, {
|
|
60
|
+
EnableUnion: false;
|
|
61
|
+
IndexedOnly: false;
|
|
62
|
+
Required: true;
|
|
63
|
+
}, ParseAbiEvent<abi, signature>>;
|
|
64
|
+
type FormatFunctionArgs<abi extends Abi, signature extends string, args = AbiParametersToPrimitiveTypes<ParseAbiFunction<abi, signature>["inputs"]>> = readonly [] extends args ? never : args;
|
|
65
|
+
type FormatFunctionResult<abi extends Abi, signature extends string, result = AbiParametersToPrimitiveTypes<ParseAbiFunction<abi, signature>["outputs"]>> = readonly [] extends result ? never : result extends readonly [unknown] ? result[0] : result;
|
|
66
|
+
|
|
67
|
+
type FilterArgs<abi extends Abi$1, event extends string> = GetEventArgs<abi, string, {
|
|
68
|
+
EnableUnion: true;
|
|
69
|
+
IndexedOnly: true;
|
|
70
|
+
Required: false;
|
|
71
|
+
}, ParseAbiEvent<abi, event>>;
|
|
72
|
+
type GetEventFilter<abi extends Abi$1, safeEventNames extends string = SafeEventNames<abi>> = {
|
|
73
|
+
filter?: (safeEventNames extends safeEventNames ? {
|
|
74
|
+
event: safeEventNames;
|
|
75
|
+
args: FilterArgs<abi, safeEventNames>;
|
|
76
|
+
} : never) | (safeEventNames extends safeEventNames ? {
|
|
77
|
+
event: safeEventNames;
|
|
78
|
+
args: FilterArgs<abi, safeEventNames>;
|
|
79
|
+
} : never)[];
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
type Config = {
|
|
83
|
+
database?: DatabaseConfig$1;
|
|
84
|
+
ordering?: "omnichain" | "multichain";
|
|
85
|
+
networks: {
|
|
86
|
+
[networkName: string]: NetworkConfig$1<unknown>;
|
|
87
|
+
};
|
|
88
|
+
contracts: {
|
|
89
|
+
[contractName: string]: GetContract;
|
|
90
|
+
};
|
|
91
|
+
accounts: {
|
|
92
|
+
[accountName: string]: AccountConfig<unknown>;
|
|
93
|
+
};
|
|
94
|
+
blocks: {
|
|
95
|
+
[sourceName: string]: GetBlockFilter<unknown>;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
type CreateConfigReturnType<networks, contracts, accounts, blocks> = {
|
|
99
|
+
database?: DatabaseConfig$1;
|
|
100
|
+
ordering?: "omnichain" | "multichain";
|
|
101
|
+
networks: networks;
|
|
102
|
+
contracts: contracts;
|
|
103
|
+
accounts: accounts;
|
|
104
|
+
blocks: blocks;
|
|
105
|
+
};
|
|
106
|
+
declare const createConfig: <const networks, const contracts = {}, const accounts = {}, const blocks = {}>(config: {
|
|
107
|
+
database?: DatabaseConfig$1 | undefined;
|
|
108
|
+
ordering?: "omnichain" | "multichain" | undefined;
|
|
109
|
+
networks: NetworksConfig<Narrow<networks>>;
|
|
110
|
+
contracts?: ContractsConfig<networks, Narrow<contracts>> | undefined;
|
|
111
|
+
accounts?: AccountsConfig<networks, Narrow<accounts>> | undefined;
|
|
112
|
+
blocks?: BlockFiltersConfig<networks, blocks> | undefined;
|
|
113
|
+
}) => CreateConfigReturnType<networks, contracts, accounts, blocks>;
|
|
114
|
+
type DatabaseConfig$1 = {
|
|
115
|
+
kind: "pglite";
|
|
116
|
+
/** Directory path to use for PGlite database files. Default: `".ponder/pglite"`. */
|
|
117
|
+
directory?: string;
|
|
118
|
+
} | {
|
|
119
|
+
kind: "postgres";
|
|
120
|
+
/** Postgres database connection string. Default: `DATABASE_PRIVATE_URL` > `DATABASE_URL` environment variable. */
|
|
121
|
+
connectionString?: string;
|
|
122
|
+
/** Postgres pool configuration passed to `node-postgres`. */
|
|
123
|
+
poolConfig?: {
|
|
124
|
+
/** Maximum number of clients in the pool. Default: `30`. */
|
|
125
|
+
max?: number;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
type BlockConfig$1 = {
|
|
129
|
+
/** Block number at which to start indexing events (inclusive). If `undefined`, events will be processed from block 0. Default: `undefined`. */
|
|
130
|
+
startBlock?: number | "latest";
|
|
131
|
+
/** Block number at which to stop indexing events (inclusive). If `undefined`, events will be processed in real-time. Default: `undefined`. */
|
|
132
|
+
endBlock?: number | "latest";
|
|
133
|
+
};
|
|
134
|
+
type TransactionReceiptConfig = {
|
|
135
|
+
includeTransactionReceipts?: boolean;
|
|
136
|
+
};
|
|
137
|
+
type FunctionCallConfig = {
|
|
138
|
+
includeCallTraces?: boolean;
|
|
139
|
+
};
|
|
140
|
+
type NetworkConfig$1<network> = {
|
|
141
|
+
/** Chain ID of the network. */
|
|
142
|
+
chainId: network extends {
|
|
143
|
+
chainId: infer chainId extends number;
|
|
144
|
+
} ? chainId | number : number;
|
|
145
|
+
/** A viem `http`, `webSocket`, or `fallback` [Transport](https://viem.sh/docs/clients/transports/http.html).
|
|
146
|
+
*
|
|
147
|
+
* __To avoid rate limiting, include a custom RPC URL.__ Usage:
|
|
148
|
+
*
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { http } from "viem";
|
|
151
|
+
*
|
|
152
|
+
* const network = {
|
|
153
|
+
* name: "mainnet",
|
|
154
|
+
* chainId: 1,
|
|
155
|
+
* transport: http("https://eth-mainnet.g.alchemy.com/v2/..."),
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
transport: Transport;
|
|
160
|
+
/** Polling interval (in ms). Default: `1_000`. */
|
|
161
|
+
pollingInterval?: number;
|
|
162
|
+
/** Maximum number of RPC requests per second. Default: `50`. */
|
|
163
|
+
maxRequestsPerSecond?: number;
|
|
164
|
+
/** Disable RPC request caching. Default: `false`. */
|
|
165
|
+
disableCache?: boolean;
|
|
166
|
+
};
|
|
167
|
+
type NetworksConfig<networks> = {} extends networks ? {} : {
|
|
168
|
+
[networkName in keyof networks]: NetworkConfig$1<networks[networkName]>;
|
|
169
|
+
};
|
|
170
|
+
type AbiConfig<abi extends Abi | readonly unknown[]> = {
|
|
171
|
+
/** Contract application byte interface. */
|
|
172
|
+
abi: abi;
|
|
173
|
+
};
|
|
174
|
+
type GetContractNetwork<networks, abi extends Abi, allNetworkNames extends string = [keyof networks] extends [never] ? string : keyof networks & string> = {
|
|
175
|
+
/**
|
|
176
|
+
* Network that this contract is deployed to. Must match a network name in `networks`.
|
|
177
|
+
* Any filter information overrides the values in the higher level "contracts" property.
|
|
178
|
+
*/
|
|
179
|
+
network: allNetworkNames | {
|
|
180
|
+
[name in allNetworkNames]?: Prettify<AddressConfig & GetEventFilter<abi> & TransactionReceiptConfig & FunctionCallConfig & BlockConfig$1>;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
type ContractConfig$1<networks, abi extends Abi> = Prettify<AbiConfig<abi> & GetContractNetwork<networks, abi> & AddressConfig & GetEventFilter<abi> & TransactionReceiptConfig & FunctionCallConfig & BlockConfig$1>;
|
|
184
|
+
type GetContract<networks = unknown, contract = unknown> = contract extends {
|
|
185
|
+
abi: infer abi extends Abi;
|
|
186
|
+
} ? ContractConfig$1<networks, abi> : ContractConfig$1<networks, Abi>;
|
|
187
|
+
type ContractsConfig<networks, contracts> = {} extends contracts ? {} : {
|
|
188
|
+
[name in keyof contracts]: GetContract<networks, contracts[name]>;
|
|
189
|
+
};
|
|
190
|
+
type GetAccountNetwork<networks, allNetworkNames extends string = [keyof networks] extends [never] ? string : keyof networks & string> = {
|
|
191
|
+
/**
|
|
192
|
+
* Network that this account is deployed to. Must match a network name in `networks`.
|
|
193
|
+
* Any filter information overrides the values in the higher level "accounts" property.
|
|
194
|
+
*/
|
|
195
|
+
network: allNetworkNames | {
|
|
196
|
+
[name in allNetworkNames]?: Prettify<AddressConfig & TransactionReceiptConfig & BlockConfig$1>;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
type AccountConfig<networks> = Prettify<GetAccountNetwork<networks> & Required<AddressConfig> & TransactionReceiptConfig & BlockConfig$1>;
|
|
200
|
+
type AccountsConfig<networks, accounts> = {} extends accounts ? {} : {
|
|
201
|
+
[name in keyof accounts]: AccountConfig<networks>;
|
|
202
|
+
};
|
|
203
|
+
type BlockFilterConfig = {
|
|
204
|
+
/** Block number at which to start indexing events (inclusive). If `undefined`, events will be processed from block 0. Default: `undefined`. */
|
|
205
|
+
startBlock?: number | "latest";
|
|
206
|
+
/** Block number at which to stop indexing events (inclusive). If `undefined`, events will be processed in real-time. Default: `undefined`. */
|
|
207
|
+
endBlock?: number | "latest";
|
|
208
|
+
interval?: number;
|
|
209
|
+
};
|
|
210
|
+
type GetBlockFilter<networks, allNetworkNames extends string = [keyof networks] extends [never] ? string : keyof networks & string> = BlockFilterConfig & {
|
|
211
|
+
network: allNetworkNames | {
|
|
212
|
+
[name in allNetworkNames]?: BlockFilterConfig;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
type BlockFiltersConfig<networks = unknown, blocks = unknown> = {} extends blocks ? {} : {
|
|
216
|
+
[name in keyof blocks]: GetBlockFilter<networks>;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* A confirmed Ethereum block.
|
|
221
|
+
*
|
|
222
|
+
* @link https://docs.soliditylang.org/en/v0.8.20/introduction-to-smart-contracts.html#blocks
|
|
223
|
+
*/
|
|
224
|
+
type Block = {
|
|
225
|
+
/** Base fee per gas */
|
|
226
|
+
baseFeePerGas: bigint | null;
|
|
227
|
+
/** Difficulty for this block */
|
|
228
|
+
difficulty: bigint;
|
|
229
|
+
/** "Extra data" field of this block */
|
|
230
|
+
extraData: Hex;
|
|
231
|
+
/** Maximum gas allowed in this block */
|
|
232
|
+
gasLimit: bigint;
|
|
233
|
+
/** Total used gas by all transactions in this block */
|
|
234
|
+
gasUsed: bigint;
|
|
235
|
+
/** Block hash */
|
|
236
|
+
hash: Hash;
|
|
237
|
+
/** Logs bloom filter */
|
|
238
|
+
logsBloom: Hex;
|
|
239
|
+
/** Address that received this block’s mining rewards */
|
|
240
|
+
miner: Address;
|
|
241
|
+
/** Unique identifier for the block. */
|
|
242
|
+
mixHash: Hash | null;
|
|
243
|
+
/** Proof-of-work hash */
|
|
244
|
+
nonce: Hex | null;
|
|
245
|
+
/** Block number */
|
|
246
|
+
number: bigint;
|
|
247
|
+
/** Parent block hash */
|
|
248
|
+
parentHash: Hash;
|
|
249
|
+
/** Root of the this block’s receipts trie */
|
|
250
|
+
receiptsRoot: Hex;
|
|
251
|
+
/** SHA3 of the uncles data in this block */
|
|
252
|
+
sha3Uncles: Hash | null;
|
|
253
|
+
/** Size of this block in bytes */
|
|
254
|
+
size: bigint;
|
|
255
|
+
/** Root of this block’s final state trie */
|
|
256
|
+
stateRoot: Hash;
|
|
257
|
+
/** Unix timestamp of when this block was collated */
|
|
258
|
+
timestamp: bigint;
|
|
259
|
+
/** Total difficulty of the chain until this block */
|
|
260
|
+
totalDifficulty: bigint | null;
|
|
261
|
+
/** Root of this block’s transaction trie */
|
|
262
|
+
transactionsRoot: Hash;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* A confirmed Ethereum transaction. Contains `legacy`, `EIP-1559`, or `EIP-2930` fee values depending on the transaction `type`.
|
|
266
|
+
*
|
|
267
|
+
* @link https://docs.soliditylang.org/en/v0.8.20/introduction-to-smart-contracts.html#transactions
|
|
268
|
+
*/
|
|
269
|
+
type Transaction = Prettify<{
|
|
270
|
+
/** Transaction sender */
|
|
271
|
+
from: Address;
|
|
272
|
+
/** Gas provided for transaction execution */
|
|
273
|
+
gas: bigint;
|
|
274
|
+
/** Hash of this transaction */
|
|
275
|
+
hash: Hash;
|
|
276
|
+
/** Contract code or a hashed method call */
|
|
277
|
+
input: Hex;
|
|
278
|
+
/** Unique number identifying this transaction */
|
|
279
|
+
nonce: number;
|
|
280
|
+
/** ECDSA signature r */
|
|
281
|
+
r: Hex | null;
|
|
282
|
+
/** ECDSA signature s */
|
|
283
|
+
s: Hex | null;
|
|
284
|
+
/** Transaction recipient or `null` if deploying a contract */
|
|
285
|
+
to: Address | null;
|
|
286
|
+
/** Index of this transaction in the block */
|
|
287
|
+
transactionIndex: number;
|
|
288
|
+
/** ECDSA recovery ID */
|
|
289
|
+
v: bigint | null;
|
|
290
|
+
/** Value in wei sent with this transaction */
|
|
291
|
+
value: bigint;
|
|
292
|
+
} & ({
|
|
293
|
+
/** Transaction type. */
|
|
294
|
+
type: "legacy";
|
|
295
|
+
accessList?: never;
|
|
296
|
+
/** Base fee per gas. Only present in legacy and EIP-2930 transactions. */
|
|
297
|
+
gasPrice: bigint;
|
|
298
|
+
maxFeePerGas?: never;
|
|
299
|
+
maxPriorityFeePerGas?: never;
|
|
300
|
+
} | {
|
|
301
|
+
/** Transaction type. */
|
|
302
|
+
type: "eip2930";
|
|
303
|
+
/** List of addresses and storage keys the transaction will access. */
|
|
304
|
+
accessList: AccessList;
|
|
305
|
+
/** Base fee per gas. Only present in legacy and EIP-2930 transactions. */
|
|
306
|
+
gasPrice: bigint;
|
|
307
|
+
maxFeePerGas?: never;
|
|
308
|
+
maxPriorityFeePerGas?: never;
|
|
309
|
+
} | {
|
|
310
|
+
/** Transaction type. */
|
|
311
|
+
type: "eip1559";
|
|
312
|
+
accessList?: never;
|
|
313
|
+
gasPrice?: never;
|
|
314
|
+
/** Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas). Only present in EIP-1559 transactions. */
|
|
315
|
+
maxFeePerGas: bigint;
|
|
316
|
+
/** Max priority fee per gas (in wei). Only present in EIP-1559 transactions. */
|
|
317
|
+
maxPriorityFeePerGas: bigint;
|
|
318
|
+
} | {
|
|
319
|
+
/** Transaction type. */
|
|
320
|
+
type: "deposit";
|
|
321
|
+
accessList?: never;
|
|
322
|
+
gasPrice?: never;
|
|
323
|
+
/** Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas). Only present in EIP-1559 transactions. */
|
|
324
|
+
maxFeePerGas?: bigint;
|
|
325
|
+
/** Max priority fee per gas (in wei). Only present in EIP-1559 transactions. */
|
|
326
|
+
maxPriorityFeePerGas?: bigint;
|
|
327
|
+
} | {
|
|
328
|
+
/** Transaction type. */
|
|
329
|
+
type: Hex;
|
|
330
|
+
gasPrice?: never;
|
|
331
|
+
accessList?: never;
|
|
332
|
+
maxFeePerGas?: never;
|
|
333
|
+
maxPriorityFeePerGas?: never;
|
|
334
|
+
})>;
|
|
335
|
+
/**
|
|
336
|
+
* A confirmed Ethereum log.
|
|
337
|
+
*
|
|
338
|
+
* @link https://docs.soliditylang.org/en/v0.8.20/abi-spec.html#events
|
|
339
|
+
*/
|
|
340
|
+
type Log = {
|
|
341
|
+
/** Globally unique identifier for this log (`${blockHash}-${logIndex}`) */
|
|
342
|
+
id: string;
|
|
343
|
+
/** The address from which this log originated */
|
|
344
|
+
address: Address;
|
|
345
|
+
/** Contains the non-indexed arguments of the log */
|
|
346
|
+
data: Hex;
|
|
347
|
+
/** Index of this log within its block */
|
|
348
|
+
logIndex: number;
|
|
349
|
+
/** `true` if this log has been removed in a chain reorganization */
|
|
350
|
+
removed: boolean;
|
|
351
|
+
/** List of order-dependent topics */
|
|
352
|
+
topics: [Hex, ...Hex[]] | [];
|
|
353
|
+
};
|
|
354
|
+
/** A confirmed Ethereum transaction receipt. */
|
|
355
|
+
type TransactionReceipt = {
|
|
356
|
+
/** Address of new contract or `null` if no contract was created */
|
|
357
|
+
contractAddress: Address | null;
|
|
358
|
+
/** Gas used by this and all preceding transactions in this block */
|
|
359
|
+
cumulativeGasUsed: bigint;
|
|
360
|
+
/** Pre-London, it is equal to the transaction's gasPrice. Post-London, it is equal to the actual gas price paid for inclusion. */
|
|
361
|
+
effectiveGasPrice: bigint;
|
|
362
|
+
/** Transaction sender */
|
|
363
|
+
from: Address;
|
|
364
|
+
/** Gas used by this transaction */
|
|
365
|
+
gasUsed: bigint;
|
|
366
|
+
/** Logs bloom filter */
|
|
367
|
+
logsBloom: Hex;
|
|
368
|
+
/** `success` if this transaction was successful or `reverted` if it failed */
|
|
369
|
+
status: "success" | "reverted";
|
|
370
|
+
/** Transaction recipient or `null` if deploying a contract */
|
|
371
|
+
to: Address | null;
|
|
372
|
+
/** Transaction type */
|
|
373
|
+
type: TransactionType;
|
|
374
|
+
};
|
|
375
|
+
type Trace = {
|
|
376
|
+
/** Globally unique identifier for this trace (`${transactionHash}-${tracePosition}`) */
|
|
377
|
+
id: string;
|
|
378
|
+
/** The type of the call. */
|
|
379
|
+
type: "CALL" | "CALLCODE" | "DELEGATECALL" | "STATICCALL" | "CREATE" | "CREATE2" | "SELFDESTRUCT";
|
|
380
|
+
/** The address of that initiated the call. */
|
|
381
|
+
from: Address;
|
|
382
|
+
/** The address of the contract that was called. */
|
|
383
|
+
to: Address | null;
|
|
384
|
+
/** How much gas was left before the call. */
|
|
385
|
+
gas: bigint;
|
|
386
|
+
/** How much gas was used by the call. */
|
|
387
|
+
gasUsed: bigint;
|
|
388
|
+
/** Calldata input. */
|
|
389
|
+
input: Hex;
|
|
390
|
+
/** Output of the call, if any. */
|
|
391
|
+
output?: Hex;
|
|
392
|
+
/** Error message, if any. */
|
|
393
|
+
error?: string;
|
|
394
|
+
/** Why this call reverted, if it reverted. */
|
|
395
|
+
revertReason?: string;
|
|
396
|
+
/** Value transferred. */
|
|
397
|
+
value: bigint | null;
|
|
398
|
+
/** Index of this trace in the transaction. */
|
|
399
|
+
traceIndex: number;
|
|
400
|
+
/** Number of subcalls. */
|
|
401
|
+
subcalls: number;
|
|
402
|
+
};
|
|
403
|
+
/** A native token transfer. */
|
|
404
|
+
type Transfer = {
|
|
405
|
+
/** The address that sent the transfer */
|
|
406
|
+
from: Address;
|
|
407
|
+
/** The address that received the transfer */
|
|
408
|
+
to: Address;
|
|
409
|
+
/** The amount of tokens transferred */
|
|
410
|
+
value: bigint;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Fix issue with Array.isArray not checking readonly arrays
|
|
415
|
+
* {@link https://github.com/microsoft/TypeScript/issues/17002}
|
|
416
|
+
*/
|
|
417
|
+
declare global {
|
|
418
|
+
interface ArrayConstructor {
|
|
419
|
+
isArray(arg: ReadonlyArray<any> | any): arg is ReadonlyArray<any>;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** User-defined tables, enums, and indexes. */
|
|
424
|
+
type Schema = {
|
|
425
|
+
[name: string]: unknown;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
type Drizzle<TSchema extends Schema = {
|
|
429
|
+
[name: string]: never;
|
|
430
|
+
}> = NodePgDatabase<TSchema> | PgliteDatabase<TSchema>;
|
|
431
|
+
type ReadonlyDrizzle<TSchema extends Schema = {
|
|
432
|
+
[name: string]: never;
|
|
433
|
+
}> = Omit<Drizzle<TSchema>, "insert" | "update" | "delete" | "transaction" | "refreshMaterializedView" | "_">;
|
|
434
|
+
type Db<schema extends Schema> = {
|
|
435
|
+
/**
|
|
436
|
+
* Find a row
|
|
437
|
+
*
|
|
438
|
+
* - Docs: https://ponder.sh/docs/indexing/write-to-the-database#find
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```ts twoslash
|
|
442
|
+
* const result = await db.find(table, { id: 10 });
|
|
443
|
+
* ```
|
|
444
|
+
*
|
|
445
|
+
* @param table - The table to select from.
|
|
446
|
+
* @param key - The primary key.
|
|
447
|
+
* @returns The row if it exists or undefined if it doesn't.
|
|
448
|
+
*/
|
|
449
|
+
find: Find;
|
|
450
|
+
/**
|
|
451
|
+
* Create new rows
|
|
452
|
+
*
|
|
453
|
+
* - Docs: https://ponder.sh/docs/indexing/write-to-the-database#insert
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```ts twoslash
|
|
457
|
+
* await db.insert(table).values({ id: 10, name: "joe" });
|
|
458
|
+
* ```
|
|
459
|
+
*
|
|
460
|
+
* @example
|
|
461
|
+
* ```ts twoslash
|
|
462
|
+
* await db.insert(table).values([
|
|
463
|
+
* { id: 10, name: "joe" },
|
|
464
|
+
* { id: 3, name: "rob" }
|
|
465
|
+
* ]);
|
|
466
|
+
* ```
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```ts twoslash
|
|
470
|
+
* await db.insert(table).values({ id: 10, name: "joe" }).onConflictDoNothing();
|
|
471
|
+
* ```
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* ```ts twoslash
|
|
475
|
+
* await db
|
|
476
|
+
* .insert(table)
|
|
477
|
+
* .values({ id: 10, name: "joe" })
|
|
478
|
+
* .onConflictDoUpdate((row) => ({ age: row.age + 3 }));
|
|
479
|
+
* ```
|
|
480
|
+
*
|
|
481
|
+
* @param table - The table to insert into.
|
|
482
|
+
*/
|
|
483
|
+
insert: Insert;
|
|
484
|
+
/**
|
|
485
|
+
* Update a row
|
|
486
|
+
*
|
|
487
|
+
* - Docs: https://ponder.sh/docs/indexing/write-to-the-database#update
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```ts twoslash
|
|
491
|
+
* await db
|
|
492
|
+
* .update(table, { id: 10 })
|
|
493
|
+
* .set({ age: 19 });
|
|
494
|
+
* ```
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```ts twoslash
|
|
498
|
+
* await db
|
|
499
|
+
* .update(table, { id: 10 })
|
|
500
|
+
* .set((row) => ({ age: row.age + 3 }));
|
|
501
|
+
* ```
|
|
502
|
+
*
|
|
503
|
+
* @param table - The table to select from.
|
|
504
|
+
* @param key - The primary key.
|
|
505
|
+
*/
|
|
506
|
+
update: Update;
|
|
507
|
+
/**
|
|
508
|
+
* Delete a row
|
|
509
|
+
*
|
|
510
|
+
* - Docs: https://ponder.sh/docs/indexing/write-to-the-database#delete
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* ```ts twoslash
|
|
514
|
+
* const deleted = await db.delete(table, { id: 10 });
|
|
515
|
+
* ```
|
|
516
|
+
*
|
|
517
|
+
* @param table - The table to select from.
|
|
518
|
+
* @param key - The primary key.
|
|
519
|
+
* @returns `true` if the row existed.
|
|
520
|
+
*/
|
|
521
|
+
delete: Delete;
|
|
522
|
+
/**
|
|
523
|
+
* Access the raw drizzle object
|
|
524
|
+
*
|
|
525
|
+
* - Docs: https://ponder.sh/docs/indexing/write-to-the-database#raw-sql
|
|
526
|
+
*/
|
|
527
|
+
sql: Prettify<Omit<Drizzle<schema>, "refreshMaterializedView" | "_">>;
|
|
528
|
+
};
|
|
529
|
+
type InferPrimaryKey<table extends Table, columns extends Record<string, Column> = table["_"]["columns"], columnNames extends keyof columns & string = keyof columns & string> = columnNames extends columnNames ? columns[columnNames]["_"]["isPrimaryKey"] extends true ? columnNames : never : never;
|
|
530
|
+
type Key<table extends Table, compositePrimaryKey extends keyof table["_"]["columns"] = InferCompositePrimaryKey<table>, primaryKey extends keyof table["_"]["columns"] = [
|
|
531
|
+
compositePrimaryKey
|
|
532
|
+
] extends [never] ? InferPrimaryKey<table> : compositePrimaryKey> = {
|
|
533
|
+
[columnName in primaryKey]: GetColumnData<table["_"]["columns"][columnName]>;
|
|
534
|
+
};
|
|
535
|
+
type InferCompositePrimaryKey<table extends OnchainTable<TableConfig & {
|
|
536
|
+
extra: PgTableExtraConfig | undefined;
|
|
537
|
+
}>, extra extends PgTableExtraConfig | undefined = table["_"]["config"]["extra"], builders = extra[keyof extra]> = builders extends builders ? builders extends PrimaryKeyBuilder ? builders["columnNames"] : never : never;
|
|
538
|
+
type Find = <table extends Table>(table: table extends {
|
|
539
|
+
[onchain]: true;
|
|
540
|
+
} ? table : PonderTypeError<`db.find() can only be used with onchain tables, and '${table["_"]["name"]}' is an offchain table.`>, key: Key<table>) => Promise<InferSelectModel<table> | null>;
|
|
541
|
+
type Insert = <table extends Table, insertModel = InferInsertModel<table>, selectModel = InferSelectModel<table>, updateModel = Prettify<Omit<insertModel, keyof Key<table>>>, updateFn = (row: selectModel) => Partial<updateModel>>(table: table extends {
|
|
542
|
+
[onchain]: true;
|
|
543
|
+
} ? table : PonderTypeError<`Indexing functions can only write to onchain tables, and '${table["_"]["name"]}' is an offchain table.`>) => {
|
|
544
|
+
/**
|
|
545
|
+
* Create new rows
|
|
546
|
+
*
|
|
547
|
+
* - Docs: https://ponder.sh/docs/indexing/write-to-the-database#insert
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```ts twoslash
|
|
551
|
+
* await db.insert(table).values({ id: 10, name: "joe" });
|
|
552
|
+
* ```
|
|
553
|
+
*
|
|
554
|
+
* @example
|
|
555
|
+
* ```ts twoslash
|
|
556
|
+
* await db.insert(table).values([
|
|
557
|
+
* { id: 10, name: "joe" },
|
|
558
|
+
* { id: 3, name: "rob" }
|
|
559
|
+
* ]);
|
|
560
|
+
* ```
|
|
561
|
+
* @param table - The table to insert into.
|
|
562
|
+
*/
|
|
563
|
+
values: <values extends insertModel | insertModel[]>(values: values) => Promise<values extends unknown[] ? selectModel[] : selectModel> & {
|
|
564
|
+
/**
|
|
565
|
+
* Create new rows, cancelling the insert if there is a conflict
|
|
566
|
+
*
|
|
567
|
+
* - Docs: https://ponder.sh/docs/indexing/write-to-the-database#upsert--conflict-resolution
|
|
568
|
+
* @example
|
|
569
|
+
* ```ts twoslash
|
|
570
|
+
* await db.insert(table).values({ id: 10, name: "joe" }).onConflictDoNothing();
|
|
571
|
+
* ```
|
|
572
|
+
* @param table - The table to insert into.
|
|
573
|
+
*/
|
|
574
|
+
onConflictDoNothing: () => Promise<values extends unknown[] ? (selectModel | null)[] : selectModel | null>;
|
|
575
|
+
/**
|
|
576
|
+
* Create new rows, updating the row if there is a conflict
|
|
577
|
+
*
|
|
578
|
+
* - Docs: https://ponder.sh/docs/indexing/write-to-the-database#upsert--conflict-resolution
|
|
579
|
+
*
|
|
580
|
+
* @example
|
|
581
|
+
* ```ts twoslash
|
|
582
|
+
* await db
|
|
583
|
+
* .insert(table)
|
|
584
|
+
* .values({ id: 10, name: "joe" })
|
|
585
|
+
* .onConflictDoUpdate({ age: 24 });
|
|
586
|
+
* ```
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```ts twoslash
|
|
590
|
+
* await db
|
|
591
|
+
* .insert(table)
|
|
592
|
+
* .values({ id: 10, name: "joe" })
|
|
593
|
+
* .onConflictDoUpdate((row) => ({ age: row.age + 3 }));
|
|
594
|
+
* ```
|
|
595
|
+
*
|
|
596
|
+
* @param table - The table to insert into.
|
|
597
|
+
*/
|
|
598
|
+
onConflictDoUpdate: (values: Partial<updateModel> | updateFn) => Promise<values extends unknown[] ? selectModel[] : selectModel>;
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
type Update = <table extends Table, insertModel = InferInsertModel<table>, selectModel = InferSelectModel<table>, insertValues = Prettify<Omit<insertModel, keyof Key<table>>>, updateFn = (row: selectModel) => Partial<insertModel>>(table: table extends {
|
|
602
|
+
[onchain]: true;
|
|
603
|
+
} ? table : PonderTypeError<`Indexing functions can only write to onchain tables, and '${table["_"]["name"]}' is an offchain table.`>, key: Key<table>) => {
|
|
604
|
+
/**
|
|
605
|
+
* Update a row
|
|
606
|
+
*
|
|
607
|
+
* - Docs: https://ponder.sh/docs/indexing/write-to-the-database#update
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* ```ts twoslash
|
|
611
|
+
* await db
|
|
612
|
+
* .update(table, { id: 10 })
|
|
613
|
+
* .set({ age: 19 });
|
|
614
|
+
* ```
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```ts twoslash
|
|
618
|
+
* await db
|
|
619
|
+
* .update(table, { id: 10 })
|
|
620
|
+
* .set((row) => ({ age: row.age + 3 }));
|
|
621
|
+
* ```
|
|
622
|
+
*
|
|
623
|
+
* @param table - The table to select from.
|
|
624
|
+
* @param key - The primary key.
|
|
625
|
+
*/
|
|
626
|
+
set: (values: Partial<insertValues> | updateFn) => Promise<selectModel>;
|
|
627
|
+
};
|
|
628
|
+
type Delete = <table extends Table>(table: table extends {
|
|
629
|
+
[onchain]: true;
|
|
630
|
+
} ? table : PonderTypeError<`Indexing functions can only write to onchain tables, and '${table["_"]["name"]}' is an offchain table.`>, key: Key<table>) => Promise<boolean>;
|
|
631
|
+
|
|
632
|
+
/** Viem actions where the `block` property is optional and implicit. */
|
|
633
|
+
declare const blockDependentActions: readonly ["getBalance", "call", "estimateGas", "getFeeHistory", "getProof", "getCode", "getStorageAt", "getEnsAddress", "getEnsAvatar", "getEnsName", "getEnsResolver", "getEnsText"];
|
|
634
|
+
/** Viem actions where the `block` property is non-existent. */
|
|
635
|
+
declare const nonBlockDependentActions: readonly ["getTransaction", "getTransactionReceipt", "getTransactionConfirmations"];
|
|
636
|
+
type BlockOptions = {
|
|
637
|
+
cache?: undefined;
|
|
638
|
+
blockNumber?: undefined;
|
|
639
|
+
} | {
|
|
640
|
+
cache: "immutable";
|
|
641
|
+
blockNumber?: undefined;
|
|
642
|
+
} | {
|
|
643
|
+
cache?: undefined;
|
|
644
|
+
blockNumber: bigint;
|
|
645
|
+
};
|
|
646
|
+
type RequiredBlockOptions = {
|
|
647
|
+
/** Hash of the block. */
|
|
648
|
+
blockHash: Hash;
|
|
649
|
+
blockNumber?: undefined;
|
|
650
|
+
} | {
|
|
651
|
+
blockHash?: undefined;
|
|
652
|
+
/** The block number. */
|
|
653
|
+
blockNumber: bigint;
|
|
654
|
+
};
|
|
655
|
+
type BlockDependentAction<fn extends (client: any, args: any) => unknown, params = Parameters<fn>[0], returnType = ReturnType<fn>> = (args: Omit<params, "blockTag" | "blockNumber"> & BlockOptions) => returnType;
|
|
656
|
+
type PonderActions = {
|
|
657
|
+
[action in (typeof blockDependentActions)[number]]: BlockDependentAction<ReturnType<typeof publicActions>[action]>;
|
|
658
|
+
} & {
|
|
659
|
+
multicall: <const contracts extends readonly unknown[], allowFailure extends boolean = true>(args: Omit<MulticallParameters<contracts, allowFailure>, "blockTag" | "blockNumber"> & BlockOptions) => Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
660
|
+
readContract: <const abi extends Abi$1 | readonly unknown[], functionName extends ContractFunctionName<abi, "pure" | "view">, const args extends ContractFunctionArgs<abi, "pure" | "view", functionName>>(args: Omit<ReadContractParameters<abi, functionName, args>, "blockTag" | "blockNumber"> & BlockOptions) => Promise<ReadContractReturnType<abi, functionName, args>>;
|
|
661
|
+
simulateContract: <const abi extends Abi$1 | readonly unknown[], functionName extends ContractFunctionName<abi, "nonpayable" | "payable">, const args extends ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>>(args: Omit<SimulateContractParameters<abi, functionName, args>, "blockTag" | "blockNumber"> & BlockOptions) => Promise<SimulateContractReturnType<abi, functionName, args>>;
|
|
662
|
+
getBlock: <includeTransactions extends boolean = false>(args: {
|
|
663
|
+
/** Whether or not to include transaction data in the response. */
|
|
664
|
+
includeTransactions?: includeTransactions | undefined;
|
|
665
|
+
} & RequiredBlockOptions) => Promise<GetBlockReturnType<Chain | undefined, includeTransactions>>;
|
|
666
|
+
getTransactionCount: (args: {
|
|
667
|
+
/** The account address. */
|
|
668
|
+
address: Address;
|
|
669
|
+
} & RequiredBlockOptions) => Promise<GetTransactionCountReturnType>;
|
|
670
|
+
getBlockTransactionCount: (args: RequiredBlockOptions) => Promise<GetBlockTransactionCountReturnType>;
|
|
671
|
+
} & Pick<PublicActions, (typeof nonBlockDependentActions)[number]>;
|
|
672
|
+
type ReadOnlyClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined> = Prettify<Omit<Client<transport, chain, undefined, PublicRpcSchema, PonderActions>, "extend" | "key" | "batch" | "cacheTime" | "account" | "type" | "uid" | "chain" | "name" | "pollingInterval" | "transport" | "ccipRead">>;
|
|
673
|
+
|
|
674
|
+
declare namespace Virtual {
|
|
675
|
+
type Setup = "setup";
|
|
676
|
+
type _FormatEventNames<contract extends Config["contracts"][string], safeEventNames = SafeEventNames<contract["abi"]>> = string extends safeEventNames ? never : safeEventNames;
|
|
677
|
+
type _FormatFunctionNames<contract extends Config["contracts"][string], safeFunctionNames = SafeFunctionNames<contract["abi"]>> = string extends safeFunctionNames ? never : safeFunctionNames;
|
|
678
|
+
/** "{ContractName}:{EventName}" | "{ContractName}.{FunctionName}()" | "{SourceName}:block" | "{SourceName}:transaction:from" . */
|
|
679
|
+
export type FormatEventNames<contracts extends Config["contracts"], accounts extends Config["accounts"], blocks extends Config["blocks"]> = {
|
|
680
|
+
[name in keyof contracts]: `${name & string}:${_FormatEventNames<contracts[name]> | Setup}`;
|
|
681
|
+
}[keyof contracts] | {
|
|
682
|
+
[name in keyof accounts]: `${name & string}:${"transaction" | "transfer"}:${"from" | "to"}`;
|
|
683
|
+
}[keyof accounts] | {
|
|
684
|
+
[name in keyof blocks]: `${name & string}:block`;
|
|
685
|
+
}[keyof blocks] | {
|
|
686
|
+
[name in keyof contracts]: true extends ExtractOverridenProperty<contracts[name], "includeCallTraces"> ? `${name & string}.${_FormatFunctionNames<contracts[name]>}` : never;
|
|
687
|
+
}[keyof contracts];
|
|
688
|
+
type FormatTransactionReceipts<source extends Config["contracts" | "accounts"][string], includeTxr = ExtractOverridenProperty<source, "includeTransactionReceipts">> = includeTxr extends includeTxr ? includeTxr extends true ? {
|
|
689
|
+
transactionReceipt: Prettify<TransactionReceipt>;
|
|
690
|
+
} : {
|
|
691
|
+
transactionReceipt?: never;
|
|
692
|
+
} : never;
|
|
693
|
+
export type ExtractEventName<name extends string> = name extends `${string}:${infer EventName extends string}` ? EventName : name extends `${string}.${infer EventName extends string}` ? EventName : never;
|
|
694
|
+
export type ExtractSourceName<name extends string> = name extends `${infer SourceName extends string}:${string}` ? SourceName : name extends `${infer SourceName extends string}.${string}` ? SourceName : never;
|
|
695
|
+
export type EventNames<config extends Config> = FormatEventNames<config["contracts"], config["accounts"], config["blocks"]>;
|
|
696
|
+
export type Event<config extends Config, name extends EventNames<config>, sourceName extends ExtractSourceName<name> = ExtractSourceName<name>, eventName extends ExtractEventName<name> = ExtractEventName<name>> = name extends `${string}:block` ? {
|
|
697
|
+
block: Prettify<Block>;
|
|
698
|
+
} : name extends `${string}:transaction:${"from" | "to"}` ? {
|
|
699
|
+
block: Prettify<Block>;
|
|
700
|
+
transaction: Prettify<Transaction>;
|
|
701
|
+
transactionReceipt: Prettify<TransactionReceipt>;
|
|
702
|
+
} : name extends `${string}:transfer:${"from" | "to"}` ? // 3. transfer event
|
|
703
|
+
{
|
|
704
|
+
transfer: Prettify<Transfer>;
|
|
705
|
+
block: Prettify<Block>;
|
|
706
|
+
transaction: Prettify<Transaction>;
|
|
707
|
+
trace: Prettify<Trace>;
|
|
708
|
+
} & FormatTransactionReceipts<config["accounts"][sourceName]> : name extends `${string}.${string}` ? Prettify<{
|
|
709
|
+
args: FormatFunctionArgs<config["contracts"][sourceName]["abi"], eventName>;
|
|
710
|
+
result: FormatFunctionResult<config["contracts"][sourceName]["abi"], eventName>;
|
|
711
|
+
trace: Prettify<Trace>;
|
|
712
|
+
block: Prettify<Block>;
|
|
713
|
+
transaction: Prettify<Transaction>;
|
|
714
|
+
} & FormatTransactionReceipts<config["contracts"][sourceName]>> : eventName extends Setup ? never : Prettify<{
|
|
715
|
+
name: eventName;
|
|
716
|
+
args: FormatEventArgs<config["contracts"][sourceName]["abi"], eventName>;
|
|
717
|
+
log: Prettify<Log>;
|
|
718
|
+
block: Prettify<Block>;
|
|
719
|
+
transaction: Prettify<Transaction>;
|
|
720
|
+
} & FormatTransactionReceipts<config["contracts"][sourceName]>>;
|
|
721
|
+
type ContextContractProperty = Exclude<keyof Config["contracts"][string], "abi" | "network" | "filter" | "factory">;
|
|
722
|
+
type ExtractOverridenProperty<contract extends Config["contracts" | "accounts"][string], property extends ContextContractProperty, base = Extract<contract, {
|
|
723
|
+
[p in property]: unknown;
|
|
724
|
+
}>[property], override = Extract<contract["network"][keyof contract["network"]], {
|
|
725
|
+
[p in property]: unknown;
|
|
726
|
+
}>[property]> = ([base] extends [never] ? undefined : base) | override;
|
|
727
|
+
export type Context<config extends Config, schema extends Schema, name extends EventNames<config>, sourceName extends ExtractSourceName<name> = ExtractSourceName<name>, sourceNetwork = sourceName extends sourceName ? (unknown extends config["contracts"][sourceName]["network"] ? never : config["contracts"][sourceName]["network"]) | (unknown extends config["blocks"][sourceName]["network"] ? never : config["blocks"][sourceName]["network"]) : never> = {
|
|
728
|
+
contracts: {
|
|
729
|
+
[_contractName in keyof config["contracts"]]: {
|
|
730
|
+
abi: config["contracts"][_contractName]["abi"];
|
|
731
|
+
address: ExtractOverridenProperty<config["contracts"][_contractName], "address">;
|
|
732
|
+
startBlock: ExtractOverridenProperty<config["contracts"][_contractName], "startBlock">;
|
|
733
|
+
endBlock: ExtractOverridenProperty<config["contracts"][_contractName], "endBlock">;
|
|
734
|
+
};
|
|
735
|
+
};
|
|
736
|
+
network: sourceNetwork extends string ? {
|
|
737
|
+
name: sourceNetwork;
|
|
738
|
+
chainId: config["networks"][sourceNetwork]["chainId"];
|
|
739
|
+
} : {
|
|
740
|
+
[key in keyof sourceNetwork]: {
|
|
741
|
+
name: key;
|
|
742
|
+
chainId: config["networks"][key & keyof config["networks"]]["chainId"];
|
|
743
|
+
};
|
|
744
|
+
}[keyof sourceNetwork];
|
|
745
|
+
client: Prettify<ReadOnlyClient>;
|
|
746
|
+
db: Db<schema>;
|
|
747
|
+
};
|
|
748
|
+
export type IndexingFunctionArgs<config extends Config, schema extends Schema, name extends EventNames<config>> = {
|
|
749
|
+
event: Event<config, name>;
|
|
750
|
+
context: Context<config, schema, name>;
|
|
751
|
+
};
|
|
752
|
+
export type Registry<config extends Config, schema extends Schema> = {
|
|
753
|
+
on: <name extends EventNames<config>>(_name: name, indexingFunction: (args: {
|
|
754
|
+
event: Event<config, name>;
|
|
755
|
+
} & {
|
|
756
|
+
context: Prettify<Context<config, schema, name>>;
|
|
757
|
+
}) => Promise<void> | void) => void;
|
|
758
|
+
};
|
|
759
|
+
export { };
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Middleware for `@ponder/client`.
|
|
764
|
+
*
|
|
765
|
+
* @param db - Drizzle database instance
|
|
766
|
+
* @param schema - Ponder schema
|
|
767
|
+
*
|
|
768
|
+
* @example
|
|
769
|
+
* ```ts
|
|
770
|
+
* import { db } from "ponder:api";
|
|
771
|
+
* import schema from "ponder:schema";
|
|
772
|
+
* import { Hono } from "hono";
|
|
773
|
+
* import { client } from "ponder";
|
|
774
|
+
*
|
|
775
|
+
* const app = new Hono();
|
|
776
|
+
*
|
|
777
|
+
* app.use("/sql/*", client({ db, schema }));
|
|
778
|
+
*
|
|
779
|
+
* export default app;
|
|
780
|
+
* ```
|
|
781
|
+
*/
|
|
782
|
+
declare const client: ({ db, }: {
|
|
783
|
+
db: ReadonlyDrizzle<Schema>;
|
|
784
|
+
schema: Schema;
|
|
785
|
+
}) => hono.MiddlewareHandler<any, string, {}>;
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Middleware for GraphQL with an interactive web view.
|
|
789
|
+
*
|
|
790
|
+
* - Docs: https://ponder.sh/docs/query/api-functions#register-graphql-middleware
|
|
791
|
+
*
|
|
792
|
+
* @example
|
|
793
|
+
* import { db } from "ponder:api";
|
|
794
|
+
* import schema from "ponder:schema";
|
|
795
|
+
* import { graphql } from "@/index.js";
|
|
796
|
+
* import { Hono } from "hono";
|
|
797
|
+
*
|
|
798
|
+
* const app = new Hono();
|
|
799
|
+
*
|
|
800
|
+
* app.use("/graphql", graphql({ db, schema }));
|
|
801
|
+
*
|
|
802
|
+
* export default app;
|
|
803
|
+
*
|
|
804
|
+
*/
|
|
805
|
+
declare const graphql: ({ db, schema }: {
|
|
806
|
+
db: ReadonlyDrizzle<Schema>;
|
|
807
|
+
schema: Schema;
|
|
808
|
+
}, { maxOperationTokens, maxOperationDepth, maxOperationAliases, }?: {
|
|
809
|
+
maxOperationTokens?: number | undefined;
|
|
810
|
+
maxOperationDepth?: number | undefined;
|
|
811
|
+
maxOperationAliases?: number | undefined;
|
|
812
|
+
}) => hono.MiddlewareHandler<any, string, {}>;
|
|
813
|
+
|
|
814
|
+
type ContractConfig = Prettify<Config["contracts"][string]>;
|
|
815
|
+
type NetworkConfig = Prettify<Config["networks"][string]>;
|
|
816
|
+
type BlockConfig = Prettify<Config["blocks"][string]>;
|
|
817
|
+
type DatabaseConfig = Prettify<Config["database"]>;
|
|
818
|
+
|
|
819
|
+
export { type Block, type BlockConfig, type ContractConfig, type DatabaseConfig, type Log, type NetworkConfig, type ReadonlyDrizzle, type Transaction, type TransactionReceipt, Virtual, client, createConfig, factory, graphql };
|