envio 3.0.0-alpha.2 → 3.0.0-alpha.21

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 (184) hide show
  1. package/README.md +164 -30
  2. package/bin.mjs +49 -0
  3. package/evm.schema.json +79 -169
  4. package/fuel.schema.json +50 -21
  5. package/index.d.ts +578 -1
  6. package/index.js +4 -0
  7. package/package.json +47 -31
  8. package/rescript.json +4 -1
  9. package/src/Batch.res +11 -8
  10. package/src/Batch.res.mjs +11 -9
  11. package/src/ChainFetcher.res +531 -0
  12. package/src/ChainFetcher.res.mjs +339 -0
  13. package/src/ChainManager.res +190 -0
  14. package/src/ChainManager.res.mjs +166 -0
  15. package/src/Change.res +3 -3
  16. package/src/Config.gen.ts +19 -0
  17. package/src/Config.res +725 -25
  18. package/src/Config.res.mjs +692 -26
  19. package/src/{Indexer.res → Ctx.res} +1 -1
  20. package/src/Ecosystem.res +9 -124
  21. package/src/Ecosystem.res.mjs +19 -160
  22. package/src/Env.res +33 -73
  23. package/src/Env.res.mjs +29 -85
  24. package/src/Envio.gen.ts +3 -1
  25. package/src/Envio.res +77 -9
  26. package/src/Envio.res.mjs +39 -1
  27. package/src/EventConfigBuilder.res +408 -0
  28. package/src/EventConfigBuilder.res.mjs +376 -0
  29. package/src/EventProcessing.res +469 -0
  30. package/src/EventProcessing.res.mjs +337 -0
  31. package/src/EvmTypes.gen.ts +6 -0
  32. package/src/EvmTypes.res +1 -0
  33. package/src/FetchState.res +1256 -639
  34. package/src/FetchState.res.mjs +1135 -612
  35. package/src/GlobalState.res +1224 -0
  36. package/src/GlobalState.res.mjs +1291 -0
  37. package/src/GlobalStateManager.res +68 -0
  38. package/src/GlobalStateManager.res.mjs +75 -0
  39. package/src/GlobalStateManager.resi +7 -0
  40. package/src/HandlerLoader.res +89 -0
  41. package/src/HandlerLoader.res.mjs +79 -0
  42. package/src/HandlerRegister.res +357 -0
  43. package/src/HandlerRegister.res.mjs +299 -0
  44. package/src/HandlerRegister.resi +30 -0
  45. package/src/Hasura.res +111 -175
  46. package/src/Hasura.res.mjs +88 -150
  47. package/src/InMemoryStore.res +1 -1
  48. package/src/InMemoryStore.res.mjs +3 -3
  49. package/src/InMemoryTable.res +1 -1
  50. package/src/InMemoryTable.res.mjs +1 -1
  51. package/src/Internal.gen.ts +6 -0
  52. package/src/Internal.res +265 -12
  53. package/src/Internal.res.mjs +115 -1
  54. package/src/LoadLayer.res +444 -0
  55. package/src/LoadLayer.res.mjs +296 -0
  56. package/src/LoadLayer.resi +32 -0
  57. package/src/LogSelection.res +33 -27
  58. package/src/LogSelection.res.mjs +6 -0
  59. package/src/Logging.res +21 -7
  60. package/src/Logging.res.mjs +16 -8
  61. package/src/Main.res +390 -0
  62. package/src/Main.res.mjs +341 -0
  63. package/src/Persistence.res +7 -21
  64. package/src/Persistence.res.mjs +3 -3
  65. package/src/PgStorage.gen.ts +10 -0
  66. package/src/PgStorage.res +116 -69
  67. package/src/PgStorage.res.d.mts +5 -0
  68. package/src/PgStorage.res.mjs +93 -50
  69. package/src/Prometheus.res +294 -224
  70. package/src/Prometheus.res.mjs +353 -340
  71. package/src/ReorgDetection.res +6 -10
  72. package/src/ReorgDetection.res.mjs +6 -6
  73. package/src/SafeCheckpointTracking.res +4 -4
  74. package/src/SafeCheckpointTracking.res.mjs +2 -2
  75. package/src/SimulateItems.res +353 -0
  76. package/src/SimulateItems.res.mjs +335 -0
  77. package/src/Sink.res +4 -2
  78. package/src/Sink.res.mjs +2 -1
  79. package/src/TableIndices.res +0 -1
  80. package/src/TestIndexer.res +913 -0
  81. package/src/TestIndexer.res.mjs +698 -0
  82. package/src/TestIndexerProxyStorage.res +205 -0
  83. package/src/TestIndexerProxyStorage.res.mjs +151 -0
  84. package/src/TopicFilter.res +1 -1
  85. package/src/Types.ts +1 -1
  86. package/src/UserContext.res +424 -0
  87. package/src/UserContext.res.mjs +279 -0
  88. package/src/Utils.res +97 -26
  89. package/src/Utils.res.mjs +91 -44
  90. package/src/bindings/BigInt.res +10 -0
  91. package/src/bindings/BigInt.res.mjs +15 -0
  92. package/src/bindings/ClickHouse.res +120 -23
  93. package/src/bindings/ClickHouse.res.mjs +118 -28
  94. package/src/bindings/DateFns.res +74 -0
  95. package/src/bindings/DateFns.res.mjs +22 -0
  96. package/src/bindings/EventSource.res +11 -2
  97. package/src/bindings/EventSource.res.mjs +8 -1
  98. package/src/bindings/Express.res +1 -0
  99. package/src/bindings/Hrtime.res +14 -1
  100. package/src/bindings/Hrtime.res.mjs +22 -2
  101. package/src/bindings/Hrtime.resi +4 -0
  102. package/src/bindings/Lodash.res +0 -1
  103. package/src/bindings/NodeJs.res +49 -3
  104. package/src/bindings/NodeJs.res.mjs +11 -3
  105. package/src/bindings/Pino.res +24 -10
  106. package/src/bindings/Pino.res.mjs +14 -8
  107. package/src/bindings/Postgres.gen.ts +8 -0
  108. package/src/bindings/Postgres.res +5 -1
  109. package/src/bindings/Postgres.res.d.mts +5 -0
  110. package/src/bindings/PromClient.res +0 -10
  111. package/src/bindings/PromClient.res.mjs +0 -3
  112. package/src/bindings/Vitest.res +144 -0
  113. package/src/bindings/Vitest.res.mjs +9 -0
  114. package/src/bindings/WebSocket.res +27 -0
  115. package/src/bindings/WebSocket.res.mjs +2 -0
  116. package/src/bindings/Yargs.res +8 -0
  117. package/src/bindings/Yargs.res.mjs +2 -0
  118. package/src/db/EntityHistory.res +7 -7
  119. package/src/db/EntityHistory.res.mjs +9 -9
  120. package/src/db/InternalTable.res +59 -111
  121. package/src/db/InternalTable.res.mjs +73 -104
  122. package/src/db/Table.res +27 -8
  123. package/src/db/Table.res.mjs +25 -14
  124. package/src/sources/Evm.res +84 -0
  125. package/src/sources/Evm.res.mjs +105 -0
  126. package/src/sources/EvmChain.res +94 -0
  127. package/src/sources/EvmChain.res.mjs +60 -0
  128. package/src/sources/Fuel.res +19 -34
  129. package/src/sources/Fuel.res.mjs +34 -16
  130. package/src/sources/FuelSDK.res +38 -0
  131. package/src/sources/FuelSDK.res.mjs +29 -0
  132. package/src/sources/HyperFuel.res +2 -2
  133. package/src/sources/HyperFuel.resi +1 -1
  134. package/src/sources/HyperFuelClient.res +2 -2
  135. package/src/sources/HyperFuelSource.res +35 -13
  136. package/src/sources/HyperFuelSource.res.mjs +26 -16
  137. package/src/sources/HyperSync.res +61 -60
  138. package/src/sources/HyperSync.res.mjs +53 -67
  139. package/src/sources/HyperSync.resi +6 -4
  140. package/src/sources/HyperSyncClient.res +29 -2
  141. package/src/sources/HyperSyncClient.res.mjs +9 -0
  142. package/src/sources/HyperSyncHeightStream.res +76 -118
  143. package/src/sources/HyperSyncHeightStream.res.mjs +68 -75
  144. package/src/sources/HyperSyncSource.res +122 -143
  145. package/src/sources/HyperSyncSource.res.mjs +106 -121
  146. package/src/sources/Rpc.res +86 -14
  147. package/src/sources/Rpc.res.mjs +101 -9
  148. package/src/sources/RpcSource.res +731 -364
  149. package/src/sources/RpcSource.res.mjs +845 -410
  150. package/src/sources/RpcWebSocketHeightStream.res +181 -0
  151. package/src/sources/RpcWebSocketHeightStream.res.mjs +196 -0
  152. package/src/sources/SimulateSource.res +59 -0
  153. package/src/sources/SimulateSource.res.mjs +50 -0
  154. package/src/sources/Source.res +7 -5
  155. package/src/sources/SourceManager.res +358 -221
  156. package/src/sources/SourceManager.res.mjs +346 -171
  157. package/src/sources/SourceManager.resi +17 -6
  158. package/src/sources/Svm.res +81 -0
  159. package/src/sources/Svm.res.mjs +90 -0
  160. package/src/tui/Tui.res +247 -0
  161. package/src/tui/Tui.res.mjs +337 -0
  162. package/src/tui/bindings/Ink.res +371 -0
  163. package/src/tui/bindings/Ink.res.mjs +72 -0
  164. package/src/tui/bindings/Style.res +123 -0
  165. package/src/tui/bindings/Style.res.mjs +2 -0
  166. package/src/tui/components/BufferedProgressBar.res +40 -0
  167. package/src/tui/components/BufferedProgressBar.res.mjs +57 -0
  168. package/src/tui/components/CustomHooks.res +122 -0
  169. package/src/tui/components/CustomHooks.res.mjs +179 -0
  170. package/src/tui/components/Messages.res +41 -0
  171. package/src/tui/components/Messages.res.mjs +75 -0
  172. package/src/tui/components/SyncETA.res +174 -0
  173. package/src/tui/components/SyncETA.res.mjs +263 -0
  174. package/src/tui/components/TuiData.res +47 -0
  175. package/src/tui/components/TuiData.res.mjs +34 -0
  176. package/svm.schema.json +112 -0
  177. package/bin.js +0 -48
  178. package/src/EventRegister.res +0 -241
  179. package/src/EventRegister.res.mjs +0 -240
  180. package/src/EventRegister.resi +0 -30
  181. package/src/bindings/Ethers.gen.ts +0 -14
  182. package/src/bindings/Ethers.res +0 -204
  183. package/src/bindings/Ethers.res.mjs +0 -130
  184. /package/src/{Indexer.res.mjs → Ctx.res.mjs} +0 -0
