envio 3.0.0-alpha.0 → 3.0.0-alpha.10

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 (136) hide show
  1. package/README.md +2 -2
  2. package/evm.schema.json +53 -57
  3. package/fuel.schema.json +35 -31
  4. package/index.d.ts +446 -1
  5. package/index.js +4 -0
  6. package/package.json +23 -11
  7. package/rescript.json +4 -1
  8. package/src/Batch.res.mjs +1 -1
  9. package/src/Benchmark.res +394 -0
  10. package/src/Benchmark.res.mjs +398 -0
  11. package/src/ChainFetcher.res +526 -0
  12. package/src/ChainFetcher.res.mjs +343 -0
  13. package/src/ChainManager.res +182 -0
  14. package/src/ChainManager.res.mjs +150 -0
  15. package/src/Config.res +367 -27
  16. package/src/Config.res.mjs +338 -28
  17. package/src/{Indexer.res → Ctx.res} +1 -1
  18. package/src/Ecosystem.res +25 -0
  19. package/src/Ecosystem.res.mjs +29 -0
  20. package/src/Env.res +252 -0
  21. package/src/Env.res.mjs +271 -0
  22. package/src/Envio.gen.ts +9 -1
  23. package/src/Envio.res +12 -9
  24. package/src/EventProcessing.res +476 -0
  25. package/src/EventProcessing.res.mjs +341 -0
  26. package/src/EventRegister.res +4 -15
  27. package/src/EventRegister.res.mjs +3 -9
  28. package/src/EventRegister.resi +2 -8
  29. package/src/FetchState.res +54 -29
  30. package/src/FetchState.res.mjs +62 -35
  31. package/src/GlobalState.res +1163 -0
  32. package/src/GlobalState.res.mjs +1196 -0
  33. package/src/GlobalStateManager.res +68 -0
  34. package/src/GlobalStateManager.res.mjs +75 -0
  35. package/src/GlobalStateManager.resi +7 -0
  36. package/src/HandlerLoader.res +89 -0
  37. package/src/HandlerLoader.res.mjs +79 -0
  38. package/src/Internal.gen.ts +3 -14
  39. package/src/Internal.res +45 -13
  40. package/src/LoadLayer.res +444 -0
  41. package/src/LoadLayer.res.mjs +296 -0
  42. package/src/LoadLayer.resi +32 -0
  43. package/src/LogSelection.res +33 -27
  44. package/src/LogSelection.res.mjs +6 -0
  45. package/src/Logging.res +11 -4
  46. package/src/Logging.res.mjs +14 -6
  47. package/src/Main.res +351 -0
  48. package/src/Main.res.mjs +312 -0
  49. package/src/Persistence.res +1 -2
  50. package/src/PgStorage.gen.ts +10 -0
  51. package/src/PgStorage.res +28 -34
  52. package/src/PgStorage.res.d.mts +5 -0
  53. package/src/PgStorage.res.mjs +27 -27
  54. package/src/Prometheus.res +8 -8
  55. package/src/Prometheus.res.mjs +10 -10
  56. package/src/ReorgDetection.res +6 -10
  57. package/src/ReorgDetection.res.mjs +6 -6
  58. package/src/TestIndexer.res +536 -0
  59. package/src/TestIndexer.res.mjs +412 -0
  60. package/src/TestIndexerProxyStorage.res +210 -0
  61. package/src/TestIndexerProxyStorage.res.mjs +157 -0
  62. package/src/Types.ts +1 -1
  63. package/src/UserContext.res +355 -0
  64. package/src/UserContext.res.mjs +236 -0
  65. package/src/Utils.res +28 -0
  66. package/src/Utils.res.mjs +18 -0
  67. package/src/bindings/ClickHouse.res +31 -1
  68. package/src/bindings/ClickHouse.res.mjs +27 -1
  69. package/src/bindings/DateFns.res +71 -0
  70. package/src/bindings/DateFns.res.mjs +22 -0
  71. package/src/bindings/Ethers.res +27 -67
  72. package/src/bindings/Ethers.res.mjs +18 -70
  73. package/src/bindings/EventSource.res +13 -0
  74. package/src/bindings/EventSource.res.mjs +2 -0
  75. package/src/bindings/NodeJs.res +44 -3
  76. package/src/bindings/NodeJs.res.mjs +11 -3
  77. package/src/bindings/Pino.res +21 -7
  78. package/src/bindings/Pino.res.mjs +11 -5
  79. package/src/bindings/Postgres.gen.ts +8 -0
  80. package/src/bindings/Postgres.res +3 -0
  81. package/src/bindings/Postgres.res.d.mts +5 -0
  82. package/src/bindings/RescriptMocha.res +123 -0
  83. package/src/bindings/RescriptMocha.res.mjs +18 -0
  84. package/src/bindings/Vitest.res +134 -0
  85. package/src/bindings/Vitest.res.mjs +9 -0
  86. package/src/bindings/Yargs.res +8 -0
  87. package/src/bindings/Yargs.res.mjs +2 -0
  88. package/src/db/InternalTable.res +2 -0
  89. package/src/db/InternalTable.res.mjs +1 -1
  90. package/src/sources/Evm.res +87 -0
  91. package/src/sources/Evm.res.mjs +105 -0
  92. package/src/sources/EvmChain.res +90 -0
  93. package/src/sources/EvmChain.res.mjs +57 -0
  94. package/src/sources/Fuel.res +19 -34
  95. package/src/sources/Fuel.res.mjs +34 -16
  96. package/src/sources/FuelSDK.res +38 -0
  97. package/src/sources/FuelSDK.res.mjs +29 -0
  98. package/src/sources/HyperFuel.res +2 -2
  99. package/src/sources/HyperFuel.resi +1 -1
  100. package/src/sources/HyperFuelClient.res +2 -2
  101. package/src/sources/HyperFuelSource.res +8 -8
  102. package/src/sources/HyperFuelSource.res.mjs +5 -5
  103. package/src/sources/HyperSyncHeightStream.res +97 -0
  104. package/src/sources/HyperSyncHeightStream.res.mjs +94 -0
  105. package/src/sources/HyperSyncSource.res +64 -172
  106. package/src/sources/HyperSyncSource.res.mjs +73 -155
  107. package/src/sources/Rpc.res +43 -0
  108. package/src/sources/Rpc.res.mjs +31 -0
  109. package/src/sources/RpcSource.res +32 -130
  110. package/src/sources/RpcSource.res.mjs +47 -121
  111. package/src/sources/Source.res +3 -2
  112. package/src/sources/SourceManager.res +183 -108
  113. package/src/sources/SourceManager.res.mjs +162 -99
  114. package/src/sources/SourceManager.resi +4 -5
  115. package/src/sources/Svm.res +59 -0
  116. package/src/sources/Svm.res.mjs +79 -0
  117. package/src/tui/Tui.res +266 -0
  118. package/src/tui/Tui.res.mjs +342 -0
  119. package/src/tui/bindings/Ink.res +376 -0
  120. package/src/tui/bindings/Ink.res.mjs +75 -0
  121. package/src/tui/bindings/Style.res +123 -0
  122. package/src/tui/bindings/Style.res.mjs +2 -0
  123. package/src/tui/components/BufferedProgressBar.res +40 -0
  124. package/src/tui/components/BufferedProgressBar.res.mjs +57 -0
  125. package/src/tui/components/CustomHooks.res +122 -0
  126. package/src/tui/components/CustomHooks.res.mjs +179 -0
  127. package/src/tui/components/Messages.res +41 -0
  128. package/src/tui/components/Messages.res.mjs +75 -0
  129. package/src/tui/components/SyncETA.res +193 -0
  130. package/src/tui/components/SyncETA.res.mjs +269 -0
  131. package/src/tui/components/TuiData.res +46 -0
  132. package/src/tui/components/TuiData.res.mjs +29 -0
  133. package/src/Platform.res +0 -140
  134. package/src/Platform.res.mjs +0 -170
  135. package/src/bindings/Ethers.gen.ts +0 -14
  136. /package/src/{Indexer.res.mjs → Ctx.res.mjs} +0 -0
