envio 2.32.10 → 2.32.12
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/sources/HyperSync.res +39 -58
- package/src/sources/HyperSync.res.js +51 -67
- package/src/sources/HyperSync.resi +2 -4
- package/src/sources/HyperSyncClient.res +30 -1
- package/src/sources/HyperSyncClient.res.js +9 -0
- package/src/sources/HyperSyncSource.res +2 -4
- package/src/sources/HyperSyncSource.res.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "envio",
|
|
3
|
-
"version": "v2.32.
|
|
3
|
+
"version": "v2.32.12",
|
|
4
4
|
"description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
|
|
5
5
|
"bin": "./bin.js",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://envio.dev",
|
|
27
27
|
"optionalDependencies": {
|
|
28
|
-
"envio-linux-x64": "v2.32.
|
|
29
|
-
"envio-linux-arm64": "v2.32.
|
|
30
|
-
"envio-darwin-x64": "v2.32.
|
|
31
|
-
"envio-darwin-arm64": "v2.32.
|
|
28
|
+
"envio-linux-x64": "v2.32.12",
|
|
29
|
+
"envio-linux-arm64": "v2.32.12",
|
|
30
|
+
"envio-darwin-x64": "v2.32.12",
|
|
31
|
+
"envio-darwin-arm64": "v2.32.12"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@elastic/ecs-pino-format": "1.4.0",
|
|
35
|
-
"@envio-dev/hypersync-client": "1.
|
|
35
|
+
"@envio-dev/hypersync-client": "1.3.0",
|
|
36
36
|
"@envio-dev/hyperfuel-client": "1.2.2",
|
|
37
37
|
"bignumber.js": "9.1.2",
|
|
38
38
|
"eventsource": "4.1.0",
|
|
@@ -199,7 +199,7 @@ module GetLogs = {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
module BlockData = {
|
|
202
|
-
let makeRequestBody = (~fromBlock, ~toBlock):
|
|
202
|
+
let makeRequestBody = (~fromBlock, ~toBlock): HyperSyncClient.QueryTypes.query => {
|
|
203
203
|
fromBlock,
|
|
204
204
|
toBlockExclusive: toBlock + 1,
|
|
205
205
|
fieldSelection: {
|
|
@@ -208,51 +208,44 @@ module BlockData = {
|
|
|
208
208
|
includeAllBlocks: true,
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
let convertResponse = (res:
|
|
211
|
+
let convertResponse = (res: HyperSyncClient.queryResponse): queryResponse<
|
|
212
212
|
array<ReorgDetection.blockDataWithTimestamp>,
|
|
213
213
|
> => {
|
|
214
|
-
res.data
|
|
215
|
-
->
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
blockHash,
|
|
228
|
-
}: ReorgDetection.blockDataWithTimestamp
|
|
229
|
-
),
|
|
230
|
-
)
|
|
231
|
-
| _ =>
|
|
232
|
-
let missingParams =
|
|
233
|
-
[
|
|
234
|
-
block.number->Utils.Option.mapNone("block.number"),
|
|
235
|
-
block.timestamp->Utils.Option.mapNone("block.timestamp"),
|
|
236
|
-
block.hash->Utils.Option.mapNone("block.hash"),
|
|
237
|
-
]->Array.keepMap(p => p)
|
|
238
|
-
|
|
239
|
-
Error(
|
|
240
|
-
UnexpectedMissingParams({
|
|
241
|
-
queryName: "query block data HyperSync",
|
|
242
|
-
missingParams,
|
|
243
|
-
}),
|
|
244
|
-
)
|
|
245
|
-
}
|
|
246
|
-
},
|
|
214
|
+
res.data.blocks
|
|
215
|
+
->Option.getWithDefault([])
|
|
216
|
+
->Array.map(block => {
|
|
217
|
+
switch block {
|
|
218
|
+
| {number: blockNumber, timestamp: blockTimestamp, hash: blockHash} =>
|
|
219
|
+
Ok(
|
|
220
|
+
(
|
|
221
|
+
{
|
|
222
|
+
blockTimestamp,
|
|
223
|
+
blockNumber,
|
|
224
|
+
blockHash,
|
|
225
|
+
}: ReorgDetection.blockDataWithTimestamp
|
|
226
|
+
),
|
|
247
227
|
)
|
|
248
|
-
|
|
228
|
+
| _ =>
|
|
229
|
+
let missingParams =
|
|
230
|
+
[
|
|
231
|
+
block.number->Utils.Option.mapNone("block.number"),
|
|
232
|
+
block.timestamp->Utils.Option.mapNone("block.timestamp"),
|
|
233
|
+
block.hash->Utils.Option.mapNone("block.hash"),
|
|
234
|
+
]->Array.keepMap(p => p)
|
|
235
|
+
|
|
236
|
+
Error(
|
|
237
|
+
UnexpectedMissingParams({
|
|
238
|
+
queryName: "query block data HyperSync",
|
|
239
|
+
missingParams,
|
|
240
|
+
}),
|
|
241
|
+
)
|
|
242
|
+
}
|
|
249
243
|
})
|
|
250
244
|
->Utils.Array.transposeResults
|
|
251
245
|
}
|
|
252
246
|
|
|
253
247
|
let rec queryBlockData = async (
|
|
254
|
-
~
|
|
255
|
-
~apiToken,
|
|
248
|
+
~client: HyperSyncClient.t,
|
|
256
249
|
~fromBlock,
|
|
257
250
|
~toBlock,
|
|
258
251
|
~logger,
|
|
@@ -268,38 +261,28 @@ module BlockData = {
|
|
|
268
261
|
},
|
|
269
262
|
)
|
|
270
263
|
|
|
271
|
-
let maybeSuccessfulRes = switch await
|
|
272
|
-
HyperSyncJsonApi.queryRoute->Rest.fetch(
|
|
273
|
-
{
|
|
274
|
-
"query": body,
|
|
275
|
-
"token": apiToken,
|
|
276
|
-
},
|
|
277
|
-
~client=Rest.client(serverUrl),
|
|
278
|
-
)
|
|
279
|
-
, ~logger) {
|
|
264
|
+
let maybeSuccessfulRes = switch await client.get(~query=body) {
|
|
280
265
|
| exception _ => None
|
|
281
266
|
| res if res.nextBlock <= fromBlock => None
|
|
282
267
|
| res => Some(res)
|
|
283
268
|
}
|
|
284
269
|
|
|
285
|
-
// If the block is not found, retry the query. This can occur since replicas of hypersync might not
|
|
270
|
+
// If the block is not found, retry the query. This can occur since replicas of hypersync might not have caught up yet
|
|
286
271
|
switch maybeSuccessfulRes {
|
|
287
272
|
| None => {
|
|
288
|
-
let logger = Logging.createChild(~params={"url": serverUrl})
|
|
289
273
|
let delayMilliseconds = 100
|
|
290
274
|
logger->Logging.childInfo(
|
|
291
275
|
`Block #${fromBlock->Int.toString} not found in HyperSync. HyperSync has multiple instances and it's possible that they drift independently slightly from the head. Indexing should continue correctly after retrying the query in ${delayMilliseconds->Int.toString}ms.`,
|
|
292
276
|
)
|
|
293
277
|
await Time.resolvePromiseAfterDelay(~delayMilliseconds)
|
|
294
|
-
await queryBlockData(~
|
|
278
|
+
await queryBlockData(~client, ~fromBlock, ~toBlock, ~logger)
|
|
295
279
|
}
|
|
296
280
|
| Some(res) =>
|
|
297
281
|
switch res->convertResponse {
|
|
298
282
|
| Error(_) as err => err
|
|
299
283
|
| Ok(datas) if res.nextBlock <= toBlock => {
|
|
300
284
|
let restRes = await queryBlockData(
|
|
301
|
-
~
|
|
302
|
-
~apiToken,
|
|
285
|
+
~client,
|
|
303
286
|
~fromBlock=res.nextBlock,
|
|
304
287
|
~toBlock,
|
|
305
288
|
~logger,
|
|
@@ -311,7 +294,7 @@ module BlockData = {
|
|
|
311
294
|
}
|
|
312
295
|
}
|
|
313
296
|
|
|
314
|
-
let queryBlockDataMulti = async (~
|
|
297
|
+
let queryBlockDataMulti = async (~client, ~blockNumbers, ~logger) => {
|
|
315
298
|
switch blockNumbers->Array.get(0) {
|
|
316
299
|
| None => Ok([])
|
|
317
300
|
| Some(firstBlock) => {
|
|
@@ -336,8 +319,7 @@ module BlockData = {
|
|
|
336
319
|
let res = await queryBlockData(
|
|
337
320
|
~fromBlock=fromBlock.contents,
|
|
338
321
|
~toBlock=toBlock.contents,
|
|
339
|
-
~
|
|
340
|
-
~apiToken,
|
|
322
|
+
~client,
|
|
341
323
|
~logger,
|
|
342
324
|
)
|
|
343
325
|
let filtered = res->Result.map(datas => {
|
|
@@ -356,10 +338,9 @@ module BlockData = {
|
|
|
356
338
|
}
|
|
357
339
|
}
|
|
358
340
|
|
|
359
|
-
let queryBlockData = (~
|
|
341
|
+
let queryBlockData = (~client, ~blockNumber, ~logger) =>
|
|
360
342
|
BlockData.queryBlockData(
|
|
361
|
-
~
|
|
362
|
-
~apiToken,
|
|
343
|
+
~client,
|
|
363
344
|
~fromBlock=blockNumber,
|
|
364
345
|
~toBlock=blockNumber,
|
|
365
346
|
~logger,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var Rest = require("../vendored/Rest.res.js");
|
|
5
4
|
var Time = require("../Time.res.js");
|
|
6
5
|
var Utils = require("../Utils.res.js");
|
|
7
|
-
var $$BigInt = require("../bindings/BigInt.res.js");
|
|
8
6
|
var Js_exn = require("rescript/lib/js/js_exn.js");
|
|
9
7
|
var Js_dict = require("rescript/lib/js/js_dict.js");
|
|
10
8
|
var Logging = require("../Logging.res.js");
|
|
@@ -14,7 +12,6 @@ var Belt_Result = require("rescript/lib/js/belt_Result.js");
|
|
|
14
12
|
var Caml_option = require("rescript/lib/js/caml_option.js");
|
|
15
13
|
var Caml_exceptions = require("rescript/lib/js/caml_exceptions.js");
|
|
16
14
|
var HyperSyncClient = require("./HyperSyncClient.res.js");
|
|
17
|
-
var HyperSyncJsonApi = require("./HyperSyncJsonApi.res.js");
|
|
18
15
|
|
|
19
16
|
var fieldNames = [
|
|
20
17
|
"address",
|
|
@@ -177,12 +174,12 @@ async function query(client, fromBlock, toBlock, logSelections, fieldSelection,
|
|
|
177
174
|
function makeRequestBody$1(fromBlock, toBlock) {
|
|
178
175
|
return {
|
|
179
176
|
fromBlock: fromBlock,
|
|
180
|
-
|
|
177
|
+
toBlock: toBlock + 1 | 0,
|
|
181
178
|
fieldSelection: {
|
|
182
179
|
block: [
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
180
|
+
"Number",
|
|
181
|
+
"Hash",
|
|
182
|
+
"Timestamp"
|
|
186
183
|
]
|
|
187
184
|
},
|
|
188
185
|
includeAllBlocks: true
|
|
@@ -190,52 +187,47 @@ function makeRequestBody$1(fromBlock, toBlock) {
|
|
|
190
187
|
}
|
|
191
188
|
|
|
192
189
|
function convertResponse(res) {
|
|
193
|
-
return Utils.$$Array.transposeResults(Belt_Array.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
}));
|
|
234
|
-
}));
|
|
190
|
+
return Utils.$$Array.transposeResults(Belt_Array.map(Belt_Option.getWithDefault(res.data.blocks, []), (function (block) {
|
|
191
|
+
var blockNumber = block.number;
|
|
192
|
+
if (blockNumber !== undefined) {
|
|
193
|
+
var blockHash = block.hash;
|
|
194
|
+
if (blockHash !== undefined) {
|
|
195
|
+
var blockTimestamp = block.timestamp;
|
|
196
|
+
if (blockTimestamp !== undefined) {
|
|
197
|
+
return {
|
|
198
|
+
TAG: "Ok",
|
|
199
|
+
_0: {
|
|
200
|
+
blockHash: blockHash,
|
|
201
|
+
blockNumber: blockNumber,
|
|
202
|
+
blockTimestamp: blockTimestamp
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
var missingParams = Belt_Array.keepMap([
|
|
211
|
+
Utils.$$Option.mapNone(block.number, "block.number"),
|
|
212
|
+
Utils.$$Option.mapNone(block.timestamp, "block.timestamp"),
|
|
213
|
+
Utils.$$Option.mapNone(block.hash, "block.hash")
|
|
214
|
+
], (function (p) {
|
|
215
|
+
return p;
|
|
216
|
+
}));
|
|
217
|
+
return {
|
|
218
|
+
TAG: "Error",
|
|
219
|
+
_0: {
|
|
220
|
+
TAG: "UnexpectedMissingParams",
|
|
221
|
+
_0: {
|
|
222
|
+
queryName: "query block data HyperSync",
|
|
223
|
+
missingParams: missingParams
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
235
227
|
})));
|
|
236
228
|
}
|
|
237
229
|
|
|
238
|
-
async function queryBlockData(
|
|
230
|
+
async function queryBlockData(client, fromBlock, toBlock, logger) {
|
|
239
231
|
var body = makeRequestBody$1(fromBlock, toBlock);
|
|
240
232
|
var logger$1 = Logging.createChildFrom(logger, {
|
|
241
233
|
logType: "HyperSync get block hash query",
|
|
@@ -246,12 +238,7 @@ async function queryBlockData(serverUrl, apiToken, fromBlock, toBlock, logger) {
|
|
|
246
238
|
var exit = 0;
|
|
247
239
|
var res;
|
|
248
240
|
try {
|
|
249
|
-
res = await
|
|
250
|
-
return Rest.$$fetch(HyperSyncJsonApi.queryRoute, {
|
|
251
|
-
query: body,
|
|
252
|
-
token: apiToken
|
|
253
|
-
}, Rest.client(serverUrl, undefined));
|
|
254
|
-
}));
|
|
241
|
+
res = await client.get(body);
|
|
255
242
|
exit = 1;
|
|
256
243
|
}
|
|
257
244
|
catch (exn){
|
|
@@ -269,20 +256,17 @@ async function queryBlockData(serverUrl, apiToken, fromBlock, toBlock, logger) {
|
|
|
269
256
|
return err;
|
|
270
257
|
}
|
|
271
258
|
var datas = err._0;
|
|
272
|
-
var restRes = await queryBlockData(
|
|
259
|
+
var restRes = await queryBlockData(client, maybeSuccessfulRes.nextBlock, toBlock, logger$1);
|
|
273
260
|
return Belt_Result.map(restRes, (function (rest) {
|
|
274
261
|
return Belt_Array.concat(datas, rest);
|
|
275
262
|
}));
|
|
276
263
|
}
|
|
277
|
-
|
|
278
|
-
url: serverUrl
|
|
279
|
-
});
|
|
280
|
-
Logging.childInfo(logger$2, "Block #" + String(fromBlock) + " not found in HyperSync. HyperSync has multiple instances and it's possible that they drift independently slightly from the head. Indexing should continue correctly after retrying the query in " + String(100) + "ms.");
|
|
264
|
+
Logging.childInfo(logger$1, "Block #" + String(fromBlock) + " not found in HyperSync. HyperSync has multiple instances and it's possible that they drift independently slightly from the head. Indexing should continue correctly after retrying the query in " + String(100) + "ms.");
|
|
281
265
|
await Time.resolvePromiseAfterDelay(100);
|
|
282
|
-
return await queryBlockData(
|
|
266
|
+
return await queryBlockData(client, fromBlock, toBlock, logger$1);
|
|
283
267
|
}
|
|
284
268
|
|
|
285
|
-
async function queryBlockDataMulti(
|
|
269
|
+
async function queryBlockDataMulti(client, blockNumbers, logger) {
|
|
286
270
|
var firstBlock = Belt_Array.get(blockNumbers, 0);
|
|
287
271
|
if (firstBlock === undefined) {
|
|
288
272
|
return {
|
|
@@ -306,7 +290,7 @@ async function queryBlockDataMulti(serverUrl, apiToken, blockNumbers, logger) {
|
|
|
306
290
|
if ((toBlock - fromBlock | 0) > 1000) {
|
|
307
291
|
Js_exn.raiseError("Invalid block data request. Range of block numbers is too large. Max range is 1000. Requested range: " + String(fromBlock) + "-" + String(toBlock));
|
|
308
292
|
}
|
|
309
|
-
var res = await queryBlockData(
|
|
293
|
+
var res = await queryBlockData(client, fromBlock, toBlock, logger);
|
|
310
294
|
var filtered = Belt_Result.map(res, (function (datas) {
|
|
311
295
|
return Belt_Array.keep(datas, (function (data) {
|
|
312
296
|
return set.delete(data.blockNumber);
|
|
@@ -318,8 +302,8 @@ async function queryBlockDataMulti(serverUrl, apiToken, blockNumbers, logger) {
|
|
|
318
302
|
return filtered;
|
|
319
303
|
}
|
|
320
304
|
|
|
321
|
-
function queryBlockData$1(
|
|
322
|
-
return queryBlockData(
|
|
305
|
+
function queryBlockData$1(client, blockNumber, logger) {
|
|
306
|
+
return queryBlockData(client, blockNumber, blockNumber, logger).then(function (res) {
|
|
323
307
|
return Belt_Result.map(res, (function (res) {
|
|
324
308
|
return Belt_Array.get(res, 0);
|
|
325
309
|
}));
|
|
@@ -339,4 +323,4 @@ exports.GetLogs = GetLogs;
|
|
|
339
323
|
exports.queryBlockData = queryBlockData$1;
|
|
340
324
|
exports.queryBlockDataMulti = queryBlockDataMulti;
|
|
341
325
|
exports.mapExn = mapExn;
|
|
342
|
-
/*
|
|
326
|
+
/* Time Not a pure module */
|
|
@@ -53,15 +53,13 @@ module GetLogs: {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
let queryBlockData: (
|
|
56
|
-
~
|
|
57
|
-
~apiToken: string,
|
|
56
|
+
~client: HyperSyncClient.t,
|
|
58
57
|
~blockNumber: int,
|
|
59
58
|
~logger: Pino.t,
|
|
60
59
|
) => promise<queryResponse<option<ReorgDetection.blockDataWithTimestamp>>>
|
|
61
60
|
|
|
62
61
|
let queryBlockDataMulti: (
|
|
63
|
-
~
|
|
64
|
-
~apiToken: string,
|
|
62
|
+
~client: HyperSyncClient.t,
|
|
65
63
|
~blockNumbers: array<int>,
|
|
66
64
|
~logger: Pino.t,
|
|
67
65
|
) => promise<queryResponse<array<ReorgDetection.blockDataWithTimestamp>>>
|
|
@@ -284,6 +284,12 @@ module QueryTypes = {
|
|
|
284
284
|
* JoinNothing: join nothing.
|
|
285
285
|
*/
|
|
286
286
|
joinMode?: joinMode,
|
|
287
|
+
/**
|
|
288
|
+
* Whether to include all blocks regardless of if they are related to a returned transaction or log. Normally
|
|
289
|
+
* the server will return only the blocks that are related to the transaction or logs in the response. But if this
|
|
290
|
+
* is set to true, the server will return data for all blocks in the requested range [from_block, to_block).
|
|
291
|
+
*/
|
|
292
|
+
includeAllBlocks?: bool,
|
|
287
293
|
}
|
|
288
294
|
}
|
|
289
295
|
|
|
@@ -456,10 +462,23 @@ type eventResponse = ResponseTypes.eventResponse
|
|
|
456
462
|
|
|
457
463
|
//Todo, add bindings for these types
|
|
458
464
|
type streamConfig
|
|
459
|
-
type queryResponse
|
|
460
465
|
type queryResponseStream
|
|
461
466
|
type eventStream
|
|
462
467
|
|
|
468
|
+
type queryResponseData = {
|
|
469
|
+
blocks: option<array<ResponseTypes.block>>,
|
|
470
|
+
transactions: option<array<ResponseTypes.transaction>>,
|
|
471
|
+
logs: option<array<ResponseTypes.log>>,
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
type queryResponse = {
|
|
475
|
+
archiveHeight: option<int>,
|
|
476
|
+
nextBlock: int,
|
|
477
|
+
totalExecutionTime: int,
|
|
478
|
+
data: queryResponseData,
|
|
479
|
+
rollbackGuard: option<ResponseTypes.rollbackGuard>,
|
|
480
|
+
}
|
|
481
|
+
|
|
463
482
|
@tag("type")
|
|
464
483
|
type heightStreamEvent =
|
|
465
484
|
| Height({height: int})
|
|
@@ -520,6 +539,16 @@ let make = (
|
|
|
520
539
|
)
|
|
521
540
|
}
|
|
522
541
|
|
|
542
|
+
type logLevel = [#trace | #debug | #info | #warn | #error]
|
|
543
|
+
let logLevelSchema: S.t<logLevel> = S.enum([#trace, #debug, #info, #warn, #error])
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Set the log level for the underlying Rust logger in hypersync-client.
|
|
547
|
+
* Must be called before creating any HypersyncClient.
|
|
548
|
+
*/
|
|
549
|
+
@module("@envio-dev/hypersync-client")
|
|
550
|
+
external setLogLevel: logLevel => unit = "setLogLevel"
|
|
551
|
+
|
|
523
552
|
module Decoder = {
|
|
524
553
|
type rec decodedSolType<'a> = {val: 'a}
|
|
525
554
|
|
|
@@ -82,6 +82,14 @@ function make(url, apiToken, httpReqTimeoutMillis, maxNumRetries, enableChecksum
|
|
|
82
82
|
}, "hyperindex/" + envioVersion);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
var logLevelSchema = S$RescriptSchema.$$enum([
|
|
86
|
+
"trace",
|
|
87
|
+
"debug",
|
|
88
|
+
"info",
|
|
89
|
+
"warn",
|
|
90
|
+
"error"
|
|
91
|
+
]);
|
|
92
|
+
|
|
85
93
|
function toUnderlying(_d) {
|
|
86
94
|
while(true) {
|
|
87
95
|
var d = _d;
|
|
@@ -117,5 +125,6 @@ exports.QueryTypes = QueryTypes;
|
|
|
117
125
|
exports.ResponseTypes = ResponseTypes;
|
|
118
126
|
exports.HeightStream = HeightStream;
|
|
119
127
|
exports.make = make;
|
|
128
|
+
exports.logLevelSchema = logLevelSchema;
|
|
120
129
|
exports.Decoder = Decoder;
|
|
121
130
|
/* serializationFormatSchema Not a pure module */
|
|
@@ -369,8 +369,7 @@ let make = (
|
|
|
369
369
|
//If there were no logs at all in the current page query then fetch the
|
|
370
370
|
//timestamp of the heighest block accounted for
|
|
371
371
|
HyperSync.queryBlockData(
|
|
372
|
-
~
|
|
373
|
-
~apiToken,
|
|
372
|
+
~client,
|
|
374
373
|
~blockNumber=heighestBlockQueried,
|
|
375
374
|
~logger,
|
|
376
375
|
)->Promise.thenResolve(res =>
|
|
@@ -548,8 +547,7 @@ let make = (
|
|
|
548
547
|
|
|
549
548
|
let getBlockHashes = (~blockNumbers, ~logger) =>
|
|
550
549
|
HyperSync.queryBlockDataMulti(
|
|
551
|
-
~
|
|
552
|
-
~apiToken,
|
|
550
|
+
~client,
|
|
553
551
|
~blockNumbers,
|
|
554
552
|
~logger,
|
|
555
553
|
)->Promise.thenResolve(HyperSync.mapExn)
|
|
@@ -280,7 +280,7 @@ function make(param) {
|
|
|
280
280
|
exit = 1;
|
|
281
281
|
}
|
|
282
282
|
if (exit === 1) {
|
|
283
|
-
lastBlockQueriedPromise = HyperSync.queryBlockData(
|
|
283
|
+
lastBlockQueriedPromise = HyperSync.queryBlockData(client, heighestBlockQueried, logger).then(function (res) {
|
|
284
284
|
if (res.TAG !== "Ok") {
|
|
285
285
|
return mkLogAndRaise("Failed to query blockData for block " + String(heighestBlockQueried), HyperSync.queryErrorToMsq(res._0));
|
|
286
286
|
}
|
|
@@ -390,7 +390,7 @@ function make(param) {
|
|
|
390
390
|
};
|
|
391
391
|
};
|
|
392
392
|
var getBlockHashes = function (blockNumbers, logger) {
|
|
393
|
-
return HyperSync.queryBlockDataMulti(
|
|
393
|
+
return HyperSync.queryBlockDataMulti(client, blockNumbers, logger).then(HyperSync.mapExn);
|
|
394
394
|
};
|
|
395
395
|
var jsonApiClient = Rest.client(endpointUrl, undefined);
|
|
396
396
|
return {
|