envio 3.0.0-alpha.2 → 3.0.0-alpha.4

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 (74) hide show
  1. package/README.md +2 -2
  2. package/evm.schema.json +44 -34
  3. package/fuel.schema.json +32 -21
  4. package/index.d.ts +4 -1
  5. package/index.js +1 -0
  6. package/package.json +7 -6
  7. package/src/Batch.res.mjs +1 -1
  8. package/src/Benchmark.res +394 -0
  9. package/src/Benchmark.res.mjs +398 -0
  10. package/src/ChainFetcher.res +459 -0
  11. package/src/ChainFetcher.res.mjs +281 -0
  12. package/src/ChainManager.res +179 -0
  13. package/src/ChainManager.res.mjs +139 -0
  14. package/src/Config.res +15 -1
  15. package/src/Config.res.mjs +28 -5
  16. package/src/Ecosystem.res +9 -124
  17. package/src/Ecosystem.res.mjs +19 -160
  18. package/src/Env.res +0 -1
  19. package/src/Env.res.mjs +0 -3
  20. package/src/Envio.gen.ts +9 -1
  21. package/src/Envio.res +12 -9
  22. package/src/EventProcessing.res +476 -0
  23. package/src/EventProcessing.res.mjs +341 -0
  24. package/src/FetchState.res +54 -29
  25. package/src/FetchState.res.mjs +62 -35
  26. package/src/GlobalState.res +1169 -0
  27. package/src/GlobalState.res.mjs +1196 -0
  28. package/src/Internal.res +43 -1
  29. package/src/LoadLayer.res +444 -0
  30. package/src/LoadLayer.res.mjs +296 -0
  31. package/src/LoadLayer.resi +32 -0
  32. package/src/Prometheus.res +8 -8
  33. package/src/Prometheus.res.mjs +10 -10
  34. package/src/ReorgDetection.res +6 -10
  35. package/src/ReorgDetection.res.mjs +6 -6
  36. package/src/Types.ts +1 -1
  37. package/src/UserContext.res +356 -0
  38. package/src/UserContext.res.mjs +238 -0
  39. package/src/Utils.res +15 -0
  40. package/src/Utils.res.mjs +18 -0
  41. package/src/bindings/ClickHouse.res +31 -1
  42. package/src/bindings/ClickHouse.res.mjs +27 -1
  43. package/src/bindings/DateFns.res +71 -0
  44. package/src/bindings/DateFns.res.mjs +22 -0
  45. package/src/bindings/Ethers.res +27 -63
  46. package/src/bindings/Ethers.res.mjs +18 -65
  47. package/src/sources/Evm.res +87 -0
  48. package/src/sources/Evm.res.mjs +105 -0
  49. package/src/sources/EvmChain.res +95 -0
  50. package/src/sources/EvmChain.res.mjs +61 -0
  51. package/src/sources/Fuel.res +19 -34
  52. package/src/sources/Fuel.res.mjs +34 -16
  53. package/src/sources/FuelSDK.res +37 -0
  54. package/src/sources/FuelSDK.res.mjs +29 -0
  55. package/src/sources/HyperFuel.res +2 -2
  56. package/src/sources/HyperFuel.resi +1 -1
  57. package/src/sources/HyperFuelClient.res +2 -2
  58. package/src/sources/HyperFuelSource.res +8 -8
  59. package/src/sources/HyperFuelSource.res.mjs +5 -5
  60. package/src/sources/HyperSyncHeightStream.res +28 -110
  61. package/src/sources/HyperSyncHeightStream.res.mjs +30 -63
  62. package/src/sources/HyperSyncSource.res +16 -18
  63. package/src/sources/HyperSyncSource.res.mjs +25 -25
  64. package/src/sources/Rpc.res +43 -0
  65. package/src/sources/Rpc.res.mjs +31 -0
  66. package/src/sources/RpcSource.res +13 -8
  67. package/src/sources/RpcSource.res.mjs +12 -7
  68. package/src/sources/Source.res +3 -2
  69. package/src/sources/SourceManager.res +183 -108
  70. package/src/sources/SourceManager.res.mjs +162 -99
  71. package/src/sources/SourceManager.resi +4 -5
  72. package/src/sources/Svm.res +59 -0
  73. package/src/sources/Svm.res.mjs +79 -0
  74. package/src/bindings/Ethers.gen.ts +0 -14
