envio 2.32.7 → 2.32.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envio",
3
- "version": "v2.32.7",
3
+ "version": "v2.32.10",
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,10 +25,10 @@
25
25
  },
26
26
  "homepage": "https://envio.dev",
27
27
  "optionalDependencies": {
28
- "envio-linux-x64": "v2.32.7",
29
- "envio-linux-arm64": "v2.32.7",
30
- "envio-darwin-x64": "v2.32.7",
31
- "envio-darwin-arm64": "v2.32.7"
28
+ "envio-linux-x64": "v2.32.10",
29
+ "envio-linux-arm64": "v2.32.10",
30
+ "envio-darwin-x64": "v2.32.10",
31
+ "envio-darwin-arm64": "v2.32.10"
32
32
  },
33
33
  "dependencies": {
34
34
  "@elastic/ecs-pino-format": "1.4.0",
@@ -104,9 +104,11 @@ module GetLogs = {
104
104
  // Remap "type" -> "kind" on the transaction object at runtime before validation.
105
105
  // The latest hypersync client renamed "kind" to "type" but v2 consumers expect "kind".
106
106
  let transaction: Js.Dict.t<unknown> = event.transaction->Utils.magic
107
- switch transaction->Js.Dict.get("type") {
108
- | Some(v) => transaction->Js.Dict.set("kind", v)
109
- | None => ()
107
+ if transaction->Utils.magic {
108
+ switch transaction->Js.Dict.get("type") {
109
+ | Some(v) => transaction->Js.Dict.set("kind", v)
110
+ | None => ()
111
+ }
110
112
  }
111
113
 
112
114
  let missingParams = []
@@ -77,9 +77,12 @@ async function query(client, fromBlock, toBlock, logSelections, fieldSelection,
77
77
  }
78
78
  var items = Belt_Array.map(res.data, (function (item) {
79
79
  var transaction = item.transaction;
80
- var v = Js_dict.get(transaction, "type");
81
- if (v !== undefined) {
82
- transaction["kind"] = Caml_option.valFromOption(v);
80
+ if (transaction) {
81
+ var v = Js_dict.get(transaction, "type");
82
+ if (v !== undefined) {
83
+ transaction["kind"] = Caml_option.valFromOption(v);
84
+ }
85
+
83
86
  }
84
87
  var missingParams = [];
85
88
  var returnedObj = item.log;
@@ -43,20 +43,19 @@ let rec getKnownBlockWithBackoff = async (
43
43
  ~lowercaseAddresses,
44
44
  )
45
45
  | result =>
46
- if lowercaseAddresses {
47
- // NOTE: this is wasteful if these fields are not selected in the users config.
48
- // There might be a better way to do this based on the block schema.
49
- // However this is not extremely expensive and good enough for now (only on rpc sync also).
50
-
51
- {
52
- ...result,
53
- // Mutation would be cheaper,
54
- // BUT "result" is an Ethers.js Block object,
55
- // which has the fields as readonly.
56
- miner: result.miner->Address.Evm.fromAddressLowercaseOrThrow,
57
- }
58
- } else {
59
- result
46
+ // NOTE: this is wasteful if these fields are not selected in the users config.
47
+ // There might be a better way to do this based on the block schema.
48
+ // However this is not extremely expensive and good enough for now (only on rpc sync also).
49
+ // Mutation would be cheaper,
50
+ // BUT "result" is an Ethers.js Block object,
51
+ // which has the fields as readonly.
52
+ {
53
+ ...result,
54
+ miner: if lowercaseAddresses {
55
+ result.miner->Address.Evm.fromAddressLowercaseOrThrow
56
+ } else {
57
+ result.miner->Address.Evm.fromAddressOrThrow
58
+ },
60
59
  }
61
60
  }
62
61
  let getSuggestedBlockIntervalFromExn = {
@@ -699,7 +698,7 @@ let make = (
699
698
  let routedAddress = if lowercaseAddresses {
700
699
  log.address->Address.Evm.fromAddressLowercaseOrThrow
701
700
  } else {
702
- log.address
701
+ log.address->Address.Evm.fromAddressOrThrow
703
702
  }
704
703
 
705
704
  switch eventRouter->EventRouter.get(
@@ -57,24 +57,20 @@ async function getKnownBlockWithBackoff(provider, sourceName, chain, blockNumber
57
57
  await Time.resolvePromiseAfterDelay(backoffMsOnFailure);
58
58
  return await getKnownBlockWithBackoff(provider, sourceName, chain, blockNumber, (backoffMsOnFailure << 1), lowercaseAddresses);
59
59
  }
60
- if (lowercaseAddresses) {
61
- return {
62
- _difficulty: result._difficulty,
63
- difficulty: result.difficulty,
64
- extraData: result.extraData,
65
- gasLimit: result.gasLimit,
66
- gasUsed: result.gasUsed,
67
- hash: result.hash,
68
- miner: Address.Evm.fromAddressLowercaseOrThrow(result.miner),
69
- nonce: result.nonce,
70
- number: result.number,
71
- parentHash: result.parentHash,
72
- timestamp: result.timestamp,
73
- transactions: result.transactions
74
- };
75
- } else {
76
- return result;
77
- }
60
+ return {
61
+ _difficulty: result._difficulty,
62
+ difficulty: result.difficulty,
63
+ extraData: result.extraData,
64
+ gasLimit: result.gasLimit,
65
+ gasUsed: result.gasUsed,
66
+ hash: result.hash,
67
+ miner: lowercaseAddresses ? Address.Evm.fromAddressLowercaseOrThrow(result.miner) : Address.Evm.fromAddressOrThrow(result.miner),
68
+ nonce: result.nonce,
69
+ number: result.number,
70
+ parentHash: result.parentHash,
71
+ timestamp: result.timestamp,
72
+ transactions: result.transactions
73
+ };
78
74
  }
79
75
 
80
76
  var suggestedRangeRegExp = /retry with the range (\d+)-(\d+)/;
@@ -652,7 +648,7 @@ function make(param) {
652
648
  var maybeDecodedEvent = param[1];
653
649
  var log = param[0];
654
650
  var topic0 = Belt_Option.getWithDefault(Belt_Array.get(log.topics, 0), "0x0");
655
- var routedAddress = lowercaseAddresses ? Address.Evm.fromAddressLowercaseOrThrow(log.address) : log.address;
651
+ var routedAddress = lowercaseAddresses ? Address.Evm.fromAddressLowercaseOrThrow(log.address) : Address.Evm.fromAddressOrThrow(log.address);
656
652
  var eventConfig = EventRouter.get(eventRouter, EventRouter.getEvmEventId(topic0, log.topics.length), routedAddress, log.blockNumber, indexingContracts);
657
653
  if (eventConfig !== undefined && !(maybeDecodedEvent === null || maybeDecodedEvent === undefined)) {
658
654
  return Caml_option.some((async function () {