envio 3.0.2 → 3.1.0-rc.1

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 (101) hide show
  1. package/README.md +0 -1
  2. package/evm.schema.json +15 -8
  3. package/fuel.schema.json +19 -12
  4. package/index.d.ts +0 -2
  5. package/package.json +6 -7
  6. package/rescript.json +1 -1
  7. package/src/Batch.res +4 -214
  8. package/src/Batch.res.mjs +6 -165
  9. package/src/ChainFetcher.res +12 -28
  10. package/src/ChainFetcher.res.mjs +8 -17
  11. package/src/ChainManager.res +10 -9
  12. package/src/ChainManager.res.mjs +6 -10
  13. package/src/Config.res +9 -25
  14. package/src/Config.res.mjs +17 -27
  15. package/src/Core.res +7 -0
  16. package/src/Ctx.res +1 -0
  17. package/src/Env.res +0 -8
  18. package/src/Env.res.mjs +0 -6
  19. package/src/EventConfigBuilder.res +13 -123
  20. package/src/EventConfigBuilder.res.mjs +6 -73
  21. package/src/EventProcessing.res +5 -29
  22. package/src/EventProcessing.res.mjs +11 -20
  23. package/src/EventUtils.res +0 -27
  24. package/src/EventUtils.res.mjs +0 -24
  25. package/src/FetchState.res +2 -15
  26. package/src/FetchState.res.mjs +3 -18
  27. package/src/GlobalState.res +26 -39
  28. package/src/GlobalState.res.mjs +12 -40
  29. package/src/HandlerLoader.res +6 -5
  30. package/src/HandlerLoader.res.mjs +27 -9
  31. package/src/HandlerRegister.res +1 -12
  32. package/src/HandlerRegister.res.mjs +1 -6
  33. package/src/HandlerRegister.resi +1 -1
  34. package/src/Hasura.res +96 -32
  35. package/src/Hasura.res.mjs +93 -38
  36. package/src/InMemoryStore.res +205 -45
  37. package/src/InMemoryStore.res.mjs +157 -40
  38. package/src/InMemoryTable.res +165 -249
  39. package/src/InMemoryTable.res.mjs +156 -227
  40. package/src/Internal.res +10 -34
  41. package/src/Internal.res.mjs +9 -3
  42. package/src/LoadLayer.res +5 -5
  43. package/src/LoadLayer.res.mjs +5 -5
  44. package/src/LogSelection.res +15 -19
  45. package/src/LogSelection.res.mjs +5 -6
  46. package/src/Main.res +4 -6
  47. package/src/Main.res.mjs +26 -15
  48. package/src/Persistence.res +7 -132
  49. package/src/Persistence.res.mjs +1 -102
  50. package/src/PgStorage.res +57 -40
  51. package/src/PgStorage.res.mjs +60 -34
  52. package/src/ReorgDetection.res +35 -58
  53. package/src/ReorgDetection.res.mjs +21 -29
  54. package/src/SimulateItems.res.mjs +21 -3
  55. package/src/Sink.res +2 -2
  56. package/src/Sink.res.mjs +1 -1
  57. package/src/TableIndices.res +9 -2
  58. package/src/TableIndices.res.mjs +7 -1
  59. package/src/TestIndexer.res +53 -60
  60. package/src/TestIndexer.res.mjs +77 -63
  61. package/src/TestIndexerProxyStorage.res +4 -14
  62. package/src/TestIndexerProxyStorage.res.mjs +1 -5
  63. package/src/UserContext.res +2 -4
  64. package/src/UserContext.res.mjs +4 -5
  65. package/src/Utils.res +0 -2
  66. package/src/Utils.res.mjs +0 -3
  67. package/src/bindings/ClickHouse.res +45 -38
  68. package/src/bindings/ClickHouse.res.mjs +16 -17
  69. package/src/bindings/Vitest.res +3 -0
  70. package/src/db/InternalTable.res +59 -18
  71. package/src/db/InternalTable.res.mjs +82 -51
  72. package/src/db/Table.res +9 -2
  73. package/src/db/Table.res.mjs +10 -7
  74. package/src/sources/EnvioApiClient.res +15 -0
  75. package/src/sources/EnvioApiClient.res.mjs +24 -0
  76. package/src/sources/EvmChain.res +32 -10
  77. package/src/sources/EvmChain.res.mjs +31 -5
  78. package/src/sources/HyperFuelSource.res +15 -58
  79. package/src/sources/HyperFuelSource.res.mjs +20 -39
  80. package/src/sources/HyperSync.res +54 -100
  81. package/src/sources/HyperSync.res.mjs +67 -96
  82. package/src/sources/HyperSync.resi +4 -22
  83. package/src/sources/HyperSyncClient.res +70 -247
  84. package/src/sources/HyperSyncClient.res.mjs +47 -46
  85. package/src/sources/HyperSyncSource.res +94 -166
  86. package/src/sources/HyperSyncSource.res.mjs +100 -127
  87. package/src/sources/RpcSource.res +43 -22
  88. package/src/sources/RpcSource.res.mjs +50 -35
  89. package/src/sources/SimulateSource.res +1 -7
  90. package/src/sources/SimulateSource.res.mjs +1 -7
  91. package/src/sources/Source.res +10 -1
  92. package/src/sources/Source.res.mjs +3 -0
  93. package/src/sources/SourceManager.res +177 -8
  94. package/src/sources/SourceManager.res.mjs +141 -3
  95. package/src/sources/SourceManager.resi +19 -0
  96. package/src/tui/Tui.res +44 -6
  97. package/src/tui/Tui.res.mjs +56 -8
  98. package/src/tui/components/TuiData.res +3 -0
  99. package/svm.schema.json +11 -4
  100. package/src/sources/HyperSyncJsonApi.res +0 -390
  101. package/src/sources/HyperSyncJsonApi.res.mjs +0 -237
