envio 3.1.2 → 3.2.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.
- package/evm.schema.json +83 -11
- package/fuel.schema.json +83 -11
- package/index.d.ts +184 -3
- package/package.json +6 -6
- package/src/Batch.res +2 -2
- package/src/ChainFetcher.res +27 -3
- package/src/ChainFetcher.res.mjs +17 -3
- package/src/ChainManager.res +163 -0
- package/src/ChainManager.res.mjs +136 -0
- package/src/Config.res +213 -30
- package/src/Config.res.mjs +102 -41
- package/src/Core.res +16 -10
- package/src/Ecosystem.res +0 -3
- package/src/Env.res +2 -2
- package/src/Env.res.mjs +2 -2
- package/src/Envio.res +101 -2
- package/src/Envio.res.mjs +2 -3
- package/src/EventConfigBuilder.res +87 -0
- package/src/EventConfigBuilder.res.mjs +53 -0
- package/src/EventUtils.res +2 -2
- package/src/FetchState.res +63 -67
- package/src/FetchState.res.mjs +44 -42
- package/src/GlobalState.res +219 -363
- package/src/GlobalState.res.mjs +314 -491
- package/src/GlobalStateManager.res +49 -59
- package/src/GlobalStateManager.res.mjs +5 -4
- package/src/GlobalStateManager.resi +1 -1
- package/src/HandlerLoader.res +18 -2
- package/src/HandlerLoader.res.mjs +16 -34
- package/src/HandlerRegister.res +9 -9
- package/src/HandlerRegister.res.mjs +9 -9
- package/src/Hasura.res +102 -32
- package/src/Hasura.res.mjs +88 -34
- package/src/InMemoryStore.res +10 -1
- package/src/InMemoryStore.res.mjs +4 -1
- package/src/InMemoryTable.res +83 -136
- package/src/InMemoryTable.res.mjs +57 -86
- package/src/Internal.res +70 -5
- package/src/Internal.res.mjs +2 -8
- package/src/LazyLoader.res +2 -2
- package/src/LazyLoader.res.mjs +3 -3
- package/src/LoadLayer.res +47 -60
- package/src/LoadLayer.res.mjs +28 -50
- package/src/LoadLayer.resi +2 -5
- package/src/LogSelection.res +90 -21
- package/src/LogSelection.res.mjs +72 -21
- package/src/Logging.res +1 -1
- package/src/Main.res +61 -2
- package/src/Main.res.mjs +37 -1
- package/src/Persistence.res +3 -16
- package/src/PgStorage.res +125 -114
- package/src/PgStorage.res.mjs +112 -95
- package/src/Ports.res +5 -0
- package/src/Ports.res.mjs +9 -0
- package/src/Prometheus.res +3 -3
- package/src/Prometheus.res.mjs +4 -4
- package/src/ReorgDetection.res +4 -4
- package/src/ReorgDetection.res.mjs +4 -5
- package/src/SafeCheckpointTracking.res +16 -16
- package/src/SafeCheckpointTracking.res.mjs +2 -2
- package/src/SimulateItems.res +10 -14
- package/src/SimulateItems.res.mjs +5 -2
- package/src/Sink.res +1 -1
- package/src/Sink.res.mjs +1 -2
- package/src/SvmTypes.res +9 -0
- package/src/SvmTypes.res.mjs +14 -0
- package/src/TestIndexer.res +35 -68
- package/src/TestIndexer.res.mjs +17 -48
- package/src/TestIndexerProxyStorage.res +23 -23
- package/src/TestIndexerProxyStorage.res.mjs +12 -15
- package/src/Throttler.res +2 -2
- package/src/Time.res +2 -2
- package/src/Time.res.mjs +2 -2
- package/src/UserContext.res +19 -118
- package/src/UserContext.res.mjs +10 -66
- package/src/Utils.res +15 -15
- package/src/Utils.res.mjs +7 -8
- package/src/adapters/MarkBatchProcessedAdapter.res +5 -0
- package/src/adapters/MarkBatchProcessedAdapter.res.mjs +14 -0
- package/src/bindings/BigDecimal.res +1 -1
- package/src/bindings/BigDecimal.res.mjs +2 -2
- package/src/bindings/ClickHouse.res +8 -6
- package/src/bindings/ClickHouse.res.mjs +5 -5
- package/src/bindings/Hrtime.res +1 -1
- package/src/bindings/Pino.res +2 -2
- package/src/bindings/Pino.res.mjs +3 -4
- package/src/db/EntityFilter.res +410 -0
- package/src/db/EntityFilter.res.mjs +424 -0
- package/src/db/EntityHistory.res +1 -1
- package/src/db/EntityHistory.res.mjs +1 -1
- package/src/db/InternalTable.res +10 -10
- package/src/db/InternalTable.res.mjs +41 -45
- package/src/db/Schema.res +2 -2
- package/src/db/Schema.res.mjs +3 -3
- package/src/db/Table.res +106 -22
- package/src/db/Table.res.mjs +84 -35
- package/src/sources/EventRouter.res +67 -2
- package/src/sources/EventRouter.res.mjs +45 -3
- package/src/sources/Evm.res +0 -7
- package/src/sources/Evm.res.mjs +0 -15
- package/src/sources/EvmChain.res +1 -1
- package/src/sources/EvmChain.res.mjs +1 -2
- package/src/sources/EvmRpcClient.res +42 -0
- package/src/sources/EvmRpcClient.res.mjs +64 -0
- package/src/sources/Fuel.res +0 -7
- package/src/sources/Fuel.res.mjs +0 -15
- package/src/sources/HyperFuelSource.res +5 -4
- package/src/sources/HyperFuelSource.res.mjs +2 -2
- package/src/sources/HyperSyncClient.res +9 -5
- package/src/sources/HyperSyncClient.res.mjs +2 -2
- package/src/sources/HyperSyncHeightStream.res +2 -2
- package/src/sources/HyperSyncHeightStream.res.mjs +2 -2
- package/src/sources/HyperSyncSource.res +12 -11
- package/src/sources/HyperSyncSource.res.mjs +6 -6
- package/src/sources/Rpc.res +1 -5
- package/src/sources/Rpc.res.mjs +1 -9
- package/src/sources/RpcSource.res +57 -21
- package/src/sources/RpcSource.res.mjs +47 -20
- package/src/sources/RpcWebSocketHeightStream.res +1 -1
- package/src/sources/SourceManager.res +3 -2
- package/src/sources/SourceManager.res.mjs +1 -1
- package/src/sources/Svm.res +3 -10
- package/src/sources/Svm.res.mjs +4 -18
- package/src/sources/SvmHyperSyncClient.res +265 -0
- package/src/sources/SvmHyperSyncClient.res.mjs +28 -0
- package/src/sources/SvmHyperSyncSource.res +638 -0
- package/src/sources/SvmHyperSyncSource.res.mjs +557 -0
- package/src/tui/Tui.res +9 -2
- package/src/tui/Tui.res.mjs +18 -3
- package/src/tui/components/BufferedProgressBar.res +2 -2
- package/src/tui/components/TuiData.res +3 -0
- package/svm.schema.json +523 -14
- package/src/TableIndices.res +0 -115
- package/src/TableIndices.res.mjs +0 -144
package/src/FetchState.res.mjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import * as Utils from "./Utils.res.mjs";
|
|
4
4
|
import * as Js_math from "@rescript/runtime/lib/es6/Js_math.js";
|
|
5
5
|
import * as Logging from "./Logging.res.mjs";
|
|
6
|
-
import * as Belt_Array from "@rescript/runtime/lib/es6/Belt_Array.js";
|
|
7
6
|
import * as Prometheus from "./Prometheus.res.mjs";
|
|
8
7
|
import * as Stdlib_Int from "@rescript/runtime/lib/es6/Stdlib_Int.js";
|
|
9
8
|
import * as Primitive_int from "@rescript/runtime/lib/es6/Primitive_int.js";
|
|
@@ -271,7 +270,7 @@ function make(partitions, maxAddrInPartition, nextPartitionIndex, dynamicContrac
|
|
|
271
270
|
}
|
|
272
271
|
newPartitions.sort(ascSortFn);
|
|
273
272
|
let partitionsCount = newPartitions.length;
|
|
274
|
-
let idsInAscOrder =
|
|
273
|
+
let idsInAscOrder = Array(partitionsCount);
|
|
275
274
|
let entities = {};
|
|
276
275
|
for (let idx$2 = 0; idx$2 < partitionsCount; ++idx$2) {
|
|
277
276
|
let p$1 = newPartitions[idx$2];
|
|
@@ -489,7 +488,9 @@ function updateInternal(fetchState, optimizedPartitionsOpt, indexingAddressesOpt
|
|
|
489
488
|
let latestOnBlockBlockNumber;
|
|
490
489
|
if (onBlockConfigs.length !== 0) {
|
|
491
490
|
let mutItems$1 = mutItemsRef;
|
|
492
|
-
let item =
|
|
491
|
+
let item = (
|
|
492
|
+
mutItems$1 !== undefined ? mutItems$1 : fetchState.buffer
|
|
493
|
+
)[fetchState.targetBufferSize - 1 | 0];
|
|
493
494
|
let maxBlockNumber;
|
|
494
495
|
if (item !== undefined) {
|
|
495
496
|
maxBlockNumber = item.blockNumber;
|
|
@@ -570,7 +571,7 @@ function addressesByContractNameGetAll(addressesByContractName) {
|
|
|
570
571
|
return all;
|
|
571
572
|
}
|
|
572
573
|
|
|
573
|
-
function createPartitionsFromIndexingAddresses(registeringContractsByContract,
|
|
574
|
+
function createPartitionsFromIndexingAddresses(registeringContractsByContract, dynamicContracts, normalSelection, maxAddrInPartition, nextPartitionIndex, existingPartitions, progressBlockNumber) {
|
|
574
575
|
let nextPartitionIndexRef = nextPartitionIndex;
|
|
575
576
|
let dynamicPartitions = [];
|
|
576
577
|
let nonDynamicPartitions = [];
|
|
@@ -579,7 +580,6 @@ function createPartitionsFromIndexingAddresses(registeringContractsByContract, c
|
|
|
579
580
|
let contractName = contractNames[cIdx];
|
|
580
581
|
let registeringContracts = registeringContractsByContract[contractName];
|
|
581
582
|
let addresses = Object.keys(registeringContracts);
|
|
582
|
-
let contractConfig = contractConfigs[contractName];
|
|
583
583
|
let isDynamic = dynamicContracts.has(contractName);
|
|
584
584
|
let partitions = isDynamic ? dynamicPartitions : nonDynamicPartitions;
|
|
585
585
|
let byStartBlock = {};
|
|
@@ -595,9 +595,7 @@ function createPartitionsFromIndexingAddresses(registeringContractsByContract, c
|
|
|
595
595
|
for (let idx = 0, idx_finish = ascKeys.length; idx < idx_finish; ++idx) {
|
|
596
596
|
let maybeNextStartBlockKey = ascKeys[idx + 1 | 0];
|
|
597
597
|
let shouldAllocateNewPartition;
|
|
598
|
-
if (
|
|
599
|
-
shouldAllocateNewPartition = true;
|
|
600
|
-
} else {
|
|
598
|
+
if (maybeNextStartBlockKey !== undefined) {
|
|
601
599
|
let nextStartBlock = Stdlib_Int.fromString(maybeNextStartBlockKey, undefined);
|
|
602
600
|
let shouldJoinCurrentStartBlock = (nextStartBlock - startBlockRef | 0) < 20000;
|
|
603
601
|
if (shouldJoinCurrentStartBlock) {
|
|
@@ -606,6 +604,8 @@ function createPartitionsFromIndexingAddresses(registeringContractsByContract, c
|
|
|
606
604
|
} else {
|
|
607
605
|
shouldAllocateNewPartition = true;
|
|
608
606
|
}
|
|
607
|
+
} else {
|
|
608
|
+
shouldAllocateNewPartition = true;
|
|
609
609
|
}
|
|
610
610
|
if (shouldAllocateNewPartition) {
|
|
611
611
|
let latestFetchedBlock_blockNumber = Primitive_int.max(startBlockRef - 1 | 0, progressBlockNumber);
|
|
@@ -666,10 +666,8 @@ function createPartitionsFromIndexingAddresses(registeringContractsByContract, c
|
|
|
666
666
|
mergedAddresses[cn] = currentAddrs;
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
|
-
let nextContractName = Utils.$$Array.firstUnsafe(Object.keys(nextP.addressesByContractName));
|
|
670
|
-
let hasFilterByAddresses = contractConfigs[nextContractName].filterByAddresses;
|
|
671
669
|
let isTooFar = (currentPBlock + 20000 | 0) < nextPBlock;
|
|
672
|
-
if (isTooFar
|
|
670
|
+
if (isTooFar) {
|
|
673
671
|
mergedNonDynamic.push({
|
|
674
672
|
id: currentP.id,
|
|
675
673
|
latestFetchedBlock: currentP.latestFetchedBlock,
|
|
@@ -724,8 +722,8 @@ function registerDynamicContracts(fetchState, items) {
|
|
|
724
722
|
let indexingAddresses = fetchState.indexingAddresses;
|
|
725
723
|
let registeringContractsByContract = {};
|
|
726
724
|
let earliestRegisteringEventBlockNumber = Infinity;
|
|
727
|
-
let hasDCWithFilterByAddresses = false;
|
|
728
725
|
let noEventsAddresses = {};
|
|
726
|
+
let registeringAddresses = {};
|
|
729
727
|
for (let itemIdx = 0, itemIdx_finish = items.length; itemIdx < itemIdx_finish; ++itemIdx) {
|
|
730
728
|
let item = items[itemIdx];
|
|
731
729
|
let dcs = item.dcs;
|
|
@@ -761,23 +759,14 @@ function registerDynamicContracts(fetchState, items) {
|
|
|
761
759
|
}
|
|
762
760
|
shouldRemove = true;
|
|
763
761
|
} else {
|
|
764
|
-
let
|
|
765
|
-
let
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
if (registeringContract.contractName !== dc.contractName) {
|
|
769
|
-
warnDifferentContractType(fetchState, registeringContract, dcWithStartBlock);
|
|
770
|
-
shouldUpdate = false;
|
|
771
|
-
} else {
|
|
772
|
-
shouldUpdate = false;
|
|
773
|
-
}
|
|
774
|
-
} else {
|
|
775
|
-
hasDCWithFilterByAddresses = hasDCWithFilterByAddresses || match.filterByAddresses;
|
|
776
|
-
shouldUpdate = true;
|
|
777
|
-
}
|
|
762
|
+
let registeringContract = registeringAddresses[dc.address];
|
|
763
|
+
let shouldUpdate = registeringContract !== undefined ? (
|
|
764
|
+
registeringContract.contractName !== dc.contractName ? (warnDifferentContractType(fetchState, registeringContract, dcWithStartBlock), false) : false
|
|
765
|
+
) : true;
|
|
778
766
|
if (shouldUpdate) {
|
|
779
767
|
earliestRegisteringEventBlockNumber = Primitive_int.min(earliestRegisteringEventBlockNumber, dcWithStartBlock_effectiveStartBlock);
|
|
780
|
-
|
|
768
|
+
Utils.Dict.getOrInsertEmptyDict(registeringContractsByContract, dc.contractName)[dc.address] = dcWithStartBlock;
|
|
769
|
+
registeringAddresses[dc.address] = dcWithStartBlock;
|
|
781
770
|
} else {
|
|
782
771
|
shouldRemove = true;
|
|
783
772
|
}
|
|
@@ -800,8 +789,11 @@ function registerDynamicContracts(fetchState, items) {
|
|
|
800
789
|
}
|
|
801
790
|
shouldRemove = true;
|
|
802
791
|
} else {
|
|
803
|
-
let
|
|
804
|
-
if (
|
|
792
|
+
let existingContract$2 = registeringAddresses[dc.address];
|
|
793
|
+
if (existingContract$2 !== undefined) {
|
|
794
|
+
if (existingContract$2.contractName !== dc.contractName) {
|
|
795
|
+
warnDifferentContractType(fetchState, existingContract$2, dcAsIndexingAddress);
|
|
796
|
+
}
|
|
805
797
|
shouldRemove = true;
|
|
806
798
|
} else {
|
|
807
799
|
let logger$1 = Logging.createChild({
|
|
@@ -811,6 +803,7 @@ function registerDynamicContracts(fetchState, items) {
|
|
|
811
803
|
});
|
|
812
804
|
Logging.childWarn(logger$1, `Persisting contract registration without fetching: Contract doesn't have any events to fetch. It'll be picked up on restart if you add events for the contract.`);
|
|
813
805
|
noEventsAddresses[dc.address] = dcAsIndexingAddress;
|
|
806
|
+
registeringAddresses[dc.address] = dcAsIndexingAddress;
|
|
814
807
|
}
|
|
815
808
|
}
|
|
816
809
|
}
|
|
@@ -888,11 +881,11 @@ function registerDynamicContracts(fetchState, items) {
|
|
|
888
881
|
}
|
|
889
882
|
}
|
|
890
883
|
}
|
|
891
|
-
let registeringContracts
|
|
892
|
-
Object.assign(newIndexingAddresses, registeringContracts
|
|
884
|
+
let registeringContracts = registeringContractsByContract[contractName];
|
|
885
|
+
Object.assign(newIndexingAddresses, registeringContracts);
|
|
893
886
|
}
|
|
894
887
|
Object.assign(newIndexingAddresses, noEventsAddresses);
|
|
895
|
-
let optimizedPartitions = createPartitionsFromIndexingAddresses(registeringContractsByContract,
|
|
888
|
+
let optimizedPartitions = createPartitionsFromIndexingAddresses(registeringContractsByContract, dynamicContractsRef, fetchState.normalSelection, fetchState.optimizedPartitions.maxAddrInPartition, fetchState.optimizedPartitions.nextPartitionIndex + newPartitions.length | 0, mutExistingPartitions.concat(newPartitions), 0);
|
|
896
889
|
return updateInternal(fetchState, optimizedPartitions, newIndexingAddresses, undefined, undefined, undefined);
|
|
897
890
|
}
|
|
898
891
|
if (!hasNoEventsUpdates) {
|
|
@@ -904,7 +897,18 @@ function registerDynamicContracts(fetchState, items) {
|
|
|
904
897
|
}
|
|
905
898
|
|
|
906
899
|
function handleQueryResult(fetchState, query, latestFetchedBlock, newItems) {
|
|
907
|
-
|
|
900
|
+
let newItems$1 = newItems.filter(item => {
|
|
901
|
+
if (item.kind !== 0) {
|
|
902
|
+
return true;
|
|
903
|
+
}
|
|
904
|
+
let filter = item.eventConfig.clientAddressFilter;
|
|
905
|
+
if (filter !== undefined) {
|
|
906
|
+
return filter(item.event, item.blockNumber, fetchState.indexingAddresses);
|
|
907
|
+
} else {
|
|
908
|
+
return true;
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
return updateInternal(fetchState, handleQueryResponse(fetchState.optimizedPartitions, query, fetchState.knownHeight, latestFetchedBlock), undefined, newItems$1.length !== 0 ? fetchState.buffer.concat(newItems$1) : undefined, undefined, undefined);
|
|
908
912
|
}
|
|
909
913
|
|
|
910
914
|
function startFetchingQueries(param, queries) {
|
|
@@ -1179,7 +1183,7 @@ function getNextQuery(fetchState, concurrencyLimit) {
|
|
|
1179
1183
|
}
|
|
1180
1184
|
|
|
1181
1185
|
function hasReadyItem(fetchState) {
|
|
1182
|
-
let item =
|
|
1186
|
+
let item = fetchState.buffer[0];
|
|
1183
1187
|
if (item !== undefined) {
|
|
1184
1188
|
return item.blockNumber <= bufferBlockNumber(fetchState);
|
|
1185
1189
|
} else {
|
|
@@ -1192,7 +1196,7 @@ function getReadyItemsCount(fetchState, targetSize, fromItem) {
|
|
|
1192
1196
|
let acc = 0;
|
|
1193
1197
|
let isFinished = false;
|
|
1194
1198
|
while (!isFinished) {
|
|
1195
|
-
let item =
|
|
1199
|
+
let item = fetchState.buffer[fromItem + acc | 0];
|
|
1196
1200
|
if (item !== undefined) {
|
|
1197
1201
|
let itemBlockNumber = item.blockNumber;
|
|
1198
1202
|
if (itemBlockNumber <= readyBlockNumber) {
|
|
@@ -1230,7 +1234,6 @@ function make$1(startBlock, endBlock, eventConfigs, addresses, maxAddrInPartitio
|
|
|
1230
1234
|
let startBlock = match.startBlock;
|
|
1231
1235
|
let match$1 = ec.startBlock;
|
|
1232
1236
|
contractConfigs[ec.contractName] = {
|
|
1233
|
-
filterByAddresses: match.filterByAddresses || ec.filterByAddresses,
|
|
1234
1237
|
startBlock: startBlock !== undefined ? (
|
|
1235
1238
|
match$1 !== undefined ? Primitive_int.min(startBlock, match$1) : startBlock
|
|
1236
1239
|
) : (
|
|
@@ -1239,7 +1242,6 @@ function make$1(startBlock, endBlock, eventConfigs, addresses, maxAddrInPartitio
|
|
|
1239
1242
|
};
|
|
1240
1243
|
} else {
|
|
1241
1244
|
contractConfigs[ec.contractName] = {
|
|
1242
|
-
filterByAddresses: ec.filterByAddresses,
|
|
1243
1245
|
startBlock: ec.startBlock
|
|
1244
1246
|
};
|
|
1245
1247
|
}
|
|
@@ -1299,7 +1301,7 @@ function make$1(startBlock, endBlock, eventConfigs, addresses, maxAddrInPartitio
|
|
|
1299
1301
|
return;
|
|
1300
1302
|
}
|
|
1301
1303
|
});
|
|
1302
|
-
let optimizedPartitions = createPartitionsFromIndexingAddresses(registeringContractsByContract,
|
|
1304
|
+
let optimizedPartitions = createPartitionsFromIndexingAddresses(registeringContractsByContract, dynamicContracts, normalSelection, maxAddrInPartition, partitions.length, partitions, progressBlockNumber);
|
|
1303
1305
|
if (optimizedPartitions.idsInAscOrder.length === 0 && Utils.$$Array.isEmpty(onBlockConfigs)) {
|
|
1304
1306
|
Stdlib_JsError.throwWithMessage(`Invalid configuration: Nothing to fetch on chain ` + chainId.toString() + `. ` + (`addresses=` + addresses.length.toString() + `, `) + (`eventConfigs=` + eventConfigs.length.toString() + `, `) + (`normalEventConfigs=` + normalEventConfigs.length.toString() + `. `) + `Make sure that you provided at least one contract address to index, or have events with Wildcard mode enabled, or have onBlock handlers.`);
|
|
1305
1307
|
}
|
|
@@ -1447,7 +1449,7 @@ function rollback(fetchState, targetBlockNumber) {
|
|
|
1447
1449
|
});
|
|
1448
1450
|
}
|
|
1449
1451
|
}
|
|
1450
|
-
let optimizedPartitions = createPartitionsFromIndexingAddresses(registeringContractsByContract, fetchState.
|
|
1452
|
+
let optimizedPartitions = createPartitionsFromIndexingAddresses(registeringContractsByContract, fetchState.optimizedPartitions.dynamicContracts, fetchState.normalSelection, fetchState.optimizedPartitions.maxAddrInPartition, nextKeptIdRef, keptPartitions, targetBlockNumber);
|
|
1451
1453
|
return updateInternal({
|
|
1452
1454
|
optimizedPartitions: fetchState.optimizedPartitions,
|
|
1453
1455
|
startBlock: fetchState.startBlock,
|
|
@@ -1544,7 +1546,7 @@ function isReadyToEnterReorgThreshold(fetchState) {
|
|
|
1544
1546
|
}
|
|
1545
1547
|
|
|
1546
1548
|
function hasFullBatch(fetchState, batchSizeTarget) {
|
|
1547
|
-
let item =
|
|
1549
|
+
let item = fetchState.buffer[batchSizeTarget - 1 | 0];
|
|
1548
1550
|
if (item !== undefined) {
|
|
1549
1551
|
return item.blockNumber <= bufferBlockNumber(fetchState);
|
|
1550
1552
|
} else {
|
|
@@ -1561,7 +1563,7 @@ function getProgressPercentage(fetchState) {
|
|
|
1561
1563
|
if (totalRange <= 0) {
|
|
1562
1564
|
return 0;
|
|
1563
1565
|
}
|
|
1564
|
-
let item =
|
|
1566
|
+
let item = fetchState.buffer[0];
|
|
1565
1567
|
let progress = item !== undefined ? item.blockNumber - firstEventBlock | 0 : bufferBlockNumber(fetchState) - firstEventBlock | 0;
|
|
1566
1568
|
return progress / totalRange;
|
|
1567
1569
|
}
|
|
@@ -1593,7 +1595,7 @@ function sortForUnorderedBatch(fetchStates, batchSizeTarget) {
|
|
|
1593
1595
|
|
|
1594
1596
|
function getProgressBlockNumberAt(fetchState, index) {
|
|
1595
1597
|
let bufferBlockNumber$1 = bufferBlockNumber(fetchState);
|
|
1596
|
-
let item =
|
|
1598
|
+
let item = fetchState.buffer[index];
|
|
1597
1599
|
if (item !== undefined && bufferBlockNumber$1 >= item.blockNumber) {
|
|
1598
1600
|
return item.blockNumber - 1 | 0;
|
|
1599
1601
|
} else {
|