envio 3.5.0-alpha.2 → 3.5.0-rc.0
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/package.json +6 -6
- package/src/Batch.res +8 -8
- package/src/Batch.res.mjs +4 -3
- package/src/BatchProcessing.res +24 -0
- package/src/BatchProcessing.res.mjs +12 -0
- package/src/ChainFetching.res +20 -19
- package/src/ChainFetching.res.mjs +14 -14
- package/src/ChainId.res +58 -0
- package/src/ChainId.res.mjs +49 -0
- package/src/ChainId.resi +27 -0
- package/src/ChainMap.res +12 -26
- package/src/ChainMap.res.mjs +5 -41
- package/src/ChainMap.resi +5 -20
- package/src/ChainMetadata.res +1 -1
- package/src/ChainMetadata.res.mjs +3 -2
- package/src/ChainState.res +45 -24
- package/src/ChainState.res.mjs +40 -16
- package/src/ChainState.resi +3 -1
- package/src/Config.res +43 -26
- package/src/Config.res.mjs +19 -16
- package/src/ContractRegisterContext.res +1 -1
- package/src/ContractRegisterContext.res.mjs +1 -1
- package/src/Core.res +1 -0
- package/src/CrossChainState.res +90 -22
- package/src/CrossChainState.res.mjs +55 -16
- package/src/CrossChainState.resi +5 -1
- package/src/Env.res +0 -3
- package/src/Env.res.mjs +0 -3
- package/src/EventConfigBuilder.res +1 -1
- package/src/EventProcessing.res +4 -4
- package/src/EventProcessing.res.mjs +5 -5
- package/src/FetchState.res +489 -153
- package/src/FetchState.res.mjs +399 -129
- package/src/FinalizeBackfill.res +61 -0
- package/src/FinalizeBackfill.res.mjs +44 -0
- package/src/HandlerRegister.res +8 -8
- package/src/HandlerRegister.res.mjs +5 -4
- package/src/HandlerRegister.resi +1 -1
- package/src/InMemoryStore.res +4 -0
- package/src/InMemoryStore.res.mjs +1 -1
- package/src/InMemoryTable.res +15 -15
- package/src/InMemoryTable.res.mjs +14 -14
- package/src/IndexerLoop.res +9 -2
- package/src/IndexerLoop.res.mjs +8 -1
- package/src/IndexerState.res +52 -23
- package/src/IndexerState.res.mjs +52 -14
- package/src/IndexerState.resi +11 -6
- package/src/Internal.res +19 -17
- package/src/Internal.res.mjs +18 -9
- package/src/LoadLayer.res +10 -2
- package/src/LoadLayer.res.mjs +3 -1
- package/src/LogSelection.res +2 -2
- package/src/Main.res +7 -11
- package/src/Main.res.mjs +4 -6
- package/src/Metrics.res +6 -6
- package/src/Metrics.res.mjs +4 -3
- package/src/Persistence.res +23 -4
- package/src/PgStorage.res +447 -100
- package/src/PgStorage.res.mjs +285 -99
- package/src/RawEvent.res +1 -2
- package/src/RawEvent.res.mjs +1 -1
- package/src/Rollback.res +18 -20
- package/src/Rollback.res.mjs +9 -9
- package/src/RollbackCommit.res +2 -2
- package/src/RollbackCommit.res.mjs +3 -3
- package/src/SafeCheckpointTracking.res +2 -2
- package/src/SimulateDeadInputTracker.res +17 -21
- package/src/SimulateDeadInputTracker.res.mjs +9 -8
- package/src/SimulateItems.res +8 -10
- package/src/SimulateItems.res.mjs +9 -10
- package/src/Sink.res +2 -2
- package/src/Sink.res.mjs +3 -2
- package/src/TestIndexer.res +14 -14
- package/src/TestIndexer.res.mjs +16 -10
- package/src/UserContext.res +2 -2
- package/src/UserContext.res.mjs +2 -1
- package/src/Utils.res +0 -4
- package/src/Utils.res.mjs +1 -6
- package/src/bindings/ClickHouse.res +20 -2
- package/src/bindings/ClickHouse.res.mjs +25 -14
- package/src/db/EntityFilter.res +0 -4
- package/src/db/EntityFilter.res.mjs +1 -8
- package/src/db/EntityHistory.res +1 -1
- package/src/db/IndexCatalog.res +248 -0
- package/src/db/IndexCatalog.res.mjs +222 -0
- package/src/db/IndexDefinition.res +131 -0
- package/src/db/IndexDefinition.res.mjs +138 -0
- package/src/db/IndexManager.res +145 -0
- package/src/db/IndexManager.res.mjs +130 -0
- package/src/db/InternalTable.res +54 -23
- package/src/db/InternalTable.res.mjs +38 -23
- package/src/db/Table.res +24 -14
- package/src/db/Table.res.mjs +21 -16
- package/src/sources/AddressSet.res +5 -4
- package/src/sources/AddressStore.res +25 -14
- package/src/sources/AddressStore.res.mjs +10 -12
- package/src/sources/Evm.res +2 -2
- package/src/sources/Evm.res.mjs +1 -1
- package/src/sources/EvmChain.res +3 -3
- package/src/sources/EvmChain.res.mjs +3 -3
- package/src/sources/EvmHyperSyncSource.res +7 -7
- package/src/sources/EvmHyperSyncSource.res.mjs +6 -6
- package/src/sources/Fuel.res +2 -2
- package/src/sources/Fuel.res.mjs +1 -1
- package/src/sources/FuelHyperSyncClient.res +3 -0
- package/src/sources/FuelHyperSyncClient.res.mjs +1 -0
- package/src/sources/FuelHyperSyncSource.res +5 -7
- package/src/sources/FuelHyperSyncSource.res.mjs +5 -5
- package/src/sources/HyperSync.resi +2 -2
- package/src/sources/HyperSyncClient.res +5 -0
- package/src/sources/HyperSyncClient.res.mjs +1 -0
- package/src/sources/RpcSource.res +13 -14
- package/src/sources/RpcSource.res.mjs +13 -12
- package/src/sources/SimulateSource.res +42 -15
- package/src/sources/SimulateSource.res.mjs +27 -9
- package/src/sources/Source.res +1 -5
- package/src/sources/SourceManager.res +12 -12
- package/src/sources/SourceManager.res.mjs +11 -10
- package/src/sources/SourceManager.resi +2 -2
- package/src/sources/Svm.res +4 -5
- package/src/sources/Svm.res.mjs +5 -4
- package/src/sources/SvmHyperSyncClient.res +3 -0
- package/src/sources/SvmHyperSyncClient.res.mjs +1 -0
- package/src/sources/SvmHyperSyncSource.res +4 -4
- package/src/sources/SvmHyperSyncSource.res.mjs +3 -3
- package/src/tui/Tui.res +1 -1
- package/src/tui/Tui.res.mjs +2 -1
- package/src/tui/components/CustomHooks.res +5 -4
- package/src/tui/components/CustomHooks.res.mjs +4 -2
package/src/sources/Svm.res.mjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as Rpc from "./Rpc.res.mjs";
|
|
4
4
|
import * as Rest from "../vendored/Rest.res.mjs";
|
|
5
5
|
import * as Utils from "../Utils.res.mjs";
|
|
6
|
+
import * as ChainId from "../ChainId.res.mjs";
|
|
6
7
|
import * as Logging from "../Logging.res.mjs";
|
|
7
8
|
import * as Internal from "../Internal.res.mjs";
|
|
8
9
|
import * as BlockStore from "./BlockStore.res.mjs";
|
|
@@ -47,7 +48,7 @@ function make(logger) {
|
|
|
47
48
|
return Logging.createChildFrom(logger, {
|
|
48
49
|
program: eventItem.onEventRegistration.eventConfig.contractName,
|
|
49
50
|
instruction: eventItem.onEventRegistration.eventConfig.name,
|
|
50
|
-
chainId: eventItem.
|
|
51
|
+
chainId: eventItem.chainId,
|
|
51
52
|
slot: eventItem.blockNumber,
|
|
52
53
|
programId: instruction.programId
|
|
53
54
|
});
|
|
@@ -66,16 +67,16 @@ let GetFinalizedSlot = {
|
|
|
66
67
|
route: route
|
|
67
68
|
};
|
|
68
69
|
|
|
69
|
-
function makeRPCSource(
|
|
70
|
+
function makeRPCSource(chainId, rpc, sourceForOpt) {
|
|
70
71
|
let sourceFor = sourceForOpt !== undefined ? sourceForOpt : "Sync";
|
|
71
72
|
let client = Rest.client(rpc, undefined);
|
|
72
73
|
let host = Utils.Url.getHostFromUrl(rpc);
|
|
73
|
-
let urlHost = host !== undefined ? host : Stdlib_JsError.throwWithMessage(`The RPC url for chain ` +
|
|
74
|
+
let urlHost = host !== undefined ? host : Stdlib_JsError.throwWithMessage(`The RPC url for chain ` + ChainId.toString(chainId) + ` is in incorrect format. The RPC url needs to start with either http:// or https://`);
|
|
74
75
|
let name = `RPC (` + urlHost + `)`;
|
|
75
76
|
return {
|
|
76
77
|
name: name,
|
|
77
78
|
sourceFor: sourceFor,
|
|
78
|
-
|
|
79
|
+
chainId: chainId,
|
|
79
80
|
poweredByHyperSync: false,
|
|
80
81
|
pollingInterval: 10000,
|
|
81
82
|
getBlockHashes: (param, param$1) => Stdlib_JsError.throwWithMessage("Svm does not support getting block hashes"),
|
|
@@ -25,6 +25,8 @@ module Registration = {
|
|
|
25
25
|
contractName: string,
|
|
26
26
|
programId: string,
|
|
27
27
|
isWildcard: bool,
|
|
28
|
+
// Earliest slot this registration accepts; `None` is unrestricted.
|
|
29
|
+
startBlock: option<int>,
|
|
28
30
|
discriminator?: string,
|
|
29
31
|
discriminatorByteLen: int,
|
|
30
32
|
isInner?: bool,
|
|
@@ -52,6 +54,7 @@ module Registration = {
|
|
|
52
54
|
contractName: eventConfig.contractName,
|
|
53
55
|
programId: eventConfig.programId->SvmTypes.Pubkey.toString,
|
|
54
56
|
isWildcard: reg.isWildcard,
|
|
57
|
+
startBlock: reg.startBlock,
|
|
55
58
|
discriminator: ?eventConfig.discriminator,
|
|
56
59
|
discriminatorByteLen: eventConfig.discriminatorByteLen,
|
|
57
60
|
isInner: ?eventConfig.isInner,
|
|
@@ -18,6 +18,7 @@ function fromOnEventRegistrations(onEventRegistrations) {
|
|
|
18
18
|
contractName: eventConfig.contractName,
|
|
19
19
|
programId: eventConfig.programId,
|
|
20
20
|
isWildcard: reg.isWildcard,
|
|
21
|
+
startBlock: reg.startBlock,
|
|
21
22
|
discriminator: eventConfig.discriminator,
|
|
22
23
|
discriminatorByteLen: eventConfig.discriminatorByteLen,
|
|
23
24
|
isInner: eventConfig.isInner,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
open Source
|
|
2
2
|
|
|
3
3
|
type options = {
|
|
4
|
-
|
|
4
|
+
chainId: ChainId.t,
|
|
5
5
|
endpointUrl: string,
|
|
6
6
|
apiToken: option<string>,
|
|
7
7
|
onEventRegistrations: array<Internal.svmOnEventRegistration>,
|
|
@@ -68,7 +68,7 @@ let toSvmInstruction = (
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
let make = (
|
|
71
|
-
{
|
|
71
|
+
{chainId, endpointUrl, apiToken, onEventRegistrations, clientTimeoutMillis, addressStore}: options,
|
|
72
72
|
): t => {
|
|
73
73
|
let name = "SvmHyperSync"
|
|
74
74
|
|
|
@@ -159,7 +159,7 @@ let make = (
|
|
|
159
159
|
)
|
|
160
160
|
Internal.Event({
|
|
161
161
|
onEventRegistration,
|
|
162
|
-
|
|
162
|
+
chainId,
|
|
163
163
|
blockNumber: item.slot,
|
|
164
164
|
logIndex: synthLogIndex(
|
|
165
165
|
~transactionIndex=item.transactionIndex,
|
|
@@ -283,7 +283,7 @@ let make = (
|
|
|
283
283
|
{
|
|
284
284
|
name,
|
|
285
285
|
sourceFor: Sync,
|
|
286
|
-
|
|
286
|
+
chainId,
|
|
287
287
|
pollingInterval: 1000,
|
|
288
288
|
poweredByHyperSync: true,
|
|
289
289
|
getBlockHashes,
|
|
@@ -57,7 +57,7 @@ function toSvmInstruction(item, programName, instructionName) {
|
|
|
57
57
|
|
|
58
58
|
function make(param) {
|
|
59
59
|
let onEventRegistrations = param.onEventRegistrations;
|
|
60
|
-
let
|
|
60
|
+
let chainId = param.chainId;
|
|
61
61
|
let client = SvmHyperSyncClient.make(param.endpointUrl, param.apiToken, param.clientTimeoutMillis, undefined, undefined, undefined, SvmHyperSyncClient.Registration.fromOnEventRegistrations(onEventRegistrations), param.addressStore);
|
|
62
62
|
let getItemsOrThrow = async (fromBlock, toBlock, addressSet, knownHeight, param, selection, itemsTarget, retry, param$1) => {
|
|
63
63
|
let totalTimeRef = Performance.now();
|
|
@@ -113,7 +113,7 @@ function make(param) {
|
|
|
113
113
|
return {
|
|
114
114
|
kind: 0,
|
|
115
115
|
onEventRegistration: onEventRegistration,
|
|
116
|
-
|
|
116
|
+
chainId: chainId,
|
|
117
117
|
blockNumber: item.slot,
|
|
118
118
|
logIndex: synthLogIndex(item.transactionIndex, item.instructionAddress),
|
|
119
119
|
transactionIndex: item.transactionIndex,
|
|
@@ -243,7 +243,7 @@ function make(param) {
|
|
|
243
243
|
return {
|
|
244
244
|
name: "SvmHyperSync",
|
|
245
245
|
sourceFor: "Sync",
|
|
246
|
-
|
|
246
|
+
chainId: chainId,
|
|
247
247
|
poweredByHyperSync: true,
|
|
248
248
|
pollingInterval: 1000,
|
|
249
249
|
getBlockHashes: getBlockHashes,
|
package/src/tui/Tui.res
CHANGED
|
@@ -204,7 +204,7 @@ module App = {
|
|
|
204
204
|
knownHeight: data.knownHeight,
|
|
205
205
|
latestFetchedBlockNumber,
|
|
206
206
|
eventsProcessed: numEventsProcessed,
|
|
207
|
-
chainId: (cs->ChainState.chainConfig).id->
|
|
207
|
+
chainId: (cs->ChainState.chainConfig).id->ChainId.toString,
|
|
208
208
|
progressBlock: committedProgressBlockNumber < data.startBlock
|
|
209
209
|
? Some(data.startBlock)
|
|
210
210
|
: Some(committedProgressBlockNumber),
|
package/src/tui/Tui.res.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import * as Env from "../Env.res.mjs";
|
|
|
4
4
|
import * as Ink from "./bindings/Ink.res.mjs";
|
|
5
5
|
import * as Ink$1 from "ink";
|
|
6
6
|
import * as React from "react";
|
|
7
|
+
import * as ChainId from "../ChainId.res.mjs";
|
|
7
8
|
import * as SyncETA from "./components/SyncETA.res.mjs";
|
|
8
9
|
import * as TuiData from "./components/TuiData.res.mjs";
|
|
9
10
|
import * as Messages from "./components/Messages.res.mjs";
|
|
@@ -255,7 +256,7 @@ function Tui$App(props) {
|
|
|
255
256
|
break;
|
|
256
257
|
}
|
|
257
258
|
return {
|
|
258
|
-
chainId: ChainState.chainConfig(cs).id
|
|
259
|
+
chainId: ChainId.toString(ChainState.chainConfig(cs).id),
|
|
259
260
|
eventsProcessed: numEventsProcessed,
|
|
260
261
|
progressBlock: committedProgressBlockNumber < data.startBlock ? data.startBlock : committedProgressBlockNumber,
|
|
261
262
|
bufferBlock: latestFetchedBlockNumber,
|
|
@@ -4,16 +4,16 @@ module InitApi = {
|
|
|
4
4
|
envioVersion: string,
|
|
5
5
|
envioApiToken: option<string>,
|
|
6
6
|
ecosystem: ecosystem,
|
|
7
|
-
hyperSyncNetworks: array<
|
|
8
|
-
rpcNetworks: array<
|
|
7
|
+
hyperSyncNetworks: array<ChainId.t>,
|
|
8
|
+
rpcNetworks: array<ChainId.t>,
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
let bodySchema = S.object(s => {
|
|
12
12
|
envioVersion: s.field("envioVersion", S.string),
|
|
13
13
|
envioApiToken: s.field("envioApiToken", S.option(S.string)),
|
|
14
14
|
ecosystem: s.field("ecosystem", S.enum([Evm, Fuel, Svm])),
|
|
15
|
-
hyperSyncNetworks: s.field("hyperSyncNetworks", S.array(
|
|
16
|
-
rpcNetworks: s.field("rpcNetworks", S.array(
|
|
15
|
+
hyperSyncNetworks: s.field("hyperSyncNetworks", S.array(ChainId.schema)),
|
|
16
|
+
rpcNetworks: s.field("rpcNetworks", S.array(ChainId.schema)),
|
|
17
17
|
})
|
|
18
18
|
|
|
19
19
|
let makeBody = (~envioVersion, ~envioApiToken, ~config: Config.t) => {
|
|
@@ -28,6 +28,7 @@ module InitApi = {
|
|
|
28
28
|
| Config.EvmSourceConfig({hypersync: None}) => false
|
|
29
29
|
| Config.FuelSourceConfig(_) => true // Fuel always uses HyperFuel
|
|
30
30
|
| Config.SvmSourceConfig(_) => false
|
|
31
|
+
| Config.SimulateSourceConfig(_) => false
|
|
31
32
|
| Config.CustomSources(sources) => sources->Array.some(s => s.poweredByHyperSync)
|
|
32
33
|
}
|
|
33
34
|
switch usesHyperSync {
|
|
@@ -4,6 +4,7 @@ import * as Env from "../../Env.res.mjs";
|
|
|
4
4
|
import * as Rest from "../../vendored/Rest.res.mjs";
|
|
5
5
|
import * as Utils from "../../Utils.res.mjs";
|
|
6
6
|
import * as React from "react";
|
|
7
|
+
import * as ChainId from "../../ChainId.res.mjs";
|
|
7
8
|
import * as Logging from "../../Logging.res.mjs";
|
|
8
9
|
import * as ChainMap from "../../ChainMap.res.mjs";
|
|
9
10
|
import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
|
|
@@ -17,8 +18,8 @@ let bodySchema = S$RescriptSchema.object(s => ({
|
|
|
17
18
|
"fuel",
|
|
18
19
|
"svm"
|
|
19
20
|
])),
|
|
20
|
-
hyperSyncNetworks: s.f("hyperSyncNetworks", S$RescriptSchema.array(
|
|
21
|
-
rpcNetworks: s.f("rpcNetworks", S$RescriptSchema.array(
|
|
21
|
+
hyperSyncNetworks: s.f("hyperSyncNetworks", S$RescriptSchema.array(ChainId.schema)),
|
|
22
|
+
rpcNetworks: s.f("rpcNetworks", S$RescriptSchema.array(ChainId.schema))
|
|
22
23
|
}));
|
|
23
24
|
|
|
24
25
|
function makeBody(envioVersion, envioApiToken, config) {
|
|
@@ -35,6 +36,7 @@ function makeBody(envioVersion, envioApiToken, config) {
|
|
|
35
36
|
usesHyperSync = true;
|
|
36
37
|
break;
|
|
37
38
|
case "SvmSourceConfig" :
|
|
39
|
+
case "SimulateSourceConfig" :
|
|
38
40
|
usesHyperSync = false;
|
|
39
41
|
break;
|
|
40
42
|
case "CustomSources" :
|