@@ -0,0 +1,95 @@
1
+ open Belt
2
+
3
+ type rpc = {
4
+ url: string,
5
+ sourceFor: Source.sourceFor,
6
+ syncConfig?: Config.sourceSyncOptions,
7
+ }
8
+
9
+ let getSyncConfig = (
10
+ {
11
+ ?initialBlockInterval,
12
+ ?backoffMultiplicative,
13
+ ?accelerationAdditive,
14
+ ?intervalCeiling,
15
+ ?backoffMillis,
16
+ ?queryTimeoutMillis,
17
+ ?fallbackStallTimeout,
18
+ }: Config.sourceSyncOptions,
19
+ ): Config.sourceSync => {
20
+ let queryTimeoutMillis = queryTimeoutMillis->Option.getWithDefault(20_000)
21
+ {
22
+ initialBlockInterval: Env.Configurable.SyncConfig.initialBlockInterval->Option.getWithDefault(
23
+ initialBlockInterval->Option.getWithDefault(10_000),
24
+ ),
25
+ // After an RPC error, how much to scale back the number of blocks requested at once
26
+ backoffMultiplicative: Env.Configurable.SyncConfig.backoffMultiplicative->Option.getWithDefault(
27
+ backoffMultiplicative->Option.getWithDefault(0.8),
28
+ ),
29
+ // Without RPC errors or timeouts, how much to increase the number of blocks requested by for the next batch
30
+ accelerationAdditive: Env.Configurable.SyncConfig.accelerationAdditive->Option.getWithDefault(
31
+ accelerationAdditive->Option.getWithDefault(500),
32
+ ),
33
+ // Do not further increase the block interval past this limit
34
+ intervalCeiling: Env.Configurable.SyncConfig.intervalCeiling->Option.getWithDefault(
35
+ intervalCeiling->Option.getWithDefault(10_000),
36
+ ),
37
+ // After an error, how long to wait before retrying
38
+ backoffMillis: backoffMillis->Option.getWithDefault(5000),
39
+ // How long to wait before cancelling an RPC request
40
+ queryTimeoutMillis,
41
+ fallbackStallTimeout: fallbackStallTimeout->Option.getWithDefault(queryTimeoutMillis / 2),
42
+ }
43
+ }
44
+
45
+ let makeSources = (
46
+ ~chain,
47
+ ~contracts: array<Internal.evmContractConfig>,
48
+ ~hyperSync,
49
+ ~allEventSignatures,
50
+ ~shouldUseHypersyncClientDecoder,
51
+ ~rpcs: array<rpc>,
52
+ ~lowercaseAddresses,
53
+ ) => {
54
+ let eventRouter =
55
+ contracts
56
+ ->Belt.Array.flatMap(contract => contract.events)
57
+ ->EventRouter.fromEvmEventModsOrThrow(~chain)
58
+
59
+ let sources = switch hyperSync {
60
+ | Some(endpointUrl) => [
61
+ HyperSyncSource.make({
62
+ chain,
63
+ contracts,
64
+ endpointUrl,
65
+ allEventSignatures,
66
+ eventRouter,
67
+ shouldUseHypersyncClientDecoder,
68
+ apiToken: Env.envioApiToken,
69
+ clientMaxRetries: Env.hyperSyncClientMaxRetries,
70
+ clientTimeoutMillis: Env.hyperSyncClientTimeoutMillis,
71
+ lowercaseAddresses,
72
+ serializationFormat: Env.hypersyncClientSerializationFormat,
73
+ enableQueryCaching: Env.hypersyncClientEnableQueryCaching,
74
+ }),
75
+ ]
76
+ | _ => []
77
+ }
78
+ rpcs->Js.Array2.forEach(({?syncConfig, url, sourceFor}) => {
79
+ let _ = sources->Js.Array2.push(
80
+ RpcSource.make({
81
+ chain,
82
+ sourceFor,
83
+ contracts,
84
+ syncConfig: getSyncConfig(syncConfig->Option.getWithDefault({})),
85
+ url,
86
+ eventRouter,
87
+ allEventSignatures,
88
+ shouldUseHypersyncClientDecoder,
89
+ lowercaseAddresses,
90
+ }),
91
+ )
92
+ })
93
+
94
+ sources
95
+ }
@@ -0,0 +1,61 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Env from "../Env.res.mjs";
4
+ import * as RpcSource from "./RpcSource.res.mjs";
5
+ import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
6
+ import * as Belt_Option from "rescript/lib/es6/belt_Option.js";
7
+ import * as EventRouter from "./EventRouter.res.mjs";
8
+ import * as HyperSyncSource from "./HyperSyncSource.res.mjs";
9
+
10
+ function getSyncConfig(param) {
11
+ var queryTimeoutMillis = Belt_Option.getWithDefault(param.queryTimeoutMillis, 20000);
12
+ return {
13
+ initialBlockInterval: Belt_Option.getWithDefault(Env.Configurable.SyncConfig.initialBlockInterval, Belt_Option.getWithDefault(param.initialBlockInterval, 10000)),
14
+ backoffMultiplicative: Belt_Option.getWithDefault(Env.Configurable.SyncConfig.backoffMultiplicative, Belt_Option.getWithDefault(param.backoffMultiplicative, 0.8)),
15
+ accelerationAdditive: Belt_Option.getWithDefault(Env.Configurable.SyncConfig.accelerationAdditive, Belt_Option.getWithDefault(param.accelerationAdditive, 500)),
16
+ intervalCeiling: Belt_Option.getWithDefault(Env.Configurable.SyncConfig.intervalCeiling, Belt_Option.getWithDefault(param.intervalCeiling, 10000)),
17
+ backoffMillis: Belt_Option.getWithDefault(param.backoffMillis, 5000),
18
+ queryTimeoutMillis: queryTimeoutMillis,
19
+ fallbackStallTimeout: Belt_Option.getWithDefault(param.fallbackStallTimeout, queryTimeoutMillis / 2 | 0)
20
+ };
21
+ }
22
+
23
+ function makeSources(chain, contracts, hyperSync, allEventSignatures, shouldUseHypersyncClientDecoder, rpcs, lowercaseAddresses) {
24
+ var eventRouter = EventRouter.fromEvmEventModsOrThrow(Belt_Array.flatMap(contracts, (function (contract) {
25
+ return contract.events;
26
+ })), chain);
27
+ var sources = hyperSync !== undefined ? [HyperSyncSource.make({
28
+ contracts: contracts,
29
+ chain: chain,
30
+ endpointUrl: hyperSync,
31
+ allEventSignatures: allEventSignatures,
32
+ shouldUseHypersyncClientDecoder: shouldUseHypersyncClientDecoder,
33
+ eventRouter: eventRouter,
34
+ apiToken: Env.envioApiToken,
35
+ clientMaxRetries: Env.hyperSyncClientMaxRetries,
36
+ clientTimeoutMillis: Env.hyperSyncClientTimeoutMillis,
37
+ lowercaseAddresses: lowercaseAddresses,
38
+ serializationFormat: Env.hypersyncClientSerializationFormat,
39
+ enableQueryCaching: Env.hypersyncClientEnableQueryCaching
40
+ })] : [];
41
+ rpcs.forEach(function (param) {
42
+ sources.push(RpcSource.make({
43
+ sourceFor: param.sourceFor,
44
+ syncConfig: getSyncConfig(Belt_Option.getWithDefault(param.syncConfig, {})),
45
+ url: param.url,
46
+ chain: chain,
47
+ contracts: contracts,
48
+ eventRouter: eventRouter,
49
+ allEventSignatures: allEventSignatures,
50
+ shouldUseHypersyncClientDecoder: shouldUseHypersyncClientDecoder,
51
+ lowercaseAddresses: lowercaseAddresses
52
+ }));
53
+ });
54
+ return sources;
55
+ }
56
+
57
+ export {
58
+ getSyncConfig ,
59
+ makeSources ,
60
+ }
61
+ /* Env Not a pure module */
@@ -1,37 +1,22 @@
1
- type receiptType =
2
- | @as(0) Call
3
- | @as(1) Return
4
- | @as(2) ReturnData
5
- | @as(3) Panic
6
- | @as(4) Revert
7
- | @as(5) Log
8
- | @as(6) LogData
9
- // Transfer is to another contract, TransferOut is to wallet address
10
- | @as(7) Transfer
11
- | @as(8) TransferOut
12
- | @as(9) ScriptResult
13
- | @as(10) MessageOut
14
- | @as(11) Mint
15
- | @as(12) Burn
1
+ @get external getNumber: Internal.eventBlock => int = "height"
2
+ @get external getTimestamp: Internal.eventBlock => int = "time"
3
+ @get external getId: Internal.eventBlock => string = "id"
16
4
 
