envio 3.0.0-alpha.2 → 3.0.0-alpha.4

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 (74) hide show
  1. package/README.md +2 -2
  2. package/evm.schema.json +44 -34
  3. package/fuel.schema.json +32 -21
  4. package/index.d.ts +4 -1
  5. package/index.js +1 -0
  6. package/package.json +7 -6
  7. package/src/Batch.res.mjs +1 -1
  8. package/src/Benchmark.res +394 -0
  9. package/src/Benchmark.res.mjs +398 -0
  10. package/src/ChainFetcher.res +459 -0
  11. package/src/ChainFetcher.res.mjs +281 -0
  12. package/src/ChainManager.res +179 -0
  13. package/src/ChainManager.res.mjs +139 -0
  14. package/src/Config.res +15 -1
  15. package/src/Config.res.mjs +28 -5
  16. package/src/Ecosystem.res +9 -124
  17. package/src/Ecosystem.res.mjs +19 -160
  18. package/src/Env.res +0 -1
  19. package/src/Env.res.mjs +0 -3
  20. package/src/Envio.gen.ts +9 -1
  21. package/src/Envio.res +12 -9
  22. package/src/EventProcessing.res +476 -0
  23. package/src/EventProcessing.res.mjs +341 -0
  24. package/src/FetchState.res +54 -29
  25. package/src/FetchState.res.mjs +62 -35
  26. package/src/GlobalState.res +1169 -0
  27. package/src/GlobalState.res.mjs +1196 -0
  28. package/src/Internal.res +43 -1
  29. package/src/LoadLayer.res +444 -0
  30. package/src/LoadLayer.res.mjs +296 -0
  31. package/src/LoadLayer.resi +32 -0
  32. package/src/Prometheus.res +8 -8
  33. package/src/Prometheus.res.mjs +10 -10
  34. package/src/ReorgDetection.res +6 -10
  35. package/src/ReorgDetection.res.mjs +6 -6
  36. package/src/Types.ts +1 -1
  37. package/src/UserContext.res +356 -0
  38. package/src/UserContext.res.mjs +238 -0
  39. package/src/Utils.res +15 -0
  40. package/src/Utils.res.mjs +18 -0
  41. package/src/bindings/ClickHouse.res +31 -1
  42. package/src/bindings/ClickHouse.res.mjs +27 -1
  43. package/src/bindings/DateFns.res +71 -0
  44. package/src/bindings/DateFns.res.mjs +22 -0
  45. package/src/bindings/Ethers.res +27 -63
  46. package/src/bindings/Ethers.res.mjs +18 -65
  47. package/src/sources/Evm.res +87 -0
  48. package/src/sources/Evm.res.mjs +105 -0
  49. package/src/sources/EvmChain.res +95 -0
  50. package/src/sources/EvmChain.res.mjs +61 -0
  51. package/src/sources/Fuel.res +19 -34
  52. package/src/sources/Fuel.res.mjs +34 -16
  53. package/src/sources/FuelSDK.res +37 -0
  54. package/src/sources/FuelSDK.res.mjs +29 -0
  55. package/src/sources/HyperFuel.res +2 -2
  56. package/src/sources/HyperFuel.resi +1 -1
  57. package/src/sources/HyperFuelClient.res +2 -2
  58. package/src/sources/HyperFuelSource.res +8 -8
  59. package/src/sources/HyperFuelSource.res.mjs +5 -5
  60. package/src/sources/HyperSyncHeightStream.res +28 -110
  61. package/src/sources/HyperSyncHeightStream.res.mjs +30 -63
  62. package/src/sources/HyperSyncSource.res +16 -18
  63. package/src/sources/HyperSyncSource.res.mjs +25 -25
  64. package/src/sources/Rpc.res +43 -0
  65. package/src/sources/Rpc.res.mjs +31 -0
  66. package/src/sources/RpcSource.res +13 -8
  67. package/src/sources/RpcSource.res.mjs +12 -7
  68. package/src/sources/Source.res +3 -2
  69. package/src/sources/SourceManager.res +183 -108
  70. package/src/sources/SourceManager.res.mjs +162 -99
  71. package/src/sources/SourceManager.resi +4 -5
  72. package/src/sources/Svm.res +59 -0
  73. package/src/sources/Svm.res.mjs +79 -0
  74. package/src/bindings/Ethers.gen.ts +0 -14
