envio 3.0.0-alpha.7 → 3.0.0-alpha.9

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/evm.schema.json CHANGED
@@ -84,17 +84,6 @@
84
84
  }
85
85
  ]
86
86
  },
87
- "event_decoder": {
88
- "description": "The event decoder to use for the indexer (default: hypersync-client)",
89
- "anyOf": [
90
- {
91
- "$ref": "#/$defs/EventDecoder"
92
- },
93
- {
94
- "type": "null"
95
- }
96
- ]
97
- },
98
87
  "rollback_on_reorg": {
99
88
  "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)",
100
89
  "type": [
@@ -689,13 +678,6 @@
689
678
  "unordered"
690
679
  ]
691
680
  },
692
- "EventDecoder": {
693
- "type": "string",
694
- "enum": [
695
- "viem",
696
- "hypersync-client"
697
- ]
698
- },
699
681
  "AddressFormat": {
700
682
  "type": "string",
701
683
  "enum": [
package/index.d.ts CHANGED
@@ -193,8 +193,6 @@ type IndexerConfig = {
193
193
  contracts?: Record<string, EvmContractConfig>;
194
194
  /** Address format (default: "checksum"). */
195
195
  addressFormat?: "lowercase" | "checksum";
196
- /** Event decoder (default: "hypersync"). */
197
- eventDecoder?: "hypersync" | "viem";
198
196
  };
199
197
  /** Fuel ecosystem configuration. */
200
198
  fuel?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envio",
3
- "version": "v3.0.0-alpha.7",
3
+ "version": "v3.0.0-alpha.9",
4
4
  "type": "module",
5
5
  "description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
6
6
  "bin": "./bin.js",
@@ -29,10 +29,10 @@
29
29
  "node": ">=22.0.0"
30
30
  },
31
31
  "optionalDependencies": {
32
- "envio-linux-x64": "v3.0.0-alpha.7",
33
- "envio-linux-arm64": "v3.0.0-alpha.7",
34
- "envio-darwin-x64": "v3.0.0-alpha.7",
35
- "envio-darwin-arm64": "v3.0.0-alpha.7"
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
36
  },
37
37
  "dependencies": {
38
38
  "@clickhouse/client": "1.12.1",
@@ -56,7 +56,7 @@
56
56
  "ink": "6.5.1",
57
57
  "ink-big-text": "2.0.0",
58
58
  "ink-spinner": "5.0.0",
59
- "postgres": "3.4.1",
59
+ "postgres": "3.4.8",
60
60
  "tsx": "4.21.0"
61
61
  },
62
62
  "files": [
package/src/Config.res CHANGED
@@ -101,14 +101,12 @@ let publicConfigEcosystemSchema = S.schema(s =>
101
101
  )
102
102
 
103
103
  type addressFormat = | @as("lowercase") Lowercase | @as("checksum") Checksum
104
- type decoder = | @as("hypersync") Hypersync | @as("viem") Viem
105
104
 
106
105
  let publicConfigEvmSchema = S.schema(s =>
107
106
  {
108
107
  "chains": s.matches(S.dict(publicConfigChainSchema)),
109
108
  "contracts": s.matches(S.option(S.dict(contractConfigSchema))),
110
109
  "addressFormat": s.matches(S.option(S.enum([Lowercase, Checksum]))),
111
- "eventDecoder": s.matches(S.option(S.enum([Hypersync, Viem]))),
112
110
  }
113
111
  )
114
112
 
@@ -160,19 +158,9 @@ let fromPublic = (
160
158
  }
161
159
 
162
160
  // Extract EVM-specific options with defaults
163
- let (lowercaseAddresses, shouldUseHypersyncClientDecoder) = switch publicConfig["evm"] {
164
- | Some(evm) => (
165
- evm["addressFormat"]->Option.getWithDefault(Checksum) == Lowercase,
166
- evm["eventDecoder"]->Option.getWithDefault(Hypersync) == Hypersync,
167
- )
168
- | None => (false, true)
169
- }
170
-
171
- // Validate that lowercase addresses is not used with viem decoder
172
- if lowercaseAddresses && !shouldUseHypersyncClientDecoder {
173
- Js.Exn.raiseError(
174
- "lowercase addresses is not supported when event_decoder is 'viem'. Please set event_decoder to 'hypersync-client' or change address_format to 'checksum'.",
175
- )
161
+ let lowercaseAddresses = switch publicConfig["evm"] {
162
+ | Some(evm) => evm["addressFormat"]->Option.getWithDefault(Checksum) == Lowercase
163
+ | None => false
176
164
  }
177
165
 
178
166
  // Parse ABIs from public config
@@ -44,10 +44,6 @@ var publicConfigEvmSchema = S$RescriptSchema.schema(function (s) {
44
44
  addressFormat: s.m(S$RescriptSchema.option(S$RescriptSchema.$$enum([
45
45
  "lowercase",
46
46
  "checksum"
47
- ]))),
48
- eventDecoder: s.m(S$RescriptSchema.option(S$RescriptSchema.$$enum([
49
- "hypersync",
50
- "viem"
51
47
  ])))
52
48
  };
53
49
  });
@@ -113,32 +109,16 @@ function fromPublic(publicConfigJson, codegenChainsOpt, maxAddrInPartitionOpt, u
113
109
  var ecosystemName = match$3[1];
114
110
  var publicChainsConfig = match$3[0];
115
111
  var evm = publicConfig.evm;
116
- var match$4;
117
- if (evm !== undefined) {
118
- var evm$1 = Caml_option.valFromOption(evm);
119
- match$4 = [
120
- Belt_Option.getWithDefault(evm$1.addressFormat, "checksum") === "lowercase",
121
- Belt_Option.getWithDefault(evm$1.eventDecoder, "hypersync") === "hypersync"
122
- ];
123
- } else {
124
- match$4 = [
125
- false,
126
- true
127
- ];
128
- }
129
- var lowercaseAddresses = match$4[0];
130
- if (lowercaseAddresses && !match$4[1]) {
131
- Js_exn.raiseError("lowercase addresses is not supported when event_decoder is 'viem'. Please set event_decoder to 'hypersync-client' or change address_format to 'checksum'.");
132
- }
133
- var match$5 = publicConfig.evm;
134
- var match$6 = publicConfig.fuel;
112
+ var lowercaseAddresses = evm !== undefined ? Belt_Option.getWithDefault(Caml_option.valFromOption(evm).addressFormat, "checksum") === "lowercase" : false;
113
+ var match$4 = publicConfig.evm;
114
+ var match$5 = publicConfig.fuel;
135
115
  var publicContractsConfig;
136
116
  switch (ecosystemName) {
137
117
  case "evm" :
138
- publicContractsConfig = match$5 !== undefined ? Caml_option.valFromOption(match$5).contracts : undefined;
118
+ publicContractsConfig = match$4 !== undefined ? Caml_option.valFromOption(match$4).contracts : undefined;
139
119
  break;
140
120
  case "fuel" :
141
- publicContractsConfig = match$6 !== undefined ? Caml_option.valFromOption(match$6).contracts : undefined;
121
+ publicContractsConfig = match$5 !== undefined ? Caml_option.valFromOption(match$5).contracts : undefined;
142
122
  break;
143
123
  case "svm" :
144
124
  publicContractsConfig = undefined;
@@ -23,6 +23,20 @@ type testIndexerState = {
23
23
  mutable processChanges: array<unknown>,
24
24
  }
25
25
 
26
+ // Cast Internal.entity back to DynamicContractRegistry.t
27
+ external castFromDcRegistry: Internal.entity => InternalTable.DynamicContractRegistry.t =
28
+ "%identity"
29
+
30
+ // Convert DynamicContractRegistry.t to Internal.indexingContract
31
+ let toIndexingContract = (
32
+ dc: InternalTable.DynamicContractRegistry.t,
33
+ ): Internal.indexingContract => {
34
+ address: dc.contractAddress,
35
+ contractName: dc.contractName,
36
+ startBlock: dc.registeringEventBlockNumber,
37
+ registrationBlock: Some(dc.registeringEventBlockNumber),
38
+ }
39
+
26
40
  let handleLoadByIds = (
27
41
  state: testIndexerState,
28
42
  ~tableName: string,
@@ -220,6 +234,7 @@ let handleWriteBatch = (
220
234
  let makeInitialState = (
221
235
  ~config: Config.t,
222
236
  ~processConfigChains: Js.Dict.t<chainConfig>,
237
+ ~dynamicContractsByChain: dict<array<Internal.indexingContract>>,
223
238
  ): Persistence.initialState => {
224
239
  let chainKeys = processConfigChains->Js.Dict.keys
225
240
  let chains = chainKeys->Array.map(chainIdStr => {
@@ -231,6 +246,10 @@ let makeInitialState = (
231
246
  }
232
247
 
233
248
  let processChainConfig = processConfigChains->Js.Dict.unsafeGet(chainIdStr)
249
+ let dynamicContracts =
250
+ dynamicContractsByChain
251
+ ->Js.Dict.get(chainIdStr)
252
+ ->Option.getWithDefault([])
234
253
  {
235
254
  Persistence.id: chainId,
236
255
  startBlock: processChainConfig.startBlock,
@@ -241,7 +260,7 @@ let makeInitialState = (
241
260
  numEventsProcessed: 0,
242
261
  firstEventBlockNumber: None,
243
262
  timestampCaughtUpToHeadOrEndblock: None,
244
- dynamicContracts: [],
263
+ dynamicContracts,
245
264
  }
246
265
  })
247
266
 
@@ -344,8 +363,33 @@ let makeCreateTestIndexer = (
344
363
  // Reset processChanges for this run
345
364
  state.processChanges = []
346
365
 
366
+ // Extract dynamic contracts from state.entities for each chain
367
+ let dynamicContractsByChain: dict<array<Internal.indexingContract>> = Js.Dict.empty()
368
+ switch state.entities->Js.Dict.get(InternalTable.DynamicContractRegistry.name) {
369
+ | Some(dcDict) =>
370
+ dcDict
371
+ ->Js.Dict.values
372
+ ->Array.forEach(entity => {
373
+ let dc = entity->castFromDcRegistry
374
+ let chainIdStr = dc.chainId->Int.toString
375
+ let contracts = switch dynamicContractsByChain->Js.Dict.get(chainIdStr) {
376
+ | Some(arr) => arr
377
+ | None =>
378
+ let arr = []
379
+ dynamicContractsByChain->Js.Dict.set(chainIdStr, arr)
380
+ arr
381
+ }
382
+ contracts->Array.push(dc->toIndexingContract)->ignore
383
+ })
384
+ | None => ()
385
+ }
386
+
347
387
  // Create initialState from processConfig chains
348
- let initialState = makeInitialState(~config, ~processConfigChains=chains)
388
+ let initialState = makeInitialState(
389
+ ~config,
390
+ ~processConfigChains=chains,
391
+ ~dynamicContractsByChain,
392
+ )
349
393
 
350
394
  Promise.make((resolve, reject) => {
351
395
  // Include initialState in workerData
@@ -20,6 +20,15 @@ import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
20
20
  import * as Caml_js_exceptions from "rescript/lib/es6/caml_js_exceptions.js";
21
21
  import * as TestIndexerProxyStorage from "./TestIndexerProxyStorage.res.mjs";
22
22
 
23
+ function toIndexingContract(dc) {
24
+ return {
25
+ address: dc.contract_address,
26
+ contractName: dc.contract_name,
27
+ startBlock: dc.registering_event_block_number,
28
+ registrationBlock: dc.registering_event_block_number
29
+ };
30
+ }
31
+
23
32
  function handleLoadByIds(state, tableName, ids) {
24
33
  var entityDict = Belt_Option.getWithDefault(Js_dict.get(state.entities, tableName), {});
25
34
  var entityConfig = state.entityConfigs[tableName];
@@ -183,7 +192,7 @@ function handleWriteBatch(state, updatedEntities, checkpointIds, checkpointChain
183
192
  }
184
193
  }
185
194
 
186
- function makeInitialState(config, processConfigChains) {
195
+ function makeInitialState(config, processConfigChains, dynamicContractsByChain) {
187
196
  var chainKeys = Object.keys(processConfigChains);
188
197
  var chains = Belt_Array.map(chainKeys, (function (chainIdStr) {
189
198
  var chainId = Belt_Option.getWithDefault(Belt_Int.fromString(chainIdStr), 0);
@@ -192,6 +201,7 @@ function makeInitialState(config, processConfigChains) {
192
201
  Js_exn.raiseError("Chain " + chainIdStr + " is not configured in config.yaml");
193
202
  }
194
203
  var processChainConfig = processConfigChains[chainIdStr];
204
+ var dynamicContracts = Belt_Option.getWithDefault(Js_dict.get(dynamicContractsByChain, chainIdStr), []);
195
205
  return {
196
206
  id: chainId,
197
207
  startBlock: processChainConfig.startBlock,
@@ -201,7 +211,7 @@ function makeInitialState(config, processConfigChains) {
201
211
  numEventsProcessed: 0,
202
212
  firstEventBlockNumber: undefined,
203
213
  timestampCaughtUpToHeadOrEndblock: undefined,
204
- dynamicContracts: [],
214
+ dynamicContracts: dynamicContracts,
205
215
  sourceBlockNumber: processChainConfig.endBlock
206
216
  };
207
217
  }));
@@ -268,7 +278,24 @@ function makeCreateTestIndexer(config, workerPath, allEntities) {
268
278
  validateBlockRange(chainIdStr, configChain, processChainConfig, progressBlock);
269
279
  }));
270
280
  state.processChanges = [];
271
- var initialState = makeInitialState(config, chains);
281
+ var dynamicContractsByChain = {};
282
+ var dcDict = Js_dict.get(state.entities, InternalTable.DynamicContractRegistry.name);
283
+ if (dcDict !== undefined) {
284
+ Belt_Array.forEach(Js_dict.values(dcDict), (function (entity) {
285
+ var chainIdStr = String(entity.chain_id);
286
+ var arr = Js_dict.get(dynamicContractsByChain, chainIdStr);
287
+ var contracts;
288
+ if (arr !== undefined) {
289
+ contracts = arr;
290
+ } else {
291
+ var arr$1 = [];
292
+ dynamicContractsByChain[chainIdStr] = arr$1;
293
+ contracts = arr$1;
294
+ }
295
+ contracts.push(toIndexingContract(entity));
296
+ }));
297
+ }
298
+ var initialState = makeInitialState(config, chains, dynamicContractsByChain);
272
299
  return new Promise((function (resolve, reject) {
273
300
  var workerDataObj = {
274
301
  processConfig: JSON.parse(Js_json.serializeExn(processConfig)),
@@ -358,6 +385,7 @@ function initTestWorker(makeGeneratedConfig, makePersistence) {
358
385
  }
359
386
 
360
387
  export {
388
+ toIndexingContract ,
361
389
  handleLoadByIds ,
362
390
  handleLoadByField ,
363
391
  handleWriteBatch ,
@@ -47,7 +47,6 @@ let makeSources = (
47
47
  ~contracts: array<Internal.evmContractConfig>,
48
48
  ~hyperSync,
49
49
  ~allEventSignatures,
50
- ~shouldUseHypersyncClientDecoder,
51
50
  ~rpcs: array<rpc>,
52
51
  ~lowercaseAddresses,
53
52
  ) => {
@@ -60,11 +59,9 @@ let makeSources = (
60
59
  | Some(endpointUrl) => [
61
60
  HyperSyncSource.make({
62
61
  chain,
63
- contracts,
64
62
  endpointUrl,
65
63
  allEventSignatures,
66
64
  eventRouter,
67
- shouldUseHypersyncClientDecoder,
68
65
  apiToken: Env.envioApiToken,
69
66
  clientMaxRetries: Env.hyperSyncClientMaxRetries,
70
67
  clientTimeoutMillis: Env.hyperSyncClientTimeoutMillis,
@@ -80,12 +77,10 @@ let makeSources = (
80
77
  RpcSource.make({
81
78
  chain,
82
79
  sourceFor,
83
- contracts,
84
80
  syncConfig: getSyncConfig(syncConfig->Option.getWithDefault({})),
85
81
  url,
86
82
  eventRouter,
87
83
  allEventSignatures,
88
- shouldUseHypersyncClientDecoder,
89
84
  lowercaseAddresses,
90
85
  }),
91
86
  )
@@ -20,16 +20,14 @@ function getSyncConfig(param) {
20
20
  };
21
21
  }
22
22
 
23
- function makeSources(chain, contracts, hyperSync, allEventSignatures, shouldUseHypersyncClientDecoder, rpcs, lowercaseAddresses) {
23
+ function makeSources(chain, contracts, hyperSync, allEventSignatures, rpcs, lowercaseAddresses) {
24
24
  var eventRouter = EventRouter.fromEvmEventModsOrThrow(Belt_Array.flatMap(contracts, (function (contract) {
25
25
  return contract.events;
26
26
  })), chain);
27
27
  var sources = hyperSync !== undefined ? [HyperSyncSource.make({
28
- contracts: contracts,
29
28
  chain: chain,
30
29
  endpointUrl: hyperSync,
31
30
  allEventSignatures: allEventSignatures,
32
- shouldUseHypersyncClientDecoder: shouldUseHypersyncClientDecoder,
33
31
  eventRouter: eventRouter,
34
32
  apiToken: Env.envioApiToken,
35
33
  clientMaxRetries: Env.hyperSyncClientMaxRetries,
@@ -44,10 +42,8 @@ function makeSources(chain, contracts, hyperSync, allEventSignatures, shouldUseH
44
42
  syncConfig: getSyncConfig(Belt_Option.getWithDefault(param.syncConfig, {})),
45
43
  url: param.url,
46
44
  chain: chain,
47
- contracts: contracts,
48
45
  eventRouter: eventRouter,
49
46
  allEventSignatures: allEventSignatures,
50
- shouldUseHypersyncClientDecoder: shouldUseHypersyncClientDecoder,
51
47
  lowercaseAddresses: lowercaseAddresses
52
48
  }));
53
49
  });
@@ -145,11 +145,9 @@ let memoGetSelectionConfig = (~chain) => {
145
145
  }
146
146
 
147
147
  type options = {
148
- contracts: array<Internal.evmContractConfig>,
149
148
  chain: ChainMap.Chain.t,
150
149
  endpointUrl: string,
151
150
  allEventSignatures: array<string>,
152
- shouldUseHypersyncClientDecoder: bool,
153
151
  eventRouter: EventRouter.t<Internal.evmEventConfig>,
154
152
  apiToken: option<string>,
155
153
  clientMaxRetries: int,
@@ -161,11 +159,9 @@ type options = {
161
159
 
162
160
  let make = (
163
161
  {
164
- contracts,
165
162
  chain,
166
163
  endpointUrl,
167
164
  allEventSignatures,
168
- shouldUseHypersyncClientDecoder,
169
165
  eventRouter,
170
166
  apiToken,
171
167
  clientMaxRetries,
@@ -205,7 +201,7 @@ Learn more or get a free API token at: https://envio.dev/app/api-tokens`)
205
201
  switch HyperSyncClient.Decoder.fromSignatures(allEventSignatures) {
206
202
  | exception exn =>
207
203
  exn->ErrorHandling.mkLogAndRaise(
208
- ~msg="Failed to instantiate a decoder from hypersync client, please double check your ABI or try using 'event_decoder: viem' config option",
204
+ ~msg="Failed to instantiate a decoder from hypersync client, please double check your ABI",
209
205
  )
210
206
  | decoder =>
211
207
  if lowercaseAddresses {
@@ -245,11 +241,6 @@ Learn more or get a free API token at: https://envio.dev/app/api-tokens`)
245
241
  })
246
242
  }
247
243
 
248
- let contractNameAbiMapping = Js.Dict.empty()
249
- contracts->Belt.Array.forEach(contract => {
250
- contractNameAbiMapping->Js.Dict.set(contract.name, contract.abi)
251
- })
252
-
253
244
  let getItemsOrThrow = async (
254
245
  ~fromBlock,
255
246
  ~toBlock,
@@ -402,7 +393,6 @@ Learn more or get a free API token at: https://envio.dev/app/api-tokens`)
402
393
 
403
394
  let handleDecodeFailure = (
404
395
  ~eventConfig: Internal.evmEventConfig,
405
- ~decoder,
406
396
  ~logIndex,
407
397
  ~blockNumber,
408
398
  ~chainId,
@@ -419,72 +409,28 @@ Learn more or get a free API token at: https://envio.dev/app/api-tokens`)
419
409
  "chainId": chainId,
420
410
  "blockNumber": blockNumber,
421
411
  "logIndex": logIndex,
422
- "decoder": decoder,
412
+ "decoder": "hypersync-client",
423
413
  },
424
414
  )
425
415
  exn->ErrorHandling.mkLogAndRaise(~msg, ~logger)
426
416
  }
427
417
  }
428
- if shouldUseHypersyncClientDecoder {
429
- //Currently there are still issues with decoder for some cases so
430
- //this can only be activated with a flag
431
-
432
- //Parse page items into queue items
433
- let parsedEvents = switch await getHscDecoder().decodeEvents(pageUnsafe.events) {
434
- | exception exn =>
435
- exn->mkLogAndRaise(
436
- ~msg="Failed to parse events using hypersync client, please double check your ABI.",
437
- )
438
- | parsedEvents => parsedEvents
439
- }
440
418
 
441
- pageUnsafe.items->Belt.Array.forEachWithIndex((index, item) => {
442
- let {block, log} = item
443
- let chainId = chain->ChainMap.Chain.toChainId
444
- let topic0 = log.topics->Js.Array2.unsafe_get(0)
445
- let maybeEventConfig =
446
- eventRouter->EventRouter.get(
447
- ~tag=EventRouter.getEvmEventId(
448
- ~sighash=topic0->EvmTypes.Hex.toString,
449
- ~topicCount=log.topics->Array.length,
450
- ),
451
- ~indexingContracts,
452
- ~contractAddress=log.address,
453
- ~blockNumber=block.number->Belt.Option.getUnsafe,
454
- )
455
- let maybeDecodedEvent = parsedEvents->Js.Array2.unsafe_get(index)
456
-
457
- switch (maybeEventConfig, maybeDecodedEvent) {
458
- | (Some(eventConfig), Value(decoded)) =>
459
- parsedQueueItems
460
- ->Js.Array2.push(
461
- makeEventBatchQueueItem(
462
- item,
463
- ~params=decoded->eventConfig.convertHyperSyncEventArgs,
464
- ~eventConfig,
465
- ),
466
- )
467
- ->ignore
468
- | (Some(eventConfig), Null | Undefined) =>
469
- handleDecodeFailure(
470
- ~eventConfig,
471
- ~decoder="hypersync-client",
472
- ~logIndex=log.logIndex,
473
- ~blockNumber=block.number->Belt.Option.getUnsafe,
474
- ~chainId,
475
- ~exn=UndefinedValue,
476
- )
477
- | (None, _) => () //ignore events that aren't registered
478
- }
479
- })
480
- } else {
481
- //Parse with viem -> slower than the HyperSyncClient
482
- pageUnsafe.items->Array.forEach(item => {
483
- let {block, log} = item
484
- let chainId = chain->ChainMap.Chain.toChainId
485
- let topic0 = log.topics->Js.Array2.unsafe_get(0)
419
+ //Parse page items into queue items
420
+ let parsedEvents = switch await getHscDecoder().decodeEvents(pageUnsafe.events) {
421
+ | exception exn =>
422
+ exn->mkLogAndRaise(
423
+ ~msg="Failed to parse events using hypersync client, please double check your ABI.",
424
+ )
425
+ | parsedEvents => parsedEvents
426
+ }
486
427
 
487
- switch eventRouter->EventRouter.get(
428
+ pageUnsafe.items->Belt.Array.forEachWithIndex((index, item) => {
429
+ let {block, log} = item
430
+ let chainId = chain->ChainMap.Chain.toChainId
431
+ let topic0 = log.topics->Js.Array2.unsafe_get(0)
432
+ let maybeEventConfig =
433
+ eventRouter->EventRouter.get(
488
434
  ~tag=EventRouter.getEvmEventId(
489
435
  ~sighash=topic0->EvmTypes.Hex.toString,
490
436
  ~topicCount=log.topics->Array.length,
@@ -492,31 +438,31 @@ Learn more or get a free API token at: https://envio.dev/app/api-tokens`)
492
438
  ~indexingContracts,
493
439
  ~contractAddress=log.address,
494
440
  ~blockNumber=block.number->Belt.Option.getUnsafe,
495
- ) {
496
- | Some(eventConfig) =>
497
- switch contractNameAbiMapping->Viem.parseLogOrThrow(
498
- ~contractName=eventConfig.contractName,
499
- ~topics=log.topics,
500
- ~data=log.data,
501
- ) {
502
- | exception exn =>
503
- handleDecodeFailure(
504
- ~eventConfig,
505
- ~decoder="viem",
506
- ~logIndex=log.logIndex,
507
- ~blockNumber=block.number->Belt.Option.getUnsafe,
508
- ~chainId,
509
- ~exn,
510
- )
511
- | decodedEvent =>
512
- parsedQueueItems
513
- ->Js.Array2.push(makeEventBatchQueueItem(item, ~params=decodedEvent.args, ~eventConfig))
514
- ->ignore
515
- }
516
- | None => () //Ignore events that aren't registered
517
- }
518
- })
519
- }
441
+ )
442
+ let maybeDecodedEvent = parsedEvents->Js.Array2.unsafe_get(index)
443
+
444
+ switch (maybeEventConfig, maybeDecodedEvent) {
445
+ | (Some(eventConfig), Value(decoded)) =>
446
+ parsedQueueItems
447
+ ->Js.Array2.push(
448
+ makeEventBatchQueueItem(
449
+ item,
450
+ ~params=decoded->eventConfig.convertHyperSyncEventArgs,
451
+ ~eventConfig,
452
+ ),
453
+ )
454
+ ->ignore
455
+ | (Some(eventConfig), Null | Undefined) =>
456
+ handleDecodeFailure(
457
+ ~eventConfig,
458
+ ~logIndex=log.logIndex,
459
+ ~blockNumber=block.number->Belt.Option.getUnsafe,
460
+ ~chainId,
461
+ ~exn=UndefinedValue,
462
+ )
463
+ | (None, _) => () //ignore events that aren't registered
464
+ }
465
+ })
520
466
 
521
467
  let parsingTimeElapsed = parsingTimeRef->Hrtime.timeSince->Hrtime.toMillis->Hrtime.intFromMillis
522
468
 
@@ -1,7 +1,6 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
3
  import * as Rest from "../vendored/Rest.res.mjs";
4
- import * as Viem from "../bindings/Viem.res.mjs";
5
4
  import * as Utils from "../Utils.res.mjs";
6
5
  import * as Hrtime from "../bindings/Hrtime.res.mjs";
7
6
  import * as Js_exn from "rescript/lib/es6/js_exn.js";
@@ -127,7 +126,6 @@ function make(param) {
127
126
  var lowercaseAddresses = param.lowercaseAddresses;
128
127
  var apiToken = param.apiToken;
129
128
  var eventRouter = param.eventRouter;
130
- var shouldUseHypersyncClientDecoder = param.shouldUseHypersyncClientDecoder;
131
129
  var allEventSignatures = param.allEventSignatures;
132
130
  var endpointUrl = param.endpointUrl;
133
131
  var chain = param.chain;
@@ -148,7 +146,7 @@ function make(param) {
148
146
  }
149
147
  catch (raw_exn){
150
148
  var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
151
- return ErrorHandling.mkLogAndRaise(undefined, "Failed to instantiate a decoder from hypersync client, please double check your ABI or try using 'event_decoder: viem' config option", exn);
149
+ return ErrorHandling.mkLogAndRaise(undefined, "Failed to instantiate a decoder from hypersync client, please double check your ABI", exn);
152
150
  }
153
151
  if (lowercaseAddresses) {
154
152
  decoder$1.disableChecksummedAddresses();
@@ -178,10 +176,6 @@ function make(param) {
178
176
  }
179
177
  };
180
178
  };
181
- var contractNameAbiMapping = {};
182
- Belt_Array.forEach(param.contracts, (function (contract) {
183
- contractNameAbiMapping[contract.name] = contract.abi;
184
- }));
185
179
  var getItemsOrThrow = async function (fromBlock, toBlock, addressesByContractName, indexingContracts, knownHeight, param, selection, retry, logger) {
186
180
  var mkLogAndRaise = function (extra, extra$1) {
187
181
  return ErrorHandling.mkLogAndRaise(logger, extra, extra$1);
@@ -292,67 +286,46 @@ function make(param) {
292
286
  }
293
287
  var parsingTimeRef = Hrtime.makeTimer();
294
288
  var parsedQueueItems = [];
295
- var handleDecodeFailure = function (eventConfig, decoder, logIndex, blockNumber, chainId, exn) {
296
- if (eventConfig.isWildcard) {
297
- return ;
298
- }
299
- var msg = "Event " + eventConfig.name + " was unexpectedly parsed as undefined";
300
- var logger$1 = Logging.createChildFrom(logger, {
301
- chainId: chainId,
302
- blockNumber: blockNumber,
303
- logIndex: logIndex,
304
- decoder: decoder
305
- });
306
- ErrorHandling.mkLogAndRaise(logger$1, msg, exn);
307
- };
308
- if (shouldUseHypersyncClientDecoder) {
309
- var parsedEvents;
310
- try {
311
- parsedEvents = await getHscDecoder().decodeEvents(pageUnsafe.events);
312
- }
313
- catch (raw_exn$1){
314
- var exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1);
315
- parsedEvents = mkLogAndRaise("Failed to parse events using hypersync client, please double check your ABI.", exn$1);
316
- }
317
- Belt_Array.forEachWithIndex(pageUnsafe.items, (function (index, item) {
318
- var block = item.block;
319
- var log = item.log;
320
- var topic0 = log.topics[0];
321
- var maybeEventConfig = EventRouter.get(eventRouter, EventRouter.getEvmEventId(topic0, log.topics.length), log.address, block.number, indexingContracts);
322
- var maybeDecodedEvent = parsedEvents[index];
323
- if (maybeEventConfig === undefined) {
324
- return ;
325
- }
326
- if (maybeDecodedEvent === null || maybeDecodedEvent === undefined) {
327
- maybeDecodedEvent === null;
328
- } else {
329
- parsedQueueItems.push(makeEventBatchQueueItem(item, maybeEventConfig.convertHyperSyncEventArgs(maybeDecodedEvent), maybeEventConfig));
330
- return ;
331
- }
332
- handleDecodeFailure(maybeEventConfig, "hypersync-client", log.logIndex, block.number, chain, {
333
- RE_EXN_ID: UndefinedValue
334
- });
335
- }));
336
- } else {
337
- Belt_Array.forEach(pageUnsafe.items, (function (item) {
338
- var block = item.block;
339
- var log = item.log;
340
- var topic0 = log.topics[0];
341
- var eventConfig = EventRouter.get(eventRouter, EventRouter.getEvmEventId(topic0, log.topics.length), log.address, block.number, indexingContracts);
342
- if (eventConfig === undefined) {
343
- return ;
344
- }
345
- var decodedEvent;
346
- try {
347
- decodedEvent = Viem.parseLogOrThrow(contractNameAbiMapping, eventConfig.contractName, log.topics, log.data);
348
- }
349
- catch (raw_exn){
350
- var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
351
- return handleDecodeFailure(eventConfig, "viem", log.logIndex, block.number, chain, exn);
352
- }
353
- parsedQueueItems.push(makeEventBatchQueueItem(item, decodedEvent.args, eventConfig));
354
- }));
289
+ var parsedEvents;
290
+ try {
291
+ parsedEvents = await getHscDecoder().decodeEvents(pageUnsafe.events);
355
292
  }
293
+ catch (raw_exn$1){
294
+ var exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1);
295
+ parsedEvents = mkLogAndRaise("Failed to parse events using hypersync client, please double check your ABI.", exn$1);
296
+ }
297
+ Belt_Array.forEachWithIndex(pageUnsafe.items, (function (index, item) {
298
+ var block = item.block;
299
+ var log = item.log;
300
+ var topic0 = log.topics[0];
301
+ var maybeEventConfig = EventRouter.get(eventRouter, EventRouter.getEvmEventId(topic0, log.topics.length), log.address, block.number, indexingContracts);
302
+ var maybeDecodedEvent = parsedEvents[index];
303
+ if (maybeEventConfig === undefined) {
304
+ return ;
305
+ }
306
+ if (maybeDecodedEvent === null || maybeDecodedEvent === undefined) {
307
+ maybeDecodedEvent === null;
308
+ } else {
309
+ parsedQueueItems.push(makeEventBatchQueueItem(item, maybeEventConfig.convertHyperSyncEventArgs(maybeDecodedEvent), maybeEventConfig));
310
+ return ;
311
+ }
312
+ var logIndex = log.logIndex;
313
+ var blockNumber = block.number;
314
+ var exn = {
315
+ RE_EXN_ID: UndefinedValue
316
+ };
317
+ if (maybeEventConfig.isWildcard) {
318
+ return ;
319
+ }
320
+ var msg = "Event " + maybeEventConfig.name + " was unexpectedly parsed as undefined";
321
+ var logger$1 = Logging.createChildFrom(logger, {
322
+ chainId: chain,
323
+ blockNumber: blockNumber,
324
+ logIndex: logIndex,
325
+ decoder: "hypersync-client"
326
+ });
327
+ ErrorHandling.mkLogAndRaise(logger$1, msg, exn);
328
+ }));
356
329
  var parsingTimeElapsed = Hrtime.intFromMillis(Hrtime.toMillis(Hrtime.timeSince(parsingTimeRef)));
357
330
  var rangeLastBlock = await lastBlockQueriedPromise;
358
331
  var reorgGuard_prevRangeLastBlock = Belt_Option.map(pageUnsafe.rollbackGuard, (function (v) {
@@ -468,25 +468,13 @@ type options = {
468
468
  syncConfig: Config.sourceSync,
469
469
  url: string,
470
470
  chain: ChainMap.Chain.t,
471
- contracts: array<Internal.evmContractConfig>,
472
471
  eventRouter: EventRouter.t<Internal.evmEventConfig>,
473
472
  allEventSignatures: array<string>,
474
- shouldUseHypersyncClientDecoder: bool,
475
473
  lowercaseAddresses: bool,
476
474
  }
477
475
 
478
476
  let make = (
479
- {
480
- sourceFor,
481
- syncConfig,
482
- url,
483
- chain,
484
- contracts,
485
- eventRouter,
486
- allEventSignatures,
487
- shouldUseHypersyncClientDecoder,
488
- lowercaseAddresses,
489
- }: options,
477
+ {sourceFor, syncConfig, url, chain, eventRouter, allEventSignatures, lowercaseAddresses}: options,
490
478
  ): t => {
491
479
  let urlHost = switch sanitizeUrl(url) {
492
480
  | None =>
@@ -572,11 +560,6 @@ let make = (
572
560
  ),
573
561
  )
574
562
 
575
- let contractNameAbiMapping = Js.Dict.empty()
576
- contracts->Belt.Array.forEach(contract => {
577
- contractNameAbiMapping->Js.Dict.set(contract.name, contract.abi)
578
- })
579
-
580
563
  let convertEthersLogToHyperSyncEvent = (log: Ethers.log): HyperSyncClient.ResponseTypes.event => {
581
564
  let hyperSyncLog: HyperSyncClient.ResponseTypes.log = {
582
565
  removed: log.removed->Option.getWithDefault(false),
@@ -676,26 +659,26 @@ let make = (
676
659
  )
677
660
  }
678
661
 
679
- let parsedQueueItems = if shouldUseHypersyncClientDecoder {
680
- // Convert Ethers logs to HyperSync events
681
- let hyperSyncEvents = logs->Belt.Array.map(convertEthersLogToHyperSyncEvent)
682
-
683
- // Decode using HyperSyncClient decoder
684
- let parsedEvents = try await getHscDecoder().decodeEvents(hyperSyncEvents) catch {
685
- | exn =>
686
- raise(
687
- Source.GetItemsError(
688
- FailedGettingItems({
689
- exn,
690
- attemptedToBlock: toBlock,
691
- retry: ImpossibleForTheQuery({
692
- message: "Failed to parse events using hypersync client decoder. Please double-check your ABI.",
693
- }),
662
+ // Convert Ethers logs to HyperSync events
663
+ let hyperSyncEvents = logs->Belt.Array.map(convertEthersLogToHyperSyncEvent)
664
+
665
+ // Decode using HyperSyncClient decoder
666
+ let parsedEvents = try await getHscDecoder().decodeEvents(hyperSyncEvents) catch {
667
+ | exn =>
668
+ raise(
669
+ Source.GetItemsError(
670
+ FailedGettingItems({
671
+ exn,
672
+ attemptedToBlock: toBlock,
673
+ retry: ImpossibleForTheQuery({
674
+ message: "Failed to parse events using hypersync client decoder. Please double-check your ABI.",
694
675
  }),
695
- ),
696
- )
697
- }
676
+ }),
677
+ ),
678
+ )
679
+ }
698
680
 
681
+ let parsedQueueItems =
699
682
  await logs
700
683
  ->Array.zip(parsedEvents)
701
684
  ->Array.keepMap(((
@@ -771,92 +754,6 @@ let make = (
771
754
  }
772
755
  })
773
756
  ->Promise.all
774
- } else {
775
- // Decode using Viem
776
- await logs
777
- ->Belt.Array.keepMap(log => {
778
- let topic0 = log.topics->Js.Array2.unsafe_get(0)
779
-
780
- switch eventRouter->EventRouter.get(
781
- ~tag=EventRouter.getEvmEventId(
782
- ~sighash=topic0->EvmTypes.Hex.toString,
783
- ~topicCount=log.topics->Array.length,
784
- ),
785
- ~indexingContracts,
786
- ~contractAddress=log.address,
787
- ~blockNumber=log.blockNumber,
788
- ) {
789
- | None => None //ignore events that aren't registered
790
- | Some(eventConfig) =>
791
- let blockNumber = log.blockNumber
792
- let logIndex = log.logIndex
793
- Some(
794
- (
795
- async () => {
796
- let (block, transaction) = try await Promise.all2((
797
- log->getEventBlockOrThrow,
798
- log->getEventTransactionOrThrow(~transactionSchema=eventConfig.transactionSchema),
799
- )) catch {
800
- // Promise.catch won't work here, because the error
801
- // might be thrown before a microtask is created
802
- | exn =>
803
- raise(
804
- Source.GetItemsError(
805
- FailedGettingFieldSelection({
806
- message: "Failed getting selected fields. Please double-check your RPC provider returns correct data.",
807
- exn,
808
- blockNumber,
809
- logIndex,
810
- }),
811
- ),
812
- )
813
- }
814
-
815
- let decodedEvent = try contractNameAbiMapping->Viem.parseLogOrThrow(
816
- ~contractName=eventConfig.contractName,
817
- ~topics=log.topics,
818
- ~data=log.data,
819
- ) catch {
820
- | exn =>
821
- raise(
822
- Source.GetItemsError(
823
- FailedGettingItems({
824
- exn,
825
- attemptedToBlock: toBlock,
826
- retry: ImpossibleForTheQuery({
827
- message: `Failed to parse event with viem, please double-check your ABI. Block number: ${blockNumber->Int.toString}, log index: ${logIndex->Int.toString}`,
828
- }),
829
- }),
830
- ),
831
- )
832
- }
833
-
834
- Internal.Event({
835
- eventConfig: (eventConfig :> Internal.eventConfig),
836
- timestamp: block.timestamp,
837
- blockNumber: block.number,
838
- chain,
839
- logIndex: log.logIndex,
840
- event: {
841
- chainId: chain->ChainMap.Chain.toChainId,
842
- params: decodedEvent.args,
843
- transaction,
844
- // Unreliably expect that the Ethers block fields match the types in HyperIndex
845
- // I assume this is wrong in some cases, so we need to fix it in the future
846
- block: block->(
847
- Utils.magic: Ethers.JsonRpcProvider.block => Internal.eventBlock
848
- ),
849
- srcAddress: log.address,
850
- logIndex: log.logIndex,
851
- }->Internal.fromGenericEvent,
852
- })
853
- }
854
- )(),
855
- )
856
- }
857
- })
858
- ->Promise.all
859
- }
860
757
 
861
758
  let optFirstBlockParent = await firstBlockParentPromise
862
759
 
@@ -4,7 +4,6 @@ import * as Rpc from "./Rpc.res.mjs";
4
4
  import * as Caml from "rescript/lib/es6/caml.js";
5
5
  import * as Rest from "../vendored/Rest.res.mjs";
6
6
  import * as Time from "../Time.res.mjs";
7
- import * as Viem from "../bindings/Viem.res.mjs";
8
7
  import * as Utils from "../Utils.res.mjs";
9
8
  import * as Ethers from "../bindings/Ethers.res.mjs";
10
9
  import * as Hrtime from "../bindings/Hrtime.res.mjs";
@@ -506,7 +505,6 @@ function sanitizeUrl(url) {
506
505
 
507
506
  function make(param) {
508
507
  var lowercaseAddresses = param.lowercaseAddresses;
509
- var shouldUseHypersyncClientDecoder = param.shouldUseHypersyncClientDecoder;
510
508
  var allEventSignatures = param.allEventSignatures;
511
509
  var eventRouter = param.eventRouter;
512
510
  var chain = param.chain;
@@ -568,10 +566,6 @@ function make(param) {
568
566
  return Js_exn.raiseError("Transaction not found for hash: " + transactionHash);
569
567
  }
570
568
  }), lowercaseAddresses));
571
- var contractNameAbiMapping = {};
572
- Belt_Array.forEach(param.contracts, (function (contract) {
573
- contractNameAbiMapping[contract.name] = contract.abi;
574
- }));
575
569
  var convertEthersLogToHyperSyncEvent = function (log) {
576
570
  var hyperSyncLog_removed = Belt_Option.getWithDefault(log.removed, false);
577
571
  var hyperSyncLog_logIndex = log.index;
@@ -630,88 +624,34 @@ function make(param) {
630
624
  if (executedBlockInterval >= suggestedBlockInterval && !Utils.Dict.has(mutSuggestedBlockIntervals, maxSuggestedBlockIntervalKey)) {
631
625
  mutSuggestedBlockIntervals[partitionId] = Caml.int_min(executedBlockInterval + syncConfig.accelerationAdditive | 0, syncConfig.intervalCeiling);
632
626
  }
633
- var parsedQueueItems;
634
- if (shouldUseHypersyncClientDecoder) {
635
- var hyperSyncEvents = Belt_Array.map(logs, convertEthersLogToHyperSyncEvent);
636
- var parsedEvents;
637
- try {
638
- parsedEvents = await getHscDecoder().decodeEvents(hyperSyncEvents);
639
- }
640
- catch (raw_exn){
641
- var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
642
- throw {
643
- RE_EXN_ID: Source.GetItemsError,
644
- _1: {
645
- TAG: "FailedGettingItems",
646
- exn: exn,
647
- attemptedToBlock: toBlock$1,
648
- retry: {
649
- TAG: "ImpossibleForTheQuery",
650
- message: "Failed to parse events using hypersync client decoder. Please double-check your ABI."
651
- }
652
- },
653
- Error: new Error()
654
- };
655
- }
656
- parsedQueueItems = await Promise.all(Belt_Array.keepMap(Belt_Array.zip(logs, parsedEvents), (function (param) {
657
- var maybeDecodedEvent = param[1];
658
- var log = param[0];
659
- var topic0 = Belt_Option.getWithDefault(Belt_Array.get(log.topics, 0), "0x0");
660
- var routedAddress = lowercaseAddresses ? Address.Evm.fromAddressLowercaseOrThrow(log.address) : log.address;
661
- var eventConfig = EventRouter.get(eventRouter, EventRouter.getEvmEventId(topic0, log.topics.length), routedAddress, log.blockNumber, indexingContracts);
662
- if (eventConfig !== undefined && !(maybeDecodedEvent === null || maybeDecodedEvent === undefined)) {
663
- return Caml_option.some((async function () {
664
- var match;
665
- try {
666
- match = await Promise.all([
667
- getEventBlockOrThrow(log),
668
- getEventTransactionOrThrow(log, eventConfig.transactionSchema)
669
- ]);
670
- }
671
- catch (raw_exn){
672
- var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
673
- throw {
674
- RE_EXN_ID: Source.GetItemsError,
675
- _1: {
676
- TAG: "FailedGettingFieldSelection",
677
- exn: exn,
678
- blockNumber: log.blockNumber,
679
- logIndex: log.index,
680
- message: "Failed getting selected fields. Please double-check your RPC provider returns correct data."
681
- },
682
- Error: new Error()
683
- };
684
- }
685
- var block = match[0];
686
- return {
687
- kind: 0,
688
- eventConfig: eventConfig,
689
- timestamp: block.timestamp,
690
- chain: chain,
691
- blockNumber: block.number,
692
- logIndex: log.index,
693
- event: {
694
- params: eventConfig.convertHyperSyncEventArgs(maybeDecodedEvent),
695
- chainId: chain,
696
- srcAddress: routedAddress,
697
- logIndex: log.index,
698
- transaction: match[1],
699
- block: block
700
- }
701
- };
702
- })());
703
- }
704
-
705
- })));
706
- } else {
707
- parsedQueueItems = await Promise.all(Belt_Array.keepMap(logs, (function (log) {
708
- var topic0 = log.topics[0];
709
- var eventConfig = EventRouter.get(eventRouter, EventRouter.getEvmEventId(topic0, log.topics.length), log.address, log.blockNumber, indexingContracts);
710
- if (eventConfig === undefined) {
711
- return ;
712
- }
713
- var blockNumber = log.blockNumber;
714
- var logIndex = log.index;
627
+ var hyperSyncEvents = Belt_Array.map(logs, convertEthersLogToHyperSyncEvent);
628
+ var parsedEvents;
629
+ try {
630
+ parsedEvents = await getHscDecoder().decodeEvents(hyperSyncEvents);
631
+ }
632
+ catch (raw_exn){
633
+ var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
634
+ throw {
635
+ RE_EXN_ID: Source.GetItemsError,
636
+ _1: {
637
+ TAG: "FailedGettingItems",
638
+ exn: exn,
639
+ attemptedToBlock: toBlock$1,
640
+ retry: {
641
+ TAG: "ImpossibleForTheQuery",
642
+ message: "Failed to parse events using hypersync client decoder. Please double-check your ABI."
643
+ }
644
+ },
645
+ Error: new Error()
646
+ };
647
+ }
648
+ var parsedQueueItems = await Promise.all(Belt_Array.keepMap(Belt_Array.zip(logs, parsedEvents), (function (param) {
649
+ var maybeDecodedEvent = param[1];
650
+ var log = param[0];
651
+ var topic0 = Belt_Option.getWithDefault(Belt_Array.get(log.topics, 0), "0x0");
652
+ var routedAddress = lowercaseAddresses ? Address.Evm.fromAddressLowercaseOrThrow(log.address) : log.address;
653
+ var eventConfig = EventRouter.get(eventRouter, EventRouter.getEvmEventId(topic0, log.topics.length), routedAddress, log.blockNumber, indexingContracts);
654
+ if (eventConfig !== undefined && !(maybeDecodedEvent === null || maybeDecodedEvent === undefined)) {
715
655
  return Caml_option.some((async function () {
716
656
  var match;
717
657
  try {
@@ -727,34 +667,14 @@ function make(param) {
727
667
  _1: {
728
668
  TAG: "FailedGettingFieldSelection",
729
669
  exn: exn,
730
- blockNumber: blockNumber,
731
- logIndex: logIndex,
670
+ blockNumber: log.blockNumber,
671
+ logIndex: log.index,
732
672
  message: "Failed getting selected fields. Please double-check your RPC provider returns correct data."
733
673
  },
734
674
  Error: new Error()
735
675
  };
736
676
  }
737
677
  var block = match[0];
738
- var decodedEvent;
739
- try {
740
- decodedEvent = Viem.parseLogOrThrow(contractNameAbiMapping, eventConfig.contractName, log.topics, log.data);
741
- }
742
- catch (raw_exn$1){
743
- var exn$1 = Caml_js_exceptions.internalToOCamlException(raw_exn$1);
744
- throw {
745
- RE_EXN_ID: Source.GetItemsError,
746
- _1: {
747
- TAG: "FailedGettingItems",
748
- exn: exn$1,
749
- attemptedToBlock: toBlock$1,
750
- retry: {
751
- TAG: "ImpossibleForTheQuery",
752
- message: "Failed to parse event with viem, please double-check your ABI. Block number: " + String(blockNumber) + ", log index: " + String(logIndex)
753
- }
754
- },
755
- Error: new Error()
756
- };
757
- }
758
678
  return {
759
679
  kind: 0,
760
680
  eventConfig: eventConfig,
@@ -763,17 +683,18 @@ function make(param) {
763
683
  blockNumber: block.number,
764
684
  logIndex: log.index,
765
685
  event: {
766
- params: decodedEvent.args,
686
+ params: eventConfig.convertHyperSyncEventArgs(maybeDecodedEvent),
767
687
  chainId: chain,
768
- srcAddress: log.address,
688
+ srcAddress: routedAddress,
769
689
  logIndex: log.index,
770
690
  transaction: match[1],
771
691
  block: block
772
692
  }
773
693
  };
774
694
  })());
775
- })));
776
- }
695
+ }
696
+
697
+ })));
777
698
  var optFirstBlockParent = await firstBlockParentPromise;
778
699
  var totalTimeElapsed = Hrtime.intFromMillis(Hrtime.toMillis(Hrtime.timeSince(startFetchingBatchTimeRef)));
779
700
  var reorgGuard_rangeLastBlock = {