envio 3.10.0 → 3.11.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 +21 -4
- package/fuel.schema.json +21 -4
- package/index.d.ts +7 -6
- package/package.json +6 -6
- package/src/ChainState.res +9 -73
- package/src/ChainState.res.mjs +6 -58
- package/src/Config.res +73 -18
- package/src/Config.res.mjs +69 -16
- package/src/EventConfigBuilder.res +14 -10
- package/src/EventConfigBuilder.res.mjs +6 -4
- package/src/HandlerRegister.res +12 -11
- package/src/HandlerRegister.res.mjs +6 -5
- package/src/Internal.res +20 -4
- package/src/Internal.res.mjs +9 -0
- package/src/Main.res +8 -1
- package/src/Main.res.mjs +3 -3
- package/src/Persistence.res +11 -1
- package/src/Persistence.res.mjs +6 -2
- package/src/PgStorage.res +1 -1
- package/src/PgStorage.res.mjs +1 -1
- package/src/SimulateItems.res +13 -6
- package/src/SimulateItems.res.mjs +7 -6
- package/src/TestIndexer.res +6 -5
- package/src/TestIndexer.res.mjs +5 -4
- package/src/db/InternalTable.res +1 -1
- package/src/db/InternalTable.res.mjs +2 -1
- package/src/sources/ChainSources.res +72 -0
- package/src/sources/ChainSources.res.mjs +55 -0
- package/src/sources/EvmHyperSyncSource.res +10 -22
- package/src/sources/EvmHyperSyncSource.res.mjs +9 -41
- package/src/sources/FuelHyperSyncSource.res +10 -18
- package/src/sources/FuelHyperSyncSource.res.mjs +8 -38
- package/src/sources/HyperSync.res +31 -0
- package/src/sources/HyperSync.res.mjs +31 -0
- package/src/sources/HyperSync.resi +16 -0
- package/src/sources/StartBlockResolver.res +173 -0
- package/src/sources/StartBlockResolver.res.mjs +134 -0
- package/src/sources/Svm.res +0 -51
- package/src/sources/Svm.res.mjs +0 -46
- package/src/sources/SvmHyperSyncSource.res +20 -9
- package/src/sources/SvmHyperSyncSource.res.mjs +34 -12
- package/svm.schema.json +80 -66
package/svm.schema.json
CHANGED
|
@@ -66,6 +66,13 @@
|
|
|
66
66
|
"items": {
|
|
67
67
|
"$ref": "#/$defs/Chain"
|
|
68
68
|
}
|
|
69
|
+
},
|
|
70
|
+
"programs": {
|
|
71
|
+
"description": "Solana programs to index. Programs are defined once for the whole project; `program_id` says where each one lives on every chain.",
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": {
|
|
74
|
+
"$ref": "#/$defs/Program"
|
|
75
|
+
}
|
|
69
76
|
}
|
|
70
77
|
},
|
|
71
78
|
"additionalProperties": false,
|
|
@@ -224,20 +231,18 @@
|
|
|
224
231
|
]
|
|
225
232
|
},
|
|
226
233
|
"rpc": {
|
|
227
|
-
"description": "RPC endpoint URL for
|
|
234
|
+
"description": "RPC endpoint URL for the Svm cluster. Accepted but unused: instruction sync is served by HyperSync.",
|
|
228
235
|
"type": [
|
|
229
236
|
"string",
|
|
230
237
|
"null"
|
|
231
238
|
]
|
|
232
239
|
},
|
|
233
|
-
"
|
|
234
|
-
"description": "The slot
|
|
235
|
-
"
|
|
236
|
-
"format": "uint64",
|
|
237
|
-
"minimum": 0
|
|
240
|
+
"start_slot": {
|
|
241
|
+
"description": "The slot at which the indexer should start ingesting data, or \"latest\" to start from the chain's current slot when the indexer is first deployed. Once resolved, the concrete slot is persisted and reused every time the indexer resumes normally (for example recovering from a crash), so downtime is backfilled instead of skipped. Running `envio start`/`dev` with -r (--restart) resets this like any other config change: \"latest\" resolves again, against the head at that time.",
|
|
242
|
+
"$ref": "#/$defs/StartBlock"
|
|
238
243
|
},
|
|
239
|
-
"
|
|
240
|
-
"description": "The slot
|
|
244
|
+
"end_slot": {
|
|
245
|
+
"description": "The slot at which the indexer should terminate.",
|
|
241
246
|
"type": [
|
|
242
247
|
"integer",
|
|
243
248
|
"null"
|
|
@@ -254,11 +259,11 @@
|
|
|
254
259
|
"format": "uint32",
|
|
255
260
|
"minimum": 0
|
|
256
261
|
},
|
|
257
|
-
"
|
|
258
|
-
"description": "
|
|
262
|
+
"hypersync_config": {
|
|
263
|
+
"description": "HyperSync Config for fetching historical instructions on this chain. Optional for the `solana` and `solana-devnet` chain ids, which default to their public HyperSync endpoints; required for any other chain id.",
|
|
259
264
|
"anyOf": [
|
|
260
265
|
{
|
|
261
|
-
"$ref": "#/$defs/
|
|
266
|
+
"$ref": "#/$defs/HypersyncConfig"
|
|
262
267
|
},
|
|
263
268
|
{
|
|
264
269
|
"type": "null"
|
|
@@ -269,7 +274,7 @@
|
|
|
269
274
|
"additionalProperties": false,
|
|
270
275
|
"required": [
|
|
271
276
|
"id",
|
|
272
|
-
"
|
|
277
|
+
"start_slot"
|
|
273
278
|
]
|
|
274
279
|
},
|
|
275
280
|
"ChainId": {
|
|
@@ -293,31 +298,23 @@
|
|
|
293
298
|
"solana-devnet"
|
|
294
299
|
]
|
|
295
300
|
},
|
|
296
|
-
"
|
|
297
|
-
"
|
|
298
|
-
"
|
|
299
|
-
|
|
300
|
-
"
|
|
301
|
-
"
|
|
302
|
-
|
|
303
|
-
"$ref": "#/$defs/HypersyncConfig"
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
"type": "null"
|
|
307
|
-
}
|
|
308
|
-
]
|
|
301
|
+
"StartBlock": {
|
|
302
|
+
"description": "A chain's configured start block: either a concrete block number or the\nliteral \"latest\". Config parsing never touches the network, so `Latest`\nstays unresolved here — it's resolved once at runtime, right before the\nindexer's first-ever persisted state is written, and never re-resolved\non a normal resume (see packages/envio/src/sources/StartBlockResolver.res).\nNote: this repo's `-r`/`--restart` CLI flag wipes the DB and re-deploys\nfrom scratch, so it re-resolves \"latest\" too — \"resume\" here means the\nopposite: recovering from a crash or process restart without `-r`.",
|
|
303
|
+
"anyOf": [
|
|
304
|
+
{
|
|
305
|
+
"type": "integer",
|
|
306
|
+
"format": "uint64",
|
|
307
|
+
"minimum": 0
|
|
309
308
|
},
|
|
310
|
-
|
|
311
|
-
"
|
|
312
|
-
"type": "array",
|
|
313
|
-
"items": {
|
|
314
|
-
"$ref": "#/$defs/Program"
|
|
315
|
-
}
|
|
309
|
+
{
|
|
310
|
+
"$ref": "#/$defs/StartBlockTag"
|
|
316
311
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
"StartBlockTag": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"enum": [
|
|
317
|
+
"latest"
|
|
321
318
|
]
|
|
322
319
|
},
|
|
323
320
|
"HypersyncConfig": {
|
|
@@ -341,8 +338,8 @@
|
|
|
341
338
|
"type": "string"
|
|
342
339
|
},
|
|
343
340
|
"program_id": {
|
|
344
|
-
"description": "Base58-encoded program id (32 bytes).",
|
|
345
|
-
"
|
|
341
|
+
"description": "Base58-encoded program id (32 bytes). A single value is allowed only when the config defines one chain; with several, give a mapping keyed by chain id that names every one of them, writing `_` for a chain the program is not deployed on.",
|
|
342
|
+
"$ref": "#/$defs/SvmProgramId"
|
|
346
343
|
},
|
|
347
344
|
"handler": {
|
|
348
345
|
"description": "Optional relative path to a file where handlers are registered for the given program. If not provided, handlers can be auto-loaded from the src directory.",
|
|
@@ -352,14 +349,14 @@
|
|
|
352
349
|
]
|
|
353
350
|
},
|
|
354
351
|
"idl": {
|
|
355
|
-
"description": "Optional path (relative to config.yaml) to an
|
|
352
|
+
"description": "Optional path (relative to config.yaml) to an IDL JSON file (Anchor 0.30+, legacy Anchor, Shank, or Codama). When present, every usable instruction is in the catalog and `onInstruction` selects by name. Omit YAML `instructions` to take that catalog as-is. A YAML row overwrites the IDL instruction of the same name, or adds a name the IDL did not declare.",
|
|
356
353
|
"type": [
|
|
357
354
|
"string",
|
|
358
355
|
"null"
|
|
359
356
|
]
|
|
360
357
|
},
|
|
361
358
|
"instructions": {
|
|
362
|
-
"description": "A list
|
|
359
|
+
"description": "Instructions to index. With `idl:`, omit this list to take the full usable IDL catalog. A row whose name the IDL declares replaces that instruction, and must spell out `accounts` and `args`; every other row adds one. Give `accounts` where you want the slots named — an empty list names none, the same as leaving it out. `args` is not the same shape: setting it attaches a decoder that also filters, so leaving it out and setting it to `[]` are different asks.",
|
|
363
360
|
"type": "array",
|
|
364
361
|
"items": {
|
|
365
362
|
"$ref": "#/$defs/Instruction"
|
|
@@ -369,8 +366,29 @@
|
|
|
369
366
|
"additionalProperties": false,
|
|
370
367
|
"required": [
|
|
371
368
|
"name",
|
|
372
|
-
"program_id"
|
|
373
|
-
|
|
369
|
+
"program_id"
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
"SvmProgramId": {
|
|
373
|
+
"title": "Program id",
|
|
374
|
+
"description": "Base58-encoded program id (32 bytes).\nA single value is allowed only when the config defines one chain.\nWith several chains, give a mapping keyed by chain id that names every one of them; write `_` for a chain the program is not deployed on.",
|
|
375
|
+
"anyOf": [
|
|
376
|
+
{
|
|
377
|
+
"type": "string"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"type": "object",
|
|
381
|
+
"additionalProperties": {
|
|
382
|
+
"type": "string"
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
],
|
|
386
|
+
"examples": [
|
|
387
|
+
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
|
|
388
|
+
{
|
|
389
|
+
"solana": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
|
|
390
|
+
"solana-devnet": "_"
|
|
391
|
+
}
|
|
374
392
|
]
|
|
375
393
|
},
|
|
376
394
|
"Instruction": {
|
|
@@ -381,24 +399,21 @@
|
|
|
381
399
|
"type": "string"
|
|
382
400
|
},
|
|
383
401
|
"discriminator": {
|
|
384
|
-
"description": "
|
|
385
|
-
"type":
|
|
386
|
-
"string",
|
|
387
|
-
"null"
|
|
388
|
-
]
|
|
402
|
+
"description": "0x-prefixed hex instruction-data prefix to dispatch on, of any whole number of bytes; an 8-byte value matches the standard Anchor discriminator. The empty prefix, written \"0x\", is carried by every call, so it is how a row matches every instruction of the program. This is the form `instruction.discriminator` reads back, so a config value and a handler comparison are the same string. Every instruction whose prefix an on-chain call carries receives it, so a program-wide entry fires alongside a keyed one, and two entries may share a prefix (say, the layouts before and after a program upgrade): each decodes with its own `args`, and one whose layout rejects the data is skipped for that call.",
|
|
403
|
+
"type": "string"
|
|
389
404
|
},
|
|
390
405
|
"accounts": {
|
|
391
|
-
"description": "Optional positional account
|
|
406
|
+
"description": "Optional positional account slots, in the order the program expects them. The Nth entry names account slot N on the dispatched instruction; named slots surface as `instruction.accounts.<name>` when `fields.instruction` includes `accounts`. The raw slots are available either way, so this only adds the names. Required on a row that replaces an instruction the IDL declares.",
|
|
392
407
|
"type": [
|
|
393
408
|
"array",
|
|
394
409
|
"null"
|
|
395
410
|
],
|
|
396
411
|
"items": {
|
|
397
|
-
"
|
|
412
|
+
"$ref": "#/$defs/SvmAccountSlot"
|
|
398
413
|
}
|
|
399
414
|
},
|
|
400
415
|
"args": {
|
|
401
|
-
"description": "
|
|
416
|
+
"description": "Borsh argument schema. Each entry names one arg and gives its type; the decoder walks the instruction data after the discriminator in declared order, and a call whose data the layout rejects is skipped. Setting it is therefore also a filter: `[]` says the instruction takes no arguments, so only calls carrying nothing past the discriminator are indexed. Omit it instead to attach no decoder at all — every matched call is indexed and the payload stays raw, reachable as `instruction.data`. An `idl` always declares the layout of the instructions it names, empty included. Required on a row that replaces an instruction the IDL declares.",
|
|
402
417
|
"type": [
|
|
403
418
|
"array",
|
|
404
419
|
"null"
|
|
@@ -410,7 +425,19 @@
|
|
|
410
425
|
},
|
|
411
426
|
"additionalProperties": false,
|
|
412
427
|
"required": [
|
|
413
|
-
"name"
|
|
428
|
+
"name",
|
|
429
|
+
"discriminator"
|
|
430
|
+
]
|
|
431
|
+
},
|
|
432
|
+
"SvmAccountSlot": {
|
|
433
|
+
"title": "Account slot",
|
|
434
|
+
"description": "One positional account slot of the instruction.\n- `payer` names a slot the call always carries; it surfaces as `instruction.accounts.payer`.\n- `?authority` names an optional slot: the key is absent from `instruction.accounts` when the call leaves the slot out or fills it with the program id.\n- `_` holds a position without naming it, so the slots after it keep theirs. It is never surfaced and never filterable, and the list may not end with one.",
|
|
435
|
+
"type": "string",
|
|
436
|
+
"pattern": "^(?:_|\\??[A-Za-z0-9_]*[A-Za-z][A-Za-z0-9_]*)$",
|
|
437
|
+
"examples": [
|
|
438
|
+
"payer",
|
|
439
|
+
"?authority",
|
|
440
|
+
"_"
|
|
414
441
|
]
|
|
415
442
|
},
|
|
416
443
|
"ArgDef": {
|
|
@@ -433,7 +460,7 @@
|
|
|
433
460
|
]
|
|
434
461
|
},
|
|
435
462
|
"ArgType": {
|
|
436
|
-
"description": "User-facing Borsh type grammar. Mirrors\n`hypersync_client_solana::decode::FieldType`. The YAML accepts either:\n- A bare string for
|
|
463
|
+
"description": "User-facing Borsh type grammar. Mirrors\n`hypersync_client_solana::decode::FieldType`. The YAML accepts either:\n- A bare string for a primitive (`u64`, `pubkey`, `bool`, ...).\n- A one-key mapping for a composite (`{ vec: u8 }`, `{ option: pubkey }`,\n `{ array: [u8, 32] }`, `{ struct: [...] }`, `{ enum: [...] }`).\n\nA nominal type is declared inline with `struct` / `enum` at the field\nthat uses it. There is no way to name one and refer to it: attach an\n`idl` to the program when its types are shared between instructions.",
|
|
437
464
|
"anyOf": [
|
|
438
465
|
{
|
|
439
466
|
"$ref": "#/$defs/ArgPrimitive"
|
|
@@ -517,20 +544,7 @@
|
|
|
517
544
|
"additionalProperties": false
|
|
518
545
|
},
|
|
519
546
|
{
|
|
520
|
-
"description": "
|
|
521
|
-
"type": "object",
|
|
522
|
-
"properties": {
|
|
523
|
-
"defined": {
|
|
524
|
-
"type": "string"
|
|
525
|
-
}
|
|
526
|
-
},
|
|
527
|
-
"required": [
|
|
528
|
-
"defined"
|
|
529
|
-
],
|
|
530
|
-
"additionalProperties": false
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
"description": "Inline-or-registry struct. Used as a nominal type definition in\nthe `defined_types` registry; rarely seen at the field level.",
|
|
547
|
+
"description": "A struct, declared inline at the field that uses it or held in the\n`defined_types` registry.",
|
|
534
548
|
"type": "object",
|
|
535
549
|
"properties": {
|
|
536
550
|
"struct": {
|
|
@@ -546,7 +560,7 @@
|
|
|
546
560
|
"additionalProperties": false
|
|
547
561
|
},
|
|
548
562
|
{
|
|
549
|
-
"description": "
|
|
563
|
+
"description": "An enum, declared inline at the field that uses it or held in the\n`defined_types` registry. Borsh selects a variant by its position\nhere, with a one-byte tag.",
|
|
550
564
|
"type": "object",
|
|
551
565
|
"properties": {
|
|
552
566
|
"enum": {
|