envio 3.0.0-alpha.9 → 3.0.0-main-alpha16-build-test

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.
Files changed (117) hide show
  1. package/README.md +1 -1
  2. package/{bin.js → bin.mjs} +22 -9
  3. package/evm.schema.json +37 -119
  4. package/fuel.schema.json +18 -0
  5. package/index.d.ts +95 -5
  6. package/package.json +34 -32
  7. package/src/Batch.res +4 -1
  8. package/src/Batch.res.mjs +3 -2
  9. package/src/Benchmark.res +1 -1
  10. package/src/ChainFetcher.res +64 -16
  11. package/src/ChainFetcher.res.mjs +65 -24
  12. package/src/ChainManager.res +12 -22
  13. package/src/ChainManager.res.mjs +17 -20
  14. package/src/Config.gen.ts +19 -0
  15. package/src/Config.res +406 -10
  16. package/src/Config.res.mjs +395 -16
  17. package/src/Ctx.res +1 -1
  18. package/src/Ecosystem.res +2 -2
  19. package/src/Env.res +8 -2
  20. package/src/Env.res.mjs +5 -5
  21. package/src/Envio.gen.ts +0 -6
  22. package/src/Envio.res +13 -5
  23. package/src/EventProcessing.res +3 -1
  24. package/src/EvmTypes.gen.ts +6 -0
  25. package/src/EvmTypes.res +1 -0
  26. package/src/FetchState.res +1226 -636
  27. package/src/FetchState.res.mjs +1111 -615
  28. package/src/GlobalState.res +35 -15
  29. package/src/GlobalState.res.mjs +73 -57
  30. package/src/HandlerLoader.res +2 -2
  31. package/src/HandlerLoader.res.mjs +3 -3
  32. package/src/HandlerRegister.res +319 -0
  33. package/src/HandlerRegister.res.mjs +299 -0
  34. package/src/{EventRegister.resi → HandlerRegister.resi} +9 -10
  35. package/src/Hasura.res +4 -4
  36. package/src/Hasura.res.mjs +3 -3
  37. package/src/InMemoryStore.res +1 -1
  38. package/src/InMemoryStore.res.mjs +3 -3
  39. package/src/InMemoryTable.res +1 -1
  40. package/src/InMemoryTable.res.mjs +1 -1
  41. package/src/Internal.gen.ts +4 -0
  42. package/src/Internal.res +3 -7
  43. package/src/Logging.res +3 -3
  44. package/src/Logging.res.mjs +2 -2
  45. package/src/Main.res +30 -4
  46. package/src/Main.res.mjs +30 -4
  47. package/src/Persistence.res +3 -16
  48. package/src/Persistence.res.mjs +3 -3
  49. package/src/PgStorage.res +54 -24
  50. package/src/PgStorage.res.mjs +50 -17
  51. package/src/Prometheus.res +23 -1
  52. package/src/Prometheus.res.mjs +55 -30
  53. package/src/Sink.res +3 -1
  54. package/src/Sink.res.mjs +2 -1
  55. package/src/TestIndexer.res +189 -14
  56. package/src/TestIndexer.res.mjs +238 -106
  57. package/src/TestIndexerProxyStorage.res +1 -6
  58. package/src/TestIndexerProxyStorage.res.mjs +1 -7
  59. package/src/TopicFilter.res +1 -1
  60. package/src/UserContext.res +131 -74
  61. package/src/UserContext.res.mjs +70 -27
  62. package/src/Utils.res +56 -1
  63. package/src/Utils.res.mjs +65 -6
  64. package/src/bindings/ClickHouse.res +12 -6
  65. package/src/bindings/ClickHouse.res.mjs +11 -11
  66. package/src/bindings/DateFns.res +1 -1
  67. package/src/bindings/EventSource.res +8 -1
  68. package/src/bindings/EventSource.res.mjs +8 -1
  69. package/src/bindings/Express.res +1 -0
  70. package/src/bindings/Hrtime.res +1 -1
  71. package/src/bindings/Hrtime.res.mjs +2 -2
  72. package/src/bindings/Pino.res +5 -5
  73. package/src/bindings/Pino.res.mjs +4 -4
  74. package/src/bindings/Vitest.res +15 -7
  75. package/src/bindings/WebSocket.res +27 -0
  76. package/src/bindings/WebSocket.res.mjs +2 -0
  77. package/src/db/EntityHistory.res +2 -2
  78. package/src/db/InternalTable.res +9 -70
  79. package/src/db/InternalTable.res.mjs +33 -82
  80. package/src/db/Table.res +21 -8
  81. package/src/db/Table.res.mjs +20 -10
  82. package/src/sources/EvmChain.res +16 -12
  83. package/src/sources/EvmChain.res.mjs +13 -10
  84. package/src/sources/FuelSDK.res +1 -1
  85. package/src/sources/HyperFuelSource.res +5 -1
  86. package/src/sources/HyperFuelSource.res.mjs +5 -1
  87. package/src/sources/HyperSync.res +15 -6
  88. package/src/sources/HyperSync.res.mjs +9 -7
  89. package/src/sources/HyperSync.resi +4 -0
  90. package/src/sources/HyperSyncClient.res +1 -1
  91. package/src/sources/HyperSyncHeightStream.res +20 -7
  92. package/src/sources/HyperSyncHeightStream.res.mjs +17 -11
  93. package/src/sources/HyperSyncSource.res +26 -16
  94. package/src/sources/HyperSyncSource.res.mjs +12 -15
  95. package/src/sources/Rpc.res +86 -49
  96. package/src/sources/Rpc.res.mjs +96 -35
  97. package/src/sources/RpcSource.res +498 -191
  98. package/src/sources/RpcSource.res.mjs +786 -289
  99. package/src/sources/RpcWebSocketHeightStream.res +177 -0
  100. package/src/sources/RpcWebSocketHeightStream.res.mjs +196 -0
  101. package/src/sources/SourceManager.res +2 -10
  102. package/src/sources/SourceManager.res.mjs +9 -13
  103. package/src/sources/Svm.res +15 -2
  104. package/src/sources/Svm.res.mjs +7 -1
  105. package/src/tui/Tui.res +17 -35
  106. package/src/tui/Tui.res.mjs +28 -32
  107. package/src/tui/bindings/Ink.res +0 -5
  108. package/src/tui/bindings/Ink.res.mjs +0 -3
  109. package/src/tui/components/CustomHooks.res +10 -2
  110. package/src/tui/components/CustomHooks.res.mjs +20 -3
  111. package/svm.schema.json +112 -0
  112. package/src/EventRegister.res +0 -241
  113. package/src/EventRegister.res.mjs +0 -240
  114. package/src/bindings/Ethers.res +0 -164
  115. package/src/bindings/Ethers.res.mjs +0 -78
  116. package/src/bindings/RescriptMocha.res +0 -123
  117. package/src/bindings/RescriptMocha.res.mjs +0 -18
