@@ -70,34 +70,6 @@ let makeCombinedEventFilterQuery = (
7070 })
7171}
7272
73- let applyConditionalFunction = (value : 'a , condition : bool , callback : 'a => 'b ) => {
74- condition ? callback (value ) : value
75- }
76-
77- let queryEventsWithCombinedFilter = async (
78- ~contractInterfaceManager ,
79- ~fromBlock ,
80- ~toBlock ,
81- ~minFromBlockLogIndex = 0 ,
82- ~provider ,
83- ~logger : Pino .t ,
84- ): array <Ethers .log > => {
85- let combinedFilterRes = await makeCombinedEventFilterQuery (
86- ~provider ,
87- ~contractInterfaceManager ,
88- ~fromBlock ,
89- ~toBlock ,
90- ~logger ,
91- )
92-
93- combinedFilterRes -> applyConditionalFunction (minFromBlockLogIndex > 0 , arrLogs => {
94- arrLogs -> Belt .Array .keep (log => {
95- log .blockNumber > fromBlock ||
96- (log .blockNumber == fromBlock && log .logIndex >= minFromBlockLogIndex )
97- })
98- })
99- }
100-
10173type eventBatchQuery = {
10274 logs : array <Ethers .log >,
10375 finalExecutedBlockInterval : int ,
@@ -108,7 +80,6 @@ let getNextPage = async (
10880 ~fromBlock ,
10981 ~toBlock ,
11082 ~initialBlockInterval ,
111- ~minFromBlockLogIndex = 0 ,
11283 ~syncConfig as sc : Config .syncConfig ,
11384 ~provider ,
11485 ~logger ,
@@ -134,11 +105,10 @@ let getNextPage = async (
134105 let nextToBlock =
135106 Pervasives .min (upperBoundToBlock , toBlock )-> Pervasives .max (fromBlockRef .contents ) //Defensively ensure we never query a target block below fromBlock
136107 let logsPromise =
137- queryEventsWithCombinedFilter (
108+ makeCombinedEventFilterQuery (
138109 ~contractInterfaceManager ,
139110 ~fromBlock = fromBlockRef .contents ,
140111 ~toBlock = nextToBlock ,
141- ~minFromBlockLogIndex = fromBlockRef .contents == fromBlock ? minFromBlockLogIndex : 0 ,
142112 ~provider ,
143113 ~logger ,
144114 )-> Promise .thenResolve (logs => (logs , nextToBlock - fromBlockRef .contents + 1 ))
0 commit comments