envio 3.3.0-alpha.4 → 3.3.0-alpha.6

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 (55) hide show
  1. package/evm.schema.json +10 -0
  2. package/package.json +7 -7
  3. package/src/Batch.res.mjs +1 -1
  4. package/src/BatchProcessing.res +5 -0
  5. package/src/BatchProcessing.res.mjs +6 -0
  6. package/src/ChainState.res +41 -7
  7. package/src/ChainState.res.mjs +22 -18
  8. package/src/ChainState.resi +3 -1
  9. package/src/Config.res +3 -0
  10. package/src/Config.res.mjs +3 -1
  11. package/src/Core.res +0 -3
  12. package/src/ExitOnCaughtUp.res +10 -2
  13. package/src/ExitOnCaughtUp.res.mjs +10 -1
  14. package/src/FetchState.res +63 -133
  15. package/src/FetchState.res.mjs +107 -166
  16. package/src/IndexerState.res +4 -0
  17. package/src/IndexerState.res.mjs +8 -1
  18. package/src/IndexerState.resi +1 -0
  19. package/src/IndexingAddresses.res +105 -0
  20. package/src/IndexingAddresses.res.mjs +100 -0
  21. package/src/IndexingAddresses.resi +32 -0
  22. package/src/Main.res +4 -15
  23. package/src/Main.res.mjs +6 -14
  24. package/src/Metrics.res +33 -0
  25. package/src/Metrics.res.mjs +39 -0
  26. package/src/Prometheus.res +2 -20
  27. package/src/Prometheus.res.mjs +83 -95
  28. package/src/SimulateDeadInputTracker.res +85 -0
  29. package/src/SimulateDeadInputTracker.res.mjs +73 -0
  30. package/src/SimulateDeadInputTracker.resi +12 -0
  31. package/src/SimulateItems.res +23 -42
  32. package/src/SimulateItems.res.mjs +12 -30
  33. package/src/TestIndexer.res +3 -27
  34. package/src/TestIndexer.res.mjs +2 -9
  35. package/src/bindings/Viem.res +0 -41
  36. package/src/bindings/Viem.res.mjs +1 -43
  37. package/src/sources/Evm.res +7 -36
  38. package/src/sources/Evm.res.mjs +4 -36
  39. package/src/sources/EvmChain.res +4 -2
  40. package/src/sources/EvmChain.res.mjs +3 -2
  41. package/src/sources/EvmRpcClient.res +36 -5
  42. package/src/sources/EvmRpcClient.res.mjs +7 -4
  43. package/src/sources/HyperSyncClient.res +0 -35
  44. package/src/sources/HyperSyncClient.res.mjs +1 -8
  45. package/src/sources/Rpc.res +15 -47
  46. package/src/sources/Rpc.res.mjs +25 -56
  47. package/src/sources/RpcSource.res +289 -204
  48. package/src/sources/RpcSource.res.mjs +293 -303
  49. package/src/sources/SimulateSource.res +1 -0
  50. package/src/sources/SimulateSource.res.mjs +2 -1
  51. package/src/sources/Source.res +4 -0
  52. package/src/sources/Svm.res +7 -15
  53. package/src/sources/Svm.res.mjs +4 -15
  54. package/src/sources/TransactionStore.res +14 -2
  55. package/src/sources/TransactionStore.res.mjs +10 -2
@@ -6,6 +6,7 @@ let make = (~items: array<Internal.item>, ~endBlock: int, ~chain: ChainMap.Chain
6
6
 
7
7
  {
8
8
  name: "SimulateSource",
9
+ simulateItems: items,
9
10
  sourceFor: Sync,
10
11
  chain,
11
12
  poweredByHyperSync: false,
@@ -32,7 +32,8 @@ function make(items, endBlock, chain) {
32
32
  "total time elapsed (s)": 0
33
33
  }
34
34
  });
35
- }
35
+ },
36
+ simulateItems: items
36
37
  };
37
38
  }
38
39
 
@@ -71,4 +71,8 @@ type t = {
71
71
  // Invoked by SourceManager once a rollback target is known so the source can
72
72
  // drop any state that may now point at an orphaned chain (e.g. RPC block cache).
73
73
  onReorg?: (~rollbackTargetBlock: int) => unit,
74
+ // Present only on the simulate source: the items a test fed in. The chain
75
+ // tracks which of these never reach a handler so the run can report dead
76
+ // simulate inputs on completion.
77
+ simulateItems?: array<Internal.item>,
74
78
  }
@@ -4,21 +4,13 @@ let cleanUpRawEventFieldsInPlace: JSON.t => unit = %raw(`fields => {
4
4
  delete fields.time
5
5
  }`)
6
6
 