@@ -1,6 +1,7 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
3
  import * as Rest from "./vendored/Rest.res.mjs";
4
+ import * as Time from "./Time.res.mjs";
4
5
  import * as Table from "./db/Table.res.mjs";
5
6
  import * as Utils from "./Utils.res.mjs";
6
7
  import * as Schema from "./db/Schema.res.mjs";
@@ -60,21 +61,6 @@ function trackTablesRoute() {
60
61
  };
61
62
  }
62
63
 
63
- function createSelectPermissionRoute() {
64
- return {
65
- method: "POST",
66
- path: "",
67
- input: (function (s) {
68
- s.field("type", S$RescriptSchema.literal("pg_create_select_permission"));
69
- return {
70
- args: s.field("args", S$RescriptSchema.json(false)),
71
- auth: auth(s)
72
- };
73
- }),
74
- responses: responses
75
- };
76
- }
77
-
78
64
  function rawBodyRoute() {
79
65
  return {
80
66
  method: "POST",
@@ -89,41 +75,31 @@ function rawBodyRoute() {
89
75
  };
90
76
  }
91
77
 
92
- function bulkKeepGoingRoute() {
93
- return {
94
- method: "POST",
95
- path: "",
96
- input: (function (s) {
97
- s.field("type", S$RescriptSchema.literal("bulk_keep_going"));
98
- return {
99
- args: s.field("args", S$RescriptSchema.json(false)),
100
- auth: auth(s)
101
- };
102
- }),
103
- responses: [(function (s) {
104
- s.status(200);
105
- return s.data(S$RescriptSchema.json(false));
106
- })]
107
- };
78
+ async function sendOperation(endpoint, auth, operation) {
79
+ var retry = async function (attempt) {
80
+ try {
81
+ await Rest.$$fetch(rawBodyRoute, {
82
+ bodyString: JSON.stringify(operation),
83
+ auth: auth
84
+ }, Rest.client(endpoint, undefined));
85
+ return ;
86
+ }
87
+ catch (raw_exn){
88
+ var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
89
+ if (attempt >= 3) {
90
+ return Logging.warn({
91
+ msg: "Hasura configuration request failed. Indexing will still work - but you may have issues querying data via GraphQL.",
92
+ err: Utils.prettifyExn(exn)
93
+ });
94
+ }
95
+ var backoffMs = Math.imul(Math.pow(2.0, attempt) | 0, 1000);
96
+ await Time.resolvePromiseAfterDelay(backoffMs);
97
+ return await retry(attempt + 1 | 0);
98
+ }
99
+ };
100
+ return await retry(0);
108
101
  }
109
102
 
110
- var bulkKeepGoingErrorsSchema = S$RescriptSchema.transform(S$RescriptSchema.array(S$RescriptSchema.union([
111
- S$RescriptSchema.object(function (s) {
112
- s.tag("message", "success");
113
- }),
114
- S$RescriptSchema.object(function (s) {
115
- return s.f("error", S$RescriptSchema.string);
116
- })
117
- ])), (function (param) {
118
- return {
119
- p: (function (a) {
120
- return Belt_Array.keepMapU(a, (function (a) {
121
- return a;
122
- }));
123
- })
124
- };
125
- }));
126
-
127
103
  async function clearHasuraMetadata(endpoint, auth) {
128
104
  try {
129
105
  var result = await Rest.$$fetch(clearMetadataRoute, auth, Rest.client(endpoint, undefined));
@@ -134,7 +110,7 @@ async function clearHasuraMetadata(endpoint, auth) {
134
110
  catch (raw_exn){
135
111
  var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
136
112
  return Logging.error({
137
- msg: "EE806: There was an issue clearing metadata in hasura - indexing may still work - but you may have issues querying the data in hasura.",
113
+ msg: "There was an issue clearing metadata in hasura - indexing may still work - but you may have issues querying the data in hasura.",
138
114
  err: Utils.prettifyExn(exn)
139
115
  });
140
116
  }
@@ -169,95 +145,55 @@ async function trackTables(endpoint, auth, pgSchema, tableNames) {
169
145
  catch (raw_exn){
170
146
  var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
171
147
  return Logging.error({
172
- msg: "EE807: There was an issue tracking tables in hasura - indexing may still work - but you may have issues querying the data in hasura.",
148
+ msg: "There was an issue tracking tables in hasura - indexing may still work - but you may have issues querying the data in hasura.",
173
149
  tableNames: tableNames,
174
150
  err: Utils.prettifyExn(exn)
175
151
  });
176
152
  }
177
153
  }
178
154
 
179
- function createSelectPermissionOperation(tableName, pgSchema, responseLimit, aggregateEntities) {
180
- return {
181
- type: "pg_create_select_permission",
182
- args: {
183
- table: {
184
- schema: pgSchema,
185
- name: tableName
186
- },
187
- role: "public",
188
- source: "default",
189
- permission: {
190
- columns: "*",
191
- filter: {},
192
- limit: responseLimit,
193
- allow_aggregations: aggregateEntities.includes(tableName)
194
- }
195
- }
196
- };
155
+ async function createSelectPermission(endpoint, auth, tableName, pgSchema, responseLimit, aggregateEntities) {
156
+ return await sendOperation(endpoint, auth, {
157
+ type: "pg_create_select_permission",
158
+ args: {
159
+ table: {
160
+ schema: pgSchema,
161
+ name: tableName
162
+ },
163
+ role: "public",
164
+ source: "default",
165
+ permission: {
166
+ columns: "*",
167
+ filter: {},
168
+ limit: responseLimit,
169
+ allow_aggregations: aggregateEntities.includes(tableName)
170
+ }
171
+ }
172
+ });
197
173
  }
198
174
 
199
- function createEntityRelationshipOperation(pgSchema, tableName, relationshipType, relationalKey, objectName, mappedEntity, isDerivedFrom) {
175
+ async function createEntityRelationship(endpoint, auth, pgSchema, tableName, relationshipType, relationalKey, objectName, mappedEntity, isDerivedFrom) {
200
176
  var derivedFromTo = isDerivedFrom ? "\"id\": \"" + relationalKey + "\"" : "\"" + relationalKey + "_id\" : \"id\"";
201
- return {
202
- type: "pg_create_" + relationshipType + "_relationship",
203
- args: {
204
- table: {
205
- schema: pgSchema,
206
- name: tableName
207
- },
208
- name: objectName,
209
- source: "default",
210
- using: {
211
- manual_configuration: {
212
- remote_table: {
177
+ return await sendOperation(endpoint, auth, {
178
+ type: "pg_create_" + relationshipType + "_relationship",
179
+ args: {
180
+ table: {
213
181
  schema: pgSchema,
214
- name: mappedEntity
182
+ name: tableName
215
183
  },
216
- column_mapping: JSON.parse("{" + derivedFromTo + "}")
184
+ name: objectName,
185
+ source: "default",
186
+ using: {
187
+ manual_configuration: {
188
+ remote_table: {
189
+ schema: pgSchema,
190
+ name: mappedEntity
191
+ },
192
+ column_mapping: JSON.parse("{" + derivedFromTo + "}")
193
+ }
194
+ }
217
195
  }
218
- }
219
- }
220
- };
221
- }
222
-
223
- async function executeBulkKeepGoing(endpoint, auth, operations) {
224
- if (operations.length === 0) {
225
- return Logging.trace("No hasura bulk configuration operations to execute");
226
- }
227
- try {
228
- var result = await Rest.$$fetch(bulkKeepGoingRoute, {
229
- auth: auth,
230
- args: operations
231
- }, Rest.client(endpoint, undefined));
232
- var errors;
233
- try {
234
- errors = S$RescriptSchema.parseJsonOrThrow(result, bulkKeepGoingErrorsSchema);
235
- }
236
- catch (raw_error){
237
- var error = Caml_js_exceptions.internalToOCamlException(raw_error);
238
- errors = error.RE_EXN_ID === S$RescriptSchema.Raised ? [S$RescriptSchema.$$Error.message(error._1)] : [Utils.prettifyExn(error)];
239
- }
240
- if (errors.length !== 0) {
241
- return Logging.warn({
242
- msg: "Hasura configuration completed with errors. Indexing will still work - but you may have issues querying data via GraphQL.",
243
- errors: errors,
244
- operations: operations.length
245
- });
246
- } else {
247
- return Logging.trace({
248
- msg: "Hasura configuration completed",
249
- operations: operations.length
250
- });
251
- }
252
- }
253
- catch (raw_exn){
254
- var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
255
- return Logging.error({
256
- msg: "EE809: There was an issue executing bulk operations in hasura - indexing may still work - but you may have issues querying the data in hasura.",
257
- operations: operations.length,
258
- err: Utils.prettifyExn(exn)
259
- });
260
- }
196
+ });
261
197
  }
262
198
 
263
199
  async function trackDatabase(endpoint, auth, pgSchema, userEntities, aggregateEntities, responseLimit, schema) {
@@ -276,23 +212,28 @@ async function trackDatabase(endpoint, auth, pgSchema, userEntities, aggregateEn
276
212
  Logging.info("Tracking tables in Hasura");
277
213
  await clearHasuraMetadata(endpoint, auth);
278
214
  await trackTables(endpoint, auth, pgSchema, tableNames);
279
- var allOperations = [];
280
- tableNames.forEach(function (tableName) {
281
- allOperations.push(createSelectPermissionOperation(tableName, pgSchema, responseLimit, aggregateEntities));
282
- });
283
- userEntities.forEach(function (entityConfig) {
284
- var match = entityConfig.table;
285
- var tableName = match.tableName;
286
- Table.getDerivedFromFields(entityConfig.table).forEach(function (derivedFromField) {
287
- var relationalFieldName = Utils.unwrapResultExn(Schema.getDerivedFromFieldName(schema, derivedFromField));
288
- allOperations.push(createEntityRelationshipOperation(pgSchema, tableName, "array", relationalFieldName, derivedFromField.fieldName, derivedFromField.derivedFromEntity, true));
289
- });
290
- Table.getLinkedEntityFields(entityConfig.table).forEach(function (param) {
291
- var field = param[0];
292
- allOperations.push(createEntityRelationshipOperation(pgSchema, tableName, "object", field.fieldName, field.fieldName, param[1], false));
293
- });
294
- });
295
- return await executeBulkKeepGoing(endpoint, auth, allOperations);
215
+ for(var i = 0 ,i_finish = tableNames.length; i < i_finish; ++i){
216
+ var tableName = tableNames[i];
217
+ await createSelectPermission(endpoint, auth, tableName, pgSchema, responseLimit, aggregateEntities);
218
+ }
219
+ for(var i$1 = 0 ,i_finish$1 = userEntities.length; i$1 < i_finish$1; ++i$1){
220
+ var entityConfig = userEntities[i$1];
221
+ var match = entityConfig.table;
222
+ var tableName$1 = match.tableName;
223
+ var derivedFromFields = Table.getDerivedFromFields(entityConfig.table);
224
+ for(var j = 0 ,j_finish = derivedFromFields.length; j < j_finish; ++j){
225
+ var derivedFromField = derivedFromFields[j];
226
+ var relationalFieldName = Utils.unwrapResultExn(Schema.getDerivedFromFieldName(schema, derivedFromField));
227
+ await createEntityRelationship(endpoint, auth, pgSchema, tableName$1, "array", relationalFieldName, derivedFromField.fieldName, derivedFromField.derivedFromEntity, true);
228
+ }
229
+ var linkedEntityFields = Table.getLinkedEntityFields(entityConfig.table);
230
+ for(var j$1 = 0 ,j_finish$1 = linkedEntityFields.length; j$1 < j_finish$1; ++j$1){
231
+ var match$1 = linkedEntityFields[j$1];
232
+ var field = match$1[0];
233
+ await createEntityRelationship(endpoint, auth, pgSchema, tableName$1, "object", field.fieldName, field.fieldName, match$1[1], false);
234
+ }
235
+ }
236
+ return Logging.info("Hasura configuration completed");
296
237
  }
297
238
 
298
239
  export {
@@ -300,15 +241,12 @@ export {
300
241
  responses ,
301
242
  clearMetadataRoute ,
302
243
  trackTablesRoute ,
303
- createSelectPermissionRoute ,
304
244
  rawBodyRoute ,
305
- bulkKeepGoingRoute ,
306
- bulkKeepGoingErrorsSchema ,
245
+ sendOperation ,
307
246
  clearHasuraMetadata ,
308
247
  trackTables ,
309
- createSelectPermissionOperation ,
310
- createEntityRelationshipOperation ,
311
- executeBulkKeepGoing ,
248
+ createSelectPermission ,
249
+ createEntityRelationship ,
312
250
  trackDatabase ,
313
251
  }
314
- /* bulkKeepGoingErrorsSchema Not a pure module */
252
+ /* Rest Not a pure module */
@@ -100,7 +100,7 @@ let isRollingBack = (inMemoryStore: t) => inMemoryStore.rollbackTargetCheckpoint
100
100
 
101
101
  let setBatchDcs = (inMemoryStore: t, ~batch: Batch.t, ~shouldSaveHistory) => {
102
102
  let inMemTable =
103
- inMemoryStore->getInMemTable(~entityConfig=InternalTable.DynamicContractRegistry.config)
103
+ inMemoryStore->getInMemTable(~entityConfig=InternalTable.DynamicContractRegistry.entityConfig)
104
104
 
105
105
  let itemIdx = ref(0)
106
106
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  import * as $$Array from "rescript/lib/es6/array.js";
4
4
  import * as Utils from "./Utils.res.mjs";
5
+ import * as Config from "./Config.res.mjs";
5
6
  import * as Js_dict from "rescript/lib/es6/js_dict.js";
6
7
  import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
7
8
  import * as EventUtils from "./EventUtils.res.mjs";
8
9
  import * as ErrorHandling from "./ErrorHandling.res.mjs";
9
10
  import * as InMemoryTable from "./InMemoryTable.res.mjs";
10
- import * as InternalTable from "./db/InternalTable.res.mjs";
11
11
  import * as Caml_exceptions from "rescript/lib/es6/caml_exceptions.js";
12
12
 
13
13
  function hashRawEventsKey(key) {
@@ -102,7 +102,7 @@ function isRollingBack(inMemoryStore) {
102
102
  }
103
103
 
104
104
  function setBatchDcs(inMemoryStore, batch, shouldSaveHistory) {
105
- var inMemTable = getInMemTable(inMemoryStore, InternalTable.DynamicContractRegistry.config);
105
+ var inMemTable = getInMemTable(inMemoryStore, Config.DynamicContractRegistry.entityConfig);
106
106
  var itemIdx = 0;
107
107
  for(var checkpoint = 0 ,checkpoint_finish = batch.checkpointIds.length; checkpoint < checkpoint_finish; ++checkpoint){
108
108
  var checkpointId = batch.checkpointIds[checkpoint];
@@ -114,7 +114,7 @@ function setBatchDcs(inMemoryStore, batch, shouldSaveHistory) {
114
114
  if (dcs !== undefined) {
115
115
  for(var dcIdx = 0 ,dcIdx_finish = dcs.length; dcIdx < dcIdx_finish; ++dcIdx){
116
116
  var dc = dcs[dcIdx];
117
- var entity_id = InternalTable.DynamicContractRegistry.makeId(chainId, dc.address);
117
+ var entity_id = Config.DynamicContractRegistry.makeId(chainId, dc.address);
118
118
  var entity_registering_event_block_number = item.blockNumber;
119
119
  var entity_registering_event_log_index = item.logIndex;
120
120
  var entity_registering_event_block_timestamp = item.timestamp;
@@ -51,7 +51,7 @@ module Entity = {
51
51
  // Helper to extract entity ID from any entity
52
52
  exception UnexpectedIdNotDefinedOnEntity
53
53
  let getEntityIdUnsafe = (entity: 'entity): string =>
54
- switch Utils.magic(entity)["id"] {
54
+ switch (entity->(Utils.magic: 'entity => {"id": option<string>}))["id"] {
55
55
  | Some(id) => id
56
56
  | None =>
57
57
  UnexpectedIdNotDefinedOnEntity->ErrorHandling.mkLogAndRaise(
@@ -54,7 +54,7 @@ var UnexpectedIdNotDefinedOnEntity = /* @__PURE__ */Caml_exceptions.create("InMe
54
54
  function getEntityIdUnsafe(entity) {
55
55
  var id = entity.id;
56
56
  if (id !== undefined) {
57
- return Caml_option.valFromOption(id);
57
+ return id;
58
58
  } else {
59
59
  return ErrorHandling.mkLogAndRaise(undefined, "Property 'id' does not exist on expected entity object", {
60
60
  RE_EXN_ID: UnexpectedIdNotDefinedOnEntity
@@ -10,6 +10,8 @@ import type {Invalid as $$noEventFilters} from './Types.ts';
10
10
  import type {t as Address_t} from './Address.gen.js';
11
11
 
12
12
  export type genericEvent<params,block,transaction> = {
13
+ readonly contractName: string;
14
+ readonly eventName: string;
13
15
  readonly params: params;
14
16
  readonly chainId: number;
15
17
  readonly srcAddress: Address_t;
@@ -45,6 +47,10 @@ export type genericHandlerWithLoader<loader,handler,eventFilters> = {
45
47
  readonly eventFilters?: eventFilters
46
48
  };
47
49
 
50
+ export abstract class fuelEventConfig { protected opaque!: any }; /* simulate opaque types */
51
+
52
+ export abstract class evmEventConfig { protected opaque!: any }; /* simulate opaque types */
53
+
48
54
  export type eventOptions<eventFilters> = { readonly wildcard?: boolean; readonly eventFilters?: eventFilters };
49
55
 
50
56
  export type fuelSupplyParams = { readonly subId: string; readonly amount: bigint };