envio 3.0.1 → 3.0.2-svm-alpha.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.
Files changed (41) hide show
  1. package/evm.schema.json +8 -8
  2. package/fuel.schema.json +12 -12
  3. package/index.d.ts +155 -1
  4. package/package.json +6 -7
  5. package/src/ChainFetcher.res +25 -1
  6. package/src/ChainFetcher.res.mjs +19 -1
  7. package/src/Config.res +156 -94
  8. package/src/Config.res.mjs +60 -97
  9. package/src/Core.res +32 -0
  10. package/src/Env.res.mjs +1 -2
  11. package/src/Envio.res +94 -0
  12. package/src/EventConfigBuilder.res +50 -0
  13. package/src/EventConfigBuilder.res.mjs +31 -0
  14. package/src/HandlerLoader.res +12 -1
  15. package/src/HandlerLoader.res.mjs +6 -1
  16. package/src/Internal.res +38 -0
  17. package/src/Main.res +53 -3
  18. package/src/Main.res.mjs +34 -2
  19. package/src/Persistence.res +2 -17
  20. package/src/Persistence.res.mjs +2 -14
  21. package/src/SimulateItems.res +23 -10
  22. package/src/SimulateItems.res.mjs +21 -6
  23. package/src/SvmTypes.res +9 -0
  24. package/src/SvmTypes.res.mjs +14 -0
  25. package/src/sources/EventRouter.res +65 -0
  26. package/src/sources/EventRouter.res.mjs +43 -0
  27. package/src/sources/HyperSyncClient.res +30 -157
  28. package/src/sources/HyperSyncClient.res.mjs +20 -6
  29. package/src/sources/HyperSyncSolanaClient.res +227 -0
  30. package/src/sources/HyperSyncSolanaClient.res.mjs +25 -0
  31. package/src/sources/HyperSyncSolanaSource.res +515 -0
  32. package/src/sources/HyperSyncSolanaSource.res.mjs +441 -0
  33. package/src/sources/HyperSyncSource.res +5 -8
  34. package/src/sources/HyperSyncSource.res.mjs +1 -8
  35. package/src/sources/RpcSource.res.mjs +1 -1
  36. package/src/sources/Svm.res +2 -2
  37. package/src/sources/Svm.res.mjs +3 -2
  38. package/src/tui/Tui.res +9 -2
  39. package/src/tui/Tui.res.mjs +19 -4
  40. package/src/tui/components/TuiData.res +3 -0
  41. package/svm.schema.json +345 -4
package/svm.schema.json CHANGED
@@ -4,6 +4,10 @@
4
4
  "description": "Schema for a YAML config for an envio Svm indexer",
5
5
  "type": "object",
6
6
  "properties": {
7
+ "name": {
8
+ "description": "Name of the project",
9
+ "type": "string"
10
+ },
7
11
  "description": {
8
12
  "description": "Description of the project",
9
13
  "type": [
@@ -11,10 +15,6 @@
11
15
  "null"
12
16
  ]
13
17
  },
14
- "name": {
15
- "description": "Name of the project",
16
- "type": "string"
17
- },
18
18
  "schema": {
19
19
  "description": "Custom path to schema.graphql file",
20
20
  "type": [
@@ -137,6 +137,17 @@
137
137
  "description": "RPC endpoint URL for connecting to the Svm cluster to fetch blockchain data.",
138
138
  "type": "string"
139
139
  },
140
+ "hypersync_config": {
141
+ "description": "Optional HyperSync Config for fetching historical instructions.",
142
+ "anyOf": [
143
+ {
144
+ "$ref": "#/$defs/HypersyncConfig"
145
+ },
146
+ {
147
+ "type": "null"
148
+ }
149
+ ]
150
+ },
140
151
  "start_block": {
141
152
  "description": "The slot number at which the indexer should start ingesting data",
142
153
  "type": "integer",
@@ -160,6 +171,16 @@
160
171
  ],
161
172
  "format": "uint32",
162
173
  "minimum": 0
174
+ },
175
+ "programs": {
176
+ "description": "Solana programs to index on this chain.",
177
+ "type": [
178
+ "array",
179
+ "null"
180
+ ],
181
+ "items": {
182
+ "$ref": "#/$defs/Program"
183
+ }
163
184
  }
164
185
  },
165
186
  "additionalProperties": false,
@@ -167,6 +188,326 @@
167
188
  "rpc",
168
189
  "start_block"
169
190
  ]
