envio 2.32.0-alpha.0 → 2.32.1

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.
@@ -165,7 +165,7 @@ module Chains = {
165
165
  ],
166
166
  )
167
167
 
168
- let initialFromConfig = (chainConfig: InternalConfig.chain) => {
168
+ let initialFromConfig = (chainConfig: Config.chain) => {
169
169
  {
170
170
  id: chainConfig.id,
171
171
  startBlock: chainConfig.startBlock,
@@ -182,7 +182,7 @@ module Chains = {
182
182
  }
183
183
  }
184
184
 
185
- let makeInitialValuesQuery = (~pgSchema, ~chainConfigs: array<InternalConfig.chain>) => {
185
+ let makeInitialValuesQuery = (~pgSchema, ~chainConfigs: array<Config.chain>) => {
186
186
  if chainConfigs->Array.length === 0 {
187
187
  None
188
188
  } else {
@@ -218,7 +218,7 @@ let getNextPage = (
218
218
  ~addresses,
219
219
  ~topicQuery,
220
220
  ~loadBlock,
221
- ~syncConfig as sc: InternalConfig.sourceSync,
221
+ ~syncConfig as sc: Config.sourceSync,
222
222
  ~provider,
223
223
  ~mutSuggestedBlockIntervals,
224
224
  ~partitionId,
@@ -465,7 +465,7 @@ let sanitizeUrl = (url: string) => {
465
465
 
466
466
  type options = {
467
467
  sourceFor: Source.sourceFor,
468
- syncConfig: InternalConfig.sourceSync,
468
+ syncConfig: Config.sourceSync,
469
469
  url: string,
470
470
  chain: ChainMap.Chain.t,
471
471
  contracts: array<Internal.evmContractConfig>,
@@ -503,24 +503,26 @@ let make = (
503
503
 
504
504
  let mutSuggestedBlockIntervals = Js.Dict.empty()
505
505
 
506
- let transactionLoader = LazyLoader.make(
507
- ~loaderFn=transactionHash => provider->Ethers.JsonRpcProvider.getTransaction(~transactionHash),
508
- ~onError=(am, ~exn) => {
509
- Logging.error({
510
- "err": exn->Utils.prettifyExn,
511
- "msg": `EE1100: Top level promise timeout reached. Please review other errors or warnings in the code. This function will retry in ${(am._retryDelayMillis / 1000)
512
- ->Belt.Int.toString} seconds. It is highly likely that your indexer isn't syncing on one or more chains currently. Also take a look at the "suggestedFix" in the metadata of this command`,
513
- "source": name,
514
- "chainId": chain->ChainMap.Chain.toChainId,
515
- "metadata": {
516
- {
517
- "asyncTaskName": "transactionLoader: fetching transaction data - `getTransaction` rpc call",
518
- "suggestedFix": "This likely means the RPC url you are using is not responding correctly. Please try another RPC endipoint.",
519
- }
520
- },
521
- })
522
- },
523
- )
506
+ let makeTransactionLoader = () =>
507
+ LazyLoader.make(
508
+ ~loaderFn=transactionHash =>
509
+ provider->Ethers.JsonRpcProvider.getTransaction(~transactionHash),
510
+ ~onError=(am, ~exn) => {
511
+ Logging.error({
512
+ "err": exn->Utils.prettifyExn,
513
+ "msg": `EE1100: Top level promise timeout reached. Please review other errors or warnings in the code. This function will retry in ${(am._retryDelayMillis / 1000)
514
+ ->Belt.Int.toString} seconds. It is highly likely that your indexer isn't syncing on one or more chains currently. Also take a look at the "suggestedFix" in the metadata of this command`,
515
+ "source": name,
516
+ "chainId": chain->ChainMap.Chain.toChainId,
517
+ "metadata": {
518
+ {
519
+ "asyncTaskName": "transactionLoader: fetching transaction data - `getTransaction` rpc call",
520
+ "suggestedFix": "This likely means the RPC url you are using is not responding correctly. Please try another RPC endipoint.",
521
+ }
522
+ },
523
+ })
524
+ },
525
+ )
524
526
 
525
527
  let makeBlockLoader = () =>
526
528
  LazyLoader.make(
@@ -551,13 +553,14 @@ let make = (
551
553
  )
552
554
 
553
555
  let blockLoader = ref(makeBlockLoader())
556
+ let transactionLoader = ref(makeTransactionLoader())
554
557
 
555
558
  let getEventBlockOrThrow = makeThrowingGetEventBlock(~getBlock=blockNumber =>
556
559
  blockLoader.contents->LazyLoader.get(blockNumber)
557
560
  )
558
561
  let getEventTransactionOrThrow = makeThrowingGetEventTransaction(
559
562
  ~getTransactionFields=Ethers.JsonRpcProvider.makeGetTransactionFields(
560
- ~getTransactionByHash=LazyLoader.get(transactionLoader, _),
563
+ ~getTransactionByHash=LazyLoader.get(transactionLoader.contents, _),
561
564
  ~lowercaseAddresses,
562
565
  ),
563
566
  )
@@ -882,6 +885,7 @@ let make = (
882
885
  // This is important, since we call this
883
886
  // function when a reorg is detected
884
887
  blockLoader := makeBlockLoader()
888
+ transactionLoader := makeTransactionLoader()
885
889
 
886
890
  blockNumbers
887
891
  ->Array.map(blockNum => blockLoader.contents->LazyLoader.get(blockNum))
@@ -519,20 +519,22 @@ function make(param) {
519
519
  var provider = Ethers.JsonRpcProvider.make(url, chain);
520
520
  var getSelectionConfig = memoGetSelectionConfig(chain);
521
521
  var mutSuggestedBlockIntervals = {};
522
- var transactionLoader = LazyLoader.make((function (transactionHash) {
523
- return provider.getTransaction(transactionHash);
524
- }), (function (am, exn) {
525
- Logging.error({
526
- err: Utils.prettifyExn(exn),
527
- msg: "EE1100: Top level promise timeout reached. Please review other errors or warnings in the code. This function will retry in " + String(am._retryDelayMillis / 1000 | 0) + " seconds. It is highly likely that your indexer isn't syncing on one or more chains currently. Also take a look at the \"suggestedFix\" in the metadata of this command",
528
- source: name,
529
- chainId: chain,
530
- metadata: {
531
- asyncTaskName: "transactionLoader: fetching transaction data - `getTransaction` rpc call",
532
- suggestedFix: "This likely means the RPC url you are using is not responding correctly. Please try another RPC endipoint."
533
- }
534
- });
535
- }), undefined, undefined, undefined, undefined);
522
+ var makeTransactionLoader = function () {
523
+ return LazyLoader.make((function (transactionHash) {
524
+ return provider.getTransaction(transactionHash);
525
+ }), (function (am, exn) {
526
+ Logging.error({
527
+ err: Utils.prettifyExn(exn),
528
+ msg: "EE1100: Top level promise timeout reached. Please review other errors or warnings in the code. This function will retry in " + String(am._retryDelayMillis / 1000 | 0) + " seconds. It is highly likely that your indexer isn't syncing on one or more chains currently. Also take a look at the \"suggestedFix\" in the metadata of this command",
529
+ source: name,
530
+ chainId: chain,
531
+ metadata: {
532
+ asyncTaskName: "transactionLoader: fetching transaction data - `getTransaction` rpc call",
533
+ suggestedFix: "This likely means the RPC url you are using is not responding correctly. Please try another RPC endipoint."
534
+ }
535
+ });
536
+ }), undefined, undefined, undefined, undefined);
537
+ };
536
538
  var makeBlockLoader = function () {
537
539
  return LazyLoader.make((function (blockNumber) {
538
540
  return getKnownBlockWithBackoff(provider, name, chain, blockNumber, 1000, lowercaseAddresses);
@@ -552,11 +554,14 @@ function make(param) {
552
554
  var blockLoader = {
553
555
  contents: makeBlockLoader()
554
556
  };
557
+ var transactionLoader = {
558
+ contents: makeTransactionLoader()
559
+ };
555
560
  var getEventBlockOrThrow = makeThrowingGetEventBlock(function (blockNumber) {
556
561
  return LazyLoader.get(blockLoader.contents, blockNumber);
557
562
  });
558
563
  var getEventTransactionOrThrow = makeThrowingGetEventTransaction(Ethers.JsonRpcProvider.makeGetTransactionFields((function (__x) {
559
- return LazyLoader.get(transactionLoader, __x);
564
+ return LazyLoader.get(transactionLoader.contents, __x);
560
565
  }), lowercaseAddresses));
561
566
  var contractNameAbiMapping = {};
562
567
  Belt_Array.forEach(param.contracts, (function (contract) {
@@ -794,6 +799,7 @@ function make(param) {
794
799
  };
795
800
  var getBlockHashes = function (blockNumbers, _currentlyUnusedLogger) {
796
801
  blockLoader.contents = makeBlockLoader();
802
+ transactionLoader.contents = makeTransactionLoader();
797
803
  return $$Promise.$$catch(Promise.all(Belt_Array.map(blockNumbers, (function (blockNum) {
798
804
  return LazyLoader.get(blockLoader.contents, blockNum);
799
805
  }))).then(function (blocks) {
@@ -1,48 +0,0 @@
1
- // TODO: rename the file to Config.res after finishing the migration from codegen
2
- // And turn it into PublicConfig instead
3
- // For internal use we should create Indexer.res with a stateful type
4
-
5
- type ecosystem = | @as("evm") Evm | @as("fuel") Fuel
6
-
7
- type sourceSyncOptions = {
8
- initialBlockInterval?: int,
9
- backoffMultiplicative?: float,
10
- accelerationAdditive?: int,
11
- intervalCeiling?: int,
12
- backoffMillis?: int,
13
- queryTimeoutMillis?: int,
14
- fallbackStallTimeout?: int,
15
- }
16
-
17
- type historyFlag = FullHistory | MinHistory
18
- type rollbackFlag = RollbackOnReorg | NoRollback
19
- type historyConfig = {rollbackFlag: rollbackFlag, historyFlag: historyFlag}
20
-
21
- type contract = {
22
- name: string,
23
- abi: EvmTypes.Abi.t,
24
- addresses: array<Address.t>,
25
- events: array<Internal.eventConfig>,
26
- startBlock: option<int>,
27
- }
28
-
29
- type chain = {
30
- id: int,
31
- startBlock: int,
32
- endBlock?: int,
33
- maxReorgDepth: int,
34
- contracts: array<contract>,
35
- sources: array<Source.t>,
36
- }
37
-
38
- type sourceSync = {
39
- initialBlockInterval: int,
40
- backoffMultiplicative: float,
41
- accelerationAdditive: int,
42
- intervalCeiling: int,
43
- backoffMillis: int,
44
- queryTimeoutMillis: int,
45
- fallbackStallTimeout: int,
46
- }
47
-
48
- type multichain = | @as("ordered") Ordered | @as("unordered") Unordered
File without changes