envio 3.0.0-alpha.2 → 3.0.0-alpha.21

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.
Files changed (184) hide show
  1. package/README.md +164 -30
  2. package/bin.mjs +49 -0
  3. package/evm.schema.json +79 -169
  4. package/fuel.schema.json +50 -21
  5. package/index.d.ts +578 -1
  6. package/index.js +4 -0
  7. package/package.json +47 -31
  8. package/rescript.json +4 -1
  9. package/src/Batch.res +11 -8
  10. package/src/Batch.res.mjs +11 -9
  11. package/src/ChainFetcher.res +531 -0
  12. package/src/ChainFetcher.res.mjs +339 -0
  13. package/src/ChainManager.res +190 -0
  14. package/src/ChainManager.res.mjs +166 -0
  15. package/src/Change.res +3 -3
  16. package/src/Config.gen.ts +19 -0
  17. package/src/Config.res +725 -25
  18. package/src/Config.res.mjs +692 -26
  19. package/src/{Indexer.res → Ctx.res} +1 -1
  20. package/src/Ecosystem.res +9 -124
  21. package/src/Ecosystem.res.mjs +19 -160
  22. package/src/Env.res +33 -73
  23. package/src/Env.res.mjs +29 -85
  24. package/src/Envio.gen.ts +3 -1
  25. package/src/Envio.res +77 -9
  26. package/src/Envio.res.mjs +39 -1
  27. package/src/EventConfigBuilder.res +408 -0
  28. package/src/EventConfigBuilder.res.mjs +376 -0
  29. package/src/EventProcessing.res +469 -0
  30. package/src/EventProcessing.res.mjs +337 -0
  31. package/src/EvmTypes.gen.ts +6 -0
  32. package/src/EvmTypes.res +1 -0
  33. package/src/FetchState.res +1256 -639
  34. package/src/FetchState.res.mjs +1135 -612
  35. package/src/GlobalState.res +1224 -0
  36. package/src/GlobalState.res.mjs +1291 -0
  37. package/src/GlobalStateManager.res +68 -0
  38. package/src/GlobalStateManager.res.mjs +75 -0
  39. package/src/GlobalStateManager.resi +7 -0
  40. package/src/HandlerLoader.res +89 -0
  41. package/src/HandlerLoader.res.mjs +79 -0
  42. package/src/HandlerRegister.res +357 -0
  43. package/src/HandlerRegister.res.mjs +299 -0
  44. package/src/HandlerRegister.resi +30 -0
  45. package/src/Hasura.res +111 -175
  46. package/src/Hasura.res.mjs +88 -150
  47. package/src/InMemoryStore.res +1 -1
  48. package/src/InMemoryStore.res.mjs +3 -3
  49. package/src/InMemoryTable.res +1 -1
  50. package/src/InMemoryTable.res.mjs +1 -1
  51. package/src/Internal.gen.ts +6 -0
  52. package/src/Internal.res +265 -12
  53. package/src/Internal.res.mjs +115 -1
  54. package/src/LoadLayer.res +444 -0
  55. package/src/LoadLayer.res.mjs +296 -0
  56. package/src/LoadLayer.resi +32 -0
  57. package/src/LogSelection.res +33 -27
  58. package/src/LogSelection.res.mjs +6 -0
  59. package/src/Logging.res +21 -7
  60. package/src/Logging.res.mjs +16 -8
  61. package/src/Main.res +390 -0
  62. package/src/Main.res.mjs +341 -0
  63. package/src/Persistence.res +7 -21
  64. package/src/Persistence.res.mjs +3 -3
  65. package/src/PgStorage.gen.ts +10 -0
  66. package/src/PgStorage.res +116 -69
  67. package/src/PgStorage.res.d.mts +5 -0
  68. package/src/PgStorage.res.mjs +93 -50
  69. package/src/Prometheus.res +294 -224
  70. package/src/Prometheus.res.mjs +353 -340
  71. package/src/ReorgDetection.res +6 -10
  72. package/src/ReorgDetection.res.mjs +6 -6
  73. package/src/SafeCheckpointTracking.res +4 -4
  74. package/src/SafeCheckpointTracking.res.mjs +2 -2
  75. package/src/SimulateItems.res +353 -0
  76. package/src/SimulateItems.res.mjs +335 -0
  77. package/src/Sink.res +4 -2
  78. package/src/Sink.res.mjs +2 -1
  79. package/src/TableIndices.res +0 -1
  80. package/src/TestIndexer.res +913 -0
  81. package/src/TestIndexer.res.mjs +698 -0
  82. package/src/TestIndexerProxyStorage.res +205 -0
  83. package/src/TestIndexerProxyStorage.res.mjs +151 -0
  84. package/src/TopicFilter.res +1 -1
  85. package/src/Types.ts +1 -1
  86. package/src/UserContext.res +424 -0
  87. package/src/UserContext.res.mjs +279 -0
  88. package/src/Utils.res +97 -26
  89. package/src/Utils.res.mjs +91 -44
  90. package/src/bindings/BigInt.res +10 -0
  91. package/src/bindings/BigInt.res.mjs +15 -0
  92. package/src/bindings/ClickHouse.res +120 -23
  93. package/src/bindings/ClickHouse.res.mjs +118 -28
  94. package/src/bindings/DateFns.res +74 -0
  95. package/src/bindings/DateFns.res.mjs +22 -0
  96. package/src/bindings/EventSource.res +11 -2
  97. package/src/bindings/EventSource.res.mjs +8 -1
  98. package/src/bindings/Express.res +1 -0
  99. package/src/bindings/Hrtime.res +14 -1
  100. package/src/bindings/Hrtime.res.mjs +22 -2
  101. package/src/bindings/Hrtime.resi +4 -0
  102. package/src/bindings/Lodash.res +0 -1
  103. package/src/bindings/NodeJs.res +49 -3
  104. package/src/bindings/NodeJs.res.mjs +11 -3
  105. package/src/bindings/Pino.res +24 -10
  106. package/src/bindings/Pino.res.mjs +14 -8
  107. package/src/bindings/Postgres.gen.ts +8 -0
  108. package/src/bindings/Postgres.res +5 -1
  109. package/src/bindings/Postgres.res.d.mts +5 -0
  110. package/src/bindings/PromClient.res +0 -10
  111. package/src/bindings/PromClient.res.mjs +0 -3
  112. package/src/bindings/Vitest.res +144 -0
  113. package/src/bindings/Vitest.res.mjs +9 -0
  114. package/src/bindings/WebSocket.res +27 -0
  115. package/src/bindings/WebSocket.res.mjs +2 -0
  116. package/src/bindings/Yargs.res +8 -0
  117. package/src/bindings/Yargs.res.mjs +2 -0
  118. package/src/db/EntityHistory.res +7 -7
  119. package/src/db/EntityHistory.res.mjs +9 -9
  120. package/src/db/InternalTable.res +59 -111
  121. package/src/db/InternalTable.res.mjs +73 -104
  122. package/src/db/Table.res +27 -8
  123. package/src/db/Table.res.mjs +25 -14
  124. package/src/sources/Evm.res +84 -0
  125. package/src/sources/Evm.res.mjs +105 -0
  126. package/src/sources/EvmChain.res +94 -0
  127. package/src/sources/EvmChain.res.mjs +60 -0
  128. package/src/sources/Fuel.res +19 -34
  129. package/src/sources/Fuel.res.mjs +34 -16
  130. package/src/sources/FuelSDK.res +38 -0
  131. package/src/sources/FuelSDK.res.mjs +29 -0
  132. package/src/sources/HyperFuel.res +2 -2
  133. package/src/sources/HyperFuel.resi +1 -1
  134. package/src/sources/HyperFuelClient.res +2 -2
  135. package/src/sources/HyperFuelSource.res +35 -13
  136. package/src/sources/HyperFuelSource.res.mjs +26 -16
  137. package/src/sources/HyperSync.res +61 -60
  138. package/src/sources/HyperSync.res.mjs +53 -67
  139. package/src/sources/HyperSync.resi +6 -4
  140. package/src/sources/HyperSyncClient.res +29 -2
  141. package/src/sources/HyperSyncClient.res.mjs +9 -0
  142. package/src/sources/HyperSyncHeightStream.res +76 -118
  143. package/src/sources/HyperSyncHeightStream.res.mjs +68 -75
  144. package/src/sources/HyperSyncSource.res +122 -143
  145. package/src/sources/HyperSyncSource.res.mjs +106 -121
  146. package/src/sources/Rpc.res +86 -14
  147. package/src/sources/Rpc.res.mjs +101 -9
  148. package/src/sources/RpcSource.res +731 -364
  149. package/src/sources/RpcSource.res.mjs +845 -410
  150. package/src/sources/RpcWebSocketHeightStream.res +181 -0
  151. package/src/sources/RpcWebSocketHeightStream.res.mjs +196 -0
  152. package/src/sources/SimulateSource.res +59 -0
  153. package/src/sources/SimulateSource.res.mjs +50 -0
  154. package/src/sources/Source.res +7 -5
  155. package/src/sources/SourceManager.res +358 -221
  156. package/src/sources/SourceManager.res.mjs +346 -171
  157. package/src/sources/SourceManager.resi +17 -6
  158. package/src/sources/Svm.res +81 -0
  159. package/src/sources/Svm.res.mjs +90 -0
  160. package/src/tui/Tui.res +247 -0
  161. package/src/tui/Tui.res.mjs +337 -0
  162. package/src/tui/bindings/Ink.res +371 -0
  163. package/src/tui/bindings/Ink.res.mjs +72 -0
  164. package/src/tui/bindings/Style.res +123 -0
  165. package/src/tui/bindings/Style.res.mjs +2 -0
  166. package/src/tui/components/BufferedProgressBar.res +40 -0
  167. package/src/tui/components/BufferedProgressBar.res.mjs +57 -0
  168. package/src/tui/components/CustomHooks.res +122 -0
  169. package/src/tui/components/CustomHooks.res.mjs +179 -0
  170. package/src/tui/components/Messages.res +41 -0
  171. package/src/tui/components/Messages.res.mjs +75 -0
  172. package/src/tui/components/SyncETA.res +174 -0
  173. package/src/tui/components/SyncETA.res.mjs +263 -0
  174. package/src/tui/components/TuiData.res +47 -0
  175. package/src/tui/components/TuiData.res.mjs +34 -0
  176. package/svm.schema.json +112 -0
  177. package/bin.js +0 -48
  178. package/src/EventRegister.res +0 -241
  179. package/src/EventRegister.res.mjs +0 -240
  180. package/src/EventRegister.resi +0 -30
  181. package/src/bindings/Ethers.gen.ts +0 -14
  182. package/src/bindings/Ethers.res +0 -204
  183. package/src/bindings/Ethers.res.mjs +0 -130
  184. /package/src/{Indexer.res.mjs → Ctx.res.mjs} +0 -0
