envio 3.0.0-alpha.21 → 3.0.0-alpha.23

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 (220) hide show
  1. package/README.md +3 -3
  2. package/bin.mjs +2 -48
  3. package/evm.schema.json +67 -0
  4. package/fuel.schema.json +67 -0
  5. package/index.d.ts +822 -38
  6. package/index.js +5 -3
  7. package/package.json +10 -8
  8. package/rescript.json +5 -9
  9. package/src/Address.res +4 -5
  10. package/src/Address.res.mjs +9 -12
  11. package/src/Api.res +15 -0
  12. package/src/Api.res.mjs +20 -0
  13. package/src/Batch.res +32 -34
  14. package/src/Batch.res.mjs +172 -187
  15. package/src/Bin.res +89 -0
  16. package/src/Bin.res.mjs +97 -0
  17. package/src/ChainFetcher.res +33 -57
  18. package/src/ChainFetcher.res.mjs +197 -227
  19. package/src/ChainManager.res +6 -14
  20. package/src/ChainManager.res.mjs +74 -85
  21. package/src/ChainMap.res +14 -16
  22. package/src/ChainMap.res.mjs +38 -38
  23. package/src/Config.res +193 -135
  24. package/src/Config.res.mjs +566 -592
  25. package/src/Core.res +182 -0
  26. package/src/Core.res.mjs +207 -0
  27. package/src/Ecosystem.res +25 -4
  28. package/src/Ecosystem.res.mjs +12 -13
  29. package/src/Env.res +20 -13
  30. package/src/Env.res.mjs +124 -113
  31. package/src/EnvSafe.res +269 -0
  32. package/src/EnvSafe.res.mjs +296 -0
  33. package/src/EnvSafe.resi +18 -0
  34. package/src/Envio.res +37 -26
  35. package/src/Envio.res.mjs +59 -60
  36. package/src/ErrorHandling.res +2 -2
  37. package/src/ErrorHandling.res.mjs +15 -15
  38. package/src/EventConfigBuilder.res +219 -81
  39. package/src/EventConfigBuilder.res.mjs +259 -202
  40. package/src/EventProcessing.res +27 -38
  41. package/src/EventProcessing.res.mjs +165 -183
  42. package/src/EventUtils.res +11 -11
  43. package/src/EventUtils.res.mjs +21 -22
  44. package/src/EvmTypes.res +0 -1
  45. package/src/EvmTypes.res.mjs +5 -5
  46. package/src/FetchState.res +360 -256
  47. package/src/FetchState.res.mjs +958 -914
  48. package/src/GlobalState.res +365 -351
  49. package/src/GlobalState.res.mjs +958 -992
  50. package/src/GlobalStateManager.res +1 -2
  51. package/src/GlobalStateManager.res.mjs +36 -44
  52. package/src/HandlerLoader.res +107 -23
  53. package/src/HandlerLoader.res.mjs +128 -38
  54. package/src/HandlerRegister.res +127 -103
  55. package/src/HandlerRegister.res.mjs +164 -164
  56. package/src/HandlerRegister.resi +12 -4
  57. package/src/Hasura.res +35 -22
  58. package/src/Hasura.res.mjs +158 -167
  59. package/src/InMemoryStore.res +20 -27
  60. package/src/InMemoryStore.res.mjs +64 -80
  61. package/src/InMemoryTable.res +34 -39
  62. package/src/InMemoryTable.res.mjs +165 -170
  63. package/src/Internal.res +52 -33
  64. package/src/Internal.res.mjs +84 -81
  65. package/src/LazyLoader.res.mjs +55 -61
  66. package/src/LoadLayer.res +77 -78
  67. package/src/LoadLayer.res.mjs +160 -189
  68. package/src/LoadManager.res +16 -21
  69. package/src/LoadManager.res.mjs +79 -84
  70. package/src/LogSelection.res +236 -68
  71. package/src/LogSelection.res.mjs +211 -141
  72. package/src/Logging.res +13 -9
  73. package/src/Logging.res.mjs +130 -143
  74. package/src/Main.res +430 -51
  75. package/src/Main.res.mjs +530 -271
  76. package/src/Persistence.res +80 -84
  77. package/src/Persistence.res.mjs +131 -132
  78. package/src/PgStorage.res +294 -167
  79. package/src/PgStorage.res.mjs +799 -817
  80. package/src/Prometheus.res +50 -58
  81. package/src/Prometheus.res.mjs +345 -373
  82. package/src/ReorgDetection.res +22 -24
  83. package/src/ReorgDetection.res.mjs +100 -106
  84. package/src/SafeCheckpointTracking.res +7 -7
  85. package/src/SafeCheckpointTracking.res.mjs +40 -43
  86. package/src/SimulateItems.res +41 -49
  87. package/src/SimulateItems.res.mjs +257 -272
  88. package/src/Sink.res +2 -2
  89. package/src/Sink.res.mjs +22 -26
  90. package/src/TableIndices.res +1 -2
  91. package/src/TableIndices.res.mjs +42 -48
  92. package/src/TestIndexer.res +196 -189
  93. package/src/TestIndexer.res.mjs +536 -536
  94. package/src/TestIndexerProxyStorage.res +16 -16
  95. package/src/TestIndexerProxyStorage.res.mjs +99 -122
  96. package/src/TestIndexerWorker.res +4 -0
  97. package/src/TestIndexerWorker.res.mjs +7 -0
  98. package/src/Throttler.res +3 -3
  99. package/src/Throttler.res.mjs +23 -24
  100. package/src/Time.res +1 -1
  101. package/src/Time.res.mjs +18 -21
  102. package/src/TopicFilter.res +3 -3
  103. package/src/TopicFilter.res.mjs +29 -30
  104. package/src/UserContext.res +93 -54
  105. package/src/UserContext.res.mjs +197 -182
  106. package/src/Utils.res +141 -86
  107. package/src/Utils.res.mjs +334 -295
  108. package/src/bindings/BigDecimal.res +0 -2
  109. package/src/bindings/BigDecimal.res.mjs +19 -23
  110. package/src/bindings/ClickHouse.res +28 -27
  111. package/src/bindings/ClickHouse.res.mjs +243 -240
  112. package/src/bindings/DateFns.res +11 -11
  113. package/src/bindings/DateFns.res.mjs +7 -7
  114. package/src/bindings/EventSource.res.mjs +2 -2
  115. package/src/bindings/Express.res +2 -5
  116. package/src/bindings/Hrtime.res +2 -2
  117. package/src/bindings/Hrtime.res.mjs +30 -32
  118. package/src/bindings/Lodash.res.mjs +1 -1
  119. package/src/bindings/NodeJs.res +14 -9
  120. package/src/bindings/NodeJs.res.mjs +20 -20
  121. package/src/bindings/Pino.res +8 -10
  122. package/src/bindings/Pino.res.mjs +40 -43
  123. package/src/bindings/Postgres.res +7 -5
  124. package/src/bindings/Postgres.res.mjs +9 -9
  125. package/src/bindings/PromClient.res +17 -2
  126. package/src/bindings/PromClient.res.mjs +30 -7
  127. package/src/bindings/SDSL.res.mjs +2 -2
  128. package/src/bindings/Viem.res +4 -4
  129. package/src/bindings/Viem.res.mjs +20 -22
  130. package/src/bindings/Vitest.res +1 -1
  131. package/src/bindings/Vitest.res.mjs +2 -2
  132. package/src/bindings/WebSocket.res +1 -1
  133. package/src/db/EntityHistory.res +9 -3
  134. package/src/db/EntityHistory.res.mjs +84 -59
  135. package/src/db/InternalTable.res +62 -60
  136. package/src/db/InternalTable.res.mjs +271 -203
  137. package/src/db/Schema.res +1 -2
  138. package/src/db/Schema.res.mjs +28 -32
  139. package/src/db/Table.res +28 -27
  140. package/src/db/Table.res.mjs +276 -292
  141. package/src/sources/EventRouter.res +21 -16
  142. package/src/sources/EventRouter.res.mjs +55 -57
  143. package/src/sources/Evm.res +17 -1
  144. package/src/sources/Evm.res.mjs +16 -8
  145. package/src/sources/EvmChain.res +15 -17
  146. package/src/sources/EvmChain.res.mjs +40 -42
  147. package/src/sources/Fuel.res +14 -1
  148. package/src/sources/Fuel.res.mjs +16 -8
  149. package/src/sources/FuelSDK.res +1 -1
  150. package/src/sources/FuelSDK.res.mjs +6 -8
  151. package/src/sources/HyperFuel.res +8 -10
  152. package/src/sources/HyperFuel.res.mjs +113 -123
  153. package/src/sources/HyperFuelClient.res.mjs +6 -7
  154. package/src/sources/HyperFuelSource.res +19 -20
  155. package/src/sources/HyperFuelSource.res.mjs +339 -356
  156. package/src/sources/HyperSync.res +11 -13
  157. package/src/sources/HyperSync.res.mjs +206 -220
  158. package/src/sources/HyperSyncClient.res +5 -7
  159. package/src/sources/HyperSyncClient.res.mjs +70 -75
  160. package/src/sources/HyperSyncHeightStream.res +8 -9
  161. package/src/sources/HyperSyncHeightStream.res.mjs +78 -86
  162. package/src/sources/HyperSyncJsonApi.res +18 -15
  163. package/src/sources/HyperSyncJsonApi.res.mjs +201 -231
  164. package/src/sources/HyperSyncSource.res +17 -21
  165. package/src/sources/HyperSyncSource.res.mjs +268 -290
  166. package/src/sources/Rpc.res +5 -5
  167. package/src/sources/Rpc.res.mjs +168 -192
  168. package/src/sources/RpcSource.res +166 -167
  169. package/src/sources/RpcSource.res.mjs +972 -1046
  170. package/src/sources/RpcWebSocketHeightStream.res +10 -11
  171. package/src/sources/RpcWebSocketHeightStream.res.mjs +131 -145
  172. package/src/sources/SimulateSource.res +1 -1
  173. package/src/sources/SimulateSource.res.mjs +35 -38
  174. package/src/sources/Source.res +1 -1
  175. package/src/sources/Source.res.mjs +3 -3
  176. package/src/sources/SourceManager.res +39 -20
  177. package/src/sources/SourceManager.res.mjs +340 -371
  178. package/src/sources/SourceManager.resi +2 -1
  179. package/src/sources/Svm.res +12 -5
  180. package/src/sources/Svm.res.mjs +44 -41
  181. package/src/tui/Tui.res +23 -12
  182. package/src/tui/Tui.res.mjs +292 -290
  183. package/src/tui/bindings/Ink.res +2 -4
  184. package/src/tui/bindings/Ink.res.mjs +35 -41
  185. package/src/tui/components/BufferedProgressBar.res +7 -7
  186. package/src/tui/components/BufferedProgressBar.res.mjs +46 -46
  187. package/src/tui/components/CustomHooks.res +1 -2
  188. package/src/tui/components/CustomHooks.res.mjs +102 -122
  189. package/src/tui/components/Messages.res +1 -2
  190. package/src/tui/components/Messages.res.mjs +38 -42
  191. package/src/tui/components/SyncETA.res +10 -11
  192. package/src/tui/components/SyncETA.res.mjs +178 -196
  193. package/src/tui/components/TuiData.res +1 -1
  194. package/src/tui/components/TuiData.res.mjs +7 -6
  195. package/src/vendored/Rest.res +52 -66
  196. package/src/vendored/Rest.res.mjs +324 -364
  197. package/svm.schema.json +67 -0
  198. package/src/Address.gen.ts +0 -8
  199. package/src/Config.gen.ts +0 -19
  200. package/src/Envio.gen.ts +0 -55
  201. package/src/EvmTypes.gen.ts +0 -6
  202. package/src/InMemoryStore.gen.ts +0 -6
  203. package/src/Internal.gen.ts +0 -64
  204. package/src/PgStorage.gen.ts +0 -10
  205. package/src/PgStorage.res.d.mts +0 -5
  206. package/src/Types.ts +0 -56
  207. package/src/bindings/BigDecimal.gen.ts +0 -14
  208. package/src/bindings/BigDecimal.res.d.mts +0 -5
  209. package/src/bindings/BigInt.gen.ts +0 -10
  210. package/src/bindings/BigInt.res +0 -70
  211. package/src/bindings/BigInt.res.d.mts +0 -5
  212. package/src/bindings/BigInt.res.mjs +0 -154
  213. package/src/bindings/Ethers.res.d.mts +0 -5
  214. package/src/bindings/Pino.gen.ts +0 -17
  215. package/src/bindings/Postgres.gen.ts +0 -8
  216. package/src/bindings/Postgres.res.d.mts +0 -5
  217. package/src/bindings/Promise.res +0 -67
  218. package/src/bindings/Promise.res.mjs +0 -26
  219. package/src/db/InternalTable.gen.ts +0 -36
  220. package/src/sources/HyperSyncClient.gen.ts +0 -19
