envio 2.20.1 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/evm.schema.json CHANGED
@@ -229,6 +229,7 @@
229
229
  "status",
230
230
  "yParity",
231
231
  "chainId",
232
+ "accessList",
232
233
  "maxFeePerBlobGas",
233
234
  "blobVersionedHashes",
234
235
  "kind",
@@ -236,7 +237,8 @@
236
237
  "l1GasPrice",
237
238
  "l1GasUsed",
238
239
  "l1FeeScalar",
239
- "gasUsedForL1"
240
+ "gasUsedForL1",
241
+ "authorizationList"
240
242
  ]
241
243
  },
242
244
  "BlockField": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envio",
3
- "version": "v2.20.1",
3
+ "version": "v2.21.0",
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,13 +25,13 @@
25
25
  },
26
26
  "homepage": "https://envio.dev",
27
27
  "optionalDependencies": {
28
- "envio-linux-x64": "v2.20.1",
29
- "envio-linux-arm64": "v2.20.1",
30
- "envio-darwin-x64": "v2.20.1",
31
- "envio-darwin-arm64": "v2.20.1"
28
+ "envio-linux-x64": "v2.21.0",
29
+ "envio-linux-arm64": "v2.21.0",
30
+ "envio-darwin-x64": "v2.21.0",
31
+ "envio-darwin-arm64": "v2.21.0"
32
32
  },
