envio 3.0.0-alpha.1 → 3.0.0-alpha.3

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 (71) hide show
  1. package/evm.schema.json +63 -48
  2. package/fuel.schema.json +35 -31
  3. package/index.d.ts +1 -0
  4. package/package.json +15 -11
  5. package/rescript.json +1 -1
  6. package/src/Batch.res.mjs +1 -1
  7. package/src/Benchmark.res +394 -0
  8. package/src/Benchmark.res.mjs +398 -0
  9. package/src/ChainFetcher.res +459 -0
  10. package/src/ChainFetcher.res.mjs +281 -0
  11. package/src/ChainManager.res +179 -0
  12. package/src/ChainManager.res.mjs +139 -0
  13. package/src/Config.res +18 -7
  14. package/src/Config.res.mjs +28 -7
  15. package/src/Ecosystem.res +25 -0
  16. package/src/Ecosystem.res.mjs +29 -0
  17. package/src/Env.res +243 -0
  18. package/src/Env.res.mjs +270 -0
  19. package/src/Envio.gen.ts +9 -1
  20. package/src/Envio.res +12 -9
  21. package/src/EventProcessing.res +476 -0
  22. package/src/EventProcessing.res.mjs +341 -0
  23. package/src/EventRegister.res +4 -15
  24. package/src/EventRegister.res.mjs +3 -9
  25. package/src/EventRegister.resi +2 -8
  26. package/src/FetchState.res +54 -29
  27. package/src/FetchState.res.mjs +62 -35
  28. package/src/GlobalState.res +1169 -0
  29. package/src/GlobalState.res.mjs +1196 -0
  30. package/src/Internal.gen.ts +3 -14
  31. package/src/Internal.res +4 -12
  32. package/src/LoadLayer.res +444 -0
  33. package/src/LoadLayer.res.mjs +296 -0
  34. package/src/LoadLayer.resi +32 -0
  35. package/src/Prometheus.res +8 -8
  36. package/src/Prometheus.res.mjs +10 -10
  37. package/src/ReorgDetection.res +6 -10
  38. package/src/ReorgDetection.res.mjs +6 -6
  39. package/src/UserContext.res +356 -0
  40. package/src/UserContext.res.mjs +238 -0
  41. package/src/bindings/DateFns.res +71 -0
  42. package/src/bindings/DateFns.res.mjs +22 -0
  43. package/src/bindings/EventSource.res +13 -0
  44. package/src/bindings/EventSource.res.mjs +2 -0
  45. package/src/sources/Evm.res +87 -0
  46. package/src/sources/Evm.res.mjs +105 -0
  47. package/src/sources/EvmChain.res +95 -0
  48. package/src/sources/EvmChain.res.mjs +61 -0
  49. package/src/sources/Fuel.res +19 -34
  50. package/src/sources/Fuel.res.mjs +34 -16
  51. package/src/sources/FuelSDK.res +37 -0
  52. package/src/sources/FuelSDK.res.mjs +29 -0
  53. package/src/sources/HyperFuel.res +2 -2
  54. package/src/sources/HyperFuel.resi +1 -1
  55. package/src/sources/HyperFuelClient.res +2 -2
  56. package/src/sources/HyperFuelSource.res +8 -8
  57. package/src/sources/HyperFuelSource.res.mjs +5 -5
  58. package/src/sources/HyperSyncHeightStream.res +179 -0
  59. package/src/sources/HyperSyncHeightStream.res.mjs +127 -0
  60. package/src/sources/HyperSyncSource.res +7 -65
  61. package/src/sources/HyperSyncSource.res.mjs +10 -66
  62. package/src/sources/RpcSource.res +4 -4
  63. package/src/sources/RpcSource.res.mjs +3 -3
  64. package/src/sources/Solana.res +59 -0
  65. package/src/sources/Solana.res.mjs +79 -0
  66. package/src/sources/Source.res +2 -2
  67. package/src/sources/SourceManager.res +24 -32
  68. package/src/sources/SourceManager.res.mjs +20 -20
  69. package/src/sources/SourceManager.resi +4 -5
  70. package/src/Platform.res +0 -140
  71. package/src/Platform.res.mjs +0 -170
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,18 +66,22 @@
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"
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
+ }
65
85
  ]