17
- @module("./vendored-fuel-abi-coder.js")
18
- external transpileAbi: Js.Json.t => Ethers.abi = "transpileAbi"
5
+ let cleanUpRawEventFieldsInPlace: Js.Json.t => unit = %raw(`fields => {
6
+ delete fields.id
7
+ delete fields.height
8
+ delete fields.time
9
+ }`)
19
10
 
20
- @module("./vendored-fuel-abi-coder.js") @scope("AbiCoder")
21
- external getLogDecoder: (~abi: Ethers.abi, ~logId: string) => string => unknown = "getLogDecoder"
22
-
23
- module Receipt = {
24
- @tag("receiptType")
25
- type t =
26
- | @as(0) Call({assetId: string, amount: bigint, to: string})
27
- | @as(6) LogData({data: string, rb: bigint})
28
- | @as(7) Transfer({amount: bigint, assetId: string, to: string})
29
- | @as(8) TransferOut({amount: bigint, assetId: string, toAddress: string})
30
- | @as(11) Mint({val: bigint, subId: string})
31
- | @as(12) Burn({val: bigint, subId: string})
32
-
33
- let getLogDataDecoder = (~abi: Ethers.abi, ~logId: string) => {
34
- let decode = getLogDecoder(~abi, ~logId)
35
- data => data->decode->Utils.magic
36
- }
11
+ let ecosystem: Ecosystem.t = {
12
+ name: Fuel,
13
+ blockFields: ["id", "height", "time"],
14
+ transactionFields: ["id"],
15
+ blockNumberName: "height",
16
+ blockTimestampName: "time",
17
+ blockHashName: "id",
18
+ getNumber,
19
+ getTimestamp,
20
+ getId,
21
+ cleanUpRawEventFieldsInPlace,
37
22
  }
@@ -1,29 +1,47 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as VendoredFuelAbiCoderJs from "./vendored-fuel-abi-coder.js";
4
3
 
5
- function transpileAbi(prim) {
6
- return VendoredFuelAbiCoderJs.transpileAbi(prim);
4
+ var cleanUpRawEventFieldsInPlace = (fields => {
5
+ delete fields.id
6
+ delete fields.height
7
+ delete fields.time
8
+ });
9
+
10
+ var ecosystem_blockFields = [
11
+ "id",
12
+ "height",
13
+ "time"
14
+ ];
15
+
16
+ var ecosystem_transactionFields = ["id"];
17
+
18
+ function ecosystem_getNumber(prim) {
19
+ return prim.height;
7
20
  }
8
21
 
9
- function getLogDecoder(prim0, prim1) {
10
- return VendoredFuelAbiCoderJs.AbiCoder.getLogDecoder(prim0, prim1);
22
+ function ecosystem_getTimestamp(prim) {
23
+ return prim.time;
11
24
  }
12
25
 
13
- function getLogDataDecoder(abi, logId) {
14
- var decode = VendoredFuelAbiCoderJs.AbiCoder.getLogDecoder(abi, logId);
15
- return function (data) {
16
- return decode(data);
17
- };
26
+ function ecosystem_getId(prim) {
27
+ return prim.id;
18
28
  }
19
29
 
20
- var Receipt = {
21
- getLogDataDecoder: getLogDataDecoder
30
+ var ecosystem = {
31
+ name: "fuel",
32
+ blockFields: ecosystem_blockFields,
33
+ transactionFields: ecosystem_transactionFields,
34
+ blockNumberName: "height",
35
+ blockTimestampName: "time",
36
+ blockHashName: "id",
37
+ getNumber: ecosystem_getNumber,
38
+ getTimestamp: ecosystem_getTimestamp,
39
+ getId: ecosystem_getId,
40
+ cleanUpRawEventFieldsInPlace: cleanUpRawEventFieldsInPlace
22
41
  };
23
42
 
24
43
  export {
25
- transpileAbi ,
26
- getLogDecoder ,
27
- Receipt ,
44
+ cleanUpRawEventFieldsInPlace ,
45
+ ecosystem ,
28
46
  }
29
- /* ./vendored-fuel-abi-coder.js Not a pure module */
47
+ /* No side effect */
@@ -0,0 +1,37 @@
1
+ type receiptType =
2
+ | @as(0) Call
3
+ | @as(1) Return
4
+ | @as(2) ReturnData
5
+ | @as(3) Panic
6
+ | @as(4) Revert
7
+ | @as(5) Log
8
+ | @as(6) LogData
9
+ // Transfer is to another contract, TransferOut is to wallet address
10
+ | @as(7) Transfer
11
+ | @as(8) TransferOut
12
+ | @as(9) ScriptResult
13
+ | @as(10) MessageOut
14
+ | @as(11) Mint
15
+ | @as(12) Burn
16
+
17
+ @module("./vendored-fuel-abi-coder.js")
18
+ external transpileAbi: Js.Json.t => Ethers.abi = "transpileAbi"
19
+
20
+ @module("./vendored-fuel-abi-coder.js") @scope("AbiCoder")
21
+ external getLogDecoder: (~abi: Ethers.abi, ~logId: string) => string => unknown = "getLogDecoder"
22
+
23
+ module Receipt = {
24
+ @tag("receiptType")
25
+ type t =
26
+ | @as(0) Call({assetId: string, amount: bigint, to: string})
27
+ | @as(6) LogData({data: string, rb: bigint})
28
+ | @as(7) Transfer({amount: bigint, assetId: string, to: string})
29
+ | @as(8) TransferOut({amount: bigint, assetId: string, toAddress: string})
30
+ | @as(11) Mint({val: bigint, subId: string})
31
+ | @as(12) Burn({val: bigint, subId: string})
32
+
33
+ let getLogDataDecoder = (~abi: Ethers.abi, ~logId: string) => {
34
+ let decode = getLogDecoder(~abi, ~logId)
35
+ data => data->decode->Utils.magic
36
+ }
37
+ }
@@ -0,0 +1,29 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as VendoredFuelAbiCoderJs from "./vendored-fuel-abi-coder.js";
4
+
5
+ function transpileAbi(prim) {
6
+ return VendoredFuelAbiCoderJs.transpileAbi(prim);
7
+ }
8
+
9
+ function getLogDecoder(prim0, prim1) {
10
+ return VendoredFuelAbiCoderJs.AbiCoder.getLogDecoder(prim0, prim1);
11
+ }
12
+
13
+ function getLogDataDecoder(abi, logId) {
14
+ var decode = VendoredFuelAbiCoderJs.AbiCoder.getLogDecoder(abi, logId);
15
+ return function (data) {
16
+ return decode(data);
17
+ };
18
+ }
19
+
20
+ var Receipt = {
21
+ getLogDataDecoder: getLogDataDecoder
22
+ };
23
+
24
+ export {
25
+ transpileAbi ,
26
+ getLogDecoder ,
27
+ Receipt ,
28
+ }
29
+ /* ./vendored-fuel-abi-coder.js Not a pure module */
@@ -33,7 +33,7 @@ type block = {
33
33
  type item = {
34
34
  transactionId: string,
35
35
  contractId: Address.t,
36
- receipt: Fuel.Receipt.t,
36
+ receipt: FuelSDK.Receipt.t,
37
37
  receiptIndex: int,
38
38
  block: block,
39
39
  }
@@ -148,7 +148,7 @@ module GetLogs = {
148
148
  time: block.time,
149
149
  },
150
150
  contractId,
151
- receipt: receipt->(Utils.magic: HyperFuelClient.FuelTypes.receipt => Fuel.Receipt.t),
151
+ receipt: receipt->(Utils.magic: HyperFuelClient.FuelTypes.receipt => FuelSDK.Receipt.t),
152
152
  receiptIndex: receipt.receiptIndex,
153
153
  })
154
154
  ->ignore
@@ -13,7 +13,7 @@ type block = {
13
13
  type item = {
14
14
  transactionId: string,
15
15
  contractId: Address.t,
16
- receipt: Fuel.Receipt.t,
16
+ receipt: FuelSDK.Receipt.t,
17
17
  receiptIndex: int,
18
18
  block: block,
19
19
  }
@@ -106,7 +106,7 @@ module QueryTypes = {
106
106
  rootContractId?: array<Address.t>,
107
107
  toAddress?: array<string>,
108
108
  assetId?: array<string>,
109
- receiptType?: array<Fuel.receiptType>,
109
+ receiptType?: array<FuelSDK.receiptType>,
110
110
  sender?: array<string>,
111
111
  recipient?: array<string>,
112
112
  contractId?: array<Address.t>,
@@ -290,7 +290,7 @@ module FuelTypes = {
290
290
  /** The length of the receipt. */
291
291
  len?: bigint,
292
292
  /** The type of receipt. */
293
- receiptType: Fuel.receiptType,
293
+ receiptType: FuelSDK.receiptType,
294
294
  /** 0 if script exited successfully, any otherwise. */
295
295
  result?: int,
296
296
  /** The amount of gas consumed by the script. */
@@ -15,7 +15,7 @@ type selectionConfig = {
15
15
  eventRouter: EventRouter.t<Internal.fuelEventConfig>,
16
16
  }
17
17
 
18
- let logDataReceiptTypeSelection: array<Fuel.receiptType> = [LogData]
18
+ let logDataReceiptTypeSelection: array<FuelSDK.receiptType> = [LogData]
19
19
 
20
20
  // only transactions with status 1 (success)
21
21
  let txStatusSelection = [1]
@@ -114,10 +114,10 @@ let getSelectionConfig = (selection: FetchState.selection, ~chain) => {
114
114
  let nonLogDataReceiptTypesByContract = Js.Dict.empty()
115
115
  let nonLogDataWildcardReceiptTypes = []
116
116
 
117
- let addNonLogDataWildcardReceiptTypes = (receiptType: Fuel.receiptType) => {
117
+ let addNonLogDataWildcardReceiptTypes = (receiptType: FuelSDK.receiptType) => {
118
118
  nonLogDataWildcardReceiptTypes->Array.push(receiptType)->ignore
119
119
  }
120
- let addNonLogDataReceiptType = (contractName, receiptType: Fuel.receiptType) => {
120
+ let addNonLogDataReceiptType = (contractName, receiptType: FuelSDK.receiptType) => {
121
121
  switch nonLogDataReceiptTypesByContract->Utils.Dict.dangerouslyGetNonOption(contractName) {
122
122
  | None => nonLogDataReceiptTypesByContract->Js.Dict.set(contractName, [receiptType])
123
123
  | Some(receiptTypes) => receiptTypes->Array.push(receiptType)->ignore // Duplication prevented by EventRouter
@@ -220,7 +220,7 @@ let make = ({chain, endpointUrl}: options): t => {
220
220
  ~toBlock,
221
221
  ~addressesByContractName,
222
222
  ~indexingContracts,
223
- ~currentBlockHeight,
223
+ ~knownHeight,
224
224
  ~partitionId as _,
225
225
  ~selection: FetchState.selection,
226
226
  ~retry,
@@ -246,7 +246,7 @@ let make = ({chain, endpointUrl}: options): t => {
246
246
  Source.GetItemsError(
247
247
  Source.FailedGettingItems({
248
248
  exn: %raw(`null`),
249
- attemptedToBlock: toBlock->Option.getWithDefault(currentBlockHeight),
249
+ attemptedToBlock: toBlock->Option.getWithDefault(knownHeight),
250
250
  retry: switch error {
251
251
  | WrongInstance =>
252
252
  let backoffMillis = switch retry {
@@ -272,7 +272,7 @@ let make = ({chain, endpointUrl}: options): t => {
272
272
  Source.GetItemsError(
273
273
  Source.FailedGettingItems({
274
274
  exn,
275
- attemptedToBlock: toBlock->Option.getWithDefault(currentBlockHeight),
275
+ attemptedToBlock: toBlock->Option.getWithDefault(knownHeight),
276
276
  retry: WithBackoff({
277
277
  message: `Unexpected issue while fetching events from HyperFuel client. Attempt a retry.`,
278
278
  backoffMillis: switch retry {
@@ -289,7 +289,7 @@ let make = ({chain, endpointUrl}: options): t => {
289
289
  startFetchingBatchTimeRef->Hrtime.timeSince->Hrtime.toMillis->Hrtime.intFromMillis
290
290
 
291
291
  //set height and next from block
292
- let currentBlockHeight = pageUnsafe.archiveHeight
292
+ let knownHeight = pageUnsafe.archiveHeight
293
293
 
294
294
  //The heighest (biggest) blocknumber that was accounted for in
295
295
  //Our query. Not necessarily the blocknumber of the last log returned
@@ -478,7 +478,7 @@ let make = ({chain, endpointUrl}: options): t => {
478
478
  parsedQueueItems,
479
479
  latestFetchedBlockNumber: rangeLastBlock.blockNumber,
480
480
  stats,
481
- currentBlockHeight,
481
+ knownHeight,
482
482
  reorgGuard,
483
483
  fromBlockQueried: fromBlock,
484
484
  }
@@ -186,7 +186,7 @@ function make(param) {
186
186
  var endpointUrl = param.endpointUrl;
187
187
  var chain = param.chain;
188
188
  var getSelectionConfig = memoGetSelectionConfig(chain);
189
- var getItemsOrThrow = async function (fromBlock, toBlock, addressesByContractName, indexingContracts, currentBlockHeight, param, selection, retry, logger) {
189
+ var getItemsOrThrow = async function (fromBlock, toBlock, addressesByContractName, indexingContracts, knownHeight, param, selection, retry, logger) {
190
190
  var mkLogAndRaise = function (extra, extra$1) {
191
191
  return ErrorHandling.mkLogAndRaise(logger, extra, extra$1);
192
192
  };
@@ -221,7 +221,7 @@ function make(param) {
221
221
  _1: {
222
222
  TAG: "FailedGettingItems",
223
223
  exn: null,
224
- attemptedToBlock: Belt_Option.getWithDefault(toBlock, currentBlockHeight),
224
+ attemptedToBlock: Belt_Option.getWithDefault(toBlock, knownHeight),
225
225
  retry: tmp
226
226
  },
227
227
  Error: new Error()
@@ -232,7 +232,7 @@ function make(param) {
232
232
  _1: {
233
233
  TAG: "FailedGettingItems",
234
234
  exn: error,
235
- attemptedToBlock: Belt_Option.getWithDefault(toBlock, currentBlockHeight),
235
+ attemptedToBlock: Belt_Option.getWithDefault(toBlock, knownHeight),
236
236
  retry: {
237
237
  TAG: "WithBackoff",
238
238
  message: "Unexpected issue while fetching events from HyperFuel client. Attempt a retry.",
@@ -243,7 +243,7 @@ function make(param) {
243
243
  };
244
244
  }
245
245
  var pageFetchTime = Hrtime.intFromMillis(Hrtime.toMillis(Hrtime.timeSince(startFetchingBatchTimeRef)));
246
- var currentBlockHeight$1 = pageUnsafe.archiveHeight;
246
+ var knownHeight$1 = pageUnsafe.archiveHeight;
247
247
  var heighestBlockQueried = pageUnsafe.nextBlock - 1 | 0;
248
248
  var match = Belt_Array.get(pageUnsafe.items, pageUnsafe.items.length - 1 | 0);
249
249
  var lastBlockQueriedPromise;
@@ -407,7 +407,7 @@ function make(param) {
407
407
  "page fetch time (ms)": stats_page$unknownfetch$unknowntime$unknown$lparms$rpar
408
408
  };
409
409
  return {
410
- currentBlockHeight: currentBlockHeight$1,
410
+ knownHeight: knownHeight$1,
411
411
  reorgGuard: reorgGuard,
412
412
  parsedQueueItems: parsedQueueItems,
413
413
  fromBlockQueried: fromBlock,