@@ -1,4 +1,3 @@
1
- open Belt
2
1
  open Source
3
2
 
4
3
  exception QueryTimout(string)
@@ -13,21 +12,22 @@ type blockInfo = {
13
12
  let getKnownRawBlock = async (~client, ~blockNumber) =>
14
13
  switch await Rpc.getRawBlock(~client, ~blockNumber) {
15
14
  | Some(json) => json
16
- | None => Js.Exn.raiseError(`RPC returned null for blockNumber ${blockNumber->Belt.Int.toString}`)
15
+ | None =>
16
+ JsError.throwWithMessage(`RPC returned null for blockNumber ${blockNumber->Belt.Int.toString}`)
17
17
  }
18
18
 
19
19
  // Extract infrastructure fields (number, timestamp, hash) from raw block JSON
20
- let parseBlockInfo = (json: Js.Json.t): blockInfo => {
21
- let jsonDict = json->(Utils.magic: Js.Json.t => Js.Dict.t<Js.Json.t>)
20
+ let parseBlockInfo = (json: JSON.t): blockInfo => {
21
+ let jsonDict = json->(Utils.magic: JSON.t => dict<JSON.t>)
22
22
  {
23
23
  number: jsonDict
24
- ->Js.Dict.unsafeGet("number")
24
+ ->Dict.getUnsafe("number")
25
25
  ->S.parseOrThrow(Rpc.hexIntSchema),
26
26
  timestamp: jsonDict
27
- ->Js.Dict.unsafeGet("timestamp")
27
+ ->Dict.getUnsafe("timestamp")
28
28
  ->S.parseOrThrow(Rpc.hexIntSchema),
29
29
  hash: jsonDict
30
- ->Js.Dict.unsafeGet("hash")
30
+ ->Dict.getUnsafe("hash")
31
31
  ->S.parseOrThrow(S.string),
32
32
  }
33
33
  }
@@ -62,47 +62,47 @@ let getKnownRawBlockWithBackoff = async (
62
62
  | json => result := Some(json)
63
63
  }
64
64
  }
65
- result.contents->Option.getExn
65
+ result.contents->Option.getOrThrow
66
66
  }