package/README.md CHANGED
@@ -12,7 +12,7 @@ HyperIndex is a fast, developer-friendly multichain indexer, optimized for both
12
12
  ## Key Features
13
13
 
14
14
  - **[Indexer auto-generation](https://docs.envio.dev/docs/HyperIndex/contract-import)** – Generate Indexers directly from smart contract addresses
15
- - **High performance** – Historical backfills at over 10,000+ events per second ([fastest in market](https://docs.envio.dev/blog/indexer-benchmarking-results))
15
+ - **High performance** – Historical backfills at over 25,000+ events per second ([fastest in market](https://docs.envio.dev/blog/indexer-benchmarking-results))
16
16
  - **Local development** – Full-featured local environment with Docker
17
17
  - **[Multichain indexing](https://docs.envio.dev/docs/HyperIndex/multichain-indexing)** – Index any EVM-, SVM-, or Fuel-compatible blockchain
18
18
  - **Real-time indexing** – Instantly track blockchain events
@@ -26,14 +26,20 @@ function getExePath() {
26
26
  extension = ".exe";
27
27
  }
28
28
 
29
+ const pkg = `envio-${os}-${arch}`;
30
+ const bin = `bin/envio${extension}`;
31
+
29
32
  try {
30
- // Since the bin will be located inside `node_modules`, we can simply call require.resolve
31
- return require.resolve(`envio-${os}-${arch}/bin/envio${extension}`);
32
- } catch (e) {
33
- throw new Error(
34
- `Couldn't find envio binary inside node_modules for ${os}-${arch}`
35
- );
36
- }
33
+ return require.resolve(`${pkg}/${bin}`);
34
+ } catch {}
35
+
36
+ throw new Error(
37
+ `Couldn't find envio binary package "${pkg}".\n` +
38
+ `Checked: require.resolve("${pkg}/${bin}")\n` +
39
+ `If you're using pnpm, yarn, or npm with --omit=optional, ensure optional ` +
40
+ `dependencies are installed:\n` +
41
+ ` npm install ${pkg}\n`
42
+ );
37
43
  }
38
44
 
39
45
  /**
@@ -41,8 +47,15 @@ function getExePath() {
41
47
  */
42
48
  function runEnvio() {
43
49
  const args = process.argv.slice(2);
44
- const processResult = spawnSync(getExePath(), args, { stdio: "inherit" });
45
- process.exit(processResult.status ?? 0);
50
+ const exePath = getExePath();
51
+
52
+ const processResult = spawnSync(exePath, args, { stdio: "inherit" });
53
+
54
+ if (processResult.error) {
55
+ console.error(`Failed to run envio binary at ${exePath}: ${processResult.error.message}`);
56
+ process.exit(1);
57
+ }
58
+ process.exit(processResult.status ?? 1);
46
59
  }
47
60
 
48
61
  runEnvio();
package/evm.schema.json CHANGED
@@ -73,17 +73,6 @@
73
73
  "$ref": "#/$defs/Chain"
74
74
  }
75
75
  },
76
- "multichain": {
77
- "description": "Multichain mode: 'ordered' processes events across chains in order, 'unordered' processes chain events in order, but non-deterministically relatively to other chains (default: unordered)",
78
- "anyOf": [
79
- {
80
- "$ref": "#/$defs/Multichain"
81
- },
82
- {
83
- "type": "null"
84
- }
85
- ]
86
- },
87
76
  "rollback_on_reorg": {
88
77
  "description": "A flag to indicate if the indexer should rollback to the last known valid block on a reorg. This currently incurs a performance hit on historical sync and is recommended to turn this off while developing (default: true)",
89
78
  "type": [
@@ -307,17 +296,6 @@
307
296
  "format": "uint64",
308
297
  "minimum": 0
309
298
  },
310
- "rpc_config": {
311
- "description": "RPC configuration for utilizing as the chain's data-source. Typically optional for chains with HyperSync support, which is highly recommended. HyperSync dramatically enhances performance, providing up to a 1000x speed boost over traditional RPC.",
312
- "anyOf": [
313
- {
314
- "$ref": "#/$defs/RpcConfig"
315
- },
316
- {
317
- "type": "null"
318
- }
319
- ]
320
- },
321
299
  "rpc": {
322
300
  "description": "RPC configuration for your indexer. If not specified otherwise, for chains supported by HyperSync, RPC serves as a fallback for added reliability. For others, it acts as the primary data-source. HyperSync offers significant performance improvements, up to a 1000x faster than traditional RPC.",
323
301
  "anyOf": [
@@ -346,7 +324,17 @@
346
324
  "integer",
347
325
  "null"
348
326
  ],
349
- "format": "int32"
327
+ "format": "uint32",
328
+ "minimum": 0
329
+ },
330
+ "block_lag": {
331
+ "description": "The number of blocks behind the chain head that the indexer should lag. Useful for avoiding reorg issues by indexing slightly behind the tip.",
332
+ "type": [
333
+ "integer",
334
+ "null"
335
+ ],
336
+ "format": "uint32",
337
+ "minimum": 0
350
338
  },
351
339
  "start_block": {
352
340
  "description": "The block at which the indexer should start ingesting data",
@@ -380,91 +368,6 @@
380
368
  "start_block"
381
369
  ]
382
370
  },
383
- "RpcConfig": {
384
- "type": "object",
385
- "properties": {
386
- "url": {
387
- "description": "URL of the RPC endpoint. Can be a single URL or an array of URLs. If multiple URLs are provided, the first one will be used as the primary RPC endpoint and the rest will be used as fallbacks.",
388
- "anyOf": [
389
- {
390
- "type": "string"
391
- },
392
- {
393
- "type": "array",
394
- "items": {
395
- "type": "string"
396
- }
397
- }
398
- ]
399
- },
400
- "initial_block_interval": {
401
- "description": "The starting interval in range of blocks per query",
402
- "type": [
403
- "integer",
404
- "null"
405
- ],
406
- "format": "uint32",
407
- "minimum": 0
408
- },
409
- "backoff_multiplicative": {
410
- "description": "After an RPC error, how much to scale back the number of blocks requested at once",
411
- "type": [
412
- "number",
413
- "null"
414
- ],
415
- "format": "double"
416
- },
417
- "acceleration_additive": {
418
- "description": "Without RPC errors or timeouts, how much to increase the number of blocks requested by for the next batch",
419
- "type": [
420
- "integer",
421
- "null"
422
- ],
423
- "format": "uint32",
424
- "minimum": 0
425
- },
426
- "interval_ceiling": {
427
- "description": "Do not further increase the block interval past this limit",
428
- "type": [
429
- "integer",
430
- "null"
431
- ],
432
- "format": "uint32",
433
- "minimum": 0
434
- },
435
- "backoff_millis": {
436
- "description": "After an error, how long to wait before retrying",
437
- "type": [
438
- "integer",
439
- "null"
440
- ],
441
- "format": "uint32",
442
- "minimum": 0
443
- },
444
- "fallback_stall_timeout": {
445
- "description": "If a fallback RPC is provided, the amount of time in ms to wait before kicking off the next provider",
446
- "type": [
447
- "integer",
448
- "null"
449
- ],
450
- "format": "uint32",
451
- "minimum": 0
452
- },
453
- "query_timeout_millis": {
454
- "description": "How long to wait before cancelling an RPC request",
455
- "type": [
456
- "integer",
457
- "null"
458
- ],
459
- "format": "uint32",
460
- "minimum": 0
461
- }
462
- },
463
- "additionalProperties": false,
464
- "required": [
465
- "url"
466
- ]
467
- },
468
371
  "RpcSelection": {
469
372
  "anyOf": [
470
373
  {
@@ -489,8 +392,22 @@
489
392
  "type": "string"
490
393
  },
491
394
  "for": {
492
- "description": "Determines if this RPC is for historical sync, real-time chain indexing, or as a fallback.",
493
- "$ref": "#/$defs/For"
395
+ "description": "Determines if this RPC is for historical sync, real-time chain indexing, or as a fallback. If not specified, defaults to \"fallback\" when HyperSync is available for the chain, or \"sync\" otherwise.",
396
+ "anyOf": [
397
+ {
398
+ "$ref": "#/$defs/For"
399
+ },
400
+ {
401
+ "type": "null"
402
+ }
403
+ ]
404
+ },
405
+ "ws": {
406
+ "description": "Optional WebSocket endpoint URL (wss:// or ws://) for real-time block header notifications via eth_subscribe(\"newHeads\"). Provides lower latency than HTTP polling for detecting new blocks.",
407
+ "type": [
408
+ "string",
409
+ "null"
410
+ ]
494
411
  },
495
412
  "initial_block_interval": {
496
413
  "description": "The starting interval in range of blocks per query",
@@ -553,12 +470,20 @@
553
470
  ],
554
471
  "format": "uint32",
555
472
  "minimum": 0
473
+ },
474
+ "polling_interval": {
475
+ "description": "How frequently (in milliseconds) to check for new blocks in realtime. Default is 1000ms. Note: Setting this higher than block time does not reduce RPC usage as every block is still fetched to check for reorgs.",
476
+ "type": [
477
+ "integer",
478
+ "null"
479
+ ],
480
+ "format": "uint32",
481
+ "minimum": 0
556
482
  }
557
483
  },
558
484
  "additionalProperties": false,
559
485
  "required": [
560
- "url",
561
- "for"
486
+ "url"
562
487
  ]
563
488
  },
564
489
  "For": {
@@ -671,13 +596,6 @@
671
596
  }
672
597
  ]