@@ -98,6 +98,36 @@ let getClickHouseFieldType = (
98
98
  isNullable ? `Nullable(${baseType})` : baseType
99
99
  }
100
100
 
101
+ // Creates an entity schema from table definition, using clickHouseDate for Date fields
102
+ let makeClickHouseEntitySchema = (table: Table.table): S.t<Internal.entity> => {
103
+ S.schema(s => {
104
+ let dict = Js.Dict.empty()
105
+ table.fields->Belt.Array.forEach(field => {
106
+ switch field {
107
+ | Field(f) => {
108
+ let fieldName = f->Table.getDbFieldName
109
+ let fieldSchema = switch f.fieldType {
110
+ | Date => {
111
+ let dateSchema = Utils.Schema.clickHouseDate->S.toUnknown
112
+ if f.isNullable {
113
+ S.null(dateSchema)->S.toUnknown
114
+ } else if f.isArray {
115
+ S.array(dateSchema)->S.toUnknown
116
+ } else {
117
+ dateSchema
118
+ }
119
+ }
120
+ | _ => f.fieldSchema
121
+ }
122
+ dict->Js.Dict.set(fieldName, s.matches(fieldSchema))
123
+ }
124
+ | DerivedFrom(_) => () // Skip derived fields
125
+ }
126
+ })
127
+ dict->Utils.magic
128
+ })
129
+ }
130
+
101
131
  let setCheckpointsOrThrow = async (client, ~batch: Batch.t, ~database: string) => {
102
132
  let checkpointsCount = batch.checkpointIds->Array.length
103
133
  if checkpointsCount === 0 {
@@ -154,7 +184,7 @@ let setUpdatesOrThrow = async (
154
184
  )}\``,
155
185
  convertOrThrow: S.compile(
156
186
  S.union([
157
- EntityHistory.makeSetUpdateSchema(entityConfig.schema),
187
+ EntityHistory.makeSetUpdateSchema(makeClickHouseEntitySchema(entityConfig.table)),
158
188
  S.object(s => {
159
189
  s.tag(EntityHistory.changeFieldName, EntityHistory.RowAction.DELETE)
160
190
  Change.Delete({
@@ -76,6 +76,31 @@ function getClickHouseFieldType(fieldType, isNullable, isArray) {
76
76
  }
77
77
  }
78
78
 
79
+ function makeClickHouseEntitySchema(table) {
80
+ return S$RescriptSchema.schema(function (s) {
81
+ var dict = {};
82
+ Belt_Array.forEach(table.fields, (function (field) {
83
+ if (field.TAG !== "Field") {
84
+ return ;
85
+ }
86
+ var f = field._0;
87
+ var fieldName = Table.getDbFieldName(f);
88
+ var match = f.fieldType;
89
+ var fieldSchema;
90
+ if (typeof match !== "object" && match === "Date") {
91
+ var dateSchema = Utils.Schema.clickHouseDate;
92
+ fieldSchema = f.isNullable ? S$RescriptSchema.$$null(dateSchema) : (
93
+ f.isArray ? S$RescriptSchema.array(dateSchema) : dateSchema
94
+ );
95
+ } else {
96
+ fieldSchema = f.fieldSchema;
97
+ }
98
+ dict[fieldName] = s.m(fieldSchema);
99
+ }));
100
+ return dict;
101
+ });
102
+ }
103
+
79
104
  async function setCheckpointsOrThrow(client, batch, database) {
80
105
  var checkpointsCount = batch.checkpointIds.length;
81
106
  if (checkpointsCount === 0) {
@@ -120,7 +145,7 @@ async function setUpdatesOrThrow(client, updates, entityConfig, database) {
120
145
  } else {
121
146
  var cache_tableName = database + ".\`" + EntityHistory.historyTableName(entityConfig.name, entityConfig.index) + "\`";
122
147
  var cache_convertOrThrow = S$RescriptSchema.compile(S$RescriptSchema.union([
123
- EntityHistory.makeSetUpdateSchema(entityConfig.schema),
148
+ EntityHistory.makeSetUpdateSchema(makeClickHouseEntitySchema(entityConfig.table)),
124
149
  S$RescriptSchema.object(function (s) {
125
150
  s.tag(EntityHistory.changeFieldName, "DELETE");
126
151
  return {
@@ -264,6 +289,7 @@ async function resume(client, database, checkpointId) {
264
289
 
265
290
  export {
266
291
  getClickHouseFieldType ,
292
+ makeClickHouseEntitySchema ,
267
293
  setCheckpointsOrThrow ,
268
294
  setUpdatesOrThrow ,
269
295
  makeCreateHistoryTableQuery ,
@@ -0,0 +1,71 @@
1
+ /**
2
+ Formats:
3
+ hh:mm:ss | 00:00:00
4
+ do MMM ''yy | 1st Jan '21
5
+ ha do MMM ''yy | 8PM 1st Jan '21
6
+ ha | 8PM
7
+ iii | Tues
8
+ iii MMM | Tues Jan
9
+ MMM | Jan
10
+ `)
11
+ */
12
+ type dateFormats =
13
+ | @as("HH:mm:ss") HoursMinSec
14
+ | @as("ha") Hour
15
+ | @as("do MMM ''yy") DayMonthYear
16
+ | @as("ha do MMM ''yy") HourDayMonthYear
17
+ | @as("h:mma do MMM ''yy") HourMinDayMonthYear
18
+ | @as("iii") DayName
19
+ | @as("iii MMM") DayNameMonth
20
+ | @as("do MMM") DayMonth
21
+ | @as("MMM") Month
22
+ | @as("h:mma") HourMin
23
+
24
+ @module("date-fns") external format: (Js.Date.t, dateFormats) => string = "format"
25
+
26
+ type formatDistanceToNowOptions = {includeSeconds: bool}
27
+ @module("date-fns")
28
+ external formatDistanceToNow: Js.Date.t => string = "formatDistanceToNow"
29
+
30
+ @module("date-fns")
31
+ external formatDistance: (Js.Date.t, Js.Date.t) => string = "formatDistance"
32
+
33
+ @module("date-fns")
34
+ external formatDistanceWithOptions: (Js.Date.t, Js.Date.t, formatDistanceToNowOptions) => string =
35
+ "formatDistance"
36
+
37
+ @module("date-fns")
38
+ external formatDistanceToNowWithOptions: (Js.Date.t, formatDistanceToNowOptions) => string =
39
+ "formatDistanceToNow"
40
+
41
+ let formatDistanceToNowWithSeconds = (date: Js.Date.t) =>
42
+ date->formatDistanceToNowWithOptions({includeSeconds: true})
43
+
44
+ type durationTimeFormat = {
45
+ years: int,
46
+ months: int,
47
+ weeks: int,
48
+ days: int,
49
+ hours: int,
50
+ minutes: int,
51
+ seconds: int,
52
+ }
53
+
54
+ @module("date-fns")
55
+ external formatRelative: (Js.Date.t, Js.Date.t) => string = "formatRelative"
56
+
57
+ type durationFormatOutput = {format: array<string>}
58
+
59
+ @module("date-fns")
60
+ external formatDuration: (durationTimeFormat, durationFormatOutput) => string = "formatDuration"
61
+
62
+ type interval = {start: Js_date.t, end: Js_date.t}
63
+
64
+ @module("date-fns")
65
+ external intervalToDuration: interval => durationTimeFormat = "intervalToDuration"
66
+
67
+ //helper to convert millis elapsed to duration object
68
+ let durationFromMillis = (millis: int) =>
69
+ intervalToDuration({start: 0->Utils.magic, end: millis->Utils.magic})
70
+
71
+ @module("date-fns") external fromUnixTime: float => Js.Date.t = "fromUnixTime"
@@ -0,0 +1,22 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as DateFns from "date-fns";
4
+
5
+ function formatDistanceToNowWithSeconds(date) {
6
+ return DateFns.formatDistanceToNow(date, {
7
+ includeSeconds: true
8
+ });
9
+ }
10
+
11
+ function durationFromMillis(millis) {
12
+ return DateFns.intervalToDuration({
13
+ start: 0,
14
+ end: millis
15
+ });
16
+ }
17
+
18
+ export {
19
+ formatDistanceToNowWithSeconds ,
20
+ durationFromMillis ,
21
+ }
22
+ /* date-fns Not a pure module */
@@ -2,15 +2,6 @@ type abi = EvmTypes.Abi.t
2
2
 
3
3
  let makeAbi = (abi: Js.Json.t): abi => abi->Utils.magic
4
4
 
5
- @deprecated("Use Address.t instead. The type will be removed in v3")
6
- type ethAddress = Address.t
7
- @deprecated("Use Address.Evm.fromStringOrThrow instead. The function will be removed in v3")
8
- let getAddressFromStringUnsafe = Address.Evm.fromStringOrThrow
9
- @deprecated("Use Address.toString instead. The function will be removed in v3")
10
- let ethAddressToString = Address.toString
11
- @deprecated("Use Address.schema instead. The function will be removed in v3")
12
- let ethAddressSchema = Address.schema
13
-
14
5
  type txHash = string
15
6
 
16
7
  module Constants = {
@@ -18,35 +9,6 @@ module Constants = {
18
9
  @module("ethers") @scope("ethers") external zeroAddress: Address.t = "ZeroAddress"
19
10
  }
20
11
 
21
- module Addresses = {
22
- @genType
23
- let mockAddresses = [
24
- "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
25
- "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
26
- "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
27
- "0x90F79bf6EB2c4f870365E785982E1f101E93b906",
28
- "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",
29
- "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
30
- "0x976EA74026E726554dB657fA54763abd0C3a0aa9",
31
- "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955",
32
- "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f",
33
- "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
34
- "0xBcd4042DE499D14e55001CcbB24a551F3b954096",
35
- "0x71bE63f3384f5fb98995898A86B02Fb2426c5788",
36
- "0xFABB0ac9d68B0B445fB7357272Ff202C5651694a",
37
- "0x1CBd3b2770909D4e10f157cABC84C7264073C9Ec",
38
- "0xdF3e18d64BC6A983f673Ab319CCaE4f1a57C7097",
39
- "0xcd3B766CCDd6AE721141F452C550Ca635964ce71",
40
- "0x2546BcD3c84621e976D8185a91A922aE77ECEc30",
41
- "0xbDA5747bFD65F08deb54cb465eB87D40e51B197E",
42
- "0xdD2FD4581271e230360230F9337D5c0430Bf44C0",
43
- "0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199",
44
- ]->Belt.Array.map(getAddressFromStringUnsafe)
45
- @genType
46
- let defaultAddress =
47
- mockAddresses[0]
48
- }
49
-
50
12
  module Filter = {
51
13
  type t
52
14
  }
@@ -144,41 +106,43 @@ module JsonRpcProvider = {
144
106
  @send
145
107
  external getLogs: (t, ~filter: Filter.t) => promise<array<log>> = "getLogs"
146
108
 
147
- @send
148
- external getTransaction: (t, ~transactionHash: string) => promise<transaction> = "getTransaction"
149
-
150
109
  let makeGetTransactionFields = (~getTransactionByHash, ~lowercaseAddresses: bool) => async (
151
110
  log: log,
152
- ): promise<unknown> => {
153
- let transaction = await getTransactionByHash(log.transactionHash)
111
+ ): promise<Internal.evmTransactionFields> => {
112
+ let transaction: Internal.evmTransactionFields = await getTransactionByHash(log.transactionHash)
154
113
  // Mutating should be fine, since the transaction isn't used anywhere else outside the function
155
114
  let fields: {..} = transaction->Obj.magic
156
115
 
157
- // Make it compatible with HyperSync transaction fields
116
+ // RPC may return null for transactionIndex on pending transactions
158
117
  fields["transactionIndex"] = log.transactionIndex
159
- fields["input"] = fields["data"]
160
118
 
161
119
  // NOTE: this is wasteful if these fields are not selected in the users config.
162
120
  // There might be a better way to do this in the `makeThrowingGetEventTransaction` function rather based on the schema.
163
121
  // However this is not extremely expensive and good enough for now (only on rpc sync also).
164
- if lowercaseAddresses {
165
- open Js.Nullable
166
- switch fields["from"] {
167
- | Value(from) => fields["from"] = from->Js.String2.toLowerCase
168
- | Undefined => ()
169
- | Null => ()
170
- }
171
- switch fields["to"] {
172
- | Value(to) => fields["to"] = to->Js.String2.toLowerCase
173
- | Undefined => ()
174
- | Null => ()
175
- }
176
- switch fields["contractAddress"] {
177
- | Value(contractAddress) =>
178
- fields["contractAddress"] = contractAddress->Js.String2.toLowerCase
179
- | Undefined => ()
180
- | Null => ()
181
- }
122
+ open Js.Nullable
123
+ switch fields["from"] {
124
+ | Value(from) =>
125
+ fields["from"] = lowercaseAddresses
126
+ ? from->Js.String2.toLowerCase->Address.unsafeFromString
127
+ : from->Address.Evm.fromStringOrThrow
128
+ | Undefined => ()
129
+ | Null => ()
130
+ }
131
+ switch fields["to"] {
132
+ | Value(to) =>
133
+ fields["to"] = lowercaseAddresses
134
+ ? to->Js.String2.toLowerCase->Address.unsafeFromString
135
+ : to->Address.Evm.fromStringOrThrow
136
+ | Undefined => ()
137
+ | Null => ()
138
+ }
139
+ switch fields["contractAddress"] {
140
+ | Value(contractAddress) =>
141
+ fields["contractAddress"] = lowercaseAddresses
142
+ ? contractAddress->Js.String2.toLowerCase->Address.unsafeFromString
143
+ : contractAddress->Address.Evm.fromStringOrThrow
144
+ | Undefined => ()
145
+ | Null => ()
182
146
  }
183
147
 
184
148
  fields->Obj.magic
@@ -2,52 +2,14 @@
2
2
 
3
3
  import * as Ethers from "ethers";
4
4
  import * as Address from "../Address.res.mjs";
5
- import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
6
- import * as Caml_array from "rescript/lib/es6/caml_array.js";
7
5
  import * as Caml_option from "rescript/lib/es6/caml_option.js";
8
6
 
9
7
  function makeAbi(abi) {
10
8
  return abi;
11
9
  }
12
10
 
13
- var getAddressFromStringUnsafe = Address.Evm.fromStringOrThrow;
14
-
15
- function ethAddressToString(prim) {
16
- return prim;
17
- }
18
-
19
11
  var Constants = {};
20
12
 
21
- var mockAddresses = Belt_Array.map([
22
- "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
23
- "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
24
- "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
25
- "0x90F79bf6EB2c4f870365E785982E1f101E93b906",
26
- "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",
27
- "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
28
- "0x976EA74026E726554dB657fA54763abd0C3a0aa9",
29
- "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955",
30
- "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f",
31
- "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
32
- "0xBcd4042DE499D14e55001CcbB24a551F3b954096",
33
- "0x71bE63f3384f5fb98995898A86B02Fb2426c5788",
34
- "0xFABB0ac9d68B0B445fB7357272Ff202C5651694a",
35
- "0x1CBd3b2770909D4e10f157cABC84C7264073C9Ec",
36
- "0xdF3e18d64BC6A983f673Ab319CCaE4f1a57C7097",
37
- "0xcd3B766CCDd6AE721141F452C550Ca635964ce71",
38
- "0x2546BcD3c84621e976D8185a91A922aE77ECEc30",
39
- "0xbDA5747bFD65F08deb54cb465eB87D40e51B197E",
40
- "0xdD2FD4581271e230360230F9337D5c0430Bf44C0",
41
- "0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199"
42
- ], getAddressFromStringUnsafe);
43
-
44
- var defaultAddress = Caml_array.get(mockAddresses, 0);
45
-
46
- var Addresses = {
47
- mockAddresses: mockAddresses,
48
- defaultAddress: defaultAddress
49
- };
50
-
51
13
  var Filter = {};
52
14
 
53
15
  function toFilter(combinedFilter) {
@@ -81,26 +43,23 @@ function makeGetTransactionFields(getTransactionByHash, lowercaseAddresses) {
81
43
  return async function (log) {
82
44
  var transaction = await getTransactionByHash(log.transactionHash);
83
45
  transaction.transactionIndex = log.transactionIndex;
84
- transaction.input = transaction.data;
85
- if (lowercaseAddresses) {
86
- var from = transaction.from;
87
- if (from === null || from === undefined) {
88
- from === null;
89
- } else {
90
- transaction.from = from.toLowerCase();
91
- }
92
- var to = transaction.to;
93
- if (to === null || to === undefined) {
94
- to === null;
95
- } else {
96
- transaction.to = to.toLowerCase();
97
- }
98
- var contractAddress = transaction.contractAddress;
99
- if (contractAddress === null || contractAddress === undefined) {
100
- contractAddress === null;
101
- } else {
102
- transaction.contractAddress = contractAddress.toLowerCase();
103
- }
46
+ var from = transaction.from;
47
+ if (from === null || from === undefined) {
48
+ from === null;
49
+ } else {
50
+ transaction.from = lowercaseAddresses ? from.toLowerCase() : Address.Evm.fromStringOrThrow(from);
51
+ }
52
+ var to = transaction.to;
53
+ if (to === null || to === undefined) {
54
+ to === null;
55
+ } else {
56
+ transaction.to = lowercaseAddresses ? to.toLowerCase() : Address.Evm.fromStringOrThrow(to);
57
+ }
58
+ var contractAddress = transaction.contractAddress;
59
+ if (contractAddress === null || contractAddress === undefined) {
60
+ contractAddress === null;
61
+ } else {
62
+ transaction.contractAddress = lowercaseAddresses ? contractAddress.toLowerCase() : Address.Evm.fromStringOrThrow(contractAddress);
104
63
  }
105
64
  return transaction;
106
65
  };
@@ -112,19 +71,13 @@ var JsonRpcProvider = {
112
71
  makeGetTransactionFields: makeGetTransactionFields
113
72
  };
114
73
 
115
- var ethAddressSchema = Address.schema;
116
-
117
74
  export {
118
75
  makeAbi ,
119
- getAddressFromStringUnsafe ,
120
- ethAddressToString ,
121
- ethAddressSchema ,
122
76
  Constants ,
123
- Addresses ,
124
77
  Filter ,
125
78
  CombinedFilter ,
126
79
  logToMinimumParseableLogData ,
127
80
  Network ,
128
81
  JsonRpcProvider ,
129
82
  }
130
- /* mockAddresses Not a pure module */
83
+ /* ethers Not a pure module */
@@ -0,0 +1,87 @@
1
+ @get external getNumber: Internal.eventBlock => int = "number"
2
+ @get external getTimestamp: Internal.eventBlock => int = "timestamp"
3
+ @get external getId: Internal.eventBlock => string = "hash"
4
+
5
+ let cleanUpRawEventFieldsInPlace: Js.Json.t => unit = %raw(`fields => {
6
+ delete fields.hash
7
+ delete fields.number
8
+ delete fields.timestamp
9
+ }`)
10
+
11
+ let ecosystem: Ecosystem.t = {
12
+ name: Evm,
13
+ blockFields: [
14
+ "number",
15
+ "timestamp",
16
+ "hash",
17
+ "parentHash",
18
+ "nonce",
19
+ "sha3Uncles",
20
+ "logsBloom",
21
+ "transactionsRoot",
22
+ "stateRoot",
23
+ "receiptsRoot",
24
+ "miner",
25
+ "difficulty",
26
+ "totalDifficulty",
27
+ "extraData",
28
+ "size",
29
+ "gasLimit",
30
+ "gasUsed",
31
+ "uncles",
32
+ "baseFeePerGas",
33
+ "blobGasUsed",
34
+ "excessBlobGas",
35
+ "parentBeaconBlockRoot",
36
+ "withdrawalsRoot",
37
+ "l1BlockNumber",
38
+ "sendCount",
39
+ "sendRoot",
40
+ "mixHash",
41
+ ],
42
+ transactionFields: [
43
+ "transactionIndex",
44
+ "hash",
45
+ "from",
46
+ "to",
47
+ "gas",
48
+ "gasPrice",
49
+ "maxPriorityFeePerGas",
50
+ "maxFeePerGas",
51
+ "cumulativeGasUsed",
52
+ "effectiveGasPrice",
53
+ "gasUsed",
54
+ "input",
55
+ "nonce",
56
+ "value",
57
+ "v",
58
+ "r",
59
+ "s",
60
+ "contractAddress",
61
+ "logsBloom",
62
+ "root",
63
+ "status",
64
+ "yParity",
65
+ "chainId",
66
+ "maxFeePerBlobGas",
67
+ "blobVersionedHashes",
68
+ "type",
69
+ "l1Fee",
70
+ "l1GasPrice",
71
+ "l1GasUsed",
72
+ "l1FeeScalar",
73
+ "gasUsedForL1",
74
+ "accessList",
75
+ "authorizationList",
76
+ ],
77
+ blockNumberName: "number",
78
+ blockTimestampName: "timestamp",
79
+ blockHashName: "hash",
80
+ getNumber,
81
+ getTimestamp,
82
+ getId,
83
+ cleanUpRawEventFieldsInPlace,
84
+ }
85
+
86
+
87
+
@@ -0,0 +1,105 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+
4
+ var cleanUpRawEventFieldsInPlace = (fields => {
5
+ delete fields.hash
6
+ delete fields.number
7
+ delete fields.timestamp
8
+ });
9
+
10
+ var ecosystem_blockFields = [
11
+ "number",
12
+ "timestamp",
13
+ "hash",
14
+ "parentHash",
15
+ "nonce",
16
+ "sha3Uncles",
17
+ "logsBloom",
18
+ "transactionsRoot",
19
+ "stateRoot",
20
+ "receiptsRoot",
21
+ "miner",
22
+ "difficulty",
23
+ "totalDifficulty",
24
+ "extraData",
25
+ "size",
26
+ "gasLimit",
27
+ "gasUsed",
28
+ "uncles",
29
+ "baseFeePerGas",
30
+ "blobGasUsed",
31
+ "excessBlobGas",
32
+ "parentBeaconBlockRoot",
33
+ "withdrawalsRoot",
34
+ "l1BlockNumber",
35
+ "sendCount",
36
+ "sendRoot",
37
+ "mixHash"
38
+ ];
39
+
40
+ var ecosystem_transactionFields = [
41
+ "transactionIndex",
42
+ "hash",
43
+ "from",
44
+ "to",
45
+ "gas",
46
+ "gasPrice",
47
+ "maxPriorityFeePerGas",
48
+ "maxFeePerGas",
49
+ "cumulativeGasUsed",
50
+ "effectiveGasPrice",
51
+ "gasUsed",
52
+ "input",
53
+ "nonce",
54
+ "value",
55
+ "v",
56
+ "r",
57
+ "s",
58
+ "contractAddress",
59
+ "logsBloom",
60
+ "root",
61
+ "status",
62
+ "yParity",
63
+ "chainId",
64
+ "maxFeePerBlobGas",
65
+ "blobVersionedHashes",
66
+ "type",
67
+ "l1Fee",
68
+ "l1GasPrice",
69
+ "l1GasUsed",
70
+ "l1FeeScalar",
71
+ "gasUsedForL1",
72
+ "accessList",
73
+ "authorizationList"
74
+ ];
75
+
76
+ function ecosystem_getNumber(prim) {
77
+ return prim.number;
78
+ }
79
+
80
+ function ecosystem_getTimestamp(prim) {
81
+ return prim.timestamp;
82
+ }
83
+
84
+ function ecosystem_getId(prim) {
85
+ return prim.hash;
86
+ }
87
+
88
+ var ecosystem = {
89
+ name: "evm",
90
+ blockFields: ecosystem_blockFields,
91
+ transactionFields: ecosystem_transactionFields,
92
+ blockNumberName: "number",
93
+ blockTimestampName: "timestamp",
94
+ blockHashName: "hash",
95
+ getNumber: ecosystem_getNumber,
96
+ getTimestamp: ecosystem_getTimestamp,
97
+ getId: ecosystem_getId,
98
+ cleanUpRawEventFieldsInPlace: cleanUpRawEventFieldsInPlace
99
+ };
100
+
101
+ export {
102
+ cleanUpRawEventFieldsInPlace ,
103
+ ecosystem ,
104
+ }
105
+ /* No side effect */