package/README.md CHANGED
@@ -14,11 +14,11 @@ HyperIndex is a fast, developer-friendly multichain indexer, optimized for both
14
14
  - **[Indexer auto-generation](https://docs.envio.dev/docs/HyperIndex/contract-import)** – Generate Indexers directly from smart contract addresses
15
15
  - **High performance** – Historical backfills at over 10,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
- - **[Multichain indexing](https://docs.envio.dev/docs/HyperIndex/multichain-indexing)** – Index any EVM-compatible blockchain and Fuel (simultaneously)
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
19
19
  - **[Reorg support](https://docs.envio.dev/docs/HyperIndex/reorgs-support)** – Graceful handling of blockchain reorganizations
20
20
  - **GraphQL API** – Easy-to-query indexed data
21
- - **Flexible language support** – JavaScript, TypeScript, and ReScript
21
+ - **Flexible language support** – TypeScript, JavaScript, and ReScript
22
22
  - **Factory contract support** – Index data from 1M+ dynamically registered contracts seamlessly
23
23
  - **On-chain & off-chain data integration** – Easily combine multiple data sources
24
24
  - **[Self-hosted & managed options](https://docs.envio.dev/docs/HyperIndex/hosted-service)** – Run your own setup or use HyperIndex hosted services
package/evm.schema.json CHANGED
@@ -15,17 +15,6 @@
15
15
  "description": "Name of the project",
16
16
  "type": "string"
17
17
  },
18
- "ecosystem": {
19
- "description": "Ecosystem of the project.",
20
- "anyOf": [
21
- {
22
- "$ref": "#/$defs/EcosystemTag"
23
- },
24
- {
25
- "type": "null"
26
- }
27
- ]
28
- },
29
18
  "schema": {
30
19
  "description": "Custom path to schema.graphql file",
31
20
  "type": [
@@ -40,6 +29,33 @@
40
29
  "null"
41
30
  ]
42
31
  },
32
+ "handlers": {
33
+ "description": "Optional relative path to handlers directory for auto-loading. Defaults to 'src/handlers' if not specified.",
34
+ "type": [
35
+ "string",
36
+ "null"
37
+ ]
38
+ },
39
+ "full_batch_size": {
40
+ "description": "Target number of events to be processed per batch. Set it to smaller number if you have many Effect API calls which are slow to resolve and can't be batched. (Default: 5000)",
41
+ "type": [
42
+ "integer",
43
+ "null"
44
+ ],
45
+ "format": "uint64",
46
+ "minimum": 0
47
+ },
48
+ "ecosystem": {
49
+ "description": "Ecosystem of the project.",
50
+ "anyOf": [
51
+ {
52
+ "$ref": "#/$defs/EcosystemTag"
53
+ },
54
+ {
55
+ "type": "null"
56
+ }
57
+ ]
58
+ },
43
59
  "contracts": {
44
60
  "description": "Global contract definitions that must contain all definitions except addresses. You can share a single handler/abi/event definitions for contracts across multiple chains.",
45
61
  "type": [
@@ -50,25 +66,18 @@
50
66
  "$ref": "#/$defs/GlobalContract_for_ContractConfig"
51
67
  }
52
68
  },
53
- "networks": {
54
- "description": "Configuration of the blockchain networks that the project is deployed on.",
69
+ "chains": {
70
+ "description": "Configuration of the blockchain chains that the project is deployed on.",
55
71
  "type": "array",
56
72
  "items": {
57
- "$ref": "#/$defs/Network"
73
+ "$ref": "#/$defs/Chain"
58
74
  }
59
75
  },
60
- "unordered_multichain_mode": {
61
- "description": "A flag to indicate if the indexer should use a single queue for all chains or a queue per chain (default: false)",
62
- "type": [
63
- "boolean",
64
- "null"
65
- ]
66
- },
67
- "event_decoder": {
68
- "description": "The event decoder to use for the indexer (default: hypersync-client)",
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)",
69
78
  "anyOf": [
70
79
  {
71
- "$ref": "#/$defs/EventDecoder"
80
+ "$ref": "#/$defs/Multichain"
72
81
  },
73
82
  {
74
83
  "type": "null"
@@ -107,13 +116,6 @@
107
116
  "null"
108
117
  ]
109
118
  },
110
- "preload_handlers": {
111
- "description": "Makes handlers run twice to enable preload optimisations. Removes handlerWithLoader API, since it's not needed. (recommended, default: false)",
112
- "type": [
113
- "boolean",
114
- "null"
115
- ]
116
- },
117
119
  "address_format": {
118
120
  "description": "Address format for Ethereum addresses: 'checksum' or 'lowercase' (default: checksum)",
119
121
  "anyOf": [
@@ -124,19 +126,12 @@
124
126
  "type": "null"
125
127
  }
126
128
  ]
127
- },
128
- "handlers": {
129
- "description": "Optional relative path to handlers directory for auto-loading. Defaults to 'src/handlers' if not specified.",
130
- "type": [
131
- "string",
132
- "null"
133
- ]
134
129
  }
135
130
  },
136
131
  "additionalProperties": false,
137
132
  "required": [
138
133
  "name",
139
- "networks"
134
+ "chains"
140
135
  ],
141
136
  "$defs": {
142
137
  "EcosystemTag": {
@@ -262,7 +257,6 @@
262
257
  "root",
263
258
  "status",
264
259
  "yParity",
265
- "chainId",
266
260
  "accessList",
267
261
  "maxFeePerBlobGas",
268
262
  "blobVersionedHashes",
@@ -304,17 +298,17 @@
304
298
  "mixHash"
305
299
  ]
306
300
  },
307
- "Network": {
301
+ "Chain": {
308
302
  "type": "object",
309
303
  "properties": {
310
304
  "id": {
311
- "description": "The public blockchain network ID.",
305
+ "description": "The public blockchain chain ID.",
312
306
  "type": "integer",
313
307
  "format": "uint64",
314
308
  "minimum": 0
315
309
  },
316
310
  "rpc_config": {
317
- "description": "RPC configuration for utilizing as the network'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.",
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.",
318
312
  "anyOf": [
319
313
  {
320
314
  "$ref": "#/$defs/RpcConfig"
@@ -325,10 +319,10 @@
325
319
  ]
326
320
  },
327
321
  "rpc": {
328
- "description": "RPC configuration for your indexer. If not specified otherwise, for networks 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.",
322
+ "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.",
329
323
  "anyOf": [
330
324
  {
331
- "$ref": "#/$defs/NetworkRpc"
325
+ "$ref": "#/$defs/RpcSelection"
332
326
  },
333
327
  {
334
328
  "type": "null"
@@ -346,7 +340,7 @@
346
340
  }
347
341
  ]
348
342
  },
349
- "confirmed_block_threshold": {
343
+ "max_reorg_depth": {
350
344
  "description": "The number of blocks from the head that the indexer should account for in case of reorgs.",
351
345
  "type": [
352
346
  "integer",
@@ -370,18 +364,20 @@
370
364
  "minimum": 0
371
365
  },
372
366
  "contracts": {
373
- "description": "All the contracts that should be indexed on the given network",
374
- "type": "array",
367
+ "description": "All the contracts that should be indexed on the given chain",
368
+ "type": [
369
+ "array",
370
+ "null"
371
+ ],
375
372
  "items": {
376
- "$ref": "#/$defs/NetworkContract_for_ContractConfig"
373
+ "$ref": "#/$defs/ChainContract_for_ContractConfig"
377
374
  }
378
375
  }
379
376
  },
380
377
  "additionalProperties": false,
381
378
  "required": [
382
379
  "id",
383
- "start_block",
384
- "contracts"
380
+ "start_block"
385
381
  ]
386
382
  },
387
383
  "RpcConfig": {
@@ -469,7 +465,7 @@
469
465
  "url"
470
466
  ]
471
467
  },
472
- "NetworkRpc": {
468
+ "RpcSelection": {
473
469
  "anyOf": [
474
470
  {
475
471
  "type": "string"
@@ -597,7 +593,7 @@
597
593
  "url"
598
594
  ]
599
595
  },
600
- "NetworkContract_for_ContractConfig": {
596
+ "ChainContract_for_ContractConfig": {
601
597
  "type": "object",
602
598
  "properties": {
603
599
  "name": {
@@ -609,7 +605,7 @@
609
605
  "$ref": "#/$defs/Addresses"
610
606
  },
611
607
  "start_block": {
612
- "description": "The block at which the indexer should start ingesting data for this specific contract. If not specified, uses the network start_block. Can be greater than the network start_block for more specific indexing.",
608
+ "description": "The block at which the indexer should start ingesting data for this specific contract. If not specified, uses the chain start_block. Can be greater than the chain start_block for more specific indexing.",
613
609
  "type": [
614
610
  "integer",
615
611
  "null"
@@ -675,11 +671,11 @@
675
671
  }
676
672
  ]
677
673
  },
678
- "EventDecoder": {
674
+ "Multichain": {
679
675
  "type": "string",
680
676
  "enum": [
681
- "viem",
682
- "hypersync-client"
677
+ "ordered",
678
+ "unordered"
683
679
  ]
684
680
  },
685
681
  "AddressFormat": {
package/fuel.schema.json CHANGED
@@ -15,10 +15,6 @@
15
15
  "description": "Name of the project",
16
16
  "type": "string"
17
17
  },
18
- "ecosystem": {
19
- "description": "Ecosystem of the project.",
20
- "$ref": "#/$defs/EcosystemTag"
21
- },
22
18
  "schema": {
23
19
  "description": "Custom path to schema.graphql file",
24
20
  "type": [
@@ -33,6 +29,26 @@
33
29
  "null"
34
30
  ]
35
31
  },
32
+ "handlers": {
33
+ "description": "Optional relative path to handlers directory for auto-loading. Defaults to 'src/handlers' if not specified.",
34
+ "type": [
35
+ "string",
36
+ "null"
37
+ ]
38
+ },
39
+ "full_batch_size": {
40
+ "description": "Target number of events to be processed per batch. Set it to smaller number if you have many Effect API calls which are slow to resolve and can't be batched. (Default: 5000)",
41
+ "type": [
42
+ "integer",
43
+ "null"
44
+ ],
45
+ "format": "uint64",
46
+ "minimum": 0
47
+ },
48
+ "ecosystem": {
49
+ "description": "Ecosystem of the project.",
50
+ "$ref": "#/$defs/EcosystemTag"
51
+ },
36
52
  "contracts": {
37
53
  "description": "Global contract definitions that must contain all definitions except addresses. You can share a single handler/abi/event definitions for contracts across multiple chains.",
38
54
  "type": [
@@ -43,11 +59,11 @@
43
59
  "$ref": "#/$defs/GlobalContract_for_ContractConfig"
44
60
  }
45
61
  },
46
- "networks": {
47
- "description": "Configuration of the blockchain networks that the project is deployed on.",
62
+ "chains": {
63
+ "description": "Configuration of the blockchain chains that the project is deployed on.",
48
64
  "type": "array",
49
65
  "items": {
50
- "$ref": "#/$defs/Network"
66
+ "$ref": "#/$defs/Chain"
51
67
  }
52
68
  },
53
69
  "raw_events": {
@@ -56,27 +72,13 @@
56
72
  "boolean",
57
73
  "null"
58
74
  ]
59
- },
60
- "preload_handlers": {
61
- "description": "Makes handlers run twice to enable preload optimisations. Removes handlerWithLoader API, since it's not needed. (recommended, default: false)",
62
- "type": [
63
- "boolean",
64
- "null"
65
- ]
66
- },
67
- "handlers": {
68
- "description": "Optional relative path to handlers directory for auto-loading. Defaults to 'src/handlers' if not specified.",
69
- "type": [
70
- "string",
71
- "null"
72
- ]
73
75
  }
74
76
  },
75
77
  "additionalProperties": false,
76
78
  "required": [
77
79
  "name",
78
80
  "ecosystem",
79
- "networks"
81
+ "chains"
80
82
  ],
81
83
  "$defs": {
82
84
  "EcosystemTag": {
@@ -159,11 +161,11 @@
159
161
  "call"
160
162
  ]
161
163
  },
162
- "Network": {
164
+ "Chain": {
163
165
  "type": "object",
164
166
  "properties": {
165
167
  "id": {
166
- "description": "Public chain/network id",
168
+ "description": "Public chain id",
167
169
  "type": "integer",
168
170
  "format": "uint64",
169
171
  "minimum": 0
@@ -195,18 +197,20 @@
195
197
  ]
196
198
  },
197
199
  "contracts": {
198
- "description": "All the contracts that should be indexed on the given network",
199
- "type": "array",
200
+ "description": "All the contracts that should be indexed on the given chain",
201
+ "type": [
202
+ "array",
203
+ "null"
204
+ ],
200
205
  "items": {
201
- "$ref": "#/$defs/NetworkContract_for_ContractConfig"
206
+ "$ref": "#/$defs/ChainContract_for_ContractConfig"
202
207
  }
203
208
  }
204
209
  },
205
210
  "additionalProperties": false,
206
211
  "required": [
207
212
  "id",
208
- "start_block",
209
- "contracts"
213
+ "start_block"
210
214
  ]
211
215
  },
212
216
  "HyperfuelConfig": {
@@ -222,7 +226,7 @@
222
226
  "url"
223
227
  ]
224
228
  },
225
- "NetworkContract_for_ContractConfig": {
229
+ "ChainContract_for_ContractConfig": {
226
230
  "type": "object",
227
231
  "properties": {
228
232
  "name": {
@@ -234,7 +238,7 @@
234
238
  "$ref": "#/$defs/Addresses"
235
239
  },
236
240
  "start_block": {
237
- "description": "The block at which the indexer should start ingesting data for this specific contract. If not specified, uses the network start_block. Can be greater than the network start_block for more specific indexing.",
241
+ "description": "The block at which the indexer should start ingesting data for this specific contract. If not specified, uses the chain start_block. Can be greater than the chain start_block for more specific indexing.",
238
242
  "type": [
239
243
  "integer",
240
244
  "null"