66
86
  },
67
87
  "event_decoder": {
@@ -107,13 +127,6 @@
107
127
  "null"
108
128
  ]
109
129
  },
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
130
  "address_format": {
118
131
  "description": "Address format for Ethereum addresses: 'checksum' or 'lowercase' (default: checksum)",
119
132
  "anyOf": [
@@ -124,19 +137,12 @@
124
137
  "type": "null"
125
138
  }
126
139
  ]
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
140
  }
135
141
  },
136
142
  "additionalProperties": false,
137
143
  "required": [
138
144
  "name",
139
- "networks"
145
+ "chains"
140
146
  ],
141
147
  "$defs": {
142
148
  "EcosystemTag": {
@@ -304,17 +310,17 @@
304
310
  "mixHash"
305
311
  ]
306
312
  },
307
- "Network": {
313
+ "Chain": {
308
314
  "type": "object",
309
315
  "properties": {
310
316
  "id": {
311
- "description": "The public blockchain network ID.",
317
+ "description": "The public blockchain chain ID.",
312
318
  "type": "integer",
313
319
  "format": "uint64",
314
320
  "minimum": 0
315
321
  },
316
322
  "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.",
323
+ "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
324
  "anyOf": [
319
325
  {
320
326
  "$ref": "#/$defs/RpcConfig"
@@ -325,10 +331,10 @@
325
331
  ]
326
332
  },
327
333
  "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.",
334
+ "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
335
  "anyOf": [
330
336
  {
331
- "$ref": "#/$defs/NetworkRpc"
337
+ "$ref": "#/$defs/RpcSelection"
332
338
  },
333
339
  {
334
340
  "type": "null"
@@ -346,7 +352,7 @@
346
352
  }
347
353
  ]
348
354
  },
349
- "confirmed_block_threshold": {
355
+ "max_reorg_depth": {
350
356
  "description": "The number of blocks from the head that the indexer should account for in case of reorgs.",
351
357
  "type": [
352
358
  "integer",
@@ -370,18 +376,20 @@
370
376
  "minimum": 0
371
377
  },
372
378
  "contracts": {
373
- "description": "All the contracts that should be indexed on the given network",
374
- "type": "array",
379
+ "description": "All the contracts that should be indexed on the given chain",
380
+ "type": [
381
+ "array",
382
+ "null"
383
+ ],
375
384
  "items": {
376
- "$ref": "#/$defs/NetworkContract_for_ContractConfig"
385
+ "$ref": "#/$defs/ChainContract_for_ContractConfig"
377
386
  }
378
387
  }
379
388
  },
380
389
  "additionalProperties": false,
381
390
  "required": [
382
391
  "id",
383
- "start_block",
384
- "contracts"
392
+ "start_block"
385
393
  ]
386
394
  },
387
395
  "RpcConfig": {
@@ -469,7 +477,7 @@
469
477
  "url"
470
478
  ]
471
479
  },
472
- "NetworkRpc": {
480
+ "RpcSelection": {
473
481
  "anyOf": [
474
482
  {
475
483
  "type": "string"
@@ -597,7 +605,7 @@
597
605
  "url"
598
606
  ]
599
607
  },
600
- "NetworkContract_for_ContractConfig": {
608
+ "ChainContract_for_ContractConfig": {
601
609
  "type": "object",
602
610
  "properties": {
603
611
  "name": {
@@ -609,7 +617,7 @@
609
617
  "$ref": "#/$defs/Addresses"
610
618
  },
611
619
  "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.",
620
+ "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
621
  "type": [
614
622
  "integer",
615
623
  "null"
@@ -675,6 +683,13 @@
675
683
  }
676
684
  ]
677
685
  },
686
+ "Multichain": {
687
+ "type": "string",
688
+ "enum": [
689
+ "ordered",
690
+ "unordered"
691
+ ]
692
+ },
678
693
  "EventDecoder": {
679
694
  "type": "string",
680
695
  "enum": [
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"
package/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export type {
8
8
  rateLimit as RateLimit,
9
9
  blockEvent as BlockEvent,
10
10
  fuelBlockEvent as FuelBlockEvent,
11
+ solanaOnBlockArgs as SolanaOnBlockArgs,
11
12
  onBlockArgs as OnBlockArgs,
12
13
  onBlockOptions as OnBlockOptions,
13
14
  } from "./src/Envio.gen.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envio",
3
- "version": "v3.0.0-alpha.1",
3
+ "version": "v3.0.0-alpha.3",
4
4
  "type": "module",
5
5
  "description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
6
6
  "bin": "./bin.js",
@@ -29,23 +29,27 @@
29
29
  "node": ">=22.0.0"
30
30
  },
31
31
  "optionalDependencies": {
32
- "envio-linux-x64": "v3.0.0-alpha.1",
33
- "envio-linux-arm64": "v3.0.0-alpha.1",
34
- "envio-darwin-x64": "v3.0.0-alpha.1",
35
- "envio-darwin-arm64": "v3.0.0-alpha.1"
32
+ "envio-linux-x64": "v3.0.0-alpha.3",
33
+ "envio-linux-arm64": "v3.0.0-alpha.3",
34
+ "envio-darwin-x64": "v3.0.0-alpha.3",
35
+ "envio-darwin-arm64": "v3.0.0-alpha.3"
36
36
  },
37
37
  "dependencies": {
38
38
  "@clickhouse/client": "1.12.1",
39
- "@envio-dev/hypersync-client": "0.7.0",
39
+ "@elastic/ecs-pino-format": "1.4.0",
40
40
  "@envio-dev/hyperfuel-client": "1.2.2",
41
- "rescript": "11.1.3",
42
- "rescript-schema": "9.3.4",
43
- "viem": "2.21.0",
41
+ "@envio-dev/hypersync-client": "0.7.0",
44
42
  "bignumber.js": "9.1.2",
43
+ "eventsource": "4.1.0",
45
44
  "pino": "8.16.1",
46
45
  "pino-pretty": "10.2.3",
47
- "@elastic/ecs-pino-format": "1.4.0",
48
- "prom-client": "15.0.0"
46
+ "prom-client": "15.0.0",
47
+ "rescript": "11.1.3",
48
+ "rescript-schema": "9.3.4",
49
+ "viem": "2.21.0",
50
+ "rescript-envsafe": "5.0.0",
51
+ "dotenv": "16.4.5",
52
+ "date-fns": "3.3.1"
49
53
  },
50
54
  "files": [
51
55
  "bin.js",
package/rescript.json CHANGED
@@ -19,6 +19,6 @@
19
19
  "generatedFileExtension": ".gen.ts",
20
20
  "moduleResolution": "node16"
21
21
  },
22
- "bs-dependencies": ["rescript-schema"],
22
+ "bs-dependencies": ["rescript-schema", "rescript-envsafe"],
23
23
  "bsc-flags": ["-open RescriptSchema"]
24
24
  }
package/src/Batch.res.mjs CHANGED
@@ -80,7 +80,7 @@ function getProgressedChainsById(chainsBeforeBatch, batchSizePerChain, progressB
80
80
  var progressedChain;
81
81
  if (batchSize !== undefined) {
82
82
  var leftItems = fetchState.buffer.slice(batchSize);
83
- progressedChain = getChainAfterBatchIfProgressed(chainBeforeBatch, progressBlockNumberAfterBatch, FetchState.updateInternal(fetchState, undefined, undefined, undefined, leftItems, undefined), batchSize);
83
+ progressedChain = getChainAfterBatchIfProgressed(chainBeforeBatch, progressBlockNumberAfterBatch, FetchState.updateInternal(fetchState, undefined, undefined, undefined, leftItems, undefined, undefined), batchSize);
84
84
  } else {
85
85
  progressedChain = getChainAfterBatchIfProgressed(chainBeforeBatch, progressBlockNumberAfterBatch, chainBeforeBatch.fetchState, 0);
86
86
  }