673
598
  },
674
- "Multichain": {
675
- "type": "string",
676
- "enum": [
677
- "ordered",
678
- "unordered"
679
- ]
680
- },
681
599
  "AddressFormat": {
682
600
  "type": "string",
683
601
  "enum": [
package/fuel.schema.json CHANGED
@@ -196,6 +196,24 @@
196
196
  }
197
197
  ]
198
198
  },
199
+ "max_reorg_depth": {
200
+ "description": "The number of blocks from the head that the indexer should account for in case of reorgs.",
201
+ "type": [
202
+ "integer",
203
+ "null"
204
+ ],
205
+ "format": "uint32",
206
+ "minimum": 0
207
+ },
208
+ "block_lag": {
209
+ "description": "The number of blocks behind the chain head that the indexer should lag. Useful for avoiding reorg issues by indexing slightly behind the tip.",
210
+ "type": [
211
+ "integer",
212
+ "null"
213
+ ],
214
+ "format": "uint32",
215
+ "minimum": 0
216
+ },
199
217
  "contracts": {
200
218
  "description": "All the contracts that should be indexed on the given chain",
201
219
  "type": [
package/index.d.ts CHANGED
@@ -18,6 +18,36 @@ export type { EffectCaller, Address } from "./src/Types.ts";
18
18
  /** Utility type to expand/flatten complex types for better IDE display. */
19
19
  export type Prettify<T> = { [K in keyof T]: T[K] } & {};
20
20
 
21
+ /**
22
+ * Operator for filtering entity fields in getWhere queries.
23
+ * Only fields with `@index` in the schema can be queried at runtime.
24
+ */
25
+ export type WhereOperator<T> = {
26
+ /** Matches entities where the field equals the given value. */
27
+ readonly _eq?: T;
28
+ /** Matches entities where the field is greater than the given value. */
29
+ readonly _gt?: T;
30
+ /** Matches entities where the field is less than the given value. */
31
+ readonly _lt?: T;
32
+ /** Matches entities where the field is greater than or equal to the given value. */
33
+ readonly _gte?: T;
34
+ /** Matches entities where the field is less than or equal to the given value. */
35
+ readonly _lte?: T;
36
+ /** Matches entities where the field equals any of the given values. */
37
+ readonly _in?: readonly T[];
38
+ };
39
+
40
+ /**
41
+ * Constructs a getWhere filter type from an entity type.
42
+ * Each field can be filtered using {@link WhereOperator} (`_eq`, `_gt`, `_lt`, `_gte`, `_lte`, `_in`).
43
+ *
44
+ * Note: only fields with `@index` in the schema can be queried at runtime.
45
+ * Attempting to filter on a non-indexed field will throw a descriptive error.
46
+ */
47
+ export type GetWhereFilter<E> = {
48
+ [K in keyof E]?: WhereOperator<E[K]>;
49
+ };
50
+
21
51
  import type {
22
52
  effect as Effect,
23
53
  effectArgs as EffectArgs,
@@ -234,6 +264,8 @@ type EvmChainConfig<Id extends number = number> = {
234
264
  readonly endBlock?: number;
235
265
  /** Number of blocks to keep for reorg handling (default: 200). */
236
266
  readonly maxReorgDepth?: number;
267
+ /** Number of blocks behind the chain head to lag (default: 0). */
268
+ readonly blockLag?: number;
237
269
  };
238
270
 
239
271
  /** EVM chain value (for runtime Indexer). */
@@ -287,6 +319,8 @@ type FuelChainConfig<Id extends number = number> = {
287
319
  readonly endBlock?: number;
288
320
  /** Number of blocks to keep for reorg handling (default: 200). */
289
321
  readonly maxReorgDepth?: number;
322
+ /** Number of blocks behind the chain head to lag (default: 0). */
323
+ readonly blockLag?: number;
290
324
  };
291
325
 
292
326
  /** Fuel chain value (for runtime Indexer). */
@@ -320,6 +354,8 @@ type SvmChainConfig<Id extends number = number> = {
320
354
  readonly endBlock?: number;
321
355
  /** Number of blocks to keep for reorg handling (default: 200). */
322
356
  readonly maxReorgDepth?: number;
357
+ /** Number of blocks behind the chain head to lag (default: 0). */
358
+ readonly blockLag?: number;
323
359
  };
324
360
 
325
361
  /** SVM chain value (for runtime Indexer). */
@@ -349,6 +385,7 @@ type IndexerConfigTypes = {
349
385
  contracts?: Record<string, {}>;
350
386
  };
351
387
  svm?: { chains: Record<string, { id: number }> };
388
+ entities?: Record<string, object>;
352
389
  };
353
390
 
354
391
  // Helper: Check if ecosystem is configured in a given config
@@ -497,12 +534,55 @@ export type TestIndexerChainConfig = {
497
534
  endBlock: number;
498
535
  };
499
536
 
500
- /** Progress returned after processing blocks with the test indexer. */
501
- export type TestIndexerProcessResult = {
502
- /** Changes happened during the processing. */
503
- changes: unknown[];
537
+ /** Entity change value containing sets and/or deleted IDs. */
538
+ type EntityChangeValue<Entity> = {
539
+ /** Entities that were created or updated. */
540
+ readonly sets?: readonly Entity[];
541
+ /** IDs of entities that were deleted. */
542
+ readonly deleted?: readonly string[];
504
543
  };
505
544
 
545
+ /** A dynamic contract address registration. */
546
+ type AddressRegistration = {
547
+ /** The contract address. */
548
+ readonly address: Address;
549
+ /** The contract name. */
550
+ readonly contract: string;
551
+ };
552
+
553
+ /** Extract entities from config. */
554
+ type ConfigEntities<Config extends IndexerConfigTypes> =
555
+ Config["entities"] extends Record<string, object> ? Config["entities"] : {};
556
+
557
+ /** Entity operations available on test indexer for direct entity manipulation. */
558
+ type EntityOps<Entity> = {
559
+ /** Get an entity by ID. Returns undefined if not found. */
560
+ readonly get: (id: string) => Promise<Entity | undefined>;
561
+ /** Set (create or update) an entity. */
562
+ readonly set: (entity: Entity) => void;
563
+ };
564
+
565
+ /** A single change representing entity modifications at a specific block. */
566
+ type EntityChange<Config extends IndexerConfigTypes> = {
567
+ /** The block where the changes occurred. */
568
+ readonly block: number;
569
+ /** The block hash (if available). */
570
+ readonly blockHash?: string;
571
+ /** The chain ID. */
572
+ readonly chainId: number;
573
+ /** Number of events processed in this block. */
574
+ readonly eventsProcessed: number;
575
+ /** Dynamic contract address registrations for this block. */
576
+ readonly addresses?: {
577
+ readonly sets?: readonly AddressRegistration[];
578
+ };
579
+ } & {
580
+ readonly [K in keyof ConfigEntities<Config>]?: EntityChangeValue<
581
+ ConfigEntities<Config>[K]
582
+ >;
583
+ };
584
+
585
+
506
586
  // Helper to extract chain IDs from config for test indexer
507
587
  type TestIndexerChainIds<Config extends IndexerConfigTypes> =
508
588
  HasEvm<Config> extends true
@@ -541,5 +621,15 @@ export type TestIndexerFromConfig<Config extends IndexerConfigTypes> = {
541
621
  /** Process blocks for the specified chains and return progress with checkpoints and changes. */
542
622
  process: (
543
623
  config: Prettify<TestIndexerProcessConfig<Config>>
544
- ) => Promise<TestIndexerProcessResult>;
624
+ ) => Promise<{
625
+ /** Changes happened during the processing. */
626
+ readonly changes: readonly EntityChange<Config>[];
627
+ }>;
628
+ } & (EcosystemCount<Config> extends 1
629
+ ? SingleEcosystemChains<Config>
630
+ : MultiEcosystemChains<Config>) & {
631
+ /** Entity operations for direct manipulation outside of handlers. */
632
+ readonly [K in keyof ConfigEntities<Config>]: EntityOps<
633
+ ConfigEntities<Config>[K]
634
+ >;
545
635
  };
package/package.json CHANGED
@@ -1,71 +1,73 @@
1
1
  {
2
2
  "name": "envio",
3
- "version": "v3.0.0-alpha.9",
3
+ "version": "3.0.0-main-alpha16-build-test",
4
4
  "type": "module",
5
5
  "description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
6
- "bin": "./bin.js",
6
+ "bin": "./bin.mjs",
7
7
  "main": "./index.js",
8
8
  "types": "./index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/enviodev/hyperindex.git"
12
12
  },
13
+ "author": "envio contributors <about@envio.dev>",
14
+ "license": "GPL-3.0",
15
+ "bugs": {
16
+ "url": "https://github.com/enviodev/hyperindex/issues"
17
+ },
18
+ "homepage": "https://envio.dev",
13
19
  "keywords": [
14
20
  "blockchain",
15
21
  "indexer",
16
22
  "ethereum",
17
23
  "evm",
18
24
  "fuel",
25
+ "solana",
19
26
  "data",
20
27
  "dapp"
21
28
  ],
22
- "author": "envio contributors <about@envio.dev>",
23
- "license": "GPL-3.0",
24
- "bugs": {
25
- "url": "https://github.com/enviodev/hyperindex/issues"
26
- },
27
- "homepage": "https://envio.dev",
28
29
  "engines": {
29
30
  "node": ">=22.0.0"
30
31
  },
31
- "optionalDependencies": {
32
- "envio-linux-x64": "v3.0.0-alpha.9",
33
- "envio-linux-arm64": "v3.0.0-alpha.9",
34
- "envio-darwin-x64": "v3.0.0-alpha.9",
35
- "envio-darwin-arm64": "v3.0.0-alpha.9"
36
- },
32
+ "files": [
33
+ "bin.mjs",
34
+ "evm.schema.json",
35
+ "fuel.schema.json",
36
+ "svm.schema.json",
37
+ "rescript.json",
38
+ "index.d.ts",
39
+ "index.js",
40
+ "src"
41
+ ],
37
42
  "dependencies": {
38
- "@clickhouse/client": "1.12.1",
43
+ "@clickhouse/client": "1.17.0",
39
44
  "@elastic/ecs-pino-format": "1.4.0",
40
45
  "@envio-dev/hyperfuel-client": "1.2.2",
41
- "@envio-dev/hypersync-client": "0.7.0",
42
- "bignumber.js": "9.1.2",
46
+ "@envio-dev/hypersync-client": "1.1.0",
47
+ "bignumber.js": "9.3.1",
43
48
  "eventsource": "4.1.0",
44
49
  "express": "4.19.2",
45
- "pino": "10.1.0",
50
+ "pino": "10.3.1",
46
51
  "pino-pretty": "13.1.3",
47
- "prom-client": "15.0.0",
52
+ "prom-client": "15.1.3",
48
53
  "yargs": "17.7.2",
49
54
  "rescript": "11.1.3",
50
55
  "rescript-schema": "9.3.4",
51
- "viem": "2.21.0",
56
+ "viem": "2.46.2",
52
57
  "rescript-envsafe": "5.0.0",
53
58
  "dotenv": "16.4.5",
54
59
  "date-fns": "3.3.1",
55
- "@rescript/react": "0.14.0",
56
- "ink": "6.5.1",
60
+ "@rescript/react": "0.14.1",
61
+ "ink": "6.8.0",
57
62
  "ink-big-text": "2.0.0",
58
63
  "ink-spinner": "5.0.0",
59
64
  "postgres": "3.4.8",
60
65
  "tsx": "4.21.0"
61
66
  },
62
- "files": [
63
- "bin.js",
64
- "evm.schema.json",
65
- "fuel.schema.json",
66
- "rescript.json",
67
- "index.d.ts",
68
- "index.js",
69
- "src"
70
- ]
71
- }
67
+ "optionalDependencies": {
68
+ "envio-linux-x64": "3.0.0-main-alpha16-build-test",
69
+ "envio-linux-arm64": "3.0.0-main-alpha16-build-test",
70
+ "envio-darwin-x64": "3.0.0-main-alpha16-build-test",
71
+ "envio-darwin-arm64": "3.0.0-main-alpha16-build-test"
72
+ }
73
+ }
package/src/Batch.res CHANGED
@@ -6,6 +6,7 @@ open Utils.UnsafeIntOperators
6
6
  type chainAfterBatch = {
7
7
  batchSize: int,
8
8
  progressBlockNumber: int,
9
+ sourceBlockNumber: int,
9
10
  totalEventsProcessed: int,
10
11
  fetchState: FetchState.t,
11
12
  isProgressAtHeadWhenBatchCreated: bool,
@@ -17,6 +18,7 @@ type chainBeforeBatch = {
17
18
  progressBlockNumber: int,
18
19
  sourceBlockNumber: int,
19
20
  totalEventsProcessed: int,
21
+ chainConfig: Config.chain,
20
22
  }
21
23
 
22
24
  type t = {
@@ -108,10 +110,11 @@ let getProgressedChainsById = {
108
110
  {
109
111
  batchSize,
110
112
  progressBlockNumber: progressBlockNumberAfterBatch,
113
+ sourceBlockNumber: chainBeforeBatch.sourceBlockNumber,
111
114
  totalEventsProcessed: chainBeforeBatch.totalEventsProcessed + batchSize,
112
115
  fetchState: fetchStateAfterBatch,
113
116
  isProgressAtHeadWhenBatchCreated: progressBlockNumberAfterBatch >=
114
- chainBeforeBatch.sourceBlockNumber,
117
+ chainBeforeBatch.sourceBlockNumber - chainBeforeBatch.chainConfig.blockLag,
115
118
  }: chainAfterBatch
116
119
  ),
117
120
  )
package/src/Batch.res.mjs CHANGED
@@ -62,9 +62,10 @@ function getChainAfterBatchIfProgressed(chainBeforeBatch, progressBlockNumberAft
62
62
  return {
63
63
  batchSize: batchSize,
64
64
  progressBlockNumber: progressBlockNumberAfterBatch,
65
+ sourceBlockNumber: chainBeforeBatch.sourceBlockNumber,
65
66
  totalEventsProcessed: chainBeforeBatch.totalEventsProcessed + batchSize,
66
67
  fetchState: fetchStateAfterBatch,
67
- isProgressAtHeadWhenBatchCreated: progressBlockNumberAfterBatch >= chainBeforeBatch.sourceBlockNumber
68
+ isProgressAtHeadWhenBatchCreated: progressBlockNumberAfterBatch >= chainBeforeBatch.sourceBlockNumber - chainBeforeBatch.chainConfig.blockLag
68
69
  };
69
70
  }
70
71
 
@@ -80,7 +81,7 @@ function getProgressedChainsById(chainsBeforeBatch, batchSizePerChain, progressB
80
81
  var progressedChain;
81
82
  if (batchSize !== undefined) {
82
83
  var leftItems = fetchState.buffer.slice(batchSize);
83
- progressedChain = getChainAfterBatchIfProgressed(chainBeforeBatch, progressBlockNumberAfterBatch, FetchState.updateInternal(fetchState, undefined, undefined, undefined, leftItems, undefined, undefined), batchSize);
84
+ progressedChain = getChainAfterBatchIfProgressed(chainBeforeBatch, progressBlockNumberAfterBatch, FetchState.updateInternal(fetchState, undefined, undefined, leftItems, undefined, undefined), batchSize);
84
85
  } else {
85
86
  progressedChain = getChainAfterBatchIfProgressed(chainBeforeBatch, progressBlockNumberAfterBatch, chainBeforeBatch.fetchState, 0);
86
87
  }
package/src/Benchmark.res CHANGED
@@ -269,7 +269,7 @@ let addBlockRangeFetched = (
269
269
  ~queryName,
270
270
  ) => {
271
271
  let group = `BlockRangeFetched Summary for Chain ${chainId->Belt.Int.toString} ${queryName}`
272
- let add = (label, value) => data->Data.addSummaryData(~group, ~label, ~value=Utils.magic(value))
272
+ let add = (label, value) => data->Data.addSummaryData(~group, ~label, ~value=value->(Utils.magic: int => float))
273
273
 
274
274
  add("Total Time Elapsed (ms)", totalTimeElapsed)
275
275
  add("Parsing Time Elapsed (ms)", parsingTimeElapsed)