33
33
  "dependencies": {
34
- "@envio-dev/hypersync-client": "0.6.3",
34
+ "@envio-dev/hypersync-client": "0.6.5",
35
35
  "rescript": "11.1.3",
36
36
  "rescript-schema": "9.3.0",
37
37
  "viem": "2.21.0"
@@ -3,6 +3,8 @@
3
3
  /* eslint-disable */
4
4
  /* tslint:disable */
5
5
 
6
+ import type {GenericContractRegister as $$genericContractRegister} from './Types.ts';
7
+
6
8
  import type {Invalid as $$noEventFilters} from './Types.ts';
7
9
 
8
10
  import type {t as Address_t} from './Address.gen';
@@ -22,7 +24,7 @@ export type genericLoader<args,loaderReturn> = (_1:args) => Promise<loaderReturn
22
24
 
23
25
  export type genericContractRegisterArgs<event,context> = { readonly event: event; readonly context: context };
24
26
 
25
- export type genericContractRegister<args> = (_1:args) => void;
27
+ export type genericContractRegister<args> = $$genericContractRegister<args>;
26
28
 
27
29
  export type genericHandlerArgs<event,context,loaderReturn> = {
28
30
  readonly event: event;
package/src/Internal.res CHANGED
@@ -35,8 +35,8 @@ type genericContractRegisterArgs<'event, 'context> = {
35
35
  event: 'event,
36
36
  context: 'context,
37
37
  }
38
- @genType
39
- type genericContractRegister<'args> = 'args => unit
38
+ @genType.import(("./Types.ts", "GenericContractRegister"))
39
+ type genericContractRegister<'args> = 'args => promise<unit>
40
40
 
41
41
  type contractRegisterContext
42
42
  type contractRegisterArgs = genericContractRegisterArgs<event, contractRegisterContext>
package/src/Logging.res CHANGED
@@ -150,7 +150,8 @@ let getEventLogger = (eventItem: Internal.eventItem) => {
150
150
  | None => {
151
151
  let l = getLogger()->child(
152
152
  {
153
- "context": `Event '${eventItem.eventConfig.name}' for contract '${eventItem.eventConfig.contractName}'`,
153
+ "contractName": eventItem.eventConfig.contractName,
154
+ "eventName": eventItem.eventConfig.name,
154
155
  "chainId": eventItem.chain->ChainMap.Chain.toChainId,
155
156
  "block": eventItem.blockNumber,
156
157
  "logIndex": eventItem.logIndex,
@@ -162,18 +163,16 @@ let getEventLogger = (eventItem: Internal.eventItem) => {
162
163
  }
163
164
  }
164
165
 
165
- let getUserLogger = {
166
- @inline
167
- let log = (eventItem, level: Pino.logLevelUser, message: string, ~params) => {
168
- (eventItem->getEventLogger->Utils.magic->Js.Dict.unsafeGet((level :> string)))(params, message)
169
- }
166
+ @inline
167
+ let logForItem = (eventItem, level: Pino.logLevel, message: string, ~params=?) => {
168
+ (eventItem->getEventLogger->Utils.magic->Js.Dict.unsafeGet((level :> string)))(params, message)
169
+ }
170
170
 
171
- (eventItem): Envio.logger => {
172
- info: (message: string, ~params=?) => eventItem->log(#uinfo, message, ~params),
173
- debug: (message: string, ~params=?) => eventItem->log(#udebug, message, ~params),
174
- warn: (message: string, ~params=?) => eventItem->log(#uwarn, message, ~params),
175
- error: (message: string, ~params=?) => eventItem->log(#uerror, message, ~params),
176
- errorWithExn: (message: string, exn) =>
177
- eventItem->log(#uerror, message, ~params={"err": exn->Internal.prettifyExn}),
178
- }
171
+ let getUserLogger = (eventItem): Envio.logger => {
172
+ info: (message: string, ~params=?) => eventItem->logForItem(#uinfo, message, ~params?),
173
+ debug: (message: string, ~params=?) => eventItem->logForItem(#udebug, message, ~params?),
174
+ warn: (message: string, ~params=?) => eventItem->logForItem(#uwarn, message, ~params?),
175
+ error: (message: string, ~params=?) => eventItem->logForItem(#uerror, message, ~params?),
176
+ errorWithExn: (message: string, exn) =>
177
+ eventItem->logForItem(#uerror, message, ~params={"err": exn->Internal.prettifyExn}),
179
178
  }
package/src/Types.ts CHANGED
@@ -45,3 +45,7 @@ export type EffectContext = {
45
45
  */
46
46
  readonly effect: EffectCaller;
47
47
  };
48
+
49
+ export type GenericContractRegister<Args> = (
50
+ args: Args
51
+ ) => void | Promise<void>;
package/src/Utils.res CHANGED
@@ -328,6 +328,8 @@ let unwrapResultExn = res =>
328
328
  external queueMicrotask: (unit => unit) => unit = "queueMicrotask"
329
329
 
330
330
  module Schema = {
331
+ let variantTag = S.union([S.string, S.object(s => s.field("TAG", S.string))])
332
+
331
333
  let getNonOptionalFieldNames = schema => {
332
334
  let acc = []
333
335
  switch schema->S.classify {
@@ -385,6 +387,10 @@ module Schema = {
385
387
  }
386
388
  }
387
389
 
390
+ let getVariantsTags = variants => {
391
+ variants->Js.Array2.map(variant => variant->S.parseOrThrow(Schema.variantTag))
392
+ }
393
+
388
394
  module Set = {
389
395
  type t<'value>
390
396
 
@@ -50,3 +50,5 @@ external done: promise<'a> => unit = "%ignore"
50
50
 
51
51
  external unsafe_async: 'a => promise<'a> = "%identity"
52
52
  external unsafe_await: promise<'a> => 'a = "?await"
53
+
54
+ let isCatchable: 'any => bool = %raw(`value => value && typeof value.catch === 'function'`)
@@ -0,0 +1,19 @@
1
+ /* TypeScript file generated from HyperSyncClient.res by genType. */
2
+
3
+ /* eslint-disable */
4
+ /* tslint:disable */
5
+
6
+ import type {t as Address_t} from '../../src/Address.gen';
7
+
8
+ export type ResponseTypes_accessList = { readonly address?: Address_t; readonly storageKeys?: string[] };
9
+
10
+ export type ResponseTypes_authorizationList = {
11
+ readonly chainId: bigint;
12
+ readonly address: Address_t;
13
+ readonly nonce: number;
14
+ readonly yParity:
15
+ 1
16
+ | 0;
17
+ readonly r: string;
18
+ readonly s: string
19
+ };
@@ -75,6 +75,7 @@ module QueryTypes = {
75
75
  | L1GasUsed
76
76
  | L1FeeScalar
77
77
  | GasUsedForL1
78
+ | AuthorizationList
78
79
 
79
80
  type logField =
80
81
  | Removed
@@ -302,11 +303,36 @@ module ResponseTypes = {
302
303
  mixHash?: string,
303
304
  }
304
305
 
306
+ @genType
305
307
  type accessList = {
306
308
  address?: Address.t,
307
309
  storageKeys?: array<string>,
308
310
  }
309
311
 
312
+ let accessListSchema = S.object(s => {
313
+ address: ?s.field("address", S.option(Address.schema)),
314
+ storageKeys: ?s.field("storageKeys", S.option(S.array(S.string))),
315
+ })
316
+
317
+ @genType
318
+ type authorizationList = {
319
+ chainId: bigint,
320
+ address: Address.t,
321
+ nonce: int,
322
+ yParity: [#0 | #1],
323
+ r: string,
324
+ s: string,
325
+ }
326
+
327
+ let authorizationListSchema = S.object(s => {
328
+ chainId: s.field("chainId", S.bigint),
329
+ address: s.field("address", Address.schema),
330
+ nonce: s.field("nonce", S.int),
331
+ yParity: s.field("yParity", S.enum([#0, #1])),
332
+ r: s.field("r", S.string),
333
+ s: s.field("s", S.string),
334
+ })
335
+
310
336
  type transaction = {
311
337
  blockHash?: string,
312
338
  blockNumber?: int,
@@ -342,6 +368,7 @@ module ResponseTypes = {
342
368
  l1GasUsed?: bigint,
343
369
  l1FeeScalar?: int,
344
370
  gasUsedForL1?: bigint,
371
+ authorizationList?: array<authorizationList>,
345
372
  }
346
373
 
347
374
  type log = {