envio 3.3.0-alpha.7 → 3.3.0-alpha.9
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/index.d.ts +23 -5
- package/package.json +6 -6
- package/src/Api.res +1 -1
- package/src/Api.res.mjs +1 -1
- package/src/ChainFetching.res +21 -10
- package/src/ChainFetching.res.mjs +11 -10
- package/src/ChainState.res +401 -171
- package/src/ChainState.res.mjs +270 -104
- package/src/ChainState.resi +19 -7
- package/src/Config.res +11 -27
- package/src/Config.res.mjs +8 -7
- package/src/Core.res +7 -0
- package/src/CrossChainState.res +82 -82
- package/src/CrossChainState.res.mjs +52 -59
- package/src/CrossChainState.resi +1 -1
- package/src/Ecosystem.res +3 -3
- package/src/Ecosystem.res.mjs +3 -3
- package/src/Envio.res +14 -9
- package/src/EnvioGlobal.res +53 -0
- package/src/EnvioGlobal.res.mjs +31 -0
- package/src/EventConfigBuilder.res +117 -69
- package/src/EventConfigBuilder.res.mjs +71 -34
- package/src/EventProcessing.res +19 -15
- package/src/EventProcessing.res.mjs +13 -12
- package/src/FetchState.res +410 -185
- package/src/FetchState.res.mjs +268 -253
- package/src/HandlerLoader.res +8 -113
- package/src/HandlerLoader.res.mjs +2 -88
- package/src/HandlerRegister.res +518 -144
- package/src/HandlerRegister.res.mjs +285 -133
- package/src/HandlerRegister.resi +24 -8
- package/src/IndexerState.res +6 -3
- package/src/IndexerState.res.mjs +3 -3
- package/src/IndexerState.resi +1 -1
- package/src/IndexingAddresses.res +10 -7
- package/src/IndexingAddresses.res.mjs +8 -7
- package/src/IndexingAddresses.resi +3 -1
- package/src/Internal.res +104 -39
- package/src/Internal.res.mjs +11 -1
- package/src/LogSelection.res +102 -165
- package/src/LogSelection.res.mjs +101 -116
- package/src/Main.res +49 -164
- package/src/Main.res.mjs +39 -104
- package/src/Metrics.res +43 -2
- package/src/Metrics.res.mjs +39 -3
- package/src/Prometheus.res +0 -35
- package/src/Prometheus.res.mjs +33 -68
- package/src/RawEvent.res +7 -2
- package/src/RawEvent.res.mjs +4 -4
- package/src/RollbackCommit.res +4 -1
- package/src/RollbackCommit.res.mjs +3 -2
- package/src/SimulateItems.res +20 -7
- package/src/SimulateItems.res.mjs +7 -11
- package/src/TestIndexer.res +1 -1
- package/src/TestIndexer.res.mjs +1 -1
- package/src/sources/BlockStore.res +46 -0
- package/src/sources/BlockStore.res.mjs +24 -0
- package/src/sources/EventRouter.res +19 -12
- package/src/sources/EventRouter.res.mjs +7 -5
- package/src/sources/Evm.res +58 -5
- package/src/sources/Evm.res.mjs +44 -5
- package/src/sources/EvmChain.res +14 -18
- package/src/sources/EvmChain.res.mjs +12 -13
- package/src/sources/FieldMask.res +39 -0
- package/src/sources/FieldMask.res.mjs +42 -0
- package/src/sources/Fuel.res +8 -3
- package/src/sources/Fuel.res.mjs +5 -4
- package/src/sources/HyperFuelSource.res +31 -40
- package/src/sources/HyperFuelSource.res.mjs +52 -44
- package/src/sources/HyperSync.res +31 -9
- package/src/sources/HyperSync.res.mjs +47 -31
- package/src/sources/HyperSync.resi +10 -3
- package/src/sources/HyperSyncClient.res +15 -4
- package/src/sources/HyperSyncHeightStream.res +1 -8
- package/src/sources/HyperSyncHeightStream.res.mjs +0 -2
- package/src/sources/HyperSyncSource.res +58 -90
- package/src/sources/HyperSyncSource.res.mjs +57 -66
- package/src/sources/RpcSource.res +118 -120
- package/src/sources/RpcSource.res.mjs +92 -74
- package/src/sources/RpcWebSocketHeightStream.res +0 -5
- package/src/sources/RpcWebSocketHeightStream.res.mjs +0 -2
- package/src/sources/SimulateSource.res +5 -3
- package/src/sources/SimulateSource.res.mjs +12 -4
- package/src/sources/Source.res +19 -5
- package/src/sources/SourceManager.res +60 -10
- package/src/sources/SourceManager.res.mjs +54 -8
- package/src/sources/SourceManager.resi +10 -0
- package/src/sources/Svm.res +14 -10
- package/src/sources/Svm.res.mjs +23 -6
- package/src/sources/SvmHyperSyncClient.res +5 -6
- package/src/sources/SvmHyperSyncSource.res +82 -41
- package/src/sources/SvmHyperSyncSource.res.mjs +86 -41
- package/src/sources/TransactionStore.res +6 -107
- package/src/sources/TransactionStore.res.mjs +5 -86
- package/svm.schema.json +19 -0
|
@@ -65,12 +65,12 @@ async function runEventHandlerOrThrow(item, checkpointId, handler, indexerState,
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
let handlerDuration = Performance.secondsSince(timeBeforeHandler);
|
|
68
|
-
return Prometheus.ProcessingHandler.increment(item.eventConfig.contractName, item.eventConfig.name, handlerDuration);
|
|
68
|
+
return Prometheus.ProcessingHandler.increment(item.onEventRegistration.eventConfig.contractName, item.onEventRegistration.eventConfig.name, handlerDuration);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
async function runHandlerOrThrow(item, checkpointId, indexerState, loadManager, persistence, config, chains) {
|
|
72
72
|
if (item.kind === 0) {
|
|
73
|
-
let handler = item.
|
|
73
|
+
let handler = item.onEventRegistration.handler;
|
|
74
74
|
if (handler !== undefined) {
|
|
75
75
|
return await runEventHandlerOrThrow(item, checkpointId, handler, indexerState, loadManager, persistence, chains, config);
|
|
76
76
|
} else {
|
|
@@ -89,7 +89,7 @@ async function runHandlerOrThrow(item, checkpointId, indexerState, loadManager,
|
|
|
89
89
|
config: config,
|
|
90
90
|
isResolved: false
|
|
91
91
|
};
|
|
92
|
-
await item.
|
|
92
|
+
await item.onBlockRegistration.handler(Ecosystem.makeOnBlockArgs(item.blockNumber, config.ecosystem, UserContext.getHandlerContext(contextParams)));
|
|
93
93
|
contextParams.isResolved = true;
|
|
94
94
|
return;
|
|
95
95
|
} catch (raw_exn) {
|
|
@@ -113,11 +113,12 @@ async function preloadBatchOrThrow(batch, loadManager, persistence, config, inde
|
|
|
113
113
|
for (let idx = 0; idx < checkpointEventsProcessed; ++idx) {
|
|
114
114
|
let item = batch.items[itemIdx + idx | 0];
|
|
115
115
|
if (item.kind === 0) {
|
|
116
|
-
let match = item.
|
|
116
|
+
let match = item.onEventRegistration;
|
|
117
117
|
let handler = match.handler;
|
|
118
118
|
if (handler !== undefined) {
|
|
119
|
-
let
|
|
120
|
-
let
|
|
119
|
+
let match$1 = match.eventConfig;
|
|
120
|
+
let contractName = match$1.contractName;
|
|
121
|
+
let eventName = match$1.name;
|
|
121
122
|
try {
|
|
122
123
|
let timerRef = Prometheus.PreloadHandler.startOperation(contractName, eventName);
|
|
123
124
|
promises.push(Utils.$$Promise.silentCatch(handler({
|
|
@@ -140,7 +141,7 @@ async function preloadBatchOrThrow(batch, loadManager, persistence, config, inde
|
|
|
140
141
|
}
|
|
141
142
|
} else {
|
|
142
143
|
try {
|
|
143
|
-
promises.push(Utils.$$Promise.silentCatch(item.
|
|
144
|
+
promises.push(Utils.$$Promise.silentCatch(item.onBlockRegistration.handler(Ecosystem.makeOnBlockArgs(item.blockNumber, config.ecosystem, UserContext.getHandlerContext({
|
|
144
145
|
item: item,
|
|
145
146
|
checkpointId: checkpointId,
|
|
146
147
|
indexerState: indexerState,
|
|
@@ -184,7 +185,7 @@ function registerProcessEventBatchMetrics(logger, batch, loadDuration, handlerDu
|
|
|
184
185
|
Prometheus.ProcessingBatch.registerMetrics(loadDuration, handlerDuration);
|
|
185
186
|
}
|
|
186
187
|
|
|
187
|
-
async function
|
|
188
|
+
async function materializeBatchEvents(batch, chainStates, ecosystem) {
|
|
188
189
|
let match = Object.values(chainStates);
|
|
189
190
|
if (match.length !== 1) {
|
|
190
191
|
let itemsByChain = {};
|
|
@@ -199,12 +200,12 @@ async function materializeBatchTransactions(batch, chainStates) {
|
|
|
199
200
|
});
|
|
200
201
|
await Promise.all(Object.entries(itemsByChain).map(async param => {
|
|
201
202
|
let cs = chainStates[param[0]];
|
|
202
|
-
return await ChainState.materializeBatchItems(cs, param[1]);
|
|
203
|
+
return await ChainState.materializeBatchItems(cs, param[1], ecosystem);
|
|
203
204
|
}));
|
|
204
205
|
return;
|
|
205
206
|
}
|
|
206
207
|
let cs = match[0];
|
|
207
|
-
return await ChainState.materializeBatchItems(cs, batch.items);
|
|
208
|
+
return await ChainState.materializeBatchItems(cs, batch.items, ecosystem);
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
async function processEventBatch(batch, indexerState, loadManager, persistence, config, chainStates) {
|
|
@@ -219,7 +220,7 @@ async function processEventBatch(batch, indexerState, loadManager, persistence,
|
|
|
219
220
|
await Writing.awaitCapacity(indexerState);
|
|
220
221
|
let timeRef = Performance.now();
|
|
221
222
|
if (Utils.$$Array.notEmpty(batch.items)) {
|
|
222
|
-
await
|
|
223
|
+
await materializeBatchEvents(batch, chainStates, config.ecosystem.name);
|
|
223
224
|
await preloadBatchOrThrow(batch, loadManager, persistence, config, indexerState, chains);
|
|
224
225
|
}
|
|
225
226
|
let elapsedTimeAfterLoaders = Performance.secondsSince(timeRef);
|
|
@@ -264,7 +265,7 @@ export {
|
|
|
264
265
|
preloadBatchOrThrow,
|
|
265
266
|
runBatchHandlersOrThrow,
|
|
266
267
|
registerProcessEventBatchMetrics,
|
|
267
|
-
|
|
268
|
+
materializeBatchEvents,
|
|
268
269
|
processEventBatch,
|
|
269
270
|
}
|
|
270
271
|
/* Utils Not a pure module */
|