@aztec/foundation 0.76.4 → 0.77.0-testnet-ignition.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 (459) hide show
  1. package/dest/array/array.d.ts +1 -1
  2. package/dest/array/array.d.ts.map +1 -1
  3. package/dest/array/array.js +19 -26
  4. package/dest/array/index.js +0 -1
  5. package/dest/async-map/index.js +2 -4
  6. package/dest/async-pool/index.js +6 -9
  7. package/dest/bigint-buffer/index.js +6 -13
  8. package/dest/buffer/buffer32.d.ts +1 -1
  9. package/dest/buffer/buffer32.d.ts.map +1 -1
  10. package/dest/buffer/buffer32.js +53 -66
  11. package/dest/buffer/index.js +0 -1
  12. package/dest/collection/array.d.ts +1 -1
  13. package/dest/collection/array.d.ts.map +1 -1
  14. package/dest/collection/array.js +47 -59
  15. package/dest/collection/index.js +0 -1
  16. package/dest/collection/object.js +9 -9
  17. package/dest/committable/committable.js +15 -20
  18. package/dest/committable/index.js +0 -1
  19. package/dest/config/env_var.d.ts +1 -1
  20. package/dest/config/env_var.d.ts.map +1 -1
  21. package/dest/config/env_var.js +1 -2
  22. package/dest/config/index.d.ts +1 -1
  23. package/dest/config/index.d.ts.map +1 -1
  24. package/dest/config/index.js +31 -36
  25. package/dest/crypto/aes128/index.d.ts +34 -0
  26. package/dest/crypto/aes128/index.d.ts.map +1 -0
  27. package/dest/crypto/aes128/index.js +49 -0
  28. package/dest/crypto/ecdsa/index.d.ts +39 -0
  29. package/dest/crypto/ecdsa/index.d.ts.map +1 -0
  30. package/dest/crypto/ecdsa/index.js +88 -0
  31. package/dest/crypto/ecdsa/signature.d.ts +71 -0
  32. package/dest/crypto/ecdsa/signature.d.ts.map +1 -0
  33. package/dest/crypto/ecdsa/signature.js +92 -0
  34. package/dest/crypto/grumpkin/index.d.ts +47 -0
  35. package/dest/crypto/grumpkin/index.d.ts.map +1 -0
  36. package/dest/crypto/grumpkin/index.js +154 -0
  37. package/dest/crypto/index.d.ts +6 -0
  38. package/dest/crypto/index.d.ts.map +1 -1
  39. package/dest/crypto/index.js +6 -1
  40. package/dest/crypto/keccak/index.js +60 -69
  41. package/dest/crypto/keys/index.js +2 -3
  42. package/dest/crypto/pedersen/index.js +0 -1
  43. package/dest/crypto/pedersen/pedersen.elliptic.js +153 -146
  44. package/dest/crypto/pedersen/pedersen.noble.js +140 -142
  45. package/dest/crypto/pedersen/pedersen.wasm.js +17 -16
  46. package/dest/crypto/poseidon/index.js +15 -19
  47. package/dest/crypto/random/index.js +7 -12
  48. package/dest/crypto/random/randomness_singleton.js +12 -12
  49. package/dest/crypto/schnorr/index.d.ts +30 -0
  50. package/dest/crypto/schnorr/index.d.ts.map +1 -0
  51. package/dest/crypto/schnorr/index.js +68 -0
  52. package/dest/crypto/schnorr/signature.d.ts +70 -0
  53. package/dest/crypto/schnorr/signature.d.ts.map +1 -0
  54. package/dest/crypto/schnorr/signature.js +93 -0
  55. package/dest/crypto/secp256k1/index.d.ts +32 -0
  56. package/dest/crypto/secp256k1/index.d.ts.map +1 -0
  57. package/dest/crypto/secp256k1/index.js +116 -0
  58. package/dest/crypto/secp256k1-signer/index.js +0 -1
  59. package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts +2 -2
  60. package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts.map +1 -1
  61. package/dest/crypto/secp256k1-signer/secp256k1_signer.js +8 -9
  62. package/dest/crypto/secp256k1-signer/utils.js +11 -16
  63. package/dest/crypto/serialize.d.ts +53 -0
  64. package/dest/crypto/serialize.d.ts.map +1 -0
  65. package/dest/crypto/serialize.js +68 -0
  66. package/dest/crypto/sha256/index.js +80 -30
  67. package/dest/crypto/sha512/index.js +2 -4
  68. package/dest/crypto/signature/index.d.ts +19 -0
  69. package/dest/crypto/signature/index.d.ts.map +1 -0
  70. package/dest/crypto/signature/index.js +3 -0
  71. package/dest/crypto/sync/index.js +1 -2
  72. package/dest/crypto/sync/pedersen/index.js +14 -13
  73. package/dest/crypto/sync/poseidon/index.js +10 -14
  74. package/dest/decorators/index.js +0 -1
  75. package/dest/decorators/memoize.js +1 -2
  76. package/dest/error/index.js +6 -19
  77. package/dest/eth-address/index.js +92 -113
  78. package/dest/eth-signature/eth_signature.js +21 -27
  79. package/dest/eth-signature/index.js +0 -1
  80. package/dest/fields/coordinate.d.ts +1 -1
  81. package/dest/fields/coordinate.d.ts.map +1 -1
  82. package/dest/fields/coordinate.js +47 -46
  83. package/dest/fields/fields.d.ts.map +1 -1
  84. package/dest/fields/fields.js +112 -126
  85. package/dest/fields/index.js +0 -1
  86. package/dest/fields/point.js +119 -129
  87. package/dest/fs/index.js +0 -1
  88. package/dest/fs/run_in_dir.d.ts +1 -1
  89. package/dest/fs/run_in_dir.d.ts.map +1 -1
  90. package/dest/fs/run_in_dir.js +16 -7
  91. package/dest/index.d.ts +0 -2
  92. package/dest/index.d.ts.map +1 -1
  93. package/dest/index.js +0 -3
  94. package/dest/iterable/all.js +3 -4
  95. package/dest/iterable/filter.js +10 -11
  96. package/dest/iterable/index.js +0 -1
  97. package/dest/iterable/isAsyncIt.js +1 -3
  98. package/dest/iterable/map.js +10 -11
  99. package/dest/iterable/peek.js +14 -14
  100. package/dest/iterable/sort.js +4 -5
  101. package/dest/iterable/take.js +6 -7
  102. package/dest/iterable/toArray.js +1 -2
  103. package/dest/jest/setup.js +7 -0
  104. package/dest/json-rpc/client/fetch.js +25 -20
  105. package/dest/json-rpc/client/index.js +0 -1
  106. package/dest/json-rpc/client/safe_json_rpc_client.js +20 -9
  107. package/dest/json-rpc/client/undici.d.ts +1 -1
  108. package/dest/json-rpc/client/undici.d.ts.map +1 -1
  109. package/dest/json-rpc/client/undici.js +16 -17
  110. package/dest/json-rpc/convert.d.ts +1 -1
  111. package/dest/json-rpc/convert.d.ts.map +1 -1
  112. package/dest/json-rpc/convert.js +10 -20
  113. package/dest/json-rpc/fixtures/class_a.js +8 -5
  114. package/dest/json-rpc/fixtures/class_b.js +8 -5
  115. package/dest/json-rpc/fixtures/test_state.js +53 -40
  116. package/dest/json-rpc/index.js +0 -1
  117. package/dest/json-rpc/js_utils.js +2 -5
  118. package/dest/json-rpc/server/index.js +0 -1
  119. package/dest/json-rpc/server/safe_json_rpc_server.js +145 -101
  120. package/dest/json-rpc/server/telemetry.js +0 -2
  121. package/dest/json-rpc/test/index.js +0 -1
  122. package/dest/json-rpc/test/integration.d.ts +1 -1
  123. package/dest/json-rpc/test/integration.d.ts.map +1 -1
  124. package/dest/json-rpc/test/integration.js +11 -5
  125. package/dest/log/console.d.ts +1 -1
  126. package/dest/log/console.d.ts.map +1 -1
  127. package/dest/log/console.js +14 -16
  128. package/dest/log/debug.d.ts +1 -1
  129. package/dest/log/debug.d.ts.map +1 -1
  130. package/dest/log/debug.js +9 -18
  131. package/dest/log/gcloud-logger-config.js +17 -15
  132. package/dest/log/index.d.ts +1 -0
  133. package/dest/log/index.d.ts.map +1 -1
  134. package/dest/log/index.js +1 -1
  135. package/dest/log/libp2p_logger.d.ts +7 -0
  136. package/dest/log/libp2p_logger.d.ts.map +1 -0
  137. package/dest/log/libp2p_logger.js +55 -0
  138. package/dest/log/log-filters.js +14 -13
  139. package/dest/log/log-levels.js +10 -2
  140. package/dest/log/log_fn.js +1 -2
  141. package/dest/log/log_history.js +21 -25
  142. package/dest/log/pino-logger.d.ts +8 -4
  143. package/dest/log/pino-logger.d.ts.map +1 -1
  144. package/dest/log/pino-logger.js +92 -74
  145. package/dest/message/index.js +7 -3
  146. package/dest/mutex/index.d.ts +1 -1
  147. package/dest/mutex/index.d.ts.map +1 -1
  148. package/dest/mutex/index.js +34 -32
  149. package/dest/mutex/mutex_database.js +4 -2
  150. package/dest/noir/index.js +0 -1
  151. package/dest/noir/noir_package_config.js +13 -8
  152. package/dest/promise/index.js +0 -1
  153. package/dest/promise/running-promise.d.ts +8 -2
  154. package/dest/promise/running-promise.d.ts.map +1 -1
  155. package/dest/promise/running-promise.js +44 -31
  156. package/dest/promise/utils.js +3 -5
  157. package/dest/queue/base_memory_queue.js +51 -59
  158. package/dest/queue/batch_queue.js +34 -27
  159. package/dest/queue/bounded_serial_queue.js +41 -51
  160. package/dest/queue/fifo_memory_queue.d.ts +1 -1
  161. package/dest/queue/fifo_memory_queue.d.ts.map +1 -1
  162. package/dest/queue/fifo_memory_queue.js +4 -8
  163. package/dest/queue/index.js +0 -1
  164. package/dest/queue/priority_memory_queue.js +3 -4
  165. package/dest/queue/priority_queue.js +5 -5
  166. package/dest/queue/semaphore.js +15 -19
  167. package/dest/queue/serial_queue.js +37 -47
  168. package/dest/retry/index.js +21 -18
  169. package/dest/running-promise/index.js +0 -1
  170. package/dest/schemas/api.d.ts +2 -2
  171. package/dest/schemas/api.d.ts.map +1 -1
  172. package/dest/schemas/api.js +2 -7
  173. package/dest/schemas/index.d.ts +1 -1
  174. package/dest/schemas/index.d.ts.map +1 -1
  175. package/dest/schemas/index.js +1 -2
  176. package/dest/schemas/parse.js +4 -8
  177. package/dest/schemas/schemas.d.ts +1 -16
  178. package/dest/schemas/schemas.d.ts.map +1 -1
  179. package/dest/schemas/schemas.js +28 -56
  180. package/dest/schemas/types.d.ts +1 -1
  181. package/dest/schemas/types.d.ts.map +1 -1
  182. package/dest/schemas/types.js +1 -2
  183. package/dest/schemas/utils.d.ts +1 -1
  184. package/dest/schemas/utils.d.ts.map +1 -1
  185. package/dest/schemas/utils.js +18 -31
  186. package/dest/serialize/buffer_reader.d.ts +1 -1
  187. package/dest/serialize/buffer_reader.d.ts.map +1 -1
  188. package/dest/serialize/buffer_reader.js +164 -188
  189. package/dest/serialize/field_reader.d.ts +1 -1
  190. package/dest/serialize/field_reader.d.ts.map +1 -1
  191. package/dest/serialize/field_reader.js +70 -79
  192. package/dest/serialize/free_funcs.d.ts +1 -1
  193. package/dest/serialize/free_funcs.d.ts.map +1 -1
  194. package/dest/serialize/free_funcs.js +40 -37
  195. package/dest/serialize/index.js +0 -1
  196. package/dest/serialize/serialize.js +72 -83
  197. package/dest/serialize/type_registry.js +10 -14
  198. package/dest/serialize/types.js +4 -5
  199. package/dest/sleep/index.js +25 -29
  200. package/dest/string/index.js +0 -1
  201. package/dest/testing/files/index.js +3 -7
  202. package/dest/testing/index.js +0 -1
  203. package/dest/testing/port_allocator.js +7 -10
  204. package/dest/testing/snapshot_serializer.d.ts +1 -1
  205. package/dest/testing/snapshot_serializer.d.ts.map +1 -1
  206. package/dest/testing/snapshot_serializer.js +14 -9
  207. package/dest/testing/test_data.js +7 -8
  208. package/dest/timer/date.js +9 -7
  209. package/dest/timer/elapsed.js +10 -7
  210. package/dest/timer/index.js +0 -1
  211. package/dest/timer/timeout.js +34 -34
  212. package/dest/timer/timer.js +17 -21
  213. package/dest/transport/browser/index.js +0 -1
  214. package/dest/transport/browser/message_port_socket.d.ts +1 -1
  215. package/dest/transport/browser/message_port_socket.d.ts.map +1 -1
  216. package/dest/transport/browser/message_port_socket.js +26 -30
  217. package/dest/transport/browser/shared_worker_connector.d.ts +1 -1
  218. package/dest/transport/browser/shared_worker_connector.d.ts.map +1 -1
  219. package/dest/transport/browser/shared_worker_connector.js +8 -10
  220. package/dest/transport/browser/shared_worker_listener.d.ts +1 -1
  221. package/dest/transport/browser/shared_worker_listener.d.ts.map +1 -1
  222. package/dest/transport/browser/shared_worker_listener.js +13 -17
  223. package/dest/transport/browser/worker_connector.d.ts +1 -1
  224. package/dest/transport/browser/worker_connector.d.ts.map +1 -1
  225. package/dest/transport/browser/worker_connector.js +12 -12
  226. package/dest/transport/browser/worker_listener.d.ts +1 -1
  227. package/dest/transport/browser/worker_listener.d.ts.map +1 -1
  228. package/dest/transport/browser/worker_listener.js +13 -17
  229. package/dest/transport/dispatch/create_dispatch_fn.js +2 -4
  230. package/dest/transport/dispatch/create_dispatch_proxy.d.ts +2 -2
  231. package/dest/transport/dispatch/create_dispatch_proxy.d.ts.map +1 -1
  232. package/dest/transport/dispatch/create_dispatch_proxy.js +16 -13
  233. package/dest/transport/dispatch/messages.js +4 -3
  234. package/dest/transport/index.js +0 -1
  235. package/dest/transport/interface/connector.d.ts +1 -1
  236. package/dest/transport/interface/connector.d.ts.map +1 -1
  237. package/dest/transport/interface/connector.js +3 -2
  238. package/dest/transport/interface/listener.d.ts +1 -1
  239. package/dest/transport/interface/listener.d.ts.map +1 -1
  240. package/dest/transport/interface/listener.js +4 -2
  241. package/dest/transport/interface/socket.js +7 -2
  242. package/dest/transport/interface/transferable.js +7 -9
  243. package/dest/transport/node/index.js +0 -1
  244. package/dest/transport/node/node_connector.d.ts +2 -2
  245. package/dest/transport/node/node_connector.d.ts.map +1 -1
  246. package/dest/transport/node/node_connector.js +9 -11
  247. package/dest/transport/node/node_connector_socket.d.ts +2 -2
  248. package/dest/transport/node/node_connector_socket.d.ts.map +1 -1
  249. package/dest/transport/node/node_connector_socket.js +21 -25
  250. package/dest/transport/node/node_listener.d.ts +1 -1
  251. package/dest/transport/node/node_listener.d.ts.map +1 -1
  252. package/dest/transport/node/node_listener.js +11 -15
  253. package/dest/transport/node/node_listener_socket.d.ts +2 -2
  254. package/dest/transport/node/node_listener_socket.d.ts.map +1 -1
  255. package/dest/transport/node/node_listener_socket.js +23 -27
  256. package/dest/transport/transport_client.d.ts +1 -1
  257. package/dest/transport/transport_client.d.ts.map +1 -1
  258. package/dest/transport/transport_client.js +47 -46
  259. package/dest/transport/transport_server.d.ts +1 -1
  260. package/dest/transport/transport_server.d.ts.map +1 -1
  261. package/dest/transport/transport_server.js +68 -55
  262. package/dest/trees/hasher.d.ts +39 -0
  263. package/dest/trees/hasher.d.ts.map +1 -0
  264. package/dest/trees/hasher.js +5 -0
  265. package/dest/trees/index.d.ts +8 -56
  266. package/dest/trees/index.d.ts.map +1 -1
  267. package/dest/trees/index.js +8 -1
  268. package/dest/trees/indexed_merkle_tree.d.ts +13 -0
  269. package/dest/trees/indexed_merkle_tree.d.ts.map +1 -0
  270. package/dest/trees/indexed_merkle_tree.js +27 -0
  271. package/dest/trees/indexed_merkle_tree_calculator.d.ts +23 -0
  272. package/dest/trees/indexed_merkle_tree_calculator.d.ts.map +1 -0
  273. package/dest/trees/indexed_merkle_tree_calculator.js +83 -0
  274. package/dest/trees/indexed_tree_leaf.d.ts +57 -0
  275. package/dest/trees/indexed_tree_leaf.d.ts.map +1 -0
  276. package/dest/trees/indexed_tree_leaf.js +5 -0
  277. package/dest/trees/membership_witness.d.ts +62 -0
  278. package/dest/trees/membership_witness.d.ts.map +1 -0
  279. package/dest/trees/membership_witness.js +70 -0
  280. package/dest/trees/merkle_tree.d.ts +18 -0
  281. package/dest/trees/merkle_tree.d.ts.map +1 -0
  282. package/dest/trees/merkle_tree.js +58 -0
  283. package/dest/trees/merkle_tree_calculator.d.ts +16 -0
  284. package/dest/trees/merkle_tree_calculator.d.ts.map +1 -0
  285. package/dest/trees/merkle_tree_calculator.js +61 -0
  286. package/dest/trees/sibling_path.d.ts +132 -0
  287. package/dest/trees/sibling_path.d.ts.map +1 -0
  288. package/dest/trees/sibling_path.js +144 -0
  289. package/dest/trees/unbalanced_merkle_tree.d.ts +1 -1
  290. package/dest/trees/unbalanced_merkle_tree.d.ts.map +1 -1
  291. package/dest/trees/unbalanced_merkle_tree.js +28 -18
  292. package/dest/trees/unbalanced_tree_store.js +43 -29
  293. package/dest/types/index.js +1 -3
  294. package/dest/url/index.js +4 -8
  295. package/dest/validation/index.js +2 -5
  296. package/dest/wasm/empty_wasi_sdk.js +142 -160
  297. package/dest/wasm/index.d.ts +1 -1
  298. package/dest/wasm/index.d.ts.map +1 -1
  299. package/dest/wasm/index.js +0 -1
  300. package/dest/wasm/wasm_module.js +80 -90
  301. package/dest/worker/browser/index.js +0 -1
  302. package/dest/worker/browser/start_web_module.d.ts +1 -1
  303. package/dest/worker/browser/start_web_module.d.ts.map +1 -1
  304. package/dest/worker/browser/start_web_module.js +9 -5
  305. package/dest/worker/browser/web_data_store.d.ts +1 -1
  306. package/dest/worker/browser/web_data_store.d.ts.map +1 -1
  307. package/dest/worker/browser/web_data_store.js +12 -15
  308. package/dest/worker/browser/web_worker.d.ts +1 -1
  309. package/dest/worker/browser/web_worker.d.ts.map +1 -1
  310. package/dest/worker/browser/web_worker.js +6 -5
  311. package/dest/worker/data_store.js +3 -2
  312. package/dest/worker/index.d.ts +1 -1
  313. package/dest/worker/index.d.ts.map +1 -1
  314. package/dest/worker/index.js +0 -1
  315. package/dest/worker/node/index.js +0 -1
  316. package/dest/worker/node/node_data_store.d.ts +1 -1
  317. package/dest/worker/node/node_data_store.d.ts.map +1 -1
  318. package/dest/worker/node/node_data_store.js +4 -5
  319. package/dest/worker/node/node_worker.d.ts +1 -1
  320. package/dest/worker/node/node_worker.d.ts.map +1 -1
  321. package/dest/worker/node/node_worker.js +6 -5
  322. package/dest/worker/node/start_node_module.d.ts +1 -1
  323. package/dest/worker/node/start_node_module.d.ts.map +1 -1
  324. package/dest/worker/node/start_node_module.js +9 -5
  325. package/dest/worker/wasm_worker.d.ts +2 -2
  326. package/dest/worker/wasm_worker.d.ts.map +1 -1
  327. package/dest/worker/wasm_worker.js +3 -2
  328. package/dest/worker/worker_pool.d.ts +1 -1
  329. package/dest/worker/worker_pool.d.ts.map +1 -1
  330. package/dest/worker/worker_pool.js +32 -43
  331. package/package.json +5 -5
  332. package/src/array/array.ts +1 -1
  333. package/src/buffer/buffer32.ts +1 -1
  334. package/src/collection/array.ts +1 -1
  335. package/src/config/env_var.ts +7 -5
  336. package/src/config/index.ts +1 -1
  337. package/src/crypto/aes128/index.ts +59 -0
  338. package/src/crypto/ecdsa/index.ts +70 -0
  339. package/src/crypto/ecdsa/signature.ts +100 -0
  340. package/src/crypto/grumpkin/index.ts +97 -0
  341. package/src/crypto/index.ts +6 -0
  342. package/src/crypto/keys/index.ts +1 -1
  343. package/src/crypto/pedersen/pedersen.wasm.ts +3 -3
  344. package/src/crypto/poseidon/index.ts +5 -5
  345. package/src/crypto/schnorr/index.ts +55 -0
  346. package/src/crypto/schnorr/signature.ts +116 -0
  347. package/src/crypto/secp256k1/index.ts +57 -0
  348. package/src/crypto/secp256k1-signer/secp256k1_signer.ts +2 -2
  349. package/src/crypto/serialize.ts +85 -0
  350. package/src/crypto/signature/index.ts +17 -0
  351. package/src/crypto/sync/index.ts +1 -1
  352. package/src/fields/coordinate.ts +1 -1
  353. package/src/fields/fields.ts +2 -1
  354. package/src/fs/run_in_dir.ts +8 -1
  355. package/src/index.ts +0 -2
  356. package/src/json-rpc/client/undici.ts +1 -1
  357. package/src/json-rpc/convert.ts +1 -1
  358. package/src/json-rpc/server/safe_json_rpc_server.ts +1 -1
  359. package/src/json-rpc/test/integration.ts +1 -1
  360. package/src/log/console.ts +1 -1
  361. package/src/log/debug.ts +1 -1
  362. package/src/log/gcloud-logger-config.ts +1 -1
  363. package/src/log/index.ts +1 -0
  364. package/src/log/libp2p_logger.ts +67 -0
  365. package/src/log/pino-logger.ts +16 -16
  366. package/src/mutex/index.ts +1 -1
  367. package/src/promise/running-promise.ts +24 -5
  368. package/src/queue/fifo_memory_queue.ts +1 -1
  369. package/src/schemas/api.ts +2 -2
  370. package/src/schemas/index.ts +1 -1
  371. package/src/schemas/schemas.ts +2 -26
  372. package/src/schemas/types.ts +1 -1
  373. package/src/schemas/utils.ts +1 -1
  374. package/src/serialize/buffer_reader.ts +1 -1
  375. package/src/serialize/field_reader.ts +1 -1
  376. package/src/serialize/free_funcs.ts +1 -1
  377. package/src/testing/snapshot_serializer.ts +1 -1
  378. package/src/transport/browser/message_port_socket.ts +1 -1
  379. package/src/transport/browser/shared_worker_connector.ts +1 -1
  380. package/src/transport/browser/shared_worker_listener.ts +1 -1
  381. package/src/transport/browser/worker_connector.ts +1 -1
  382. package/src/transport/browser/worker_listener.ts +1 -1
  383. package/src/transport/dispatch/create_dispatch_proxy.ts +2 -2
  384. package/src/transport/interface/connector.ts +1 -1
  385. package/src/transport/interface/listener.ts +1 -1
  386. package/src/transport/node/node_connector.ts +2 -2
  387. package/src/transport/node/node_connector_socket.ts +2 -2
  388. package/src/transport/node/node_listener.ts +1 -1
  389. package/src/transport/node/node_listener_socket.ts +2 -2
  390. package/src/transport/transport_client.ts +2 -2
  391. package/src/transport/transport_server.ts +3 -3
  392. package/src/trees/hasher.ts +39 -0
  393. package/src/trees/index.ts +8 -57
  394. package/src/trees/indexed_merkle_tree.ts +36 -0
  395. package/src/trees/indexed_merkle_tree_calculator.ts +94 -0
  396. package/src/trees/indexed_tree_leaf.ts +56 -0
  397. package/src/trees/membership_witness.ts +99 -0
  398. package/src/trees/merkle_tree.ts +72 -0
  399. package/src/trees/merkle_tree_calculator.ts +67 -0
  400. package/src/trees/sibling_path.ts +183 -0
  401. package/src/trees/unbalanced_merkle_tree.ts +2 -2
  402. package/src/wasm/index.ts +1 -1
  403. package/src/worker/browser/start_web_module.ts +1 -1
  404. package/src/worker/browser/web_data_store.ts +1 -1
  405. package/src/worker/browser/web_worker.ts +1 -1
  406. package/src/worker/index.ts +1 -1
  407. package/src/worker/node/node_data_store.ts +1 -1
  408. package/src/worker/node/node_worker.ts +1 -1
  409. package/src/worker/node/start_node_module.ts +1 -1
  410. package/src/worker/wasm_worker.ts +2 -2
  411. package/src/worker/worker_pool.ts +1 -1
  412. package/dest/abi/abi.d.ts +0 -853
  413. package/dest/abi/abi.d.ts.map +0 -1
  414. package/dest/abi/abi.js +0 -214
  415. package/dest/abi/buffer.d.ts +0 -18
  416. package/dest/abi/buffer.d.ts.map +0 -1
  417. package/dest/abi/buffer.js +0 -34
  418. package/dest/abi/decoder.d.ts +0 -58
  419. package/dest/abi/decoder.d.ts.map +0 -1
  420. package/dest/abi/decoder.js +0 -180
  421. package/dest/abi/encoder.d.ts +0 -16
  422. package/dest/abi/encoder.d.ts.map +0 -1
  423. package/dest/abi/encoder.js +0 -174
  424. package/dest/abi/event_selector.d.ts +0 -52
  425. package/dest/abi/event_selector.d.ts.map +0 -1
  426. package/dest/abi/event_selector.js +0 -76
  427. package/dest/abi/function_selector.d.ts +0 -65
  428. package/dest/abi/function_selector.d.ts.map +0 -1
  429. package/dest/abi/function_selector.js +0 -92
  430. package/dest/abi/index.d.ts +0 -10
  431. package/dest/abi/index.d.ts.map +0 -1
  432. package/dest/abi/index.js +0 -10
  433. package/dest/abi/note_selector.d.ts +0 -42
  434. package/dest/abi/note_selector.d.ts.map +0 -1
  435. package/dest/abi/note_selector.js +0 -63
  436. package/dest/abi/selector.d.ts +0 -42
  437. package/dest/abi/selector.d.ts.map +0 -1
  438. package/dest/abi/selector.js +0 -57
  439. package/dest/abi/u128.d.ts +0 -13
  440. package/dest/abi/u128.d.ts.map +0 -1
  441. package/dest/abi/u128.js +0 -58
  442. package/dest/abi/utils.d.ts +0 -44
  443. package/dest/abi/utils.d.ts.map +0 -1
  444. package/dest/abi/utils.js +0 -72
  445. package/dest/aztec-address/index.d.ts +0 -57
  446. package/dest/aztec-address/index.d.ts.map +0 -1
  447. package/dest/aztec-address/index.js +0 -114
  448. package/src/abi/abi.ts +0 -504
  449. package/src/abi/buffer.ts +0 -36
  450. package/src/abi/decoder.ts +0 -195
  451. package/src/abi/encoder.ts +0 -170
  452. package/src/abi/event_selector.ts +0 -92
  453. package/src/abi/function_selector.ts +0 -124
  454. package/src/abi/index.ts +0 -9
  455. package/src/abi/note_selector.ts +0 -78
  456. package/src/abi/selector.ts +0 -64
  457. package/src/abi/u128.ts +0 -71
  458. package/src/abi/utils.ts +0 -86
  459. package/src/aztec-address/index.ts +0 -146