@@ -28,6 +28,7 @@ type cfg = {
28
28
  serializationFormat?: serializationFormat,
29
29
  /** Whether to use query caching when using CapnProto serialization format. */
30
30
  enableQueryCaching?: bool,
31
+ logLevel?: string,
31
32
  }
32
33
 
33
34
  module QueryTypes = {
@@ -112,34 +113,10 @@ module QueryTypes = {
112
113
  | Topic2
113
114
  | Topic3
114
115
 
115
- type traceField =
116
- | From
117
- | To
118
- | CallType
119
- | Gas
120
- | Input
121
- | Init
122
- | Value
123
- | Author
124
- | RewardType
125
- | BlockHash
126
- | BlockNumber
127
- | Address
128
- | Code
129
- | GasUsed
130
- | Output
131
- | Subtraces
132
- | TraceAddress
133
- | TransactionHash
134
- | TransactionPosition
135
- | Type
136
- | Error
137
-
138
116
  type fieldSelection = {
139
117
  block?: array<blockField>,
140
118
  transaction?: array<transactionField>,
141
119
  log?: array<logField>,
142
- trace?: array<traceField>,
143
120
  }
144
121
  type topicFilter = array<EvmTypes.Hex.t>
145
122
  type topic0 = topicFilter
@@ -155,138 +132,39 @@ module QueryTypes = {
155
132
  )
156
133
 
157
134
  type logFilter = {
158
- /**
159
- * Address of the contract, any logs that has any of these addresses will be returned.
160
- * Empty means match all.
161
- */
162
135
  address?: array<Address.t>,
163
- /**
164
- * Topics to match, each member of the top level array is another array, if the nth topic matches any
165
- * topic specified in topics[n] the log will be returned. Empty means match all.
166
- */
167
136
  topics: topicSelection,
168
137
  }
169
138
 
170
139
  let makeLogSelection = (~address, ~topics) => {address, topics}
171
140
 
172
141
  type transactionFilter = {
173
- /**
174
- * Address the transaction should originate from. If transaction.from matches any of these, the transaction
175
- * will be returned. Keep in mind that this has an and relationship with to filter, so each transaction should
176
- * match both of them. Empty means match all.
177
- */
178
142
  from?: array<Address.t>,
179
- /**
180
- * Address the transaction should go to. If transaction.to matches any of these, the transaction will
181
- * be returned. Keep in mind that this has an and relationship with from filter, so each transaction should
182
- * match both of them. Empty means match all.
183
- */
184
- @as("to")
185
- to_?: array<Address.t>,
186
- /** If first 4 bytes of transaction input matches any of these, transaction will be returned. Empty means match all. */
143
+ @as("to") to_?: array<Address.t>,
187
144
  sighash?: array<string>,
188
- /** If tx.status matches this it will be returned. */
189
145
  status?: int,
190
- /** If transaction.type matches any of these values, the transaction will be returned */
191
- @as("type")
192
- type_?: array<int>,
146
+ @as("type") type_?: array<int>,
193
147
  contractAddress?: array<Address.t>,
194
148
  }
195
149
 
196
- type traceSelection = {
197
- from?: array<Address.t>,
198
- @as("to") to_?: array<Address.t>,
199
- address?: array<Address.t>,
200
- callType?: array<string>,
201
- rewardType?: array<string>,
202
- @as("type")
203
- type_?: array<string>,
204
- sighash?: array<string>,
205
- }
206
-
207
150
  type blockSelection = {
208
- /**
209
- * Hash of a block, any blocks that have one of these hashes will be returned.
210
- * Empty means match all.
211
- */
212
151
  hash?: array<string>,
213
- /**
214
- * Miner address of a block, any blocks that have one of these miners will be returned.
215
- * Empty means match all.
216
- */
217
152
  miner?: array<Address.t>,
218
153
  }
219
154
 
220
155
  type joinMode = | @as(0) Default | @as(1) JoinAll | @as(2) JoinNothing
221
156
 
222
157
  type query = {
223
- /** The block to start the query from */
224
158
  fromBlock: int,
225
- /**
226
- * The block to end the query at. If not specified, the query will go until the
227
- * end of data. Exclusive, the returned range will be [from_block..to_block).
228
- *
229
- * The query will return before it reaches this target block if it hits the time limit
230
- * configured on the server. The user should continue their query by putting the
231
- * next_block field in the response into from_block field of their next query. This implements
232
- * pagination.
233
- */
234
- @as("toBlock")
235
- toBlockExclusive?: int,
236
- /**
237
- * List of log selections, these have an or relationship between them, so the query will return logs
238
- * that match any of these selections.
239
- */
159
+ @as("toBlock") toBlockExclusive?: int,
240
160
  logs?: array<logFilter>,
241
- /**
242
- * List of transaction selections, the query will return transactions that match any of these selections and
243
- * it will return transactions that are related to the returned logs.
244
- */
245
161
  transactions?: array<transactionFilter>,
246
- /**
247
- * List of trace selections, the query will return traces that match any of these selections and
248
- * it will re turn traces that are related to the returned logs.
249
- */
250
- traces?: array<traceSelection>,
251
- /** List of block selections, the query will return blocks that match any of these selections */
252
162
  blocks?: array<blockSelection>,
253
- /**
254
- * Field selection. The user can select which fields they are interested in, requesting less fields will improve
255
- * query execution time and reduce the payload size so the user should always use a minimal number of fields.
256
- */
257
163
  fieldSelection: fieldSelection,
258
- /**
259
- * Maximum number of blocks that should be returned, the server might return more blocks than this number but
260
- * it won't overshoot by too much.
261
- */
262
164
  maxNumBlocks?: int,
263
- /**
264
- * Maximum number of transactions that should be returned, the server might return more transactions than this number but
265
- * it won't overshoot by too much.
266
- */
267
165
  maxNumTransactions?: int,
268
- /**
269
- * Maximum number of logs that should be returned, the server might return more logs than this number but
270
- * it won't overshoot by too much.
271
- */
272
166
  maxNumLogs?: int,
273
- /**
274
- * Maximum number of traces that should be returned, the server might return more traces than this number but
275
- * it won't overshoot by too much.
276
- */
277
- maxNumTraces?: int,
278
- /**
279
- * Selects join mode for the query,
280
- * Default: join in this order logs -> transactions -> traces -> blocks
281
- * JoinAll: join everything to everything. For example if logSelection matches log0, we get the
282
- * associated transaction of log0 and then we get associated logs of that transaction as well. Applites similarly
283
- * to blocks, traces.
284
- * JoinNothing: join nothing.
285
- */
286
167
  joinMode?: joinMode,
287
- /**
288
- * If set to true, the server will return data for all blocks in the requested range [from_block, to_block).
289
- */
290
168
  includeAllBlocks?: bool,
291
169
  }
292
170
  }
@@ -385,8 +263,7 @@ module ResponseTypes = {
385
263
  gasUsed?: bigint,
386
264
  contractAddress?: string,
387
265
  logsBloom?: string,
388
- @as("type")
389
- type_?: int,
266
+ @as("type") type_?: int,
390
267
  root?: string,
391
268
  status?: int,
392
269
  l1Fee?: bigint,
@@ -416,46 +293,15 @@ module ResponseTypes = {
416
293
  }
417
294
 
418
295
  type rollbackGuard = {
419
- /** Block number of the last scanned block */
420
296
  blockNumber: int,
421
- /** Block timestamp of the last scanned block */
422
297
  timestamp: int,
423
- /** Block hash of the last scanned block */
424
298
  hash: string,
425
- /**
426
- * Block number of the first scanned block in memory.
427
- *
428
- * This might not be the first scanned block. It only includes blocks that are in memory (possible to be rolled back).
429
- */
430
299
  firstBlockNumber: int,
431
- /**
432
- * Parent hash of the first scanned block in memory.
433
- *
434
- * This might not be the first scanned block. It only includes blocks that are in memory (possible to be rolled back).
435
- */
436
300
  firstParentHash: string,
437
301
  }
438
-
439
- type eventResponse = {
440
- /** Current height of the source hypersync instance */
441
- archiveHeight: option<int>,
442
- /**
443
- * Next block to query for, the responses are paginated so,
444
- * the caller should continue the query from this block if they
445
- * didn't get responses up to the to_block they specified in the Query.
446
- */
447
- nextBlock: int,
448
- /** Total time it took the hypersync instance to execute the query. */
449
- totalExecutionTime: int,
450
- /** Response data */
451
- data: array<event>,
452
- /** Rollback guard, supposed to be used to detect rollbacks */
453
- rollbackGuard: option<rollbackGuard>,
454
- }
455
302
  }
456
303
 
457
304
  type query = QueryTypes.query
458
- type eventResponse = ResponseTypes.eventResponse
459
305
 
460
306
  type queryResponseData = {
461
307
  blocks: array<ResponseTypes.block>,
@@ -471,52 +317,85 @@ type queryResponse = {
471
317
  rollbackGuard: option<ResponseTypes.rollbackGuard>,
472
318
  }
473
319
 
474
- //Todo, add bindings for these types
475
- type streamConfig
476
- type queryResponseStream
477
- type eventStream
478
-
479
- @tag("type")
480
- type heightStreamEvent =
481
- | Height({height: int})
482
- | Connected
483
- | Reconnecting({delayMillis: int, errorMsg: string})
484
-
485
- module HeightStream = {
486
- type t = {
487
- /** Close the height stream */
488
- close: unit => promise<unit>,
489
- /** Receive the next height stream event from the stream */
490
- recv: unit => promise<heightStreamEvent>,
320
+ module Decoder = {
321
+ type eventParamsInput = {
322
+ sighash: string,
323
+ topicCount: int,
324
+ eventName: string,
325
+ params: array<Internal.paramMeta>,
326
+ }
327
+
328
+ type tWithParams = {
329
+ decodeLogs: array<ResponseTypes.event> => promise<array<Nullable.t<Internal.eventParams>>>,
330
+ }
331
+
332
+ @send
333
+ external classFromParams: (
334
+ Core.decoderCtor,
335
+ array<eventParamsInput>,
336
+ ~checksumAddresses: bool=?,
337
+ ) => tWithParams = "fromParams"
338
+
339
+ let fromParams = (eventParams, ~checksumAddresses=?) =>
340
+ Core.getAddon().decoder->classFromParams(eventParams, ~checksumAddresses?)
341
+ }
342
+
343
+ module EventItems = {
344
+ type item = {
345
+ logIndex: int,
346
+ srcAddress: Address.t,
347
+ topic0: EvmTypes.Hex.t,
348
+ topicCount: int,
349
+ block: ResponseTypes.block,
350
+ transaction: ResponseTypes.transaction,
351
+ params: Nullable.t<Internal.eventParams>,
352
+ }
353
+
354
+ type response = {
355
+ archiveHeight: option<int>,
356
+ nextBlock: int,
357
+ items: array<item>,
358
+ rollbackGuard: option<ResponseTypes.rollbackGuard>,
491
359
  }
492
360
  }
493
361
 
494
362
  type t = {
495
- getHeight: unit => promise<int>,
496
- collect: (~query: query, ~config: streamConfig) => promise<queryResponse>,
497
- collectEvents: (~query: query, ~config: streamConfig) => promise<eventResponse>,
498
- collectParquet: (~path: string, ~query: query, ~config: streamConfig) => promise<unit>,
499
363
  get: (~query: query) => promise<queryResponse>,
500
- getEvents: (~query: query) => promise<eventResponse>,
501
- stream: (~query: query, ~config: streamConfig) => promise<queryResponseStream>,
502
- streamEvents: (~query: query, ~config: streamConfig) => promise<eventStream>,
503
- streamHeight: unit => promise<HeightStream.t>,
364
+ getEventItems: (~query: query) => promise<EventItems.response>,
365
+ getHeight: unit => promise<int>,
504
366
  }
505
367
 
506
- @module("@envio-dev/hypersync-client") @scope("HypersyncClient")
507
- external makeWithAgent: (cfg, ~userAgent: string) => t = "newWithAgent"
368
+ @send
369
+ external classNew: (Core.hypersyncClientCtor, cfg, string, array<Decoder.eventParamsInput>) => t =
370
+ "new"
371
+
372
+ let makeWithAgent = (cfg, ~userAgent, ~eventParams) =>
373
+ Core.getAddon().hypersyncClient->classNew(cfg, userAgent, eventParams)
374
+
375
+ type logLevel = [#trace | #debug | #info | #warn | #error]
376
+ let logLevelSchema: S.t<logLevel> = S.enum([#trace, #debug, #info, #warn, #error])
377
+
378
+ let logLevelToString = (level: logLevel) =>
379
+ switch level {
380
+ | #trace => "trace"
381
+ | #debug => "debug"
382
+ | #info => "info"
383
+ | #warn => "warn"
384
+ | #error => "error"
385
+ }
508
386
 
509
387
  let make = (
510
388
  ~url,
511
389
  ~apiToken,
512
390
  ~httpReqTimeoutMillis,
513
- ~maxNumRetries,
391
+ ~eventParams,
514
392
  ~enableChecksumAddresses=true,
515
393
  ~serializationFormat=?,
516
394
  ~enableQueryCaching=?,
517
395
  ~retryBaseMs=?,
518
396
  ~retryBackoffMs=?,
519
397
  ~retryCeilingMs=?,
398
+ ~logLevel=#info,
520
399
  ) => {
521
400
  let envioVersion = Utils.EnvioPackage.value.version
522
401
  makeWithAgent(
@@ -525,72 +404,16 @@ let make = (
525
404
  enableChecksumAddresses,
526
405
  apiToken,
527
406
  httpReqTimeoutMillis,
528
- maxNumRetries,
407
+ // Retries are handled internally by the indexer, not the binary client
408
+ maxNumRetries: 0,
529
409
  ?serializationFormat,
530
410
  ?enableQueryCaching,
531
411
  ?retryBaseMs,
532
412
  ?retryBackoffMs,
533
413
  ?retryCeilingMs,
414
+ logLevel: logLevelToString(logLevel),
534
415
  },
535
416
  ~userAgent=`hyperindex/${envioVersion}`,
417
+ ~eventParams,
536
418
  )
537
419
  }
538
-
539
- type logLevel = [#trace | #debug | #info | #warn | #error]
540
- let logLevelSchema: S.t<logLevel> = S.enum([#trace, #debug, #info, #warn, #error])
541
-
542
- /**
543
- * Set the log level for the underlying Rust logger in hypersync-client.
544
- * Must be called before creating any HypersyncClient.
545
- */
546
- @module("@envio-dev/hypersync-client")
547
- external setLogLevel: logLevel => unit = "setLogLevel"
548
-
549
- module Decoder = {
550
- type rec decodedSolType<'a> = {val: 'a}
551
-
552
- @unboxed
553
- type rec decodedRaw =
554
- | DecodedBool(bool)
555
- | DecodedStr(string)
556
- | DecodedNum(bigint)
557
- | DecodedVal(decodedSolType<decodedRaw>)
558
- | DecodedArr(array<decodedRaw>)
559
-
560
- @unboxed
561
- type rec decodedUnderlying =
562
- | Bool(bool)
563
- | Str(string)
564
- | Num(bigint)
565
- | Arr(array<decodedUnderlying>)
566
-
567
- let rec toUnderlying = (d: decodedRaw): decodedUnderlying => {
568
- switch d {
569
- | DecodedVal(v) => v.val->toUnderlying
570
- | DecodedBool(v) => Bool(v)
571
- | DecodedStr(v) => Str(v)
572
- | DecodedNum(v) => Num(v)
573
- | DecodedArr(v) => v->Belt.Array.map(toUnderlying)->Arr
574
- }
575
- }
576
-
577
- type decodedEvent = {
578
- indexed: array<decodedRaw>,
579
- body: array<decodedRaw>,
580
- }
581
-
582
- type log
583
- type t = {
584
- enableChecksummedAddresses: unit => unit,
585
- disableChecksummedAddresses: unit => unit,
586
- decodeLogs: array<log> => promise<array<Nullable.t<decodedEvent>>>,
587
- decodeLogsSync: array<log> => array<Nullable.t<decodedEvent>>,
588
- decodeEvents: array<ResponseTypes.event> => promise<array<Nullable.t<decodedEvent>>>,
589
- decodeEventsSync: array<ResponseTypes.event> => array<Nullable.t<decodedEvent>>,
590
- }
591
-
592
- @module("@envio-dev/hypersync-client") @scope("Decoder")
593
- external fromSignatures: array<string> => t = "fromSignatures"
594
- // Keep the @envio-dev/hypersync-client import inside of the package
595
- let fromSignatures = fromSignatures
596
- }
@@ -1,10 +1,10 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
+ import * as Core from "../Core.res.mjs";
3
4
  import * as Utils from "../Utils.res.mjs";
4
5
  import * as Address from "../Address.res.mjs";
5
- import * as Belt_Array from "@rescript/runtime/lib/es6/Belt_Array.js";
6
+ import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
6
7
  import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
7
- import * as HypersyncClient from "@envio-dev/hypersync-client";
8
8
 
9
9
  let serializationFormatSchema = S$RescriptSchema.$$enum([
10
10
  "Json",
@@ -58,23 +58,18 @@ let ResponseTypes = {
58
58
  authorizationListSchema: authorizationListSchema
59
59
  };
60
60
 
61
- let HeightStream = {};
61
+ function fromParams(eventParams, checksumAddresses) {
62
+ return Core.getAddon().Decoder.fromParams(eventParams, checksumAddresses !== undefined ? Primitive_option.valFromOption(checksumAddresses) : undefined);
63
+ }
62
64
 
63
- function make(url, apiToken, httpReqTimeoutMillis, maxNumRetries, enableChecksumAddressesOpt, serializationFormat, enableQueryCaching, retryBaseMs, retryBackoffMs, retryCeilingMs) {
64
- let enableChecksumAddresses = enableChecksumAddressesOpt !== undefined ? enableChecksumAddressesOpt : true;
65
- let envioVersion = Utils.EnvioPackage.value.version;
66
- return HypersyncClient.HypersyncClient.newWithAgent({
67
- url: url,
68
- apiToken: apiToken,
69
- httpReqTimeoutMillis: httpReqTimeoutMillis,
70
- maxNumRetries: maxNumRetries,
71
- retryBackoffMs: retryBackoffMs,
72
- retryBaseMs: retryBaseMs,
73
- retryCeilingMs: retryCeilingMs,
74
- enableChecksumAddresses: enableChecksumAddresses,
75
- serializationFormat: serializationFormat,
76
- enableQueryCaching: enableQueryCaching
77
- }, `hyperindex/` + envioVersion);
65
+ let Decoder = {
66
+ fromParams: fromParams
67
+ };
68
+
69
+ let EventItems = {};
70
+
71
+ function makeWithAgent(cfg, userAgent, eventParams) {
72
+ return Core.getAddon().HypersyncClient.new(cfg, userAgent, eventParams);
78
73
  }
79
74
 
80
75
  let logLevelSchema = S$RescriptSchema.$$enum([
@@ -85,42 +80,48 @@ let logLevelSchema = S$RescriptSchema.$$enum([
85
80
  "error"
86
81
  ]);
87
82
 
88
- function toUnderlying(_d) {
89
- while (true) {
90
- let d = _d;
91
- if (Array.isArray(d)) {
92
- return Belt_Array.map(d, toUnderlying);
93
- }
94
- switch (typeof d) {
95
- case "boolean" :
96
- return d;
97
- case "string" :
98
- return d;
99
- case "bigint" :
100
- return d;
101
- case "object" :
102
- _d = d.val;
103
- continue;
104
- }
105
- };
83
+ function logLevelToString(level) {
84
+ if (level === "warn") {
85
+ return "warn";
86
+ } else if (level === "debug") {
87
+ return "debug";
88
+ } else if (level === "error") {
89
+ return "error";
90
+ } else if (level === "trace") {
91
+ return "trace";
92
+ } else {
93
+ return "info";
94
+ }
106
95
  }
107
96
 
108
- function fromSignatures(prim) {
109
- return HypersyncClient.Decoder.fromSignatures(prim);
97
+ function make(url, apiToken, httpReqTimeoutMillis, eventParams, enableChecksumAddressesOpt, serializationFormat, enableQueryCaching, retryBaseMs, retryBackoffMs, retryCeilingMs, logLevelOpt) {
98
+ let enableChecksumAddresses = enableChecksumAddressesOpt !== undefined ? enableChecksumAddressesOpt : true;
99
+ let logLevel = logLevelOpt !== undefined ? logLevelOpt : "info";
100
+ let envioVersion = Utils.EnvioPackage.value.version;
101
+ return makeWithAgent({
102
+ url: url,
103
+ apiToken: apiToken,
104
+ httpReqTimeoutMillis: httpReqTimeoutMillis,
105
+ maxNumRetries: 0,
106
+ retryBackoffMs: retryBackoffMs,
107
+ retryBaseMs: retryBaseMs,
108
+ retryCeilingMs: retryCeilingMs,
109
+ enableChecksumAddresses: enableChecksumAddresses,
110
+ serializationFormat: serializationFormat,
111
+ enableQueryCaching: enableQueryCaching,
112
+ logLevel: logLevelToString(logLevel)
113
+ }, `hyperindex/` + envioVersion, eventParams);
110
114
  }
111
115
 
112
- let Decoder = {
113
- toUnderlying: toUnderlying,
114
- fromSignatures: fromSignatures
115
- };
116
-
117
116
  export {
118
117
  serializationFormatSchema,
119
118
  QueryTypes,
120
119
  ResponseTypes,
121
- HeightStream,
122
- make,
123
- logLevelSchema,
124
120
  Decoder,
121
+ EventItems,
122
+ makeWithAgent,
123
+ logLevelSchema,
124
+ logLevelToString,
125
+ make,
125
126
  }
126
127
  /* serializationFormatSchema Not a pure module */