envio 2.7.3 → 2.7.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envio",
3
- "version": "v2.7.3",
3
+ "version": "v2.7.5",
4
4
  "description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
5
5
  "bin": "./bin.js",
6
6
  "repository": {
@@ -23,20 +23,24 @@
23
23
  },
24
24
  "homepage": "https://envio.dev",
25
25
  "optionalDependencies": {
26
- "envio-linux-x64": "v2.7.3",
27
- "envio-linux-arm64": "v2.7.3",
28
- "envio-darwin-x64": "v2.7.3",
29
- "envio-darwin-arm64": "v2.7.3"
26
+ "envio-linux-x64": "v2.7.5",
27
+ "envio-linux-arm64": "v2.7.5",
28
+ "envio-darwin-x64": "v2.7.5",
29
+ "envio-darwin-arm64": "v2.7.5"
30
30
  },
31
31
  "dependencies": {
32
+ "@envio-dev/hypersync-client": "0.6.2",
32
33
  "rescript": "11.1.3",
33
- "rescript-schema": "8.2.0"
34
+ "rescript-schema": "8.2.0",
35
+ "viem": "2.21.0"
34
36
  },
35
37
  "files": [
36
38
  "bin.js",
37
39
  "evm.schema.json",
38
40
  "fuel.schema.json",
39
41
  "rescript.json",
40
- "src/**/*.res"
42
+ "src/**/*.res",
43
+ "src/**/*.resi",
44
+ "src/**/*.ts"
41
45
  ]
42
46
  }
package/rescript.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envio",
3
- "namespace": true,
3
+ "namespace": false,
4
4
  "sources": [
5
5
  {
6
6
  "dir": "src",
@@ -12,6 +12,9 @@
12
12
  "module": "commonjs",
13
13
  "in-source": true
14
14
  },
15
+ "gentypeconfig": {
16
+ "generatedFileExtension": ".gen.ts"
17
+ },
15
18
  "bs-dependencies": ["rescript-schema"],
16
19
  "bsc-flags": ["-open RescriptSchema"]
17
20
  }
