envio 3.0.0-alpha.0 → 3.0.0-alpha.10
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/README.md +2 -2
- package/evm.schema.json +53 -57
- package/fuel.schema.json +35 -31
- package/index.d.ts +446 -1
- package/index.js +4 -0
- package/package.json +23 -11
- package/rescript.json +4 -1
- package/src/Batch.res.mjs +1 -1
- package/src/Benchmark.res +394 -0
- package/src/Benchmark.res.mjs +398 -0
- package/src/ChainFetcher.res +526 -0
- package/src/ChainFetcher.res.mjs +343 -0
- package/src/ChainManager.res +182 -0
- package/src/ChainManager.res.mjs +150 -0
- package/src/Config.res +367 -27
- package/src/Config.res.mjs +338 -28
- package/src/{Indexer.res → Ctx.res} +1 -1
- package/src/Ecosystem.res +25 -0
- package/src/Ecosystem.res.mjs +29 -0
- package/src/Env.res +252 -0
- package/src/Env.res.mjs +271 -0
- package/src/Envio.gen.ts +9 -1
- package/src/Envio.res +12 -9
- package/src/EventProcessing.res +476 -0
- package/src/EventProcessing.res.mjs +341 -0
- package/src/EventRegister.res +4 -15
- package/src/EventRegister.res.mjs +3 -9
- package/src/EventRegister.resi +2 -8
- package/src/FetchState.res +54 -29
- package/src/FetchState.res.mjs +62 -35
- package/src/GlobalState.res +1163 -0
- package/src/GlobalState.res.mjs +1196 -0
- package/src/GlobalStateManager.res +68 -0
- package/src/GlobalStateManager.res.mjs +75 -0
- package/src/GlobalStateManager.resi +7 -0
- package/src/HandlerLoader.res +89 -0
- package/src/HandlerLoader.res.mjs +79 -0
- package/src/Internal.gen.ts +3 -14
- package/src/Internal.res +45 -13
- package/src/LoadLayer.res +444 -0
- package/src/LoadLayer.res.mjs +296 -0
- package/src/LoadLayer.resi +32 -0
- package/src/LogSelection.res +33 -27
- package/src/LogSelection.res.mjs +6 -0
- package/src/Logging.res +11 -4
- package/src/Logging.res.mjs +14 -6
- package/src/Main.res +351 -0
- package/src/Main.res.mjs +312 -0
- package/src/Persistence.res +1 -2
- package/src/PgStorage.gen.ts +10 -0
- package/src/PgStorage.res +28 -34
- package/src/PgStorage.res.d.mts +5 -0
- package/src/PgStorage.res.mjs +27 -27
- package/src/Prometheus.res +8 -8
- package/src/Prometheus.res.mjs +10 -10
- package/src/ReorgDetection.res +6 -10
- package/src/ReorgDetection.res.mjs +6 -6
- package/src/TestIndexer.res +536 -0
- package/src/TestIndexer.res.mjs +412 -0
- package/src/TestIndexerProxyStorage.res +210 -0
- package/src/TestIndexerProxyStorage.res.mjs +157 -0
- package/src/Types.ts +1 -1
- package/src/UserContext.res +355 -0
- package/src/UserContext.res.mjs +236 -0
- package/src/Utils.res +28 -0
- package/src/Utils.res.mjs +18 -0
- package/src/bindings/ClickHouse.res +31 -1
- package/src/bindings/ClickHouse.res.mjs +27 -1
- package/src/bindings/DateFns.res +71 -0
- package/src/bindings/DateFns.res.mjs +22 -0
- package/src/bindings/Ethers.res +27 -67
- package/src/bindings/Ethers.res.mjs +18 -70
- package/src/bindings/EventSource.res +13 -0
- package/src/bindings/EventSource.res.mjs +2 -0
- package/src/bindings/NodeJs.res +44 -3
- package/src/bindings/NodeJs.res.mjs +11 -3
- package/src/bindings/Pino.res +21 -7
- package/src/bindings/Pino.res.mjs +11 -5
- package/src/bindings/Postgres.gen.ts +8 -0
- package/src/bindings/Postgres.res +3 -0
- package/src/bindings/Postgres.res.d.mts +5 -0
- package/src/bindings/RescriptMocha.res +123 -0
- package/src/bindings/RescriptMocha.res.mjs +18 -0
- package/src/bindings/Vitest.res +134 -0
- package/src/bindings/Vitest.res.mjs +9 -0
- package/src/bindings/Yargs.res +8 -0
- package/src/bindings/Yargs.res.mjs +2 -0
- package/src/db/InternalTable.res +2 -0
- package/src/db/InternalTable.res.mjs +1 -1
- package/src/sources/Evm.res +87 -0
- package/src/sources/Evm.res.mjs +105 -0
- package/src/sources/EvmChain.res +90 -0
- package/src/sources/EvmChain.res.mjs +57 -0
- package/src/sources/Fuel.res +19 -34
- package/src/sources/Fuel.res.mjs +34 -16
- package/src/sources/FuelSDK.res +38 -0
- package/src/sources/FuelSDK.res.mjs +29 -0
- package/src/sources/HyperFuel.res +2 -2
- package/src/sources/HyperFuel.resi +1 -1
- package/src/sources/HyperFuelClient.res +2 -2
- package/src/sources/HyperFuelSource.res +8 -8
- package/src/sources/HyperFuelSource.res.mjs +5 -5
- package/src/sources/HyperSyncHeightStream.res +97 -0
- package/src/sources/HyperSyncHeightStream.res.mjs +94 -0
- package/src/sources/HyperSyncSource.res +64 -172
- package/src/sources/HyperSyncSource.res.mjs +73 -155
- package/src/sources/Rpc.res +43 -0
- package/src/sources/Rpc.res.mjs +31 -0
- package/src/sources/RpcSource.res +32 -130
- package/src/sources/RpcSource.res.mjs +47 -121
- package/src/sources/Source.res +3 -2
- package/src/sources/SourceManager.res +183 -108
- package/src/sources/SourceManager.res.mjs +162 -99
- package/src/sources/SourceManager.resi +4 -5
- package/src/sources/Svm.res +59 -0
- package/src/sources/Svm.res.mjs +79 -0
- package/src/tui/Tui.res +266 -0
- package/src/tui/Tui.res.mjs +342 -0
- package/src/tui/bindings/Ink.res +376 -0
- package/src/tui/bindings/Ink.res.mjs +75 -0
- package/src/tui/bindings/Style.res +123 -0
- package/src/tui/bindings/Style.res.mjs +2 -0
- package/src/tui/components/BufferedProgressBar.res +40 -0
- package/src/tui/components/BufferedProgressBar.res.mjs +57 -0
- package/src/tui/components/CustomHooks.res +122 -0
- package/src/tui/components/CustomHooks.res.mjs +179 -0
- package/src/tui/components/Messages.res +41 -0
- package/src/tui/components/Messages.res.mjs +75 -0
- package/src/tui/components/SyncETA.res +193 -0
- package/src/tui/components/SyncETA.res.mjs +269 -0
- package/src/tui/components/TuiData.res +46 -0
- package/src/tui/components/TuiData.res.mjs +29 -0
- package/src/Platform.res +0 -140
- package/src/Platform.res.mjs +0 -170
- package/src/bindings/Ethers.gen.ts +0 -14
- /package/src/{Indexer.res.mjs → Ctx.res.mjs} +0 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as $$Ink from "ink";
|
|
4
|
+
import * as Caml from "rescript/lib/es6/caml.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import * as DateFns from "date-fns";
|
|
7
|
+
import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
|
|
8
|
+
import InkSpinner from "ink-spinner";
|
|
9
|
+
import * as JsxRuntime from "react/jsx-runtime";
|
|
10
|
+
|
|
11
|
+
function isIndexerFullySynced(chains) {
|
|
12
|
+
return Belt_Array.reduce(chains, true, (function (accum, current) {
|
|
13
|
+
var match = current.progress;
|
|
14
|
+
if (typeof match !== "object" || match.TAG === "Syncing") {
|
|
15
|
+
return false;
|
|
16
|
+
} else {
|
|
17
|
+
return accum;
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getTotalRemainingBlocks(chains) {
|
|
23
|
+
return Belt_Array.reduce(chains, 0, (function (accum, param) {
|
|
24
|
+
var progress = param.progress;
|
|
25
|
+
var endBlock = param.endBlock;
|
|
26
|
+
var finalBlock = endBlock !== undefined ? endBlock : param.knownHeight;
|
|
27
|
+
if (typeof progress !== "object") {
|
|
28
|
+
return (finalBlock - param.latestFetchedBlockNumber | 0) + accum | 0;
|
|
29
|
+
}
|
|
30
|
+
progress.TAG === "Syncing";
|
|
31
|
+
return (finalBlock - progress._0.latestProcessedBlock | 0) + accum | 0;
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getLatestTimeCaughtUpToHead(chains, indexerStartTime) {
|
|
36
|
+
var latesttimestampCaughtUpToHeadOrEndblockFloat = Belt_Array.reduce(chains, 0.0, (function (accum, current) {
|
|
37
|
+
var match = current.progress;
|
|
38
|
+
if (typeof match !== "object") {
|
|
39
|
+
return accum;
|
|
40
|
+
}
|
|
41
|
+
if (match.TAG === "Syncing") {
|
|
42
|
+
return accum;
|
|
43
|
+
}
|
|
44
|
+
var timestampCaughtUpToHeadOrEndblock = match._0.timestampCaughtUpToHeadOrEndblock;
|
|
45
|
+
if (timestampCaughtUpToHeadOrEndblock.valueOf() > accum) {
|
|
46
|
+
return timestampCaughtUpToHeadOrEndblock.valueOf();
|
|
47
|
+
} else {
|
|
48
|
+
return accum;
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
return DateFns.formatDistance(indexerStartTime, new Date(latesttimestampCaughtUpToHeadOrEndblockFloat), {
|
|
52
|
+
includeSeconds: true
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getTotalBlocksProcessed(chains) {
|
|
57
|
+
return Belt_Array.reduce(chains, 0, (function (accum, param) {
|
|
58
|
+
var progress = param.progress;
|
|
59
|
+
if (typeof progress !== "object") {
|
|
60
|
+
return param.latestFetchedBlockNumber + accum | 0;
|
|
61
|
+
}
|
|
62
|
+
progress.TAG === "Syncing";
|
|
63
|
+
var match = progress._0;
|
|
64
|
+
return (match.latestProcessedBlock - match.firstEventBlockNumber | 0) + accum | 0;
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function useShouldDisplayEta(chains) {
|
|
69
|
+
var match = React.useState(function () {
|
|
70
|
+
return false;
|
|
71
|
+
});
|
|
72
|
+
var setShouldDisplayEta = match[1];
|
|
73
|
+
var shouldDisplayEta = match[0];
|
|
74
|
+
React.useEffect((function () {
|
|
75
|
+
if (!shouldDisplayEta) {
|
|
76
|
+
var match = Belt_Array.reduce(chains, [
|
|
77
|
+
true,
|
|
78
|
+
0
|
|
79
|
+
], (function (param, chain) {
|
|
80
|
+
return [
|
|
81
|
+
param[0] && chain.numBatchesFetched >= 1,
|
|
82
|
+
param[1] + chain.numBatchesFetched | 0
|
|
83
|
+
];
|
|
84
|
+
}));
|
|
85
|
+
var numChains = chains.length;
|
|
86
|
+
var minTotalBatches = numChains + 2 | 0;
|
|
87
|
+
var hasMinNumBatches = match[1] >= minTotalBatches;
|
|
88
|
+
var shouldDisplayEta$1 = match[0] && hasMinNumBatches;
|
|
89
|
+
if (shouldDisplayEta$1) {
|
|
90
|
+
setShouldDisplayEta(function (param) {
|
|
91
|
+
return true;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}), [chains]);
|
|
98
|
+
return shouldDisplayEta;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function useEta(chains, indexerStartTime) {
|
|
102
|
+
var shouldDisplayEta = useShouldDisplayEta(chains);
|
|
103
|
+
var match = React.useState(function () {
|
|
104
|
+
return 0;
|
|
105
|
+
});
|
|
106
|
+
var setSecondsToSub = match[1];
|
|
107
|
+
var match$1 = React.useState(function () {
|
|
108
|
+
return 0;
|
|
109
|
+
});
|
|
110
|
+
var setTimeSinceStart = match$1[1];
|
|
111
|
+
React.useEffect((function () {
|
|
112
|
+
setTimeSinceStart(function (param) {
|
|
113
|
+
return Date.now() - indexerStartTime.valueOf();
|
|
114
|
+
});
|
|
115
|
+
setSecondsToSub(function (param) {
|
|
116
|
+
return 0;
|
|
117
|
+
});
|
|
118
|
+
var intervalId = setInterval((function () {
|
|
119
|
+
setSecondsToSub(function (prev) {
|
|
120
|
+
return prev + 1;
|
|
121
|
+
});
|
|
122
|
+
}), 1000);
|
|
123
|
+
return (function () {
|
|
124
|
+
clearInterval(intervalId);
|
|
125
|
+
});
|
|
126
|
+
}), [
|
|
127
|
+
chains,
|
|
128
|
+
indexerStartTime
|
|
129
|
+
]);
|
|
130
|
+
var blocksProcessed = getTotalBlocksProcessed(chains);
|
|
131
|
+
if (!(shouldDisplayEta && blocksProcessed > 0)) {
|
|
132
|
+
return ;
|
|
133
|
+
}
|
|
134
|
+
var nowDate = Date.now();
|
|
135
|
+
var remainingBlocks = getTotalRemainingBlocks(chains);
|
|
136
|
+
var etaFloat = match$1[0] / blocksProcessed * remainingBlocks;
|
|
137
|
+
var millisToSub = match[0] * 1000;
|
|
138
|
+
var etaFloat$1 = Caml.float_max(etaFloat - millisToSub, 0.0);
|
|
139
|
+
var eta = new Date(etaFloat$1 + nowDate);
|
|
140
|
+
var interval_start = new Date(nowDate);
|
|
141
|
+
var interval = {
|
|
142
|
+
start: interval_start,
|
|
143
|
+
end: eta
|
|
144
|
+
};
|
|
145
|
+
var duration = DateFns.intervalToDuration(interval);
|
|
146
|
+
var formattedDuration = DateFns.formatDuration(duration, {
|
|
147
|
+
format: [
|
|
148
|
+
"hours",
|
|
149
|
+
"minutes",
|
|
150
|
+
"seconds"
|
|
151
|
+
]
|
|
152
|
+
});
|
|
153
|
+
var tmp = formattedDuration === "" ? "less than 1 second" : formattedDuration;
|
|
154
|
+
return tmp;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function SyncETA$Syncing(props) {
|
|
158
|
+
return JsxRuntime.jsxs($$Ink.Text, {
|
|
159
|
+
children: [
|
|
160
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
161
|
+
children: "Sync Time ETA: "
|
|
162
|
+
}),
|
|
163
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
164
|
+
children: props.etaStr
|
|
165
|
+
}),
|
|
166
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
167
|
+
children: " ("
|
|
168
|
+
}),
|
|
169
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
170
|
+
children: JsxRuntime.jsx(InkSpinner, {}),
|
|
171
|
+
color: "#9860E5"
|
|
172
|
+
}),
|
|
173
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
174
|
+
children: " in progress",
|
|
175
|
+
color: "#FFBB2F"
|
|
176
|
+
}),
|
|
177
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
178
|
+
children: ")"
|
|
179
|
+
})
|
|
180
|
+
],
|
|
181
|
+
bold: true
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
var Syncing = {
|
|
186
|
+
make: SyncETA$Syncing
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
function SyncETA$Synced(props) {
|
|
190
|
+
return JsxRuntime.jsxs($$Ink.Text, {
|
|
191
|
+
children: [
|
|
192
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
193
|
+
children: "Time Synced: "
|
|
194
|
+
}),
|
|
195
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
196
|
+
children: props.latestTimeCaughtUpToHeadStr
|
|
197
|
+
}),
|
|
198
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
199
|
+
children: " ("
|
|
200
|
+
}),
|
|
201
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
202
|
+
children: "synced",
|
|
203
|
+
color: "#3B8C3D"
|
|
204
|
+
}),
|
|
205
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
206
|
+
children: ")"
|
|
207
|
+
})
|
|
208
|
+
],
|
|
209
|
+
bold: true
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
var Synced = {
|
|
214
|
+
make: SyncETA$Synced
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
function SyncETA$Calculating(props) {
|
|
218
|
+
return JsxRuntime.jsxs($$Ink.Text, {
|
|
219
|
+
children: [
|
|
220
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
221
|
+
children: JsxRuntime.jsx(InkSpinner, {}),
|
|
222
|
+
color: "#9860E5"
|
|
223
|
+
}),
|
|
224
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
225
|
+
children: " Calculating ETA...",
|
|
226
|
+
bold: true
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
var Calculating = {
|
|
233
|
+
make: SyncETA$Calculating
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
function SyncETA(props) {
|
|
237
|
+
var indexerStartTime = props.indexerStartTime;
|
|
238
|
+
var chains = props.chains;
|
|
239
|
+
var optEta = useEta(chains, indexerStartTime);
|
|
240
|
+
if (!isIndexerFullySynced(chains)) {
|
|
241
|
+
if (optEta !== undefined) {
|
|
242
|
+
return JsxRuntime.jsx(SyncETA$Syncing, {
|
|
243
|
+
etaStr: optEta
|
|
244
|
+
});
|
|
245
|
+
} else {
|
|
246
|
+
return JsxRuntime.jsx(SyncETA$Calculating, {});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
var latestTimeCaughtUpToHeadStr = getLatestTimeCaughtUpToHead(chains, indexerStartTime);
|
|
250
|
+
return JsxRuntime.jsx(SyncETA$Synced, {
|
|
251
|
+
latestTimeCaughtUpToHeadStr: latestTimeCaughtUpToHeadStr
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
var make = SyncETA;
|
|
256
|
+
|
|
257
|
+
export {
|
|
258
|
+
isIndexerFullySynced ,
|
|
259
|
+
getTotalRemainingBlocks ,
|
|
260
|
+
getLatestTimeCaughtUpToHead ,
|
|
261
|
+
getTotalBlocksProcessed ,
|
|
262
|
+
useShouldDisplayEta ,
|
|
263
|
+
useEta ,
|
|
264
|
+
Syncing ,
|
|
265
|
+
Synced ,
|
|
266
|
+
Calculating ,
|
|
267
|
+
make ,
|
|
268
|
+
}
|
|
269
|
+
/* ink Not a pure module */
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type syncing = {
|
|
2
|
+
firstEventBlockNumber: int,
|
|
3
|
+
latestProcessedBlock: int,
|
|
4
|
+
numEventsProcessed: int,
|
|
5
|
+
}
|
|
6
|
+
type synced = {
|
|
7
|
+
...syncing,
|
|
8
|
+
timestampCaughtUpToHeadOrEndblock: Js.Date.t,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type progress = SearchingForEvents | Syncing(syncing) | Synced(synced)
|
|
12
|
+
|
|
13
|
+
let getNumberOfEventsProccessed = (progress: progress) => {
|
|
14
|
+
switch progress {
|
|
15
|
+
| SearchingForEvents => 0
|
|
16
|
+
| Syncing(syncing) => syncing.numEventsProcessed
|
|
17
|
+
| Synced(synced) => synced.numEventsProcessed
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
type chain = {
|
|
21
|
+
chainId: string,
|
|
22
|
+
eventsProcessed: int,
|
|
23
|
+
progressBlock: option<int>,
|
|
24
|
+
bufferBlock: option<int>,
|
|
25
|
+
sourceBlock: option<int>,
|
|
26
|
+
startBlock: int,
|
|
27
|
+
endBlock: option<int>,
|
|
28
|
+
firstEventBlockNumber: option<int>,
|
|
29
|
+
poweredByHyperSync: bool,
|
|
30
|
+
progress: progress,
|
|
31
|
+
latestFetchedBlockNumber: int,
|
|
32
|
+
knownHeight: int,
|
|
33
|
+
numBatchesFetched: int,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let minOfOption: (int, option<int>) => int = (a: int, b: option<int>) => {
|
|
37
|
+
switch (a, b) {
|
|
38
|
+
| (a, Some(b)) => min(a, b)
|
|
39
|
+
| (a, None) => a
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type number
|
|
44
|
+
@val external number: int => number = "Number"
|
|
45
|
+
@send external toLocaleString: number => string = "toLocaleString"
|
|
46
|
+
let formatLocaleString = n => n->number->toLocaleString
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function getNumberOfEventsProccessed(progress) {
|
|
5
|
+
if (typeof progress !== "object") {
|
|
6
|
+
return 0;
|
|
7
|
+
} else {
|
|
8
|
+
return progress._0.numEventsProcessed;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function minOfOption(a, b) {
|
|
13
|
+
if (b !== undefined && a >= b) {
|
|
14
|
+
return b;
|
|
15
|
+
} else {
|
|
16
|
+
return a;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function formatLocaleString(n) {
|
|
21
|
+
return Number(n).toLocaleString();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
getNumberOfEventsProccessed ,
|
|
26
|
+
minOfOption ,
|
|
27
|
+
formatLocaleString ,
|
|
28
|
+
}
|
|
29
|
+
/* No side effect */
|
package/src/Platform.res
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
type name = | @as("evm") Evm | @as("fuel") Fuel
|
|
2
|
-
|
|
3
|
-
type t = {
|
|
4
|
-
name: name,
|
|
5
|
-
blockFields: array<string>,
|
|
6
|
-
transactionFields: array<string>,
|
|
7
|
-
blockNumberName: string,
|
|
8
|
-
blockTimestampName: string,
|
|
9
|
-
blockHashName: string,
|
|
10
|
-
getNumber: Internal.eventBlock => int,
|
|
11
|
-
getTimestamp: Internal.eventBlock => int,
|
|
12
|
-
getId: Internal.eventBlock => string,
|
|
13
|
-
cleanUpRawEventFieldsInPlace: Js.Json.t => unit,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module Evm = {
|
|
17
|
-
@get external getNumber: Internal.eventBlock => int = "number"
|
|
18
|
-
@get external getTimestamp: Internal.eventBlock => int = "timestamp"
|
|
19
|
-
@get external getId: Internal.eventBlock => string = "hash"
|
|
20
|
-
|
|
21
|
-
let cleanUpRawEventFieldsInPlace: Js.Json.t => unit = %raw(`fields => {
|
|
22
|
-
delete fields.hash
|
|
23
|
-
delete fields.number
|
|
24
|
-
delete fields.timestamp
|
|
25
|
-
}`)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
let evm: t = {
|
|
29
|
-
name: Evm,
|
|
30
|
-
blockFields: [
|
|
31
|
-
"number",
|
|
32
|
-
"timestamp",
|
|
33
|
-
"hash",
|
|
34
|
-
"parentHash",
|
|
35
|
-
"nonce",
|
|
36
|
-
"sha3Uncles",
|
|
37
|
-
"logsBloom",
|
|
38
|
-
"transactionsRoot",
|
|
39
|
-
"stateRoot",
|
|
40
|
-
"receiptsRoot",
|
|
41
|
-
"miner",
|
|
42
|
-
"difficulty",
|
|
43
|
-
"totalDifficulty",
|
|
44
|
-
"extraData",
|
|
45
|
-
"size",
|
|
46
|
-
"gasLimit",
|
|
47
|
-
"gasUsed",
|
|
48
|
-
"uncles",
|
|
49
|
-
"baseFeePerGas",
|
|
50
|
-
"blobGasUsed",
|
|
51
|
-
"excessBlobGas",
|
|
52
|
-
"parentBeaconBlockRoot",
|
|
53
|
-
"withdrawalsRoot",
|
|
54
|
-
"l1BlockNumber",
|
|
55
|
-
"sendCount",
|
|
56
|
-
"sendRoot",
|
|
57
|
-
"mixHash",
|
|
58
|
-
],
|
|
59
|
-
transactionFields: [
|
|
60
|
-
"transactionIndex",
|
|
61
|
-
"hash",
|
|
62
|
-
"from",
|
|
63
|
-
"to",
|
|
64
|
-
"gas",
|
|
65
|
-
"gasPrice",
|
|
66
|
-
"maxPriorityFeePerGas",
|
|
67
|
-
"maxFeePerGas",
|
|
68
|
-
"cumulativeGasUsed",
|
|
69
|
-
"effectiveGasPrice",
|
|
70
|
-
"gasUsed",
|
|
71
|
-
"input",
|
|
72
|
-
"nonce",
|
|
73
|
-
"value",
|
|
74
|
-
"v",
|
|
75
|
-
"r",
|
|
76
|
-
"s",
|
|
77
|
-
"contractAddress",
|
|
78
|
-
"logsBloom",
|
|
79
|
-
"root",
|
|
80
|
-
"status",
|
|
81
|
-
"yParity",
|
|
82
|
-
"chainId",
|
|
83
|
-
"maxFeePerBlobGas",
|
|
84
|
-
"blobVersionedHashes",
|
|
85
|
-
"type",
|
|
86
|
-
"l1Fee",
|
|
87
|
-
"l1GasPrice",
|
|
88
|
-
"l1GasUsed",
|
|
89
|
-
"l1FeeScalar",
|
|
90
|
-
"gasUsedForL1",
|
|
91
|
-
"accessList",
|
|
92
|
-
"authorizationList",
|
|
93
|
-
],
|
|
94
|
-
blockNumberName: "number",
|
|
95
|
-
blockTimestampName: "timestamp",
|
|
96
|
-
blockHashName: "hash",
|
|
97
|
-
getNumber: Evm.getNumber,
|
|
98
|
-
getTimestamp: Evm.getTimestamp,
|
|
99
|
-
getId: Evm.getId,
|
|
100
|
-
cleanUpRawEventFieldsInPlace: Evm.cleanUpRawEventFieldsInPlace,
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
module Fuel = {
|
|
104
|
-
@get external getNumber: Internal.eventBlock => int = "height"
|
|
105
|
-
@get external getTimestamp: Internal.eventBlock => int = "time"
|
|
106
|
-
@get external getId: Internal.eventBlock => string = "id"
|
|
107
|
-
|
|
108
|
-
let cleanUpRawEventFieldsInPlace: Js.Json.t => unit = %raw(`fields => {
|
|
109
|
-
delete fields.id
|
|
110
|
-
delete fields.height
|
|
111
|
-
delete fields.time
|
|
112
|
-
}`)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
let fuel: t = {
|
|
116
|
-
name: Fuel,
|
|
117
|
-
blockFields: ["id", "height", "time"],
|
|
118
|
-
transactionFields: ["id"],
|
|
119
|
-
blockNumberName: "height",
|
|
120
|
-
blockTimestampName: "time",
|
|
121
|
-
blockHashName: "id",
|
|
122
|
-
getNumber: Fuel.getNumber,
|
|
123
|
-
getTimestamp: Fuel.getTimestamp,
|
|
124
|
-
getId: Fuel.getId,
|
|
125
|
-
cleanUpRawEventFieldsInPlace: Fuel.cleanUpRawEventFieldsInPlace,
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
let fromName = (name: name): t => {
|
|
129
|
-
switch name {
|
|
130
|
-
| Evm => evm
|
|
131
|
-
| Fuel => fuel
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Create a block event object for block handlers based on platform
|
|
136
|
-
let makeBlockEvent = (~blockNumber: int, platform: t): Internal.blockEvent => {
|
|
137
|
-
let blockEvent = Js.Dict.empty()
|
|
138
|
-
blockEvent->Js.Dict.set(platform.blockNumberName, blockNumber->Utils.magic)
|
|
139
|
-
blockEvent->Utils.magic
|
|
140
|
-
}
|
package/src/Platform.res.mjs
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var cleanUpRawEventFieldsInPlace = (fields => {
|
|
5
|
-
delete fields.hash
|
|
6
|
-
delete fields.number
|
|
7
|
-
delete fields.timestamp
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
var Evm = {
|
|
11
|
-
cleanUpRawEventFieldsInPlace: cleanUpRawEventFieldsInPlace
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
var evm_blockFields = [
|
|
15
|
-
"number",
|
|
16
|
-
"timestamp",
|
|
17
|
-
"hash",
|
|
18
|
-
"parentHash",
|
|
19
|
-
"nonce",
|
|
20
|
-
"sha3Uncles",
|
|
21
|
-
"logsBloom",
|
|
22
|
-
"transactionsRoot",
|
|
23
|
-
"stateRoot",
|
|
24
|
-
"receiptsRoot",
|
|
25
|
-
"miner",
|
|
26
|
-
"difficulty",
|
|
27
|
-
"totalDifficulty",
|
|
28
|
-
"extraData",
|
|
29
|
-
"size",
|
|
30
|
-
"gasLimit",
|
|
31
|
-
"gasUsed",
|
|
32
|
-
"uncles",
|
|
33
|
-
"baseFeePerGas",
|
|
34
|
-
"blobGasUsed",
|
|
35
|
-
"excessBlobGas",
|
|
36
|
-
"parentBeaconBlockRoot",
|
|
37
|
-
"withdrawalsRoot",
|
|
38
|
-
"l1BlockNumber",
|
|
39
|
-
"sendCount",
|
|
40
|
-
"sendRoot",
|
|
41
|
-
"mixHash"
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
var evm_transactionFields = [
|
|
45
|
-
"transactionIndex",
|
|
46
|
-
"hash",
|
|
47
|
-
"from",
|
|
48
|
-
"to",
|
|
49
|
-
"gas",
|
|
50
|
-
"gasPrice",
|
|
51
|
-
"maxPriorityFeePerGas",
|
|
52
|
-
"maxFeePerGas",
|
|
53
|
-
"cumulativeGasUsed",
|
|
54
|
-
"effectiveGasPrice",
|
|
55
|
-
"gasUsed",
|
|
56
|
-
"input",
|
|
57
|
-
"nonce",
|
|
58
|
-
"value",
|
|
59
|
-
"v",
|
|
60
|
-
"r",
|
|
61
|
-
"s",
|
|
62
|
-
"contractAddress",
|
|
63
|
-
"logsBloom",
|
|
64
|
-
"root",
|
|
65
|
-
"status",
|
|
66
|
-
"yParity",
|
|
67
|
-
"chainId",
|
|
68
|
-
"maxFeePerBlobGas",
|
|
69
|
-
"blobVersionedHashes",
|
|
70
|
-
"type",
|
|
71
|
-
"l1Fee",
|
|
72
|
-
"l1GasPrice",
|
|
73
|
-
"l1GasUsed",
|
|
74
|
-
"l1FeeScalar",
|
|
75
|
-
"gasUsedForL1",
|
|
76
|
-
"accessList",
|
|
77
|
-
"authorizationList"
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
function evm_getNumber(prim) {
|
|
81
|
-
return prim.number;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function evm_getTimestamp(prim) {
|
|
85
|
-
return prim.timestamp;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function evm_getId(prim) {
|
|
89
|
-
return prim.hash;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var evm = {
|
|
93
|
-
name: "evm",
|
|
94
|
-
blockFields: evm_blockFields,
|
|
95
|
-
transactionFields: evm_transactionFields,
|
|
96
|
-
blockNumberName: "number",
|
|
97
|
-
blockTimestampName: "timestamp",
|
|
98
|
-
blockHashName: "hash",
|
|
99
|
-
getNumber: evm_getNumber,
|
|
100
|
-
getTimestamp: evm_getTimestamp,
|
|
101
|
-
getId: evm_getId,
|
|
102
|
-
cleanUpRawEventFieldsInPlace: cleanUpRawEventFieldsInPlace
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
var cleanUpRawEventFieldsInPlace$1 = (fields => {
|
|
106
|
-
delete fields.id
|
|
107
|
-
delete fields.height
|
|
108
|
-
delete fields.time
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
var Fuel = {
|
|
112
|
-
cleanUpRawEventFieldsInPlace: cleanUpRawEventFieldsInPlace$1
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
var fuel_blockFields = [
|
|
116
|
-
"id",
|
|
117
|
-
"height",
|
|
118
|
-
"time"
|
|
119
|
-
];
|
|
120
|
-
|
|
121
|
-
var fuel_transactionFields = ["id"];
|
|
122
|
-
|
|
123
|
-
function fuel_getNumber(prim) {
|
|
124
|
-
return prim.height;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function fuel_getTimestamp(prim) {
|
|
128
|
-
return prim.time;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function fuel_getId(prim) {
|
|
132
|
-
return prim.id;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
var fuel = {
|
|
136
|
-
name: "fuel",
|
|
137
|
-
blockFields: fuel_blockFields,
|
|
138
|
-
transactionFields: fuel_transactionFields,
|
|
139
|
-
blockNumberName: "height",
|
|
140
|
-
blockTimestampName: "time",
|
|
141
|
-
blockHashName: "id",
|
|
142
|
-
getNumber: fuel_getNumber,
|
|
143
|
-
getTimestamp: fuel_getTimestamp,
|
|
144
|
-
getId: fuel_getId,
|
|
145
|
-
cleanUpRawEventFieldsInPlace: cleanUpRawEventFieldsInPlace$1
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
function fromName(name) {
|
|
149
|
-
if (name === "evm") {
|
|
150
|
-
return evm;
|
|
151
|
-
} else {
|
|
152
|
-
return fuel;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function makeBlockEvent(blockNumber, platform) {
|
|
157
|
-
var blockEvent = {};
|
|
158
|
-
blockEvent[platform.blockNumberName] = blockNumber;
|
|
159
|
-
return blockEvent;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export {
|
|
163
|
-
Evm ,
|
|
164
|
-
evm ,
|
|
165
|
-
Fuel ,
|
|
166
|
-
fuel ,
|
|
167
|
-
fromName ,
|
|
168
|
-
makeBlockEvent ,
|
|
169
|
-
}
|
|
170
|
-
/* No side effect */
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* TypeScript file generated from Ethers.res by genType. */
|
|
2
|
-
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
/* tslint:disable */
|
|
5
|
-
|
|
6
|
-
import * as EthersJS from './Ethers.res.mjs';
|
|
7
|
-
|
|
8
|
-
import type {t as Address_t} from '../../src/Address.gen.js';
|
|
9
|
-
|
|
10
|
-
export const Addresses_mockAddresses: Address_t[] = EthersJS.Addresses.mockAddresses as any;
|
|
11
|
-
|
|
12
|
-
export const Addresses_defaultAddress: Address_t = EthersJS.Addresses.defaultAddress as any;
|
|
13
|
-
|
|
14
|
-
export const Addresses: { mockAddresses: Address_t[]; defaultAddress: Address_t } = EthersJS.Addresses as any;
|
|
File without changes
|