7
- // Ordered transaction field names. The index of each is the field code shared
8
- // with the Rust store (`SvmTxField`) keep this order in sync.
9
- let transactionFields = [
10
- "transactionIndex",
11
- "signatures",
12
- "feePayer",
13
- "success",
14
- "err",
15
- "fee",
16
- "computeUnitsConsumed",
17
- "accountKeys",
18
- "recentBlockhash",
19
- "version",
20
- "tokenBalances",
21
- ]
7
+ // Ordered transaction field names, the field codes shared with the Rust store
8
+ // (`SvmTxField`). Derived from the typed field list so the two can't drift;
9
+ // `Internal.allSvmTransactionFields` is pinned to the Rust ordinal order by a test.
10
+ let transactionFields =
11
+ Internal.allSvmTransactionFields->(
12
+ Utils.magic: array<Internal.svmTransactionField> => array<string>
13
+ )
22
14
 
23
15
  // One instruction's selected transaction fields → store selection bitmask.
24
16
  // Computed per event at config build and cached on the event config.
@@ -4,6 +4,7 @@ import * as Rpc from "./Rpc.res.mjs";
4
4
  import * as Rest from "../vendored/Rest.res.mjs";
5
5
  import * as Utils from "../Utils.res.mjs";
6
6
  import * as Logging from "../Logging.res.mjs";
7
+ import * as Internal from "../Internal.res.mjs";
7
8
  import * as Prometheus from "../Prometheus.res.mjs";
8
9
  import * as Performance from "../bindings/Performance.res.mjs";
9
10
  import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
@@ -16,21 +17,7 @@ let cleanUpRawEventFieldsInPlace = (fields => {
16
17
  delete fields.time
17
18
  });
18
19
 
19
- let transactionFields = [
20
- "transactionIndex",
21
- "signatures",
22
- "feePayer",
23
- "success",
24
- "err",
25
- "fee",
26
- "computeUnitsConsumed",
27
- "accountKeys",
28
- "recentBlockhash",
29
- "version",
30
- "tokenBalances"
31
- ];
32
-
33
- let eventTransactionFieldMask = TransactionStore.makeMaskFn(transactionFields);
20
+ let eventTransactionFieldMask = TransactionStore.makeMaskFn(Internal.allSvmTransactionFields);
34
21
 
35
22
  function make(logger) {
36
23
  return {
@@ -93,6 +80,8 @@ function makeRPCSource(chain, rpc, sourceForOpt) {
93
80
  };
94
81
  }
95
82
 
83
+ let transactionFields = Internal.allSvmTransactionFields;
84
+
96
85
  export {
97
86
  cleanUpRawEventFieldsInPlace,
98
87
  transactionFields,
@@ -6,8 +6,20 @@
6
6
  // in columnar form and zipped into plain JS objects on the main thread.
7
7
  type t
8
8
 
9
- @send external classNew: Core.transactionStoreCtor => t = "new"
10
- let make = (): t => Core.getAddon().transactionStore->classNew
9
+ @send external newEvm: (Core.transactionStoreCtor, ~shouldChecksum: bool) => t = "newEvm"
10
+ @send external newSvm: Core.transactionStoreCtor => t = "newSvm"
11
+ @send external newFuel: Core.transactionStoreCtor => t = "newFuel"
12
+
13
+ // The store's ecosystem is fixed here, from the chain's config. EVM carries the
14
+ // chain's address-checksumming setting; SVM/Fuel need no extra data.
15
+ let make = (~ecosystem: Ecosystem.name, ~shouldChecksum: bool): t => {
16
+ let ctor = Core.getAddon().transactionStore
17
+ switch ecosystem {
18
+ | Evm => ctor->newEvm(~shouldChecksum)
19
+ | Svm => ctor->newSvm
20
+ | Fuel => ctor->newFuel
21
+ }
22
+ }
11
23
 
12
24
  // Field-name → bit-index map from an ordered field-name array. The index is the
13
25
  // field code shared with the Rust store (`EvmTxField`/`SvmTxField`).
@@ -3,8 +3,16 @@
3
3
  import * as Core from "../Core.res.mjs";
4
4
  import * as Utils from "../Utils.res.mjs";
5
5
 
6
- function make() {
7
- return Core.getAddon().TransactionStore.new();
6
+ function make(ecosystem, shouldChecksum) {
7
+ let ctor = Core.getAddon().TransactionStore;
8
+ switch (ecosystem) {
9
+ case "evm" :
10
+ return ctor.newEvm(shouldChecksum);
11
+ case "fuel" :
12
+ return ctor.newFuel();
13
+ case "svm" :
14
+ return ctor.newSvm();
15
+ }
8
16
  }
9
17
 
10
18
  function fieldCodes(fields) {