envio 2.29.0-alpha.2 → 2.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envio",
3
- "version": "v2.29.0-alpha.2",
3
+ "version": "v2.29.0",
4
4
  "description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
5
5
  "bin": "./bin.js",
6
6
  "main": "./index.js",
@@ -25,19 +25,21 @@
25
25
  },
26
26
  "homepage": "https://envio.dev",
27
27
  "optionalDependencies": {
28
- "envio-linux-x64": "v2.29.0-alpha.2",
29
- "envio-linux-arm64": "v2.29.0-alpha.2",
30
- "envio-darwin-x64": "v2.29.0-alpha.2",
31
- "envio-darwin-arm64": "v2.29.0-alpha.2"
28
+ "envio-linux-x64": "v2.29.0",
29
+ "envio-linux-arm64": "v2.29.0",
30
+ "envio-darwin-x64": "v2.29.0",
31
+ "envio-darwin-arm64": "v2.29.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "@envio-dev/hypersync-client": "0.6.6",
35
+ "@envio-dev/hyperfuel-client": "1.2.2",
35
36
  "rescript": "11.1.3",
36
37
  "rescript-schema": "9.3.0",
37
38
  "viem": "2.21.0",
38
39
  "bignumber.js": "9.1.2",
39
40
  "pino": "8.16.1",
40
41
  "pino-pretty": "10.2.3",
42
+ "@elastic/ecs-pino-format": "1.4.0",
41
43
  "prom-client": "15.0.0"
42
44
  },
43
45
  "files": [
package/src/Batch.res CHANGED
@@ -58,6 +58,18 @@ let getOrderedNextItem = (fetchStates: ChainMap.t<FetchState.t>): option<
58
58
  })
59
59
  }
60
60
 
61
+ let hasUnorderedNextItem = (fetchStates: ChainMap.t<FetchState.t>) => {
62
+ fetchStates
63
+ ->ChainMap.values
64
+ ->Js.Array2.some(fetchState => {
65
+ fetchState->FetchState.isActivelyIndexing &&
66
+ switch fetchState->FetchState.getEarliestEvent {
67
+ | Item(_) => true
68
+ | NoItem(_) => false
69
+ }
70
+ })
71
+ }
72
+
61
73
  let popOrderedBatchItems = (
62
74
  ~maxBatchSize,
63
75
  ~fetchStates: ChainMap.t<FetchState.t>,
package/src/Batch.res.js CHANGED
@@ -45,6 +45,20 @@ function getOrderedNextItem(fetchStates) {
45
45
  }));
46
46
  }
47
47
 
48
+ function hasUnorderedNextItem(fetchStates) {
49
+ return ChainMap.values(fetchStates).some(function (fetchState) {
50
+ if (!FetchState.isActivelyIndexing(fetchState)) {
51
+ return false;
52
+ }
53
+ var match = FetchState.getEarliestEvent(fetchState);
54
+ if (match.TAG === "Item") {
55
+ return true;
56
+ } else {
57
+ return false;
58
+ }
59
+ });
60
+ }
61
+
48
62
  function popOrderedBatchItems(maxBatchSize, fetchStates, sizePerChain) {
49
63
  var items = [];
50
64
  var loop = function () {
@@ -113,6 +127,7 @@ function popUnorderedBatchItems(maxBatchSize, fetchStates, sizePerChain) {
113
127
  exports.getQueueItemComparitor = getQueueItemComparitor;
114
128
  exports.isQueueItemEarlier = isQueueItemEarlier;
115
129
  exports.getOrderedNextItem = getOrderedNextItem;
130
+ exports.hasUnorderedNextItem = hasUnorderedNextItem;
116
131
  exports.popOrderedBatchItems = popOrderedBatchItems;
117
132
  exports.popUnorderedBatchItems = popUnorderedBatchItems;
118
133
  /* Utils Not a pure module */
@@ -131,7 +131,20 @@ let onBlock = (rawOptions: unknown, handler: Internal.onBlockArgs => promise<uni
131
131
  ),
132
132
  ],
133
133
  )
134
- | Some(_) => Js.Exn.raiseError("Currently only one onBlock handler per chain is supported")
134
+ | Some(onBlockConfigs) =>
135
+ onBlockConfigs->Belt.Array.push(
136
+ (
137
+ {
138
+ index: onBlockConfigs->Belt.Array.length,
139
+ name: options["name"],
140
+ startBlock: options["startBlock"],
141
+ endBlock: options["endBlock"],
142
+ interval: options["interval"],
143
+ chainId,
144
+ handler,
145
+ }: Internal.onBlockConfig
146
+ ),
147
+ )
135
148
  }
136
149
  })
137
150
  }
@@ -86,9 +86,17 @@ function onBlock(rawOptions, handler) {
86
86
  var options = S$RescriptSchema.parseOrThrow(rawOptions, onBlockOptionsSchema);
87
87
  var chainId = options.chain;
88
88
  var onBlockByChainId = registration.registrations.onBlockByChainId;
89
- var match$2 = onBlockByChainId[String(chainId)];
90
- if (match$2 !== undefined) {
91
- return Js_exn.raiseError("Currently only one onBlock handler per chain is supported");
89
+ var onBlockConfigs = onBlockByChainId[String(chainId)];
90
+ if (onBlockConfigs !== undefined) {
91
+ onBlockConfigs.push({
92
+ index: onBlockConfigs.length,
93
+ name: options.name,
94
+ chainId: chainId,
95
+ startBlock: options.startBlock,
96
+ endBlock: options.endBlock,
97
+ interval: options.interval,
98
+ handler: handler
99
+ });
92
100
  } else {
93
101
  onBlockByChainId[chainId] = [{
94
102
  index: 0,
@@ -99,7 +107,6 @@ function onBlock(rawOptions, handler) {
99
107
  interval: options.interval,
100
108
  handler: handler
101
109
  }];
102
- return ;
103
110
  }
104
111
  });
105
112
  }
@@ -16,6 +16,10 @@ let isEarlier = (item1: (int, int, int, int), item2: (int, int, int, int)) => {
16
16
  item1 < item2
17
17
  }
18
18
 
19
+ let isEarlierUnordered = (item1: (int, int, int), item2: (int, int, int)) => {
20
+ item1 < item2
21
+ }
22
+
19
23
  // type eventIndex = {
20
24
  // blockNumber: int,
21
25
  // logIndex: int,
@@ -20,6 +20,8 @@ function getOrderedBatchItemComparator(item) {
20
20
 
21
21
  var isEarlier = Caml_obj.lessthan;
22
22
 
23
+ var isEarlierUnordered = Caml_obj.lessthan;
24
+
23
25
  function packEventIndex(blockNumber, logIndex) {
24
26
  var blockNumber$1 = BigInt(blockNumber);
25
27
  var logIndex$1 = BigInt(logIndex);
@@ -34,6 +36,7 @@ function getEventIdKeyString(chainId, eventId) {
34
36
 
35
37
  exports.getOrderedBatchItemComparator = getOrderedBatchItemComparator;
36
38
  exports.isEarlier = isEarlier;
39
+ exports.isEarlierUnordered = isEarlierUnordered;
37
40
  exports.packEventIndex = packEventIndex;
38
41
  exports.getEventIdKeyString = getEventIdKeyString;
39
42
  /* BigInt Not a pure module */