@@ -0,0 +1,8 @@
1
+ /* TypeScript file generated from Address.res by genType. */
2
+
3
+ /* eslint-disable */
4
+ /* tslint:disable */
5
+
6
+ import type {Address as $$t} from './bindings/OpaqueTypes.ts';
7
+
8
+ export type t = $$t;
@@ -0,0 +1,29 @@
1
+ @genType.import(("./bindings/OpaqueTypes.ts", "Address"))
2
+ type t
3
+
4
+ let schema = S.string->S.setName("Address")->(Utils.magic: S.t<string> => S.t<t>)
5
+
6
+ external toString: t => string = "%identity"
7
+
8
+ external unsafeFromString: string => t = "%identity"
9
+
10
+ module Evm = {
11
+ @module("viem")
12
+ external fromStringOrThrow: string => t = "getAddress"
13
+ // Reassign since the function might be used in the handler code
14
+ // and we don't want to have a "viem" import there. It's needed to keep "viem" a dependency
15
+ // of generated code instead of adding it to the indexer project dependencies.
16
+ // Also, we want a custom error message, which is searchable in our codebase.
17
+ let fromStringOrThrow = string => {
18
+ try {
19
+ fromStringOrThrow(string)
20
+ } catch {
21
+ | _ =>
22
+ Js.Exn.raiseError(
23
+ `Address "${string}" is invalid. Expected a 20-byte hex string starting with 0x.`,
24
+ )
25
+ }
26
+ }
27
+
28
+ let fromAddressOrThrow = address => address->toString->fromStringOrThrow
29
+ }
@@ -0,0 +1,22 @@
1
+ module Chain: {
2
+ type t
3
+
4
+ external toChainId: t => int = "%identity"
5
+
6
+ let toString: t => string
7
+
8
+ let makeUnsafe: (~chainId: int) => t
9
+ }
10
+
11
+ type t<'a>
12
+ let fromArrayUnsafe: array<(Chain.t, 'a)> => t<'a>
13
+ let get: (t<'a>, Chain.t) => 'a
14
+ let set: (t<'a>, Chain.t, 'a) => t<'a>
15
+ let values: t<'a> => array<'a>
16
+ let keys: t<'a> => array<Chain.t>
17
+ let entries: t<'a> => array<(Chain.t, 'a)>
18
+ let has: (t<'a>, Chain.t) => bool
19
+ let map: (t<'a>, 'a => 'b) => t<'b>
20
+ let mapWithKey: (t<'a>, (Chain.t, 'a) => 'b) => t<'b>
21
+ let size: t<'a> => int
22
+ let update: (t<'a>, Chain.t, 'a => 'a) => t<'a>
package/src/EvmTypes.res CHANGED
@@ -1,7 +1,14 @@
1
1
  module Hex = {
2
2
  type t
3
+ /**No string validation in schema*/
4
+ let schema =
5
+ S.string->S.setName("EVM.Hex")->(Utils.magic: S.t<string> => S.t<t>)
3
6
  external fromStringUnsafe: string => t = "%identity"
4
7
  external fromStringsUnsafe: array<string> => array<t> = "%identity"
5
8
  external toString: t => string = "%identity"
6
9
  external toStrings: array<t> => array<string> = "%identity"
7
10
  }
11
+
12
+ module Abi = {
13
+ type t
14
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ Throttles a scheduled function to run at a minimum given interval
3
+
4
+ Does NOT queue scheduled functions but rather overwrites them
5
+ on each schedule call.
6
+ */
7
+ type t
8
+
9
+ /**
10
+ Creates a throttler that throttles scheduled functions to run at a minimum
11
+ given interval in milliseconds.
12
+
13
+ Does NOT queue scheduled functions but rather overwrites them
14
+
15
+ The logger will be used to log any errors that occur in the scheduled
16
+ functions.
17
+ */
18
+ let make: (~intervalMillis: int, ~logger: Pino.t) => t
19
+
20
+ /**
21
+ Schedules a function to be run on a throttler, overwriting any
22
+ previously scheduled functions. Should only be used for functions
23
+ that do not need to be executed if there is a more up to date scheduled
24
+ function available.
25
+ */
26
+ let schedule: (t, unit => promise<unit>) => unit
@@ -0,0 +1,481 @@
1
+ type cfg = {
2
+ url?: string,
3
+ bearerToken?: string,
4
+ httpReqTimeoutMillis?: int,
5
+ maxNumRetries?: int,
6
+ retryBackoffMs?: int,
7
+ retryBaseMs?: int,
8
+ retryCeilingMs?: int,
9
+ enableChecksumAddresses?: bool,
10
+ }
11
+
12
+ module QueryTypes = {
13
+ type blockField =
14
+ | Number
15
+ | Hash
16
+ | ParentHash
17
+ | Nonce
18
+ | Sha3Uncles
19
+ | LogsBloom
20
+ | TransactionsRoot
21
+ | StateRoot
22
+ | ReceiptsRoot
23
+ | Miner
24
+ | Difficulty
25
+ | TotalDifficulty
26
+ | ExtraData
27
+ | Size
28
+ | GasLimit
29
+ | GasUsed
30
+ | Timestamp
31
+ | Uncles
32
+ | BaseFeePerGas
33
+ | BlobGasUsed
34
+ | ExcessBlobGas
35
+ | ParentBeaconBlockRoot
36
+ | WithdrawalsRoot
37
+ | Withdrawals
38
+ | L1BlockNumber
39
+ | SendCount
40
+ | SendRoot
41
+ | MixHash
42
+
43
+ type transactionField =
44
+ | BlockHash
45
+ | BlockNumber
46
+ | From
47
+ | Gas
48
+ | GasPrice
49
+ | Hash
50
+ | Input
51
+ | Nonce
52
+ | To
53
+ | TransactionIndex
54
+ | Value
55
+ | V
56
+ | R
57
+ | S
58
+ | YParity
59
+ | MaxPriorityFeePerGas
60
+ | MaxFeePerGas
61
+ | ChainId
62
+ | AccessList
63
+ | MaxFeePerBlobGas
64
+ | BlobVersionedHashes
65
+ | CumulativeGasUsed
66
+ | EffectiveGasPrice
67
+ | GasUsed
68
+ | ContractAddress
69
+ | LogsBloom
70
+ | Kind
71
+ | Root
72
+ | Status
73
+ | L1Fee
74
+ | L1GasPrice
75
+ | L1GasUsed
76
+ | L1FeeScalar
77
+ | GasUsedForL1
78
+
79
+ type logField =
80
+ | Removed
81
+ | LogIndex
82
+ | TransactionIndex
83
+ | TransactionHash
84
+ | BlockHash
85
+ | BlockNumber
86
+ | Address
87
+ | Data
88
+ | Topic0
89
+ | Topic1
90
+ | Topic2
91
+ | Topic3
92
+
93
+ type traceField =
94
+ | From
95
+ | To
96
+ | CallType
97
+ | Gas
98
+ | Input
99
+ | Init
100
+ | Value
101
+ | Author
102
+ | RewardType
103
+ | BlockHash
104
+ | BlockNumber
105
+ | Address
106
+ | Code
107
+ | GasUsed
108
+ | Output
109
+ | Subtraces
110
+ | TraceAddress
111
+ | TransactionHash
112
+ | TransactionPosition
113
+ | Kind
114
+ | Error
115
+
116
+ type fieldSelection = {
117
+ block?: array<blockField>,
118
+ transaction?: array<transactionField>,
119
+ log?: array<logField>,
120
+ trace?: array<traceField>,
121
+ }
122
+ type topicFilter = array<EvmTypes.Hex.t>
123
+ type topic0 = topicFilter
124
+ type topic1 = topicFilter
125
+ type topic2 = topicFilter
126
+ type topic3 = topicFilter
127
+ type topicSelection = (topic0, topic1, topic2, topic3)
128
+ let makeTopicSelection = (~topic0=[], ~topic1=[], ~topic2=[], ~topic3=[]) => (
129
+ topic0,
130
+ topic1,
131
+ topic2,
132
+ topic3,
133
+ )
134
+
135
+ type logSelection = {
136
+ /**
137
+ * Address of the contract, any logs that has any of these addresses will be returned.
138
+ * Empty means match all.
139
+ */
140
+ address?: array<Address.t>,
141
+ /**
142
+ * Topics to match, each member of the top level array is another array, if the nth topic matches any
143
+ * topic specified in topics[n] the log will be returned. Empty means match all.
144
+ */
145
+ topics: topicSelection,
146
+ }
147
+
148
+ let makeLogSelection = (~address, ~topics) => {address, topics}
149
+
150
+ type transactionSelection = {
151
+ /**
152
+ * Address the transaction should originate from. If transaction.from matches any of these, the transaction
153
+ * will be returned. Keep in mind that this has an and relationship with to filter, so each transaction should
154
+ * match both of them. Empty means match all.
155
+ */
156
+ from?: array<Address.t>,
157
+ /**
158
+ * Address the transaction should go to. If transaction.to matches any of these, the transaction will
159
+ * be returned. Keep in mind that this has an and relationship with from filter, so each transaction should
160
+ * match both of them. Empty means match all.
161
+ */
162
+ @as("to")
163
+ to_?: array<Address.t>,
164
+ /** If first 4 bytes of transaction input matches any of these, transaction will be returned. Empty means match all. */
165
+ sighash?: array<string>,
166
+ /** If tx.status matches this it will be returned. */
167
+ status?: int,
168
+ /** If transaction.type matches any of these values, the transaction will be returned */
169
+ kind?: array<int>,
170
+ contractAddress?: array<Address.t>,
171
+ }
172
+
173
+ type traceSelection = {
174
+ from?: array<Address.t>,
175
+ @as("to") to_?: array<Address.t>,
176
+ address?: array<Address.t>,
177
+ callType?: array<string>,
178
+ rewardType?: array<string>,
179
+ kind?: array<string>,
180
+ sighash?: array<string>,
181
+ }
182
+
183
+ type blockSelection = {
184
+ /**
185
+ * Hash of a block, any blocks that have one of these hashes will be returned.
186
+ * Empty means match all.
187
+ */
188
+ hash?: array<string>,
189
+ /**
190
+ * Miner address of a block, any blocks that have one of these miners will be returned.
191
+ * Empty means match all.
192
+ */
193
+ miner?: array<Address.t>,
194
+ }
195
+
196
+ type joinMode = | @as(0) Default | @as(1) JoinAll | @as(2) JoinNothing
197
+
198
+ type query = {
199
+ /** The block to start the query from */
200
+ fromBlock: int,
201
+ /**
202
+ * The block to end the query at. If not specified, the query will go until the
203
+ * end of data. Exclusive, the returned range will be [from_block..to_block).
204
+ *
205
+ * The query will return before it reaches this target block if it hits the time limit
206
+ * configured on the server. The user should continue their query by putting the
207
+ * next_block field in the response into from_block field of their next query. This implements
208
+ * pagination.
209
+ */
210
+ @as("toBlock")
211
+ toBlockExclusive?: int,
212
+ /**
213
+ * List of log selections, these have an or relationship between them, so the query will return logs
214
+ * that match any of these selections.
215
+ */
216
+ logs?: array<logSelection>,
217
+ /**
218
+ * List of transaction selections, the query will return transactions that match any of these selections and
219
+ * it will return transactions that are related to the returned logs.
220
+ */
221
+ transactions?: array<transactionSelection>,
222
+ /**
223
+ * List of trace selections, the query will return traces that match any of these selections and
224
+ * it will re turn traces that are related to the returned logs.
225
+ */
226
+ traces?: array<traceSelection>,
227
+ /** List of block selections, the query will return blocks that match any of these selections */
228
+ blocks?: array<blockSelection>,
229
+ /**
230
+ * Field selection. The user can select which fields they are interested in, requesting less fields will improve
231
+ * query execution time and reduce the payload size so the user should always use a minimal number of fields.
232
+ */
233
+ fieldSelection: fieldSelection,
234
+ /**
235
+ * Maximum number of blocks that should be returned, the server might return more blocks than this number but
236
+ * it won't overshoot by too much.
237
+ */
238
+ maxNumBlocks?: int,
239
+ /**
240
+ * Maximum number of transactions that should be returned, the server might return more transactions than this number but
241
+ * it won't overshoot by too much.
242
+ */
243
+ maxNumTransactions?: int,
244
+ /**
245
+ * Maximum number of logs that should be returned, the server might return more logs than this number but
246
+ * it won't overshoot by too much.
247
+ */
248
+ maxNumLogs?: int,
249
+ /**
250
+ * Maximum number of traces that should be returned, the server might return more traces than this number but
251
+ * it won't overshoot by too much.
252
+ */
253
+ maxNumTraces?: int,
254
+ /**
255
+ * Selects join mode for the query,
256
+ * Default: join in this order logs -> transactions -> traces -> blocks
257
+ * JoinAll: join everything to everything. For example if logSelection matches log0, we get the
258
+ * associated transaction of log0 and then we get associated logs of that transaction as well. Applites similarly
259
+ * to blocks, traces.
260
+ * JoinNothing: join nothing.
261
+ */
262
+ joinMode?: joinMode,
263
+ }
264
+ }
265
+
266
+ module ResponseTypes = {
267
+ type withdrawal = {
268
+ index?: string,
269
+ validatorIndex?: string,
270
+ address?: Address.t,
271
+ amount?: string,
272
+ }
273
+
274
+ type block = {
275
+ number?: int,
276
+ hash?: string,
277
+ parentHash?: string,
278
+ nonce?: bigint,
279
+ sha3Uncles?: string,
280
+ logsBloom?: string,
281
+ transactionsRoot?: string,
282
+ stateRoot?: string,
283
+ receiptsRoot?: string,
284
+ miner?: Address.t,
285
+ difficulty?: bigint,
286
+ totalDifficulty?: bigint,
287
+ extraData?: string,
288
+ size?: bigint,
289
+ gasLimit?: bigint,
290
+ gasUsed?: bigint,
291
+ timestamp?: int,
292
+ uncles?: array<string>,
293
+ baseFeePerGas?: bigint,
294
+ blobGasUsed?: bigint,
295
+ excessBlobGas?: bigint,
296
+ parentBeaconBlockRoot?: string,
297
+ withdrawalsRoot?: string,
298
+ withdrawals?: array<withdrawal>,
299
+ l1BlockNumber?: int,
300
+ sendCount?: string,
301
+ sendRoot?: string,
302
+ mixHash?: string,
303
+ }
304
+
305
+ type accessList = {
306
+ address?: Address.t,
307
+ storageKeys?: array<string>,
308
+ }
309
+
310
+ type transaction = {
311
+ blockHash?: string,
312
+ blockNumber?: int,
313
+ from?: string,
314
+ gas?: bigint,
315
+ gasPrice?: bigint,
316
+ hash?: string,
317
+ input?: string,
318
+ nonce?: bigint,
319
+ to?: string,
320
+ transactionIndex?: int,
321
+ value?: bigint,
322
+ v?: string,
323
+ r?: string,
324
+ s?: string,
325
+ yParity?: string,
326
+ maxPriorityFeePerGas?: bigint,
327
+ maxFeePerGas?: bigint,
328
+ chainId?: int,
329
+ accessList?: array<accessList>,
330
+ maxFeePerBlobGas?: bigint,
331
+ blobVersionedHashes?: array<string>,
332
+ cumulativeGasUsed?: bigint,
333
+ effectiveGasPrice?: bigint,
334
+ gasUsed?: bigint,
335
+ contractAddress?: string,
336
+ logsBloom?: string,
337
+ kind?: int,
338
+ root?: string,
339
+ status?: int,
340
+ l1Fee?: bigint,
341
+ l1GasPrice?: bigint,
342
+ l1GasUsed?: bigint,
343
+ l1FeeScalar?: int,
344
+ gasUsedForL1?: bigint,
345
+ }
346
+
347
+ type log = {
348
+ removed?: bool,
349
+ @as("logIndex") index?: int,
350
+ transactionIndex?: int,
351
+ transactionHash?: string,
352
+ blockHash?: string,
353
+ blockNumber?: int,
354
+ address?: Address.t,
355
+ data?: string,
356
+ topics?: array<Js.Nullable.t<EvmTypes.Hex.t>>,
357
+ }
358
+
359
+ type event = {
360
+ transaction?: transaction,
361
+ block?: block,
362
+ log: log,
363
+ }
364
+
365
+ type rollbackGuard = {
366
+ /** Block number of the last scanned block */
367
+ blockNumber: int,
368
+ /** Block timestamp of the last scanned block */
369
+ timestamp: int,
370
+ /** Block hash of the last scanned block */
371
+ hash: string,
372
+ /**
373
+ * Block number of the first scanned block in memory.
374
+ *
375
+ * This might not be the first scanned block. It only includes blocks that are in memory (possible to be rolled back).
376
+ */
377
+ firstBlockNumber: int,
378
+ /**
379
+ * Parent hash of the first scanned block in memory.
380
+ *
381
+ * This might not be the first scanned block. It only includes blocks that are in memory (possible to be rolled back).
382
+ */
383
+ firstParentHash: string,
384
+ }
385
+
386
+ type eventResponse = {
387
+ /** Current height of the source hypersync instance */
388
+ archiveHeight: option<int>,
389
+ /**
390
+ * Next block to query for, the responses are paginated so,
391
+ * the caller should continue the query from this block if they
392
+ * didn't get responses up to the to_block they specified in the Query.
393
+ */
394
+ nextBlock: int,
395
+ /** Total time it took the hypersync instance to execute the query. */
396
+ totalExecutionTime: int,
397
+ /** Response data */
398
+ data: array<event>,
399
+ /** Rollback guard, supposed to be used to detect rollbacks */
400
+ rollbackGuard: option<rollbackGuard>,
401
+ }
402
+ }
403
+
404
+ type query = QueryTypes.query
405
+ type eventResponse = ResponseTypes.eventResponse
406
+
407
+ //Todo, add bindings for these types
408
+ type streamConfig
409
+ type queryResponse
410
+ type queryResponseStream
411
+ type eventStream
412
+ type t = {
413
+ getHeight: unit => promise<int>,
414
+ collect: (~query: query, ~config: streamConfig) => promise<queryResponse>,
415
+ collectEvents: (~query: query, ~config: streamConfig) => promise<eventResponse>,
416
+ collectParquet: (~path: string, ~query: query, ~config: streamConfig) => promise<unit>,
417
+ get: (~query: query) => promise<queryResponse>,
418
+ getEvents: (~query: query) => promise<eventResponse>,
419
+ stream: (~query: query, ~config: streamConfig) => promise<queryResponseStream>,
420
+ streamEvents: (~query: query, ~config: streamConfig) => promise<eventStream>,
421
+ }
422
+
423
+ @module("@envio-dev/hypersync-client") @scope("HypersyncClient") external new: cfg => t = "new"
424
+
425
+ let defaultToken = "3dc856dd-b0ea-494f-b27e-017b8b6b7e07"
426
+
427
+ let make = (~url, ~bearerToken: option<string>, ~httpReqTimeoutMillis, ~maxNumRetries) =>
428
+ new({
429
+ url,
430
+ enableChecksumAddresses: true,
431
+ bearerToken: bearerToken->Belt.Option.getWithDefault(defaultToken),
432
+ httpReqTimeoutMillis,
433
+ maxNumRetries,
434
+ })
435
+
436
+ module Decoder = {
437
+ type rec decodedSolType<'a> = {val: 'a}
438
+
439
+ @unboxed
440
+ type rec decodedRaw =
441
+ | DecodedBool(bool)
442
+ | DecodedStr(string)
443
+ | DecodedNum(bigint)
444
+ | DecodedVal(decodedSolType<decodedRaw>)
445
+ | DecodedArr(array<decodedRaw>)
446
+
447
+ @unboxed
448
+ type rec decodedUnderlying =
449
+ | Bool(bool)
450
+ | Str(string)
451
+ | Num(bigint)
452
+ | Arr(array<decodedUnderlying>)
453
+
454
+ let rec toUnderlying = (d: decodedRaw): decodedUnderlying => {
455
+ switch d {
456
+ | DecodedVal(v) => v.val->toUnderlying
457
+ | DecodedBool(v) => Bool(v)
458
+ | DecodedStr(v) => Str(v)
459
+ | DecodedNum(v) => Num(v)
460
+ | DecodedArr(v) => v->Belt.Array.map(toUnderlying)->Arr
461
+ }
462
+ }
463
+
464
+ type decodedEvent = {
465
+ indexed: array<decodedRaw>,
466
+ body: array<decodedRaw>,
467
+ }
468
+
469
+ type log
470
+ type t = {
471
+ enableChecksummedAddresses: unit => unit,
472
+ disableChecksummedAddresses: unit => unit,
473
+ decodeLogs: array<log> => promise<array<Js.Nullable.t<decodedEvent>>>,
474
+ decodeLogsSync: array<log> => array<Js.Nullable.t<decodedEvent>>,
475
+ decodeEvents: array<ResponseTypes.event> => promise<array<Js.Nullable.t<decodedEvent>>>,
476
+ decodeEventsSync: array<ResponseTypes.event> => array<Js.Nullable.t<decodedEvent>>,
477
+ }
478
+
479
+ @module("@envio-dev/hypersync-client") @scope("Decoder")
480
+ external fromSignatures: array<string> => t = "fromSignatures"
481
+ }
@@ -0,0 +1 @@
1
+ export type Address = string;
@@ -0,0 +1,17 @@
1
+ /* TypeScript file generated from Pino.res by genType. */
2
+
3
+ /* eslint-disable */
4
+ /* tslint:disable */
5
+
6
+ export type logLevelUser = "udebug" | "uinfo" | "uwarn" | "uerror";
7
+
8
+ export abstract class pinoMessageBlob { protected opaque!: any }; /* simulate opaque types */
9
+
10
+ export type t = {
11
+ readonly trace: (_1:pinoMessageBlob) => void;
12
+ readonly debug: (_1:pinoMessageBlob) => void;
13
+ readonly info: (_1:pinoMessageBlob) => void;
14
+ readonly warn: (_1:pinoMessageBlob) => void;
15
+ readonly error: (_1:pinoMessageBlob) => void;
16
+ readonly fatal: (_1:pinoMessageBlob) => void
17
+ };
@@ -0,0 +1,28 @@
1
+ type eventLog = {
2
+ abi: EvmTypes.Abi.t,
3
+ data: string,
4
+ topics: array<EvmTypes.Hex.t>,
5
+ }
6
+
7
+ type decodedEvent<'a> = {
8
+ eventName: string,
9
+ args: 'a,
10
+ }
11
+
12
+ @module("viem") external decodeEventLogOrThrow: eventLog => decodedEvent<'a> = "decodeEventLog"
13
+
14
+ type hex = EvmTypes.Hex.t
15
+ @module("viem") external toHex: 'a => hex = "toHex"
16
+ @module("viem") external keccak256: hex => hex = "keccak256"
17
+ @module("viem") external keccak256Bytes: bytes => hex = "keccak256"
18
+ @module("viem") external pad: hex => hex = "pad"
19
+ @module("viem")
20
+ external encodePacked: (~types: array<string>, ~values: array<'a>) => hex = "encodePacked"
21
+
22
+ type sizeOptions = {size: int}
23
+ @module("viem") external intToHex: (int, ~options: sizeOptions=?) => hex = "numberToHex"
24
+ @module("viem") external bigintToHex: (bigint, ~options: sizeOptions=?) => hex = "numberToHex"
25
+ @module("viem") external stringToHex: (string, ~options: sizeOptions=?) => hex = "stringToHex"
26
+ @module("viem") external boolToHex: (bool, ~options: sizeOptions=?) => hex = "boolToHex"
27
+ @module("viem") external bytesToHex: (bytes, ~options: sizeOptions=?) => hex = "bytesToHex"
28
+ @module("viem") external concat: array<hex> => hex = "concat"