191
+ },
192
+ "HypersyncConfig": {
193
+ "type": "object",
194
+ "properties": {
195
+ "url": {
196
+ "description": "URL of the HyperSync endpoint (default: the public Solana HyperSync endpoint at https://solana.hypersync.xyz)",
197
+ "type": "string"
198
+ }
199
+ },
200
+ "additionalProperties": false,
201
+ "required": [
202
+ "url"
203
+ ]
204
+ },
205
+ "Program": {
206
+ "type": "object",
207
+ "properties": {
208
+ "name": {
209
+ "description": "A unique project-wide name for this program (used in generated code).",
210
+ "type": "string"
211
+ },
212
+ "program_id": {
213
+ "description": "Base58-encoded program id (32 bytes).",
214
+ "type": "string"
215
+ },
216
+ "handler": {
217
+ "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.",
218
+ "type": [
219
+ "string",
220
+ "null"
221
+ ]
222
+ },
223
+ "idl": {
224
+ "description": "Optional path (relative to config.yaml) to an Anchor IDL JSON file. When present, codegen parses the IDL and derives `accounts`/`args` for every named instruction. Mutually exclusive with per-instruction `accounts`/`args` overrides.",
225
+ "type": [
226
+ "string",
227
+ "null"
228
+ ]
229
+ },
230
+ "instructions": {
231
+ "description": "A list of instructions that should be indexed on this program.",
232
+ "type": "array",
233
+ "items": {
234
+ "$ref": "#/$defs/Instruction"
235
+ }
236
+ }
237
+ },
238
+ "additionalProperties": false,
239
+ "required": [
240
+ "name",
241
+ "program_id",
242
+ "instructions"
243
+ ]
244
+ },
245
+ "Instruction": {
246
+ "type": "object",
247
+ "properties": {
248
+ "name": {
249
+ "description": "Name of the instruction in the HyperIndex generated code. Should be unique per program.",
250
+ "type": "string"
251
+ },
252
+ "discriminator": {
253
+ "description": "Hex-encoded instruction-data prefix used as the discriminator (\"0x\" optional). Must be 1, 2, 4, or 8 bytes after decoding. An 8-byte value matches the standard Anchor discriminator.",
254
+ "type": [
255
+ "string",
256
+ "null"
257
+ ]
258
+ },
259
+ "is_inner": {
260
+ "description": "Filter on inner-vs-outer instructions. None / absent matches both.",
261
+ "type": [
262
+ "boolean",
263
+ "null"
264
+ ]
265
+ },
266
+ "account_filters": {
267
+ "description": "Optional positional account filters. Each entry pins a particular account position (0..=9) to one of a set of base58 pubkeys.",
268
+ "type": [
269
+ "array",
270
+ "null"
271
+ ],
272
+ "items": {
273
+ "$ref": "#/$defs/AccountFilter"
274
+ }
275
+ },
276
+ "include_transaction": {
277
+ "description": "When true, also fetch the parent transaction for each matched instruction. Defaults to true so handlers can read tx signatures.",
278
+ "type": [
279
+ "boolean",
280
+ "null"
281
+ ]
282
+ },
283
+ "include_logs": {
284
+ "description": "When true, also fetch program logs for each matched instruction.",
285
+ "type": [
286
+ "boolean",
287
+ "null"
288
+ ]
289
+ },
290
+ "accounts": {
291
+ "description": "Optional positional account names. The Nth entry names account slot N on the dispatched instruction; surfaces as `event.instruction.decoded.accounts.<name>`. Accounts beyond the named list become `extra_accounts`.",
292
+ "type": [
293
+ "array",
294
+ "null"
295
+ ],
296
+ "items": {
297
+ "type": "string"
298
+ }
299
+ },
300
+ "args": {
301
+ "description": "Optional Borsh argument schema. Each entry names one arg and gives its type; the decoder walks the instruction data after the discriminator in declared order. Mutually exclusive with the program-level `idl` field.",
302
+ "type": [
303
+ "array",
304
+ "null"
305
+ ],
306
+ "items": {
307
+ "$ref": "#/$defs/ArgDef"
308
+ }
309
+ }
310
+ },
311
+ "additionalProperties": false,
312
+ "required": [
313
+ "name"
314
+ ]
315
+ },
316
+ "AccountFilter": {
317
+ "type": "object",
318
+ "properties": {
319
+ "position": {
320
+ "description": "Account position within the instruction (0..=9).",
321
+ "type": "integer",
322
+ "format": "uint8",
323
+ "minimum": 0,
324
+ "maximum": 255
325
+ },
326
+ "values": {
327
+ "description": "Allowed base58 pubkeys for this account position.",
328
+ "type": "array",
329
+ "items": {
330
+ "type": "string"
331
+ }
332
+ }
333
+ },
334
+ "additionalProperties": false,
335
+ "required": [
336
+ "position",
337
+ "values"
338
+ ]
339
+ },
340
+ "ArgDef": {
341
+ "description": "One named argument of an instruction. Mirrors\n`hypersync_client_solana::decode::NamedField`.",
342
+ "type": "object",
343
+ "properties": {
344
+ "name": {
345
+ "description": "Field name as it appears on the decoded args object.",
346
+ "type": "string"
347
+ },
348
+ "type": {
349
+ "description": "Borsh type of this field.",
350
+ "$ref": "#/$defs/ArgType"
351
+ }
352
+ },
353
+ "additionalProperties": false,
354
+ "required": [
355
+ "name",
356
+ "type"
357
+ ]
358
+ },
359
+ "ArgType": {
360
+ "description": "User-facing Borsh type grammar. Mirrors\n`hypersync_client_solana::decode::FieldType`. The YAML accepts either:\n- A bare string for primitives (`\"u64\"`, `\"pubkey\"`, `\"bool\"`, ...).\n- A tagged object for composites (`{ vec: u8 }`, `{ option: pubkey }`,\n `{ array: [u8, 32] }`, `{ defined: \"DataV2\" }`).\n- An object with `kind: struct` or `kind: enum` for nominal types\n declared inline on this field. Most users will use `defined` and\n declare the nominal types under the program's `types:` block (Anchor\n IDL shape) once that lands; for now inline `struct` / `enum` is the\n only way to express nominal shapes ad-hoc.",
361
+ "anyOf": [
362
+ {
363
+ "$ref": "#/$defs/ArgPrimitive"
364
+ },
365
+ {
366
+ "$ref": "#/$defs/ArgComposite"
367
+ }
368
+ ]
369
+ },
370
+ "ArgPrimitive": {
371
+ "type": "string",
372
+ "enum": [
373
+ "bool",
374
+ "u8",
375
+ "u16",
376
+ "u32",
377
+ "u64",
378
+ "u128",
379
+ "i8",
380
+ "i16",
381
+ "i32",
382
+ "i64",
383
+ "i128",
384
+ "f32",
385
+ "f64",
386
+ "string",
387
+ "bytes",
388
+ "pubkey",
389
+ "publicKey"
390
+ ]
391
+ },
392
+ "ArgComposite": {
393
+ "oneOf": [
394
+ {
395
+ "type": "object",
396
+ "properties": {
397
+ "option": {
398
+ "$ref": "#/$defs/ArgType"
399
+ }
400
+ },
401
+ "required": [
402
+ "option"
403
+ ],
404
+ "additionalProperties": false
405
+ },
406
+ {
407
+ "type": "object",
408
+ "properties": {
409
+ "vec": {
410
+ "$ref": "#/$defs/ArgType"
411
+ }
412
+ },
413
+ "required": [
414
+ "vec"
415
+ ],
416
+ "additionalProperties": false
417
+ },
418
+ {
419
+ "description": "`[ <element type>, <length> ]` — same shape Anchor IDLs use.",
420
+ "type": "object",
421
+ "properties": {
422
+ "array": {
423
+ "type": "array",
424
+ "prefixItems": [
425
+ {
426
+ "$ref": "#/$defs/ArgType"
427
+ },
428
+ {
429
+ "type": "integer",
430
+ "format": "uint",
431
+ "minimum": 0
432
+ }
433
+ ],
434
+ "minItems": 2,
435
+ "maxItems": 2
436
+ }
437
+ },
438
+ "required": [
439
+ "array"
440
+ ],
441
+ "additionalProperties": false
442
+ },
443
+ {
444
+ "description": "Reference to a nominal type defined in the program-level\n`defined_types` registry (populated from an Anchor IDL `types:`\nblock or the bundled-Metaplex registry).",
445
+ "type": "object",
446
+ "properties": {
447
+ "defined": {
448
+ "type": "string"
449
+ }
450
+ },
451
+ "required": [
452
+ "defined"
453
+ ],
454
+ "additionalProperties": false
455
+ },
456
+ {
457
+ "description": "Inline-or-registry struct. Used as a nominal type definition in\nthe `defined_types` registry; rarely seen at the field level.",
458
+ "type": "object",
459
+ "properties": {
460
+ "struct": {
461
+ "type": "array",
462
+ "items": {
463
+ "$ref": "#/$defs/ArgDef"
464
+ }
465
+ }
466
+ },
467
+ "required": [
468
+ "struct"
469
+ ],
470
+ "additionalProperties": false
471
+ },
472
+ {
473
+ "description": "Inline-or-registry enum. Same role as `Struct`: a nominal type\ndefinition in the `defined_types` registry.",
474
+ "type": "object",
475
+ "properties": {
476
+ "enum": {
477
+ "type": "array",
478
+ "items": {
479
+ "$ref": "#/$defs/ArgEnumVariant"
480
+ }
481
+ }
482
+ },
483
+ "required": [
484
+ "enum"
485
+ ],
486
+ "additionalProperties": false
487
+ }
488
+ ]
489
+ },
490
+ "ArgEnumVariant": {
491
+ "type": "object",
492
+ "properties": {
493
+ "name": {
494
+ "type": "string"
495
+ },
496
+ "fields": {
497
+ "description": "`None` for unit variants; `Some([])` for struct variants with no\nfields. The Borsh wire format is identical in both cases (the\n1-byte tag), but the distinction is preserved for round-tripping.",
498
+ "type": [
499
+ "array",
500
+ "null"
501
+ ],
502
+ "items": {
503
+ "$ref": "#/$defs/ArgDef"
504
+ }
505
+ }
506
+ },
507
+ "additionalProperties": false,
508
+ "required": [
509
+ "name"
510
+ ]
170
511
  }
171
512
  }
172
513
  }