@@ -0,0 +1,263 @@
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 allChainsStartedFetching = Belt_Array.every(chains, (function (chain) {
77
+ if (chain.knownHeight > 0) {
78
+ return chain.latestFetchedBlockNumber > 0;
79
+ } else {
80
+ return false;
81
+ }
82
+ }));
83
+ if (allChainsStartedFetching) {
84
+ setShouldDisplayEta(function (param) {
85
+ return true;
86
+ });
87
+ }
88
+
89
+ }
90
+
91
+ }), [chains]);
92
+ return shouldDisplayEta;
93
+ }
94
+
95
+ function useEta(chains, indexerStartTime) {
96
+ var shouldDisplayEta = useShouldDisplayEta(chains);
97
+ var match = React.useState(function () {
98
+ return 0;
99
+ });
100
+ var setSecondsToSub = match[1];
101
+ var match$1 = React.useState(function () {
102
+ return 0;
103
+ });
104
+ var setTimeSinceStart = match$1[1];
105
+ React.useEffect((function () {
106
+ setTimeSinceStart(function (param) {
107
+ return Date.now() - indexerStartTime.valueOf();
108
+ });
109
+ setSecondsToSub(function (param) {
110
+ return 0;
111
+ });
112
+ var intervalId = setInterval((function () {
113
+ setSecondsToSub(function (prev) {
114
+ return prev + 1;
115
+ });
116
+ }), 1000);
117
+ return (function () {
118
+ clearInterval(intervalId);
119
+ });
120
+ }), [
121
+ chains,
122
+ indexerStartTime
123
+ ]);
124
+ var blocksProcessed = getTotalBlocksProcessed(chains);
125
+ if (!(shouldDisplayEta && blocksProcessed > 0)) {
126
+ return ;
127
+ }
128
+ var nowDate = Date.now();
129
+ var remainingBlocks = getTotalRemainingBlocks(chains);
130
+ var etaFloat = match$1[0] / blocksProcessed * remainingBlocks;
131
+ var millisToSub = match[0] * 1000;
132
+ var etaFloat$1 = Caml.float_max(etaFloat - millisToSub, 0.0);
133
+ var eta = new Date(etaFloat$1 + nowDate);
134
+ var interval_start = new Date(nowDate);
135
+ var interval = {
136
+ start: interval_start,
137
+ end: eta
138
+ };
139
+ var duration = DateFns.intervalToDuration(interval);
140
+ var formattedDuration = DateFns.formatDuration(duration, {
141
+ format: [
142
+ "hours",
143
+ "minutes",
144
+ "seconds"
145
+ ]
146
+ });
147
+ var tmp = formattedDuration === "" ? "less than 1 second" : formattedDuration;
148
+ return tmp;
149
+ }
150
+
151
+ function SyncETA$Syncing(props) {
152
+ return JsxRuntime.jsxs($$Ink.Text, {
153
+ children: [
154
+ JsxRuntime.jsx($$Ink.Text, {
155
+ children: "Sync Time ETA: "
156
+ }),
157
+ JsxRuntime.jsx($$Ink.Text, {
158
+ children: props.etaStr
159
+ }),
160
+ JsxRuntime.jsx($$Ink.Text, {
161
+ children: " ("
162
+ }),
163
+ JsxRuntime.jsx($$Ink.Text, {
164
+ children: JsxRuntime.jsx(InkSpinner, {}),
165
+ color: "#9860E5"
166
+ }),
167
+ JsxRuntime.jsx($$Ink.Text, {
168
+ children: " in progress",
169
+ color: "#FFBB2F"
170
+ }),
171
+ JsxRuntime.jsx($$Ink.Text, {
172
+ children: ")"
173
+ })
174
+ ],
175
+ bold: true
176
+ });
177
+ }
178
+
179
+ var Syncing = {
180
+ make: SyncETA$Syncing
181
+ };
182
+
183
+ function SyncETA$Synced(props) {
184
+ return JsxRuntime.jsxs($$Ink.Text, {
185
+ children: [
186
+ JsxRuntime.jsx($$Ink.Text, {
187
+ children: "Time Synced: "
188
+ }),
189
+ JsxRuntime.jsx($$Ink.Text, {
190
+ children: props.latestTimeCaughtUpToHeadStr
191
+ }),
192
+ JsxRuntime.jsx($$Ink.Text, {
193
+ children: " ("
194
+ }),
195
+ JsxRuntime.jsx($$Ink.Text, {
196
+ children: "synced",
197
+ color: "#3B8C3D"
198
+ }),
199
+ JsxRuntime.jsx($$Ink.Text, {
200
+ children: ")"
201
+ })
202
+ ],
203
+ bold: true
204
+ });
205
+ }
206
+
207
+ var Synced = {
208
+ make: SyncETA$Synced
209
+ };
210
+
211
+ function SyncETA$Calculating(props) {
212
+ return JsxRuntime.jsxs($$Ink.Text, {
213
+ children: [
214
+ JsxRuntime.jsx($$Ink.Text, {
215
+ children: JsxRuntime.jsx(InkSpinner, {}),
216
+ color: "#9860E5"
217
+ }),
218
+ JsxRuntime.jsx($$Ink.Text, {
219
+ children: " Calculating ETA...",
220
+ bold: true
221
+ })
222
+ ]
223
+ });
224
+ }
225
+
226
+ var Calculating = {
227
+ make: SyncETA$Calculating
228
+ };
229
+
230
+ function SyncETA(props) {
231
+ var indexerStartTime = props.indexerStartTime;
232
+ var chains = props.chains;
233
+ var optEta = useEta(chains, indexerStartTime);
234
+ if (!isIndexerFullySynced(chains)) {
235
+ if (optEta !== undefined) {
236
+ return JsxRuntime.jsx(SyncETA$Syncing, {
237
+ etaStr: optEta
238
+ });
239
+ } else {
240
+ return JsxRuntime.jsx(SyncETA$Calculating, {});
241
+ }
242
+ }
243
+ var latestTimeCaughtUpToHeadStr = getLatestTimeCaughtUpToHead(chains, indexerStartTime);
244
+ return JsxRuntime.jsx(SyncETA$Synced, {
245
+ latestTimeCaughtUpToHeadStr: latestTimeCaughtUpToHeadStr
246
+ });
247
+ }
248
+
249
+ var make = SyncETA;
250
+
251
+ export {
252
+ isIndexerFullySynced ,
253
+ getTotalRemainingBlocks ,
254
+ getLatestTimeCaughtUpToHead ,
255
+ getTotalBlocksProcessed ,
256
+ useShouldDisplayEta ,
257
+ useEta ,
258
+ Syncing ,
259
+ Synced ,
260
+ Calculating ,
261
+ make ,
262
+ }
263
+ /* ink Not a pure module */
@@ -0,0 +1,47 @@
1
+ type syncing = {
2
+ firstEventBlockNumber: int,
3
+ latestProcessedBlock: int,
4
+ numEventsProcessed: float,
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: float,
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
+ }
34
+
35
+ let minOfOption: (int, option<int>) => int = (a: int, b: option<int>) => {
36
+ switch (a, b) {
37
+ | (a, Some(b)) => min(a, b)
38
+ | (a, None) => a
39
+ }
40
+ }
41
+
42
+ type number
43
+ @val external number: int => number = "Number"
44
+ @val external floatNumber: float => number = "Number"
45
+ @send external toLocaleString: number => string = "toLocaleString"
46
+ let formatLocaleString = n => n->number->toLocaleString
47
+ let formatFloatLocaleString = n => n->floatNumber->toLocaleString
@@ -0,0 +1,34 @@
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
+ function formatFloatLocaleString(n) {
25
+ return Number(n).toLocaleString();
26
+ }
27
+
28
+ export {
29
+ getNumberOfEventsProccessed ,
30
+ minOfOption ,
31
+ formatLocaleString ,
32
+ formatFloatLocaleString ,
33
+ }
34
+ /* No side effect */
@@ -0,0 +1,112 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Envio Svm Config Schema",
4
+ "description": "Schema for a YAML config for an envio Svm indexer",
5
+ "type": "object",
6
+ "properties": {
7
+ "description": {
8
+ "description": "Description of the project",
9
+ "type": [
10
+ "string",
11
+ "null"
12
+ ]
13
+ },
14
+ "name": {
15
+ "description": "Name of the project",
16
+ "type": "string"
17
+ },
18
+ "schema": {
19
+ "description": "Custom path to schema.graphql file",
20
+ "type": [
21
+ "string",
22
+ "null"
23
+ ]
24
+ },
25
+ "output": {
26
+ "description": "Path where the generated directory will be placed. By default it's 'generated' relative to the current working directory. If set, it'll be a path relative to the config file location.",
27
+ "type": [
28
+ "string",
29
+ "null"
30
+ ]
31
+ },
32
+ "handlers": {
33
+ "description": "Optional relative path to handlers directory for auto-loading. Defaults to 'src/handlers' if not specified.",
34
+ "type": [
35
+ "string",
36
+ "null"
37
+ ]
38
+ },
39
+ "full_batch_size": {
40
+ "description": "Target number of events to be processed per batch. Set it to smaller number if you have many Effect API calls which are slow to resolve and can't be batched. (Default: 5000)",
41
+ "type": [
42
+ "integer",
43
+ "null"
44
+ ],
45
+ "format": "uint64",
46
+ "minimum": 0
47
+ },
48
+ "ecosystem": {
49
+ "description": "Ecosystem of the project.",
50
+ "$ref": "#/$defs/EcosystemTag"
51
+ },
52
+ "chains": {
53
+ "description": "Configuration of the blockchain chains that the project is deployed on.",
54
+ "type": "array",
55
+ "items": {
56
+ "$ref": "#/$defs/Chain"
57
+ }
58
+ }
59
+ },
60
+ "additionalProperties": false,
61
+ "required": [
62
+ "name",
63
+ "ecosystem",
64
+ "chains"
65
+ ],
66
+ "$defs": {
67
+ "EcosystemTag": {
68
+ "type": "string",
69
+ "enum": [
70
+ "svm"
71
+ ]
72
+ },
73
+ "Chain": {
74
+ "type": "object",
75
+ "properties": {
76
+ "rpc": {
77
+ "description": "RPC endpoint URL for connecting to the Svm cluster to fetch blockchain data.",
78
+ "type": "string"
79
+ },
80
+ "start_block": {
81
+ "description": "The slot number at which the indexer should start ingesting data",
82
+ "type": "integer",
83
+ "format": "uint64",
84
+ "minimum": 0
85
+ },
86
+ "end_block": {
87
+ "description": "The slot number at which the indexer should terminate.",
88
+ "type": [
89
+ "integer",
90
+ "null"
91
+ ],
92
+ "format": "uint64",
93
+ "minimum": 0
94
+ },
95
+ "block_lag": {
96
+ "description": "The number of blocks behind the chain head that the indexer should lag. Useful for avoiding reorg issues by indexing slightly behind the tip.",
97
+ "type": [
98
+ "integer",
99
+ "null"
100
+ ],
101
+ "format": "uint32",
102
+ "minimum": 0
103
+ }
104
+ },
105
+ "additionalProperties": false,
106
+ "required": [
107
+ "rpc",
108
+ "start_block"
109
+ ]
110
+ }
111
+ }
112
+ }
package/bin.js DELETED
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env node
2
- //@ts-check
3
-
4
- import { spawnSync } from "child_process";
5
- import { createRequire } from "module";
6
-
7
- const require = createRequire(import.meta.url);
8
-
9
- /**
10
- * Returns the executable path for envio located inside node_modules
11
- * The naming convention is envio-${os}-${arch}
12
- * If the platform is `win32` or `cygwin`, executable will include a `.exe` extension
13
- * @see https://nodejs.org/api/os.html#osarch
14
- * @see https://nodejs.org/api/os.html#osplatform
15
- * @example "x/xx/node_modules/envio-darwin-arm64"
16
- */
17
- function getExePath() {
18
- const arch = process.arch;
19
- /**
20
- * @type {string}
21
- */
22
- let os = process.platform;
23
- let extension = "";
24
- if (["win32", "cygwin"].includes(process.platform)) {
25
- os = "windows";
26
- extension = ".exe";
27
- }
28
-
29
- try {
30
- // Since the bin will be located inside `node_modules`, we can simply call require.resolve
31
- return require.resolve(`envio-${os}-${arch}/bin/envio${extension}`);
32
- } catch (e) {
33
- throw new Error(
34
- `Couldn't find envio binary inside node_modules for ${os}-${arch}`
35
- );
36
- }
37
- }
38
-
39
- /**
40
- * Runs `envio` with args using nodejs spawn
41
- */
42
- function runEnvio() {
43
- const args = process.argv.slice(2);
44
- const processResult = spawnSync(getExePath(), args, { stdio: "inherit" });
45
- process.exit(processResult.status ?? 0);
46
- }
47
-
48
- runEnvio();