@@ -1,65 +1,77 @@
1
- var _UnbalancedTreeStore_instances, _UnbalancedTreeStore_nodeMapping, _UnbalancedTreeStore_numLeaves, _UnbalancedTreeStore_getKey;
2
- import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
3
1
  import { findLeafLevelAndIndex } from './unbalanced_merkle_tree.js';
4
2
  export class UnbalancedTreeStore {
5
- constructor(numLeaves) {
6
- _UnbalancedTreeStore_instances.add(this);
7
- _UnbalancedTreeStore_nodeMapping.set(this, new Map());
8
- _UnbalancedTreeStore_numLeaves.set(this, void 0);
9
- __classPrivateFieldSet(this, _UnbalancedTreeStore_numLeaves, numLeaves, "f");
3
+ #nodeMapping = new Map();
4
+ #numLeaves;
5
+ constructor(numLeaves){
6
+ this.#numLeaves = numLeaves;
10
7
  }
11
8
  setLeaf(leafIndex, value) {
12
- if (leafIndex >= __classPrivateFieldGet(this, _UnbalancedTreeStore_numLeaves, "f")) {
13
- throw new Error(`Expected at most ${__classPrivateFieldGet(this, _UnbalancedTreeStore_numLeaves, "f")} leaves. Received a leaf at index ${leafIndex}.`);
9
+ if (leafIndex >= this.#numLeaves) {
10
+ throw new Error(`Expected at most ${this.#numLeaves} leaves. Received a leaf at index ${leafIndex}.`);
14
11
  }
15
- const { level, indexAtLevel } = findLeafLevelAndIndex(__classPrivateFieldGet(this, _UnbalancedTreeStore_numLeaves, "f"), leafIndex);
12
+ const { level, indexAtLevel } = findLeafLevelAndIndex(this.#numLeaves, leafIndex);
16
13
  const location = {
17
14
  level,
18
- index: indexAtLevel,
15
+ index: indexAtLevel
19
16
  };
20
- __classPrivateFieldGet(this, _UnbalancedTreeStore_nodeMapping, "f").set(__classPrivateFieldGet(this, _UnbalancedTreeStore_instances, "m", _UnbalancedTreeStore_getKey).call(this, location), {
17
+ this.#nodeMapping.set(this.#getKey(location), {
21
18
  location,
22
- value,
19
+ value
23
20
  });
24
21
  return location;
25
22
  }
26
23
  setNode({ level, index }, value) {
27
24
  const location = {
28
25
  level,
29
- index,
26
+ index
30
27
  };
31
- __classPrivateFieldGet(this, _UnbalancedTreeStore_nodeMapping, "f").set(__classPrivateFieldGet(this, _UnbalancedTreeStore_instances, "m", _UnbalancedTreeStore_getKey).call(this, location), {
28
+ this.#nodeMapping.set(this.#getKey(location), {
32
29
  location,
33
- value,
30
+ value
34
31
  });
35
32
  }
36
33
  getParentLocation({ level, index }) {
37
34
  if (level === 0) {
38
35
  throw new Error('Tree root does not have a parent.');
39
36
  }
40
- return { level: level - 1, index: Math.floor(index / 2) };
37
+ return {
38
+ level: level - 1,
39
+ index: Math.floor(index / 2)
40
+ };
41
41
  }
42
42
  getSiblingLocation({ level, index }) {
43
43
  if (level === 0) {
44
44
  throw new Error('Tree root does not have a sibling.');
45
45
  }
46
- return { level, index: index % 2 ? index - 1 : index + 1 };
46
+ return {
47
+ level,
48
+ index: index % 2 ? index - 1 : index + 1
49
+ };
47
50
  }
48
51
  getChildLocations({ level, index }) {
49
- const left = { level: level + 1, index: index * 2 };
50
- const right = { level: level + 1, index: index * 2 + 1 };
51
- return [left, right];
52
+ const left = {
53
+ level: level + 1,
54
+ index: index * 2
55
+ };
56
+ const right = {
57
+ level: level + 1,
58
+ index: index * 2 + 1
59
+ };
60
+ return [
61
+ left,
62
+ right
63
+ ];
52
64
  }
53
65
  getLeaf(leafIndex) {
54
- const { level, indexAtLevel } = findLeafLevelAndIndex(__classPrivateFieldGet(this, _UnbalancedTreeStore_numLeaves, "f"), leafIndex);
66
+ const { level, indexAtLevel } = findLeafLevelAndIndex(this.#numLeaves, leafIndex);
55
67
  const location = {
56
68
  level,
57
- index: indexAtLevel,
69
+ index: indexAtLevel
58
70
  };
59
71
  return this.getNode(location);
60
72
  }
61
73
  getNode(location) {
62
- return __classPrivateFieldGet(this, _UnbalancedTreeStore_nodeMapping, "f").get(__classPrivateFieldGet(this, _UnbalancedTreeStore_instances, "m", _UnbalancedTreeStore_getKey).call(this, location))?.value;
74
+ return this.#nodeMapping.get(this.#getKey(location))?.value;
63
75
  }
64
76
  getParent(location) {
65
77
  const parentLocation = this.getParentLocation(location);
@@ -71,10 +83,12 @@ export class UnbalancedTreeStore {
71
83
  }
72
84
  getChildren(location) {
73
85
  const [left, right] = this.getChildLocations(location);
74
- return [this.getNode(left), this.getNode(right)];
86
+ return [
87
+ this.getNode(left),
88
+ this.getNode(right)
89
+ ];
90
+ }
91
+ #getKey(location) {
92
+ return `${location.level}-${location.index}`;
75
93
  }
76
94
  }
77
- _UnbalancedTreeStore_nodeMapping = new WeakMap(), _UnbalancedTreeStore_numLeaves = new WeakMap(), _UnbalancedTreeStore_instances = new WeakSet(), _UnbalancedTreeStore_getKey = function _UnbalancedTreeStore_getKey(location)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ztJQUN0QyxDQUFDO0lBRUQsVUFBVSxDQUFDLFFBQTBCO1FBQ25DLE1BQU0sZUFBZSxHQUFHLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxRQUFRLENBQUMsQ0FBQztRQUMxRCxPQUFPLElBQUksQ0FBQyxPQUFPLENBQUMsZUFBZSxDQUFDLENBQUM7SUFDdkMsQ0FBQztJQUVELFdBQVcsQ0FBQyxRQUEwQjtRQUNwQyxNQUFNLENBQUMsSUFBSSxFQUFFLEtBQUssQ0FBQyxHQUFHLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxRQUFRLENBQUMsQ0FBQztRQUN2RCxPQUFPLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7SUFDbkQsQ0FBQztDQUtGO3FOQUhTLFFBQTBCO0lBQ2hDLE9BQU8sR0FBRyxRQUFRLENBQUMsS0FBSyxJQUFJLFFBQVEsQ0FBQyxLQUFLLEVBQUUsQ0FBQztBQUMvQyxDQUFDIn0=
@@ -1,5 +1,3 @@
1
- /** Removes readonly modifiers for an object. */
2
- export function unfreeze(obj) {
1
+ /** Strips methods of a type. */ /** Removes readonly modifiers for an object. */ export function unfreeze(obj) {
3
2
  return obj;
4
3
  }
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBa0JBLGdEQUFnRDtBQUNoRCxNQUFNLFVBQVUsUUFBUSxDQUFJLEdBQU07SUFDaEMsT0FBTyxHQUFtQixDQUFDO0FBQzdCLENBQUMifQ==
package/dest/url/index.js CHANGED
@@ -1,5 +1,4 @@
1
- /* eslint-disable */
2
- // Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
1
+ /* eslint-disable */ // Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
3
2
  // Permission is hereby granted, free of charge, to any person obtaining
4
3
  // a copy of this software and associated documentation files (the
5
4
  // 'Software'), to deal in the Software without restriction, including
@@ -23,8 +22,7 @@ import { sep } from 'path';
23
22
  * @param {String} uri
24
23
  * @return {String} path
25
24
  * @api public
26
- */
27
- export function fileURLToPath(uri) {
25
+ */ export function fileURLToPath(uri) {
28
26
  if (typeof uri !== 'string' || uri.length <= 7 || uri.substring(0, 7) !== 'file://') {
29
27
  throw new TypeError('must pass in a file:// URI to convert to a file path');
30
28
  }
@@ -55,12 +53,10 @@ export function fileURLToPath(uri) {
55
53
  path = path.replace(/\//g, '\\');
56
54
  }
57
55
  if (/^.+:/.test(path)) {
58
- // has Windows drive at beginning of path
59
- }
60
- else {
56
+ // has Windows drive at beginning of path
57
+ } else {
61
58
  // unix path…
62
59
  path = sep + path;
63
60
  }
64
61
  return host + path;
65
62
  }
66
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXJsL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG9CQUFvQjtBQUNwQiw2REFBNkQ7QUFDN0Qsd0VBQXdFO0FBQ3hFLGtFQUFrRTtBQUNsRSxzRUFBc0U7QUFDdEUsc0VBQXNFO0FBQ3RFLHFFQUFxRTtBQUNyRSx3RUFBd0U7QUFDeEUsNEJBQTRCO0FBQzVCLGlFQUFpRTtBQUNqRSxrRUFBa0U7QUFDbEUsa0VBQWtFO0FBQ2xFLHFFQUFxRTtBQUNyRSx5RUFBeUU7QUFDekUsdUVBQXVFO0FBQ3ZFLHVFQUF1RTtBQUN2RSxvRUFBb0U7QUFDcEUseURBQXlEO0FBQ3pELE9BQU8sRUFBRSxHQUFHL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QsbUVBQW1FO0lBQ25FLDJEQUEyRDtJQUMzRCxJQUFJLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxTQUFTLEVBQUUsS0FBSyxDQUFDLENBQUM7SUFFdEMsMEVBQTBFO0lBQzFFLElBQUksR0FBRyxLQUFLLElBQUksRUFBRSxDQUFDO1FBQ2pCLElBQUksR0FBRyxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBRUQsSUFBSSxNQUFNLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUM7UUFDdEIseUNBQXlDO0lBQzNDLENBQUM7U0FBTSxDQUFDO1FBQ04sYUFBYTtRQUNiLElBQUksR0FBRyxHQUFHLEdBQUcsSUFBSSxDQUFDO0lBQ3BCLENBQUM7SUFFRCxPQUFPLElBQUksR0FBRyxJQUFJLENBQUM7QUFDckIsQ0FBQyJ9
@@ -1,5 +1,4 @@
1
- /** Utility function to throw an error if a required value is missing. */
2
- export function required(value, errMsg) {
1
+ /** Utility function to throw an error if a required value is missing. */ export function required(value, errMsg) {
3
2
  if (value === undefined) {
4
3
  throw new Error(errMsg || 'Value is required');
5
4
  }
@@ -9,10 +8,8 @@ export function required(value, errMsg) {
9
8
  * Helper function to assert a condition is truthy
10
9
  * @param x - A boolean condition to assert.
11
10
  * @param err - Error message to throw if x isn't met.
12
- */
13
- export function assert(x, err) {
11
+ */ export function assert(x, err) {
14
12
  if (!x) {
15
13
  throw new Error(err);
16
14
  }
17
15
  }
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdmFsaWRhdGlvbi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSx5RUFBeUU7QUFDekUsTUFBTSxVQUFVLFFBQVEsQ0FBSSxLQUFvQixFQUFFLE1BQWU7SUFDL0QsSUFBSSxLQUFLLEtBQUssU0FBUyxFQUFFLENBQUM7UUFDeEIsTUFBTSxJQUFJLEtBQUssQ0FBQyxNQUFNLElBQUksbUJBQW1CLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBQ0QsT0FBTyxLQUFLLENBQUM7QUFDZixDQUFDO0FBRUQ7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxNQUFNLENBQUMsQ0FBTSxFQUFFLEdBQVc7SUFDeEMsSUFBSSxDQUFDLENBQUMsRUFBRSxDQUFDO1FBQ1AsTUFBTSxJQUFJLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUN2QixDQUFDO0FBQ0gsQ0FBQyJ9
@@ -4,163 +4,145 @@ import { createDebugOnlyLogger } from '../log/index.js';
4
4
  * https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md
5
5
  * We don't use these functions, but the environment expects them.
6
6
  * TODO find a way to update off of wasi 12.
7
- */
8
- /* eslint-disable camelcase */
9
- export const getEmptyWasiSdk = (debug = createDebugOnlyLogger('wasm:empty_wasi_sdk')) => ({
10
- /**
11
- * Retrieves the current time from the system clock.
12
- * This function is a dummy implementation of the WASI API's `clock_time_get` method,
13
- * which is expected by the environment but not used in this context.
14
- *
15
- * No input parameters or return values are required, as the purpose of this function
16
- * is solely to satisfy the environment expectations and provide debugging information.
17
- */
18
- clock_time_get() {
19
- debug('clock_time_get');
20
- },
21
- /**
22
- * Dummy implementation of WASI's environ_get function.
23
- * This function is used to obtain a snapshot of the current environment variables.
24
- * In this dummy implementation, no actual actions are performed, but the debug logger logs 'environ_get' when called.
25
- * Environment variables are not used in this context, so the real implementation is not required.
26
- *
27
- * @see https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#environ_get
28
- */
29
- environ_get() {
30
- debug('environ_get');
31
- },
32
- /**
33
- * Retrieves the environment variable sizes from the WebAssembly environment.
34
- * This function is part of the WASI API and provides a dummy implementation to fulfill the expected APIs.
35
- * It does not have any actual functionality, but serves as a placeholder in the environment.
36
- */
37
- environ_sizes_get() {
38
- debug('environ_sizes_get');
39
- },
40
- /**
41
- * Closes a file descriptor, releasing any resources associated with it.
42
- * This function does not perform any actual closing operation, but exists to
43
- * satisfy the requirements of the WebAssembly System Interface (WASI) API,
44
- * which expects certain functions to be present for compatibility purposes.
45
- *
46
- * @see https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md
47
- */
48
- fd_close() {
49
- debug('fd_close');
50
- },
51
- /**
52
- * A dummy implementation of the 'fd_read' function from the WASI API.
53
- * This function is required by the environment, but not used in this context.
54
- * It would normally read data from a file descriptor into an array buffer,
55
- * but here it simply logs the invocation for debugging purposes.
56
- */
57
- fd_read() {
58
- debug('fd_read');
59
- },
60
- /**
61
- * Handles the file descriptor write operation.
62
- * This dummy implementation of the WASI 'fd_write' function is part of the wasi API:
63
- * https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md
64
- * The environment expects this function, but it is not used in the current implementation.
65
- * It is used to write data from WebAssembly memory to a file descriptor.
66
- */
67
- fd_write() {
68
- debug('fd_write');
69
- },
70
- /**
71
- * Perform a file seek operation on the given file descriptor to change its current position.
72
- * The new position is calculated using the provided offset and whence values.
73
- * Throws an error if the file descriptor is invalid or the operation cannot be performed.
74
- *
75
- * @param fd - The file descriptor of the file to perform the seek operation on.
76
- * @param offset - The relative offset to apply, based on the whence value.
77
- * @param whence - The reference point from which the offset should be calculated. One of SEEK_SET (start), SEEK_CUR (current), or SEEK_END (end).
78
- * @returns The new position in the file after the seek operation has been performed.
79
- */
80
- fd_seek() {
81
- debug('fd_seek');
82
- },
83
- /**
84
- * This function is a dummy implementation of the 'fd_fdstat_get' function in the WebAssembly System Interface (WASI) API.
85
- * Although not actually used in this context, it is present due to the environment's expectation of its existence.
86
- * The 'fd_fdstat_get' function is typically responsible for obtaining file descriptor status information.
87
- */
88
- fd_fdstat_get() {
89
- debug('fd_fdstat_get');
90
- },
91
- /**
92
- * Sets the file descriptor flags for a given file descriptor.
93
- * This function is a dummy implementation of the WASI API function 'fd_fdstat_set_flags'.
94
- * It currently does not perform any operation but logs the function call with a debug instance.
95
- * This is provided since the environment expects this function to be present.
96
- */
97
- fd_fdstat_set_flags() {
98
- debug('fd_fdstat_set_flags');
99
- },
100
- /**
101
- * Handles the `fd_prestat_get` function call for the dummy WebAssembly System Interface (WASI) implementation.
102
- * This function is expected by the WASI environment, although it is not used in this implementation.
103
- * The `fd_prestat_get` function retrieves pre-opened file descriptor properties.
104
- *
105
- * @returns A constant integer value indicating successful completion of the function call.
106
- */
107
- fd_prestat_get() {
108
- debug('fd_prestat_get');
109
- return 8;
110
- },
111
- /**
112
- * Provides a dummy implementation for the `fd_prestat_dir_name` function, which is expected to be called by the WASI environment.
113
- * This function is intended to retrieve the pre-opened directory's path associated with the given file descriptor. However, since it's a dummy implementation,
114
- * it doesn't perform any actual operation and only logs the function call with the provided debug logger.
115
- *
116
- * @returns A constant number representing a dummy return value for the function call.
117
- */
118
- fd_prestat_dir_name() {
119
- debug('fd_prestat_dir_name');
120
- return 28;
121
- },
122
- /**
123
- * Handles the opening of a file path within the WASI environment.
124
- * This function is a dummy implementation required for compatibility with
125
- * the WebAssembly System Interface (WASI) API, but it does not perform any
126
- * actual file opening operation. It is mainly used for debugging purposes.
127
- */
128
- path_open() {
129
- debug('path_open');
130
- },
131
- /**
132
- * Retrieve file system information of the specified path.
133
- * This function retrieves statistics, such as size and permissions, associated with the file or directory
134
- * identified by the given path. In case of an error or non-existing path, appropriate debug logs will be generated.
135
- *
136
- * @returns An object containing file statistics like size, permissions, etc.
137
- */
138
- path_filestat_get() {
139
- debug('path_filestat_get');
140
- },
141
- /**
142
- * Terminate the process normally, performing the regular cleanup for terminating programs.
143
- * The input 'status' represents the exit code and is used to indicate success or failure
144
- * of the program execution. A zero value typically indicates successful execution,
145
- * while non-zero values are treated as errors by the operating system.
146
- *
147
- * @param status - The exit code representing the success or failure of the program execution.
148
- * @returns The exit status code.
149
- */
150
- proc_exit() {
151
- debug('proc_exit');
152
- return 52;
153
- },
154
- /**
155
- * Generates a random number and returns it.
156
- * This dummy implementation of 'random_get' method in the wasi API is expected by the environment.
157
- * In this case, the function always returns 1 to maintain consistency with the environment's expectations.
158
- *
159
- * @returns A random number. In this implementation, always returns 1.
160
- */
161
- random_get() {
162
- debug('random_get');
163
- return 1;
164
- },
165
- });
166
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1wdHlfd2FzaV9zZGsuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2FzbS9lbXB0eV93YXNpX3Nkay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUV4RDs7Ozs7R0FLRztBQUNILDhCQUE4QjtBQUM5QixNQUFNLENBQUMsTUFBTSxlQUFlLEdBQUcsQ0FBQyxLQUFLLEdBQUcscUJBQXFCLENBQUMscUJBQXFCLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQztJQUN4Rjs7Ozs7OztPQU9HO0lBQ0gsY0FBYztRQUNaLEtBQUssQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDO0lBQzFCLENBQUM7SUFDRDs7Ozs7OztPQU9HO0lBQ0gsV0FBVztRQUNULEtBQUssQ0FBQyxhQUFhLENBQUMsQ0FBQztJQUN2QixDQUFDO0lBQ0Q7Ozs7T0FJRztJQUNILGlCQUFpQjtRQUNmLEtBQUssQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDO0lBQzdCLENBQUM7SUFDRDs7Ozs7OztPQU9HO0lBQ0gsUUFBUTtRQUNOLEtBQUssQ0FBQyxVQUFVLENBQUMsQ0FBQztJQUNwQixDQUFDO0lBQ0Q7Ozs7O09BS0c7SUFDSCxPQUFPO1FBQ0wsS0FBSyxDQUFDLFNBQVM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FDO0NBQ0YsQ0FBQyxDQUFDIn0=
7
+ */ /* eslint-disable camelcase */ export const getEmptyWasiSdk = (debug = createDebugOnlyLogger('wasm:empty_wasi_sdk'))=>({
8
+ /**
9
+ * Retrieves the current time from the system clock.
10
+ * This function is a dummy implementation of the WASI API's `clock_time_get` method,
11
+ * which is expected by the environment but not used in this context.
12
+ *
13
+ * No input parameters or return values are required, as the purpose of this function
14
+ * is solely to satisfy the environment expectations and provide debugging information.
15
+ */ clock_time_get () {
16
+ debug('clock_time_get');
17
+ },
18
+ /**
19
+ * Dummy implementation of WASI's environ_get function.
20
+ * This function is used to obtain a snapshot of the current environment variables.
21
+ * In this dummy implementation, no actual actions are performed, but the debug logger logs 'environ_get' when called.
22
+ * Environment variables are not used in this context, so the real implementation is not required.
23
+ *
24
+ * @see https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#environ_get
25
+ */ environ_get () {
26
+ debug('environ_get');
27
+ },
28
+ /**
29
+ * Retrieves the environment variable sizes from the WebAssembly environment.
30
+ * This function is part of the WASI API and provides a dummy implementation to fulfill the expected APIs.
31
+ * It does not have any actual functionality, but serves as a placeholder in the environment.
32
+ */ environ_sizes_get () {
33
+ debug('environ_sizes_get');
34
+ },
35
+ /**
36
+ * Closes a file descriptor, releasing any resources associated with it.
37
+ * This function does not perform any actual closing operation, but exists to
38
+ * satisfy the requirements of the WebAssembly System Interface (WASI) API,
39
+ * which expects certain functions to be present for compatibility purposes.
40
+ *
41
+ * @see https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md
42
+ */ fd_close () {
43
+ debug('fd_close');
44
+ },
45
+ /**
46
+ * A dummy implementation of the 'fd_read' function from the WASI API.
47
+ * This function is required by the environment, but not used in this context.
48
+ * It would normally read data from a file descriptor into an array buffer,
49
+ * but here it simply logs the invocation for debugging purposes.
50
+ */ fd_read () {
51
+ debug('fd_read');
52
+ },
53
+ /**
54
+ * Handles the file descriptor write operation.
55
+ * This dummy implementation of the WASI 'fd_write' function is part of the wasi API:
56
+ * https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md
57
+ * The environment expects this function, but it is not used in the current implementation.
58
+ * It is used to write data from WebAssembly memory to a file descriptor.
59
+ */ fd_write () {
60
+ debug('fd_write');
61
+ },
62
+ /**
63
+ * Perform a file seek operation on the given file descriptor to change its current position.
64
+ * The new position is calculated using the provided offset and whence values.
65
+ * Throws an error if the file descriptor is invalid or the operation cannot be performed.
66
+ *
67
+ * @param fd - The file descriptor of the file to perform the seek operation on.
68
+ * @param offset - The relative offset to apply, based on the whence value.
69
+ * @param whence - The reference point from which the offset should be calculated. One of SEEK_SET (start), SEEK_CUR (current), or SEEK_END (end).
70
+ * @returns The new position in the file after the seek operation has been performed.
71
+ */ fd_seek () {
72
+ debug('fd_seek');
73
+ },
74
+ /**
75
+ * This function is a dummy implementation of the 'fd_fdstat_get' function in the WebAssembly System Interface (WASI) API.
76
+ * Although not actually used in this context, it is present due to the environment's expectation of its existence.
77
+ * The 'fd_fdstat_get' function is typically responsible for obtaining file descriptor status information.
78
+ */ fd_fdstat_get () {
79
+ debug('fd_fdstat_get');
80
+ },
81
+ /**
82
+ * Sets the file descriptor flags for a given file descriptor.
83
+ * This function is a dummy implementation of the WASI API function 'fd_fdstat_set_flags'.
84
+ * It currently does not perform any operation but logs the function call with a debug instance.
85
+ * This is provided since the environment expects this function to be present.
86
+ */ fd_fdstat_set_flags () {
87
+ debug('fd_fdstat_set_flags');
88
+ },
89
+ /**
90
+ * Handles the `fd_prestat_get` function call for the dummy WebAssembly System Interface (WASI) implementation.
91
+ * This function is expected by the WASI environment, although it is not used in this implementation.
92
+ * The `fd_prestat_get` function retrieves pre-opened file descriptor properties.
93
+ *
94
+ * @returns A constant integer value indicating successful completion of the function call.
95
+ */ fd_prestat_get () {
96
+ debug('fd_prestat_get');
97
+ return 8;
98
+ },
99
+ /**
100
+ * Provides a dummy implementation for the `fd_prestat_dir_name` function, which is expected to be called by the WASI environment.
101
+ * This function is intended to retrieve the pre-opened directory's path associated with the given file descriptor. However, since it's a dummy implementation,
102
+ * it doesn't perform any actual operation and only logs the function call with the provided debug logger.
103
+ *
104
+ * @returns A constant number representing a dummy return value for the function call.
105
+ */ fd_prestat_dir_name () {
106
+ debug('fd_prestat_dir_name');
107
+ return 28;
108
+ },
109
+ /**
110
+ * Handles the opening of a file path within the WASI environment.
111
+ * This function is a dummy implementation required for compatibility with
112
+ * the WebAssembly System Interface (WASI) API, but it does not perform any
113
+ * actual file opening operation. It is mainly used for debugging purposes.
114
+ */ path_open () {
115
+ debug('path_open');
116
+ },
117
+ /**
118
+ * Retrieve file system information of the specified path.
119
+ * This function retrieves statistics, such as size and permissions, associated with the file or directory
120
+ * identified by the given path. In case of an error or non-existing path, appropriate debug logs will be generated.
121
+ *
122
+ * @returns An object containing file statistics like size, permissions, etc.
123
+ */ path_filestat_get () {
124
+ debug('path_filestat_get');
125
+ },
126
+ /**
127
+ * Terminate the process normally, performing the regular cleanup for terminating programs.
128
+ * The input 'status' represents the exit code and is used to indicate success or failure
129
+ * of the program execution. A zero value typically indicates successful execution,
130
+ * while non-zero values are treated as errors by the operating system.
131
+ *
132
+ * @param status - The exit code representing the success or failure of the program execution.
133
+ * @returns The exit status code.
134
+ */ proc_exit () {
135
+ debug('proc_exit');
136
+ return 52;
137
+ },
138
+ /**
139
+ * Generates a random number and returns it.
140
+ * This dummy implementation of 'random_get' method in the wasi API is expected by the environment.
141
+ * In this case, the function always returns 1 to maintain consistency with the environment's expectations.
142
+ *
143
+ * @returns A random number. In this implementation, always returns 1.
144
+ */ random_get () {
145
+ debug('random_get');
146
+ return 1;
147
+ }
148
+ });
@@ -1,2 +1,2 @@
1
- export { WasmModule, IWasmModule } from './wasm_module.js';
1
+ export { WasmModule, type IWasmModule } from './wasm_module.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wasm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wasm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,2 +1 @@
1
1
  export { WasmModule } from './wasm_module.js';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2FzbS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFlLE1BQU0sa0JBQWtCLENBQUMifQ==