envio 3.3.0-alpha.1 → 3.3.0-alpha.3

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 (84) hide show
  1. package/index.d.ts +23 -21
  2. package/package.json +6 -6
  3. package/src/Batch.res +0 -6
  4. package/src/Batch.res.mjs +0 -11
  5. package/src/BatchProcessing.res +2 -12
  6. package/src/BatchProcessing.res.mjs +2 -7
  7. package/src/ChainFetching.res +42 -6
  8. package/src/ChainFetching.res.mjs +30 -11
  9. package/src/ChainMetadata.res +1 -11
  10. package/src/ChainMetadata.res.mjs +1 -10
  11. package/src/ChainState.res +150 -1
  12. package/src/ChainState.res.mjs +138 -9
  13. package/src/ChainState.resi +51 -1
  14. package/src/Config.res +3 -6
  15. package/src/Config.res.mjs +2 -3
  16. package/src/Core.res +7 -0
  17. package/src/CrossChainState.res +24 -26
  18. package/src/CrossChainState.res.mjs +19 -16
  19. package/src/Ecosystem.res +6 -3
  20. package/src/Envio.res +3 -2
  21. package/src/EventConfigBuilder.res +61 -23
  22. package/src/EventConfigBuilder.res.mjs +27 -13
  23. package/src/EventProcessing.res +63 -21
  24. package/src/EventProcessing.res.mjs +47 -22
  25. package/src/FetchState.res +53 -43
  26. package/src/FetchState.res.mjs +71 -54
  27. package/src/HandlerLoader.res +10 -1
  28. package/src/HandlerLoader.res.mjs +15 -8
  29. package/src/Internal.res +46 -7
  30. package/src/Internal.res.mjs +19 -1
  31. package/src/LoadLayer.res +5 -5
  32. package/src/LoadLayer.res.mjs +6 -6
  33. package/src/Main.res +3 -50
  34. package/src/Main.res.mjs +2 -23
  35. package/src/PgStorage.res +4 -4
  36. package/src/PgStorage.res.mjs +5 -5
  37. package/src/Prometheus.res +10 -10
  38. package/src/Prometheus.res.mjs +9 -9
  39. package/src/PruneStaleHistory.res +2 -2
  40. package/src/PruneStaleHistory.res.mjs +3 -3
  41. package/src/Rollback.res +3 -3
  42. package/src/Rollback.res.mjs +4 -4
  43. package/src/SimulateItems.res +80 -15
  44. package/src/SimulateItems.res.mjs +65 -21
  45. package/src/TestIndexer.res +48 -36
  46. package/src/TestIndexer.res.mjs +35 -28
  47. package/src/bindings/Performance.res +7 -0
  48. package/src/bindings/Performance.res.mjs +21 -0
  49. package/src/bindings/Performance.resi +7 -0
  50. package/src/sources/EventRouter.res +17 -21
  51. package/src/sources/EventRouter.res.mjs +6 -9
  52. package/src/sources/Evm.res +47 -67
  53. package/src/sources/Evm.res.mjs +42 -65
  54. package/src/sources/Fuel.res +3 -3
  55. package/src/sources/Fuel.res.mjs +1 -6
  56. package/src/sources/HyperFuelSource.res +15 -11
  57. package/src/sources/HyperFuelSource.res.mjs +13 -11
  58. package/src/sources/HyperSync.res +7 -1
  59. package/src/sources/HyperSync.res.mjs +6 -3
  60. package/src/sources/HyperSync.resi +2 -0
  61. package/src/sources/HyperSyncClient.res +14 -79
  62. package/src/sources/HyperSyncClient.res.mjs +1 -22
  63. package/src/sources/HyperSyncSource.res +44 -27
  64. package/src/sources/HyperSyncSource.res.mjs +32 -27
  65. package/src/sources/RpcSource.res +14 -10
  66. package/src/sources/RpcSource.res.mjs +11 -9
  67. package/src/sources/SimulateSource.res +4 -2
  68. package/src/sources/SimulateSource.res.mjs +1 -0
  69. package/src/sources/Source.res +5 -1
  70. package/src/sources/SourceManager.res +17 -16
  71. package/src/sources/SourceManager.res.mjs +10 -15
  72. package/src/sources/Svm.res +23 -6
  73. package/src/sources/Svm.res.mjs +24 -6
  74. package/src/sources/SvmHyperSyncClient.res +3 -29
  75. package/src/sources/SvmHyperSyncSource.res +78 -96
  76. package/src/sources/SvmHyperSyncSource.res.mjs +79 -91
  77. package/src/sources/TransactionStore.res +128 -0
  78. package/src/sources/TransactionStore.res.mjs +97 -0
  79. package/src/tui/Tui.res +13 -16
  80. package/src/tui/Tui.res.mjs +12 -14
  81. package/svm.schema.json +30 -37
  82. package/src/bindings/Hrtime.res +0 -58
  83. package/src/bindings/Hrtime.res.mjs +0 -90
  84. package/src/bindings/Hrtime.resi +0 -30