67
67
  let getSuggestedBlockIntervalFromExn = {
68
68
  // Unknown provider: "retry with the range 123-456"
69
- let suggestedRangeRegExp = %re(`/retry with the range (\d+)-(\d+)/`)
69
+ let suggestedRangeRegExp = /retry with the range (\d+)-(\d+)/
70
70
 
71
71
  // QuickNode, 1RPC, Blast: "limited to a 1000 blocks range"
72
- let blockRangeLimitRegExp = %re(`/limited to a (\d+) blocks range/`)
72
+ let blockRangeLimitRegExp = /limited to a (\d+) blocks range/
73
73
 
74
74
  // Alchemy: "up to a 500 block range"
75
- let alchemyRangeRegExp = %re(`/up to a (\d+) block range/`)
75
+ let alchemyRangeRegExp = /up to a (\d+) block range/
76
76
 
77
77
  // Cloudflare: "Max range: 3500"
78
- let cloudflareRangeRegExp = %re(`/Max range: (\d+)/`)
78
+ let cloudflareRangeRegExp = /Max range: (\d+)/
79
79
 
80
80
  // Thirdweb: "Maximum allowed number of requested blocks is 3500"
81
- let thirdwebRangeRegExp = %re(`/Maximum allowed number of requested blocks is (\d+)/`)
81
+ let thirdwebRangeRegExp = /Maximum allowed number of requested blocks is (\d+)/
82
82
 
83
83
  // BlockPI: "limited to 2000 block"
84
- let blockpiRangeRegExp = %re(`/limited to (\d+) block/`)
84
+ let blockpiRangeRegExp = /limited to (\d+) block/
85
85
 
86
86
  // Base: "block range too large" - fixed 2000 block limit
87
- let baseRangeRegExp = %re(`/block range too large/`)
87
+ let baseRangeRegExp = /block range too large/
88
88
 
89
89
  // evm-rpc.sei-apis.com: "block range too large (2000), maximum allowed is 1000 blocks"
90
- let maxAllowedBlocksRegExp = %re(`/maximum allowed is (\d+) blocks/`)
90
+ let maxAllowedBlocksRegExp = /maximum allowed is (\d+) blocks/
91
91
 
92
92
  // Blast (paid): "exceeds the range allowed for your plan (5000 > 3000)"
93
- let blastPaidRegExp = %re(`/exceeds the range allowed for your plan \(\d+ > (\d+)\)/`)
93
+ let blastPaidRegExp = /exceeds the range allowed for your plan \(\d+ > (\d+)\)/
94
94
 
95
95
  // Chainstack: "Block range limit exceeded" - 10000 block limit
96
- let chainstackRegExp = %re(`/Block range limit exceeded./`)
96
+ let chainstackRegExp = /Block range limit exceeded./
97
97
 
98
98
  // Coinbase: "please limit the query to at most 1000 blocks"
99
- let coinbaseRegExp = %re(`/please limit the query to at most (\d+) blocks/`)
99
+ let coinbaseRegExp = /please limit the query to at most (\d+) blocks/
100
100
 
101
101
  // PublicNode: "maximum block range: 2000"
102
- let publicNodeRegExp = %re(`/maximum block range: (\d+)/`)
102
+ let publicNodeRegExp = /maximum block range: (\d+)/
103
103
 
104
104
  // Hyperliquid: "query exceeds max block range 1000"
105
- let hyperliquidRegExp = %re(`/query exceeds max block range (\d+)/`)
105
+ let hyperliquidRegExp = /query exceeds max block range (\d+)/
106
106
 
107
107
  // TODO: Reproduce how the error message looks like
108
108
  // when we send request with numeric block range instead of hex
@@ -119,8 +119,8 @@ let getSuggestedBlockIntervalFromExn = {
119
119
  let parseMessageForBlockRange = (message: string) => {
120
120
  // Helper to extract block range from regex match
121
121
  let extractBlockRange = (execResult, ~isMaxRange) =>
122
- switch execResult->Js.Re.captures {
123
- | [_, Js.Nullable.Value(blockRangeLimit)] =>
122
+ switch execResult->RegExp.Result.matches {
123
+ | [Some(blockRangeLimit)] =>
124
124
  switch blockRangeLimit->Int.fromString {
125
125
  | Some(blockRangeLimit) if blockRangeLimit > 0 => Some(blockRangeLimit, isMaxRange)
126
126
  | _ => None
@@ -129,10 +129,10 @@ let getSuggestedBlockIntervalFromExn = {
129
129
  }
130
130
 
131
131
  // Try each regex pattern in order
132
- switch suggestedRangeRegExp->Js.Re.exec_(message) {
132
+ switch suggestedRangeRegExp->RegExp.exec(message) {
133
133
  | Some(execResult) =>
134
- switch execResult->Js.Re.captures {
135
- | [_, Js.Nullable.Value(fromBlock), Js.Nullable.Value(toBlock)] =>
134
+ switch execResult->RegExp.Result.matches {
135
+ | [Some(fromBlock), Some(toBlock)] =>
136
136
  switch (fromBlock->Int.fromString, toBlock->Int.fromString) {
137
137
  | (Some(fromBlock), Some(toBlock)) if toBlock >= fromBlock =>
138
138
  Some(toBlock - fromBlock + 1, false)
@@ -142,40 +142,40 @@ let getSuggestedBlockIntervalFromExn = {
142
142
  }
143
143
  | None =>
144
144
  // Try each provider's specific error pattern
145
- switch blockRangeLimitRegExp->Js.Re.exec_(message) {
145
+ switch blockRangeLimitRegExp->RegExp.exec(message) {
146
146
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
147
147
  | None =>
148
- switch alchemyRangeRegExp->Js.Re.exec_(message) {
148
+ switch alchemyRangeRegExp->RegExp.exec(message) {
149
149
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
150
150
  | None =>
151
- switch cloudflareRangeRegExp->Js.Re.exec_(message) {
151
+ switch cloudflareRangeRegExp->RegExp.exec(message) {
152
152
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
153
153
  | None =>
154
- switch thirdwebRangeRegExp->Js.Re.exec_(message) {
154
+ switch thirdwebRangeRegExp->RegExp.exec(message) {
155
155
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
156
156
  | None =>
157
- switch blockpiRangeRegExp->Js.Re.exec_(message) {
157
+ switch blockpiRangeRegExp->RegExp.exec(message) {
158
158
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
159
159
  | None =>
160
- switch maxAllowedBlocksRegExp->Js.Re.exec_(message) {
160
+ switch maxAllowedBlocksRegExp->RegExp.exec(message) {
161
161
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
162
162
  | None =>
163
- switch baseRangeRegExp->Js.Re.exec_(message) {
163
+ switch baseRangeRegExp->RegExp.exec(message) {
164
164
  | Some(_) => Some(2000, true)
165
165
  | None =>
166
- switch blastPaidRegExp->Js.Re.exec_(message) {
166
+ switch blastPaidRegExp->RegExp.exec(message) {
167
167
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
168
168
  | None =>
169
- switch chainstackRegExp->Js.Re.exec_(message) {
169
+ switch chainstackRegExp->RegExp.exec(message) {
170
170
  | Some(_) => Some(10000, true)
171
171
  | None =>
172
- switch coinbaseRegExp->Js.Re.exec_(message) {
172
+ switch coinbaseRegExp->RegExp.exec(message) {
173
173
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
174
174
  | None =>
175
- switch publicNodeRegExp->Js.Re.exec_(message) {
175
+ switch publicNodeRegExp->RegExp.exec(message) {
176
176
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
177
177
  | None =>
178
- switch hyperliquidRegExp->Js.Re.exec_(message) {
178
+ switch hyperliquidRegExp->RegExp.exec(message) {
179
179
  | Some(execResult) => extractBlockRange(execResult, ~isMaxRange=true)
180
180
  | None => None
181
181
  }
@@ -201,7 +201,7 @@ let getSuggestedBlockIntervalFromExn = {
201
201
  )> =>
202
202
  switch exn {
203
203
  | Rpc.JsonRpcError({message}) => parseMessageForBlockRange(message)
204
- | Js.Exn.Error(error) =>
204
+ | JsExn(error) =>
205
205
  try {
206
206
  let message: string = (error->Obj.magic)["error"]["message"]
207
207
  message->S.assertOrThrow(S.string)
@@ -265,11 +265,11 @@ let getNextPage = (
265
265
  ->Promise.catch(err => {
266
266
  switch getSuggestedBlockIntervalFromExn(err) {
267
267
  | Some((nextBlockIntervalTry, isMaxRange)) =>
268
- mutSuggestedBlockIntervals->Js.Dict.set(
268
+ mutSuggestedBlockIntervals->Dict.set(
269
269
  isMaxRange ? maxSuggestedBlockIntervalKey : partitionId,
270
270
  nextBlockIntervalTry,
271
271
  )
272
- raise(
272
+ throw(
273
273
  Source.GetItemsError(
274
274
  FailedGettingItems({
275
275
  exn: err,
@@ -284,8 +284,8 @@ let getNextPage = (
284
284
  let executedBlockInterval = toBlock - fromBlock + 1
285
285
  let nextBlockIntervalTry =
286
286
  (executedBlockInterval->Belt.Int.toFloat *. sc.backoffMultiplicative)->Belt.Int.fromFloat
287
- mutSuggestedBlockIntervals->Js.Dict.set(partitionId, nextBlockIntervalTry)
288
- raise(
287
+ mutSuggestedBlockIntervals->Dict.set(partitionId, nextBlockIntervalTry)
288
+ throw(
289
289
  Source.GetItemsError(
290
290
  Source.FailedGettingItems({
291
291
  exn: err,
@@ -318,8 +318,8 @@ let getSelectionConfig = (selection: FetchState.selection, ~chain) => {
318
318
  ->(Utils.magic: array<Internal.eventConfig> => array<Internal.evmEventConfig>)
319
319
  ->Belt.Array.forEach(({getEventFiltersOrThrow}) => {
320
320
  switch getEventFiltersOrThrow(chain) {
321
- | Static(s) => staticTopicSelections->Js.Array2.pushMany(s)->ignore
322
- | Dynamic(fn) => dynamicEventFilters->Js.Array2.push(fn)->ignore
321
+ | Static(s) => staticTopicSelections->Array.pushMany(s)->ignore
322
+ | Dynamic(fn) => dynamicEventFilters->Array.push(fn)->ignore
323
323
  }
324
324
  })
325
325
 
@@ -328,7 +328,7 @@ let getSelectionConfig = (selection: FetchState.selection, ~chain) => {
328
328
  dynamicEventFilters,
329
329
  ) {
330
330
  | ([], []) =>
331
- raise(
331
+ throw(
332
332
  Source.GetItemsError(
333
333
  UnsupportedSelection({
334
334
  message: "Invalid events configuration for the partition. Nothing to fetch. Please, report to the Envio team.",
@@ -345,7 +345,7 @@ let getSelectionConfig = (selection: FetchState.selection, ~chain) => {
345
345
  topicQuery,
346
346
  }
347
347
  }
348
- | ([], [dynamicEventFilter]) if selection.eventConfigs->Js.Array2.length === 1 =>
348
+ | ([], [dynamicEventFilter]) if selection.eventConfigs->Array.length === 1 =>
349
349
  let eventConfig = selection.eventConfigs->Utils.Array.firstUnsafe
350
350
 
351
351
  (~addressesByContractName) => {
@@ -355,7 +355,7 @@ let getSelectionConfig = (selection: FetchState.selection, ~chain) => {
355
355
  topicQuery: switch dynamicEventFilter(addresses) {
356
356
  | [topicSelection] => topicSelection->Rpc.GetLogs.mapTopicQuery
357
357
  | _ =>
358
- raise(
358
+ throw(
359
359
  Source.GetItemsError(
360
360
  UnsupportedSelection({
361
361
  message: "RPC data-source currently doesn't support an array of event filters. Please, create a GitHub issue if it's a blocker for you.",
@@ -366,7 +366,7 @@ let getSelectionConfig = (selection: FetchState.selection, ~chain) => {
366
366
  }
367
367
  }
368
368
  | _ =>
369
- raise(
369
+ throw(
370
370
  Source.GetItemsError(
371
371
  UnsupportedSelection({
372
372
  message: "RPC data-source currently supports event filters only when there's a single wildcard event. Please, create a GitHub issue if it's a blocker for you.",
@@ -384,16 +384,16 @@ let memoGetSelectionConfig = (~chain) =>
384
384
  Utils.WeakMap.memoize(selection => selection->getSelectionConfig(~chain))
385
385
 
386
386
  // Type-erase a schema for storage in the field registry
387
- external toFieldSchema: S.t<'a> => S.t<Js.Json.t> = "%identity"
387
+ external toFieldSchema: S.t<'a> => S.t<JSON.t> = "%identity"
388
388
 
389
- let lowercaseAddressSchema: S.t<Js.Json.t> =
389
+ let lowercaseAddressSchema: S.t<JSON.t> =
390
390
  S.string
391
391
  ->S.transform(_ => {
392
- parser: str => str->Js.String2.toLowerCase->Address.unsafeFromString,
392
+ parser: str => str->String.toLowerCase->Address.unsafeFromString,
393
393
  })
394
394
  ->toFieldSchema
395
395
 
396
- let checksumAddressSchema: S.t<Js.Json.t> =
396
+ let checksumAddressSchema: S.t<JSON.t> =
397
397
  S.string
398
398
  ->S.transform(_ => {
399
399
  parser: str => str->Address.Evm.fromStringOrThrow,
@@ -404,11 +404,11 @@ let checksumAddressSchema: S.t<Js.Json.t> =
404
404
  type blockFieldDef = {
405
405
  location: Internal.evmBlockField,
406
406
  jsonKey: string,
407
- schema: S.t<Js.Json.t>, // Type-erased schema
407
+ schema: S.t<JSON.t>, // Type-erased schema
408
408
  }
409
409
 
410
410
  // Block field registry: maps field location (= JS property name) to parsing info.
411
- let makeBlockFieldRegistry = (addressSchema: S.t<Js.Json.t>): Utils.Record.t<
411
+ let makeBlockFieldRegistry = (addressSchema: S.t<JSON.t>): Utils.Record.t<
412
412
  Internal.evmBlockField,
413
413
  blockFieldDef,
414
414
  > =>
@@ -464,19 +464,19 @@ let blockFieldRegistryChecksum = makeBlockFieldRegistry(checksumAddressSchema)
464
464
 
465
465
  // Parse block fields from raw JSON, similar to parseFieldsFromJson for transactions
466
466
  let parseBlockFieldsFromJson = (
467
- mutBlockAcc: Js.Dict.t<Js.Json.t>,
467
+ mutBlockAcc: dict<JSON.t>,
468
468
  fields: array<blockFieldDef>,
469
- json: Js.Json.t,
469
+ json: JSON.t,
470
470
  ) => {
471
- let jsonDict = json->(Utils.magic: Js.Json.t => Js.Dict.t<Js.Json.t>)
471
+ let jsonDict = json->(Utils.magic: JSON.t => dict<JSON.t>)
472
472
  fields->Array.forEach(def => {
473
- let raw = jsonDict->Js.Dict.unsafeGet(def.jsonKey)
473
+ let raw = jsonDict->Dict.getUnsafe(def.jsonKey)
474
474
  try {
475
475
  let parsed = raw->S.parseOrThrow(def.schema)
476
- mutBlockAcc->Js.Dict.set((def.location :> string), parsed)
476
+ mutBlockAcc->Dict.set((def.location :> string), parsed)
477
477
  } catch {
478
478
  | S.Raised(error) =>
479
- Js.Exn.raiseError(
479
+ JsError.throwWithMessage(
480
480
  `Invalid block field "${(def.location :> string)}" found in the RPC response. Error: ${error->S.Error.reason}`,
481
481
  )
482
482
  }
@@ -484,7 +484,7 @@ let parseBlockFieldsFromJson = (
484
484
  }
485
485
 
486
486
  let makeThrowingGetEventBlock = (
487
- ~getBlockJson: int => promise<Js.Json.t>,
487
+ ~getBlockJson: int => promise<JSON.t>,
488
488
  ~lowercaseAddresses: bool,
489
489
  ) => {
490
490
  let blockFieldRegistry = if lowercaseAddresses {
@@ -501,7 +501,7 @@ let makeThrowingGetEventBlock = (
501
501
  | None => {
502
502
  let fields: array<blockFieldDef> = []
503
503
  selectedBlockFields->Utils.Set.forEach(fieldName => {
504
- fields->Js.Array2.push(blockFieldRegistry->Utils.Record.getUnsafe(fieldName))->ignore
504
+ fields->Array.push(blockFieldRegistry->Utils.Record.getUnsafe(fieldName))->ignore
505
505
  })
506
506
 
507
507
  let fn = if selectedBlockFields->Utils.Set.size == 0 {
@@ -509,9 +509,9 @@ let makeThrowingGetEventBlock = (
509
509
  } else {
510
510
  (log: Rpc.GetLogs.log) => {
511
511
  getBlockJson(log.blockNumber)->Promise.thenResolve(json => {
512
- let mutBlockAcc = Js.Dict.empty()
512
+ let mutBlockAcc = Dict.make()
513
513
  parseBlockFieldsFromJson(mutBlockAcc, fields, json)
514
- mutBlockAcc->(Utils.magic: Js.Dict.t<Js.Json.t> => Internal.eventBlock)
514
+ mutBlockAcc->(Utils.magic: dict<JSON.t> => Internal.eventBlock)
515
515
  })
516
516
  }
517
517
  }
@@ -529,14 +529,14 @@ type fieldSource = TransactionOnly | ReceiptOnly | Both
529
529
  type fieldDef = {
530
530
  location: Internal.evmTransactionField,
531
531
  jsonKey: string,
532
- schema: S.t<Js.Json.t>, // Type-erased schema (S.nullable for optional fields)
532
+ schema: S.t<JSON.t>, // Type-erased schema (S.nullable for optional fields)
533
533
  source: fieldSource,
534
534
  }
535
535
 
536
536
  // Field registry: maps field location (= JS property name) to parsing info.
537
537
  // Only includes fields that require an RPC call. Log-derived fields (hash, transactionIndex) are special-cased.
538
538
  // Nullable fields are wrapped with S.nullable during registry construction based on Internal.evmNullableTransactionFields
539
- let makeFieldRegistry = (addressSchema: S.t<Js.Json.t>): Utils.Record.t<
539
+ let makeFieldRegistry = (addressSchema: S.t<JSON.t>): Utils.Record.t<
540
540
  Internal.evmTransactionField,
541
541
  fieldDef,
542
542
  > =>
@@ -691,19 +691,19 @@ type fetchStrategy = NoRpc | TransactionOnly | ReceiptOnly | TransactionAndRecei
691
691
  // Parse fields from a raw JSON object into a result dict.
692
692
  // Uses unsafeGet so nullable schemas (S.nullable) handle both null and undefined.
693
693
  let parseFieldsFromJson = (
694
- mutTransactionAcc: Js.Dict.t<Js.Json.t>,
694
+ mutTransactionAcc: dict<JSON.t>,
695
695
  fields: array<fieldDef>,
696
- json: Js.Json.t,
696
+ json: JSON.t,
697
697
  ) => {
698
- let jsonDict = json->(Utils.magic: Js.Json.t => Js.Dict.t<Js.Json.t>)
698
+ let jsonDict = json->(Utils.magic: JSON.t => dict<JSON.t>)
699
699
  fields->Array.forEach(def => {
700
- let raw = jsonDict->Js.Dict.unsafeGet(def.jsonKey)
700
+ let raw = jsonDict->Dict.getUnsafe(def.jsonKey)
701
701
  try {
702
702
  let parsed = raw->S.parseOrThrow(def.schema)
703
- mutTransactionAcc->Js.Dict.set((def.location :> string), parsed)
703
+ mutTransactionAcc->Dict.set((def.location :> string), parsed)
704
704
  } catch {
705
705
  | S.Raised(error) =>
706
- Js.Exn.raiseError(
706
+ JsError.throwWithMessage(
707
707
  `Invalid transaction field "${(def.location :> string)}" found in the RPC response. Error: ${error->S.Error.reason}`,
708
708
  )
709
709
  }
@@ -711,8 +711,8 @@ let parseFieldsFromJson = (
711
711
  }
712
712
 
713
713
  let makeThrowingGetEventTransaction = (
714
- ~getTransactionJson: string => promise<Js.Json.t>,
715
- ~getReceiptJson: string => promise<Js.Json.t>,
714
+ ~getTransactionJson: string => promise<JSON.t>,
715
+ ~getReceiptJson: string => promise<JSON.t>,
716
716
  ~lowercaseAddresses: bool,
717
717
  ) => {
718
718
  let fieldRegistry = if lowercaseAddresses {
@@ -742,9 +742,9 @@ let makeThrowingGetEventTransaction = (
742
742
  switch fieldRegistry->Utils.Record.get(fieldName) {
743
743
  | Some(def) =>
744
744
  switch def.source {
745
- | TransactionOnly => txFields->Js.Array2.push(def)->ignore
746
- | ReceiptOnly => receiptFields->Js.Array2.push(def)->ignore
747
- | Both => bothFields->Js.Array2.push(def)->ignore
745
+ | TransactionOnly => txFields->Array.push(def)->ignore
746
+ | ReceiptOnly => receiptFields->Array.push(def)->ignore
747
+ | Both => bothFields->Array.push(def)->ignore
748
748
  }
749
749
  | None => () // Unknown field — skip silently
750
750
  }
@@ -762,20 +762,20 @@ let makeThrowingGetEventTransaction = (
762
762
 
763
763
  // Assign Both fields to whichever source is already being fetched; default to transaction
764
764
  let targetForBoth = strategy == ReceiptOnly ? receiptFields : txFields
765
- bothFields->Array.forEach(f => targetForBoth->Js.Array2.push(f)->ignore)
765
+ bothFields->Array.forEach(f => targetForBoth->Array.push(f)->ignore)
766
766
 
767
767
  // Set log-derived fields on the mutable accumulator
768
- let setLogFields = (mutTransactionAcc: Js.Dict.t<Js.Json.t>, log: Rpc.GetLogs.log) => {
768
+ let setLogFields = (mutTransactionAcc: dict<JSON.t>, log: Rpc.GetLogs.log) => {
769
769
  if hasTransactionIndex.contents {
770
- mutTransactionAcc->Js.Dict.set(
770
+ mutTransactionAcc->Dict.set(
771
771
  "transactionIndex",
772
- log.transactionIndex->(Utils.magic: int => Js.Json.t),
772
+ log.transactionIndex->(Utils.magic: int => JSON.t),
773
773
  )
774
774
  }
775
775
  if hasHash.contents {
776
- mutTransactionAcc->Js.Dict.set(
776
+ mutTransactionAcc->Dict.set(
777
777
  "hash",
778
- log.transactionHash->(Utils.magic: string => Js.Json.t),
778
+ log.transactionHash->(Utils.magic: string => JSON.t),
779
779
  )
780
780
  }
781
781
  }
@@ -786,9 +786,9 @@ let makeThrowingGetEventTransaction = (
786
786
  switch strategy {
787
787
  | NoRpc =>
788
788
  (log: Rpc.GetLogs.log) => {
789
- let mutTransactionAcc = Js.Dict.empty()
789
+ let mutTransactionAcc = Dict.make()
790
790
  setLogFields(mutTransactionAcc, log)
791
- mutTransactionAcc->(Utils.magic: Js.Dict.t<Js.Json.t> => 'a)->Promise.resolve
791
+ mutTransactionAcc->(Utils.magic: dict<JSON.t> => 'a)->Promise.resolve
792
792
  }
793
793
  | _ =>
794
794
  (log: Rpc.GetLogs.log) => {
@@ -807,7 +807,7 @@ let makeThrowingGetEventTransaction = (
807
807
  txJson,
808
808
  receiptJson,
809
809
  )) => {
810
- let mutTransactionAcc = Js.Dict.empty()
810
+ let mutTransactionAcc = Dict.make()
811
811
  setLogFields(mutTransactionAcc, log)
812
812
 
813
813
  switch txJson {
@@ -819,7 +819,7 @@ let makeThrowingGetEventTransaction = (
819
819
  | None => ()
820
820
  }
821
821
 
822
- mutTransactionAcc->(Utils.magic: Js.Dict.t<Js.Json.t> => 'a)
822
+ mutTransactionAcc->(Utils.magic: dict<JSON.t> => 'a)
823
823
  })
824
824
  }
825
825
  }
@@ -858,7 +858,7 @@ let make = (
858
858
  let chainId = chain->ChainMap.Chain.toChainId
859
859
  let urlHost = switch Utils.Url.getHostFromUrl(url) {
860
860
  | None =>
861
- Js.Exn.raiseError(
861
+ JsError.throwWithMessage(
862
862
  `The RPC url for chain ${chainId->Belt.Int.toString} is in incorrect format. The RPC url needs to start with either http:// or https://`,
863
863
  )
864
864
  | Some(host) => host
@@ -867,7 +867,7 @@ let make = (
867
867
 
868
868
  let getSelectionConfig = memoGetSelectionConfig(~chain)
869
869
 
870
- let mutSuggestedBlockIntervals = Js.Dict.empty()
870
+ let mutSuggestedBlockIntervals = Dict.make()
871
871
 
872
872
  let client = Rpc.makeClient(url)
873
873
 
@@ -965,13 +965,14 @@ let make = (
965
965
  ~getTransactionJson=async transactionHash => {
966
966
  switch await transactionLoader.contents->LazyLoader.get(transactionHash) {
967
967
  | Some(json) => json
968
- | None => Js.Exn.raiseError(`Transaction not found for hash: ${transactionHash}`)
968
+ | None => JsError.throwWithMessage(`Transaction not found for hash: ${transactionHash}`)
969
969
  }
970
970
  },
971
971
  ~getReceiptJson=async transactionHash => {
972
972
  switch await receiptLoader.contents->LazyLoader.get(transactionHash) {
973
973
  | Some(json) => json
974
- | None => Js.Exn.raiseError(`Transaction receipt not found for hash: ${transactionHash}`)
974
+ | None =>
975
+ JsError.throwWithMessage(`Transaction receipt not found for hash: ${transactionHash}`)
975
976
  }
976
977
  },
977
978
  ~lowercaseAddresses,
@@ -987,7 +988,7 @@ let make = (
987
988
  blockNumber: log.blockNumber,
988
989
  address: log.address,
989
990
  data: log.data,
990
- topics: log.topics->(Utils.magic: array<string> => array<Js.Nullable.t<EvmTypes.Hex.t>>),
991
+ topics: log.topics->(Utils.magic: array<string> => array<Nullable.t<EvmTypes.Hex.t>>),
991
992
  }
992
993
  {log: hyperSyncLog}
993
994
  }
@@ -1007,7 +1008,7 @@ let make = (
1007
1008
  ~fromBlock,
1008
1009
  ~toBlock,
1009
1010
  ~addressesByContractName,
1010
- ~indexingContracts,
1011
+ ~indexingAddresses,
1011
1012
  ~knownHeight,
1012
1013
  ~partitionId,
1013
1014
  ~selection: FetchState.selection,
@@ -1074,7 +1075,7 @@ let make = (
1074
1075
  ) {
1075
1076
  // Increase batch size going forward, but do not increase past a configured maximum
1076
1077
  // See: https://en.wikipedia.org/wiki/Additive_increase/multiplicative_decrease
1077
- mutSuggestedBlockIntervals->Js.Dict.set(
1078
+ mutSuggestedBlockIntervals->Dict.set(
1078
1079
  partitionId,
1079
1080
  Pervasives.min(
1080
1081
  executedBlockInterval + syncConfig.accelerationAdditive,
@@ -1089,7 +1090,7 @@ let make = (
1089
1090
  // Decode using HyperSyncClient decoder
1090
1091
  let parsedEvents = try await getHscDecoder().decodeEvents(hyperSyncEvents) catch {
1091
1092
  | exn =>
1092
- raise(
1093
+ throw(
1093
1094
  Source.GetItemsError(
1094
1095
  FailedGettingItems({
1095
1096
  exn,
@@ -1102,79 +1103,76 @@ let make = (
1102
1103
  )
1103
1104
  }
1104
1105
 
1105
- let parsedQueueItems =
1106
- await logs
1107
- ->Array.zip(parsedEvents)
1108
- ->Array.keepMap(((
1109
- log: Rpc.GetLogs.log,
1110
- maybeDecodedEvent: Js.Nullable.t<HyperSyncClient.Decoder.decodedEvent>,
1111
- )) => {
1112
- let topic0 = log.topics[0]->Option.getWithDefault("0x0")
1113
- let routedAddress = if lowercaseAddresses {
1114
- log.address->Address.Evm.fromAddressLowercaseOrThrow
1115
- } else {
1116
- log.address->Address.Evm.fromAddressOrThrow
1117
- }
1106
+ let parsedQueueItems = await logs
1107
+ ->Array.zip(parsedEvents)
1108
+ ->Array.filterMap(((
1109
+ log: Rpc.GetLogs.log,
1110
+ maybeDecodedEvent: Nullable.t<HyperSyncClient.Decoder.decodedEvent>,
1111
+ )) => {
1112
+ let topic0 = log.topics[0]->Option.getOr("0x0")
1113
+ let routedAddress = if lowercaseAddresses {
1114
+ log.address->Address.Evm.fromAddressLowercaseOrThrow
1115
+ } else {
1116
+ log.address->Address.Evm.fromAddressOrThrow
1117
+ }
1118
1118
 
1119
- switch eventRouter->EventRouter.get(
1120
- ~tag=EventRouter.getEvmEventId(~sighash=topic0, ~topicCount=log.topics->Array.length),
1121
- ~indexingContracts,
1122
- ~contractAddress=routedAddress,
1123
- ~blockNumber=log.blockNumber,
1124
- ) {
1125
- | None => None
1126
- | Some(eventConfig) =>
1127
- switch maybeDecodedEvent {
1128
- | Js.Nullable.Value(decoded) =>
1129
- Some(
1130
- (
1131
- async () => {
1132
- let (block, transaction) = try await Promise.all2((
1133
- log->getEventBlockOrThrow(~selectedBlockFields=eventConfig.selectedBlockFields),
1134
- log->getEventTransactionOrThrow(
1135
- ~selectedTransactionFields=eventConfig.selectedTransactionFields,
1119
+ switch eventRouter->EventRouter.get(
1120
+ ~tag=EventRouter.getEvmEventId(~sighash=topic0, ~topicCount=log.topics->Array.length),
1121
+ ~indexingAddresses,
1122
+ ~contractAddress=routedAddress,
1123
+ ~blockNumber=log.blockNumber,
1124
+ ) {
1125
+ | None => None
1126
+ | Some(eventConfig) =>
1127
+ switch maybeDecodedEvent {
1128
+ | Value(decoded) =>
1129
+ Some(
1130
+ (
1131
+ async () => {
1132
+ let (block, transaction) = try await Promise.all2((
1133
+ log->getEventBlockOrThrow(~selectedBlockFields=eventConfig.selectedBlockFields),
1134
+ log->getEventTransactionOrThrow(
1135
+ ~selectedTransactionFields=eventConfig.selectedTransactionFields,
1136
+ ),
1137
+ )) catch {
1138
+ | exn =>
1139
+ throw(
1140
+ Source.GetItemsError(
1141
+ FailedGettingFieldSelection({
1142
+ message: "Failed getting selected fields. Please double-check your RPC provider returns correct data.",
1143
+ exn,
1144
+ blockNumber: log.blockNumber,
1145
+ logIndex: log.logIndex,
1146
+ }),
1136
1147
  ),
1137
- )) catch {
1138
- | exn =>
1139
- raise(
1140
- Source.GetItemsError(
1141
- FailedGettingFieldSelection({
1142
- message: "Failed getting selected fields. Please double-check your RPC provider returns correct data.",
1143
- exn,
1144
- blockNumber: log.blockNumber,
1145
- logIndex: log.logIndex,
1146
- }),
1147
- ),
1148
- )
1149
- }
1148
+ )
1149
+ }
1150
1150
 
1151
- Internal.Event({
1152
- eventConfig: (eventConfig :> Internal.eventConfig),
1153
- timestamp: block->Evm.getTimestamp,
1154
- blockNumber: block->Evm.getNumber,
1155
- chain,
1151
+ Internal.Event({
1152
+ eventConfig: (eventConfig :> Internal.eventConfig),
1153
+ timestamp: block->Evm.getTimestamp,
1154
+ blockNumber: block->Evm.getNumber,
1155
+ chain,
1156
+ logIndex: log.logIndex,
1157
+ event: {
1158
+ contractName: eventConfig.contractName,
1159
+ eventName: eventConfig.name,
1160
+ chainId: chain->ChainMap.Chain.toChainId,
1161
+ params: decoded->eventConfig.convertHyperSyncEventArgs,
1162
+ transaction,
1163
+ block,
1164
+ srcAddress: routedAddress,
1156
1165
  logIndex: log.logIndex,
1157
- event: {
1158
- contractName: eventConfig.contractName,
1159
- eventName: eventConfig.name,
1160
- chainId: chain->ChainMap.Chain.toChainId,
1161
- params: decoded->eventConfig.convertHyperSyncEventArgs,
1162
- transaction,
1163
- block,
1164
- srcAddress: routedAddress,
1165
- logIndex: log.logIndex,
1166
- }->Internal.fromGenericEvent,
1167
- })
1168
- }
1169
- )(),
1170
- )
1171
- | Js.Nullable.Null
1172
- | Js.Nullable.Undefined =>
1173
- None
1174
- }
1166
+ }->Internal.fromGenericEvent,
1167
+ })
1168
+ }
1169
+ )(),
1170
+ )
1171
+ | Null | Undefined => None
1175
1172
  }
1176
- })
1177
- ->Promise.all
1173
+ }
1174
+ })
1175
+ ->Promise.all
1178
1176
 
1179
1177
  let optFirstBlockParent = await firstBlockParentPromise
1180
1178
 
@@ -1234,8 +1232,9 @@ let make = (
1234
1232
  }
1235
1233
 
1236
1234
  let createHeightSubscription =
1237
- ws->Belt.Option.map(wsUrl => (~onHeight) =>
1238
- RpcWebSocketHeightStream.subscribe(~wsUrl, ~chainId, ~onHeight))
1235
+ ws->Belt.Option.map(wsUrl =>
1236
+ (~onHeight) => RpcWebSocketHeightStream.subscribe(~wsUrl, ~chainId, ~onHeight)
1237
+ )
1239
1238
 
1240
1239
  {
1241
1240
  name,
@@ -1262,7 +1261,7 @@ let make = (
1262
1261
  ~method="eth_blockNumber",
1263
1262
  ~seconds,
1264
1263
  )
1265
- exn->raise
1264
+ exn->throw
1266
1265
  }
1267
1266
  let seconds = timerRef->Hrtime.timeSince->Hrtime.toSecondsFloat
1268
1267
  Prometheus.SourceRequestCount.increment(