package/svm.schema.json CHANGED
@@ -463,53 +463,46 @@
463
463
  "type": "object",
464
464
  "properties": {
465
465
  "transaction_fields": {
466
- "description": "Include the parent transaction for each matched instruction. Use `true` to include all fields.",
467
- "anyOf": [
468
- {
469
- "$ref": "#/$defs/FieldSelectionValue"
470
- },
471
- {
472
- "type": "null"
473
- }
474
- ]
466
+ "description": "Parent-transaction fields to include on each matched instruction, as a list of field names. Omit (or pass an empty list) to include no transaction.",
467
+ "type": [
468
+ "array",
469
+ "null"
470
+ ],
471
+ "items": {
472
+ "$ref": "#/$defs/SvmTransactionField"
473
+ }
475
474
  },
476
475
  "log_fields": {
477
- "description": "Include program logs scoped to each matched instruction. Use `true` to include all fields.",
478
- "anyOf": [
479
- {
480
- "$ref": "#/$defs/FieldSelectionValue"
481
- },
482
- {
483
- "type": "null"
484
- }
476
+ "description": "Set to `true` to include program logs scoped to each matched instruction.",
477
+ "type": [
478
+ "boolean",
479
+ "null"
485
480
  ]
486
481
  },
487
482
  "token_balance_fields": {
488
- "description": "Include SPL Token / Token-2022 balance snapshots for the parent transaction. Implies transaction_fields: true. Use `true` to include all fields.",
489
- "anyOf": [
490
- {
491
- "$ref": "#/$defs/FieldSelectionValue"
492
- },
493
- {
494
- "type": "null"
495
- }
483
+ "description": "Set to `true` to include SPL Token / Token-2022 balance snapshots for the parent transaction, exposed as `transaction.tokenBalances`. Independent of `transaction_fields`.",
484
+ "type": [
485
+ "boolean",
486
+ "null"
496
487
  ]
497
488
  }
498
489
  },
499
490
  "additionalProperties": false
500
491
  },
501
- "FieldSelectionValue": {
502
- "description": "Value for a field-selection entry. `true` includes all fields;\na list of field names enables per-field selection (not yet supported).",
503
- "anyOf": [
504
- {
505
- "type": "boolean"
506
- },
507
- {
508
- "type": "array",
509
- "items": {
510
- "type": "string"
511
- }
512
- }
492
+ "SvmTransactionField": {
493
+ "description": "Selectable parent-transaction field names (camelCase), matching the\npublic `svmTransaction` shape. `tokenBalances` is selected via the\nseparate `token_balance_fields` toggle, so it isn't listed here.",
494
+ "type": "string",
495
+ "enum": [
496
+ "transactionIndex",
497
+ "signatures",
498
+ "feePayer",
499
+ "success",
500
+ "err",
501
+ "fee",
502
+ "computeUnitsConsumed",
503
+ "accountKeys",
504
+ "recentBlockhash",
505
+ "version"
513
506
  ]
514
507
  },
515
508
  "ArgDef": {
@@ -1,58 +0,0 @@
1
- type seconds = float
2
- type milliseconds = float
3
- type nanoseconds = float
4
-
5
- type timeTuple = (seconds, nanoseconds)
6
-
7
- type timeRef = timeTuple
8
-
9
- type timeElapsed = timeTuple
10
-
11
- @val @scope("process") external makeTimer: unit => timeRef = "hrtime"
12
-
13
- @val @scope("process") external timeSince: timeRef => timeElapsed = "hrtime"
14
-
15
- let nanoToMilli = (nano: nanoseconds): milliseconds => nano /. 1_000_000.
16
- let secToMilli = (sec: seconds): milliseconds => sec *. 1_000.
17
-
18
- let nanoToTimeTuple = (nano: nanoseconds): timeTuple => {
19
- let factor = 1_000_000_000.
20
- let seconds = Math.floor(nano /. factor)
21
- let nanos = Float.mod(nano, factor)
22
- (seconds, nanos)
23
- }
24
-
25
- let timeElapsedToNewRef = (elapsed: timeElapsed, ref: timeRef): timeRef => {
26
- let (elapsedSeconds, elapsedNano) = elapsed
27
- let (refSeconds, refNano) = ref
28
-
29
- let (nanoExtraSeconds, remainderNanos) = nanoToTimeTuple(elapsedNano +. refNano)
30
- (elapsedSeconds +. refSeconds +. nanoExtraSeconds, remainderNanos)
31
- }
32
-
33
- let toMillis = ((sec, nano): timeElapsed): milliseconds => {
34
- sec->secToMilli +. nano->nanoToMilli
35
- }
36
-
37
- let toSeconds = ((sec, nano): timeElapsed): seconds => {
38
- sec +. nano /. 1_000_000_000.
39
- }
40
-
41
- let toSecondsFloat = (elapsed: timeElapsed): float => {
42
- elapsed->toSeconds->(Utils.magic: seconds => float)
43
- }
44
-
45
- let toInt = float => float->Int.fromFloat
46
- let intFromMillis = toInt
47
- let intFromNanos = toInt
48
- let intFromSeconds = toInt
49
- let floatFromMillis: milliseconds => float = v => v->(Utils.magic: milliseconds => float)
50
- let floatFromSeconds: seconds => float = v => v->(Utils.magic: seconds => float)
51
-
52
- let millisBetween = (~from: timeRef, ~to: timeRef): int => {
53
- to->toMillis->intFromMillis - from->toMillis->intFromMillis
54
- }
55
-
56
- let secondsBetween = (~from: timeRef, ~to: timeRef): float => {
57
- to->toSecondsFloat -. from->toSecondsFloat
58
- }
@@ -1,90 +0,0 @@
1
- // Generated by ReScript, PLEASE EDIT WITH CARE
2
-
3
-
4
- function nanoToMilli(nano) {
5
- return nano / 1000000;
6
- }
7
-
8
- function secToMilli(sec) {
9
- return sec * 1000;
10
- }
11
-
12
- function nanoToTimeTuple(nano) {
13
- let seconds = Math.floor(nano / 1000000000);
14
- let nanos = nano % 1000000000;
15
- return [
16
- seconds,
17
- nanos
18
- ];
19
- }
20
-
21
- function timeElapsedToNewRef(elapsed, ref) {
22
- let match = nanoToTimeTuple(elapsed[1] + ref[1]);
23
- return [
24
- elapsed[0] + ref[0] + match[0],
25
- match[1]
26
- ];
27
- }
28
-
29
- function toMillis(param) {
30
- return param[0] * 1000 + param[1] / 1000000;
31
- }
32
-
33
- function toSeconds(param) {
34
- return param[0] + param[1] / 1000000000;
35
- }
36
-
37
- let toSecondsFloat = toSeconds;
38
-
39
- function toInt(float) {
40
- return float | 0;
41
- }
42
-
43
- function floatFromMillis(v) {
44
- return v;
45
- }
46
-
47
- function floatFromSeconds(v) {
48
- return v;
49
- }
50
-
51
- function millisBetween(from, to) {
52
- return (toMillis(to) | 0) - (toMillis(from) | 0) | 0;
53
- }
54
-
55
- function secondsBetween(from, to) {
56
- return toSeconds(to) - toSeconds(from);
57
- }
58
-
59
- function makeTimer(prim) {
60
- return process.hrtime();
61
- }
62
-
63
- function timeSince(prim) {
64
- return process.hrtime(prim);
65
- }
66
-
67
- let intFromMillis = toInt;
68
-
69
- let intFromNanos = toInt;
70
-
71
- let intFromSeconds = toInt;
72
-
73
- export {
74
- makeTimer,
75
- timeSince,
76
- nanoToMilli,
77
- secToMilli,
78
- timeElapsedToNewRef,
79
- toMillis,
80
- toSeconds,
81
- toSecondsFloat,
82
- intFromMillis,
83
- intFromNanos,
84
- intFromSeconds,
85
- floatFromMillis,
86
- floatFromSeconds,
87
- millisBetween,
88
- secondsBetween,
89
- }
90
- /* No side effect */
@@ -1,30 +0,0 @@
1
- type seconds
2
- type milliseconds
3
- type nanoseconds
4
-
5
- type timeTuple = (seconds, nanoseconds)
6
-
7
- type timeRef
8
-
9
- type timeElapsed = timeTuple
10
-
11
- let makeTimer: unit => timeRef
12
-
13
- let timeSince: timeRef => timeElapsed
14
-
15
- let nanoToMilli: nanoseconds => milliseconds
16
- let secToMilli: seconds => milliseconds
17
-
18
- let timeElapsedToNewRef: (timeElapsed, timeRef) => timeRef
19
- let toMillis: timeElapsed => milliseconds
20
- let toSeconds: timeElapsed => seconds
21
- let toSecondsFloat: timeElapsed => float
22
-
23
- let intFromMillis: milliseconds => int
24
- let intFromNanos: nanoseconds => int
25
- let intFromSeconds: seconds => int
26
- let floatFromMillis: milliseconds => float
27
- let floatFromSeconds: seconds => float
28
-
29
- let millisBetween: (~from: timeRef, ~to: timeRef) => int
30
- let secondsBetween: (~from: timeRef, ~to: timeRef) => float