@aztec/foundation 0.0.0-test.1 → 0.0.1-commit.1142ef1

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 (685) hide show
  1. package/dest/array/array.d.ts +6 -9
  2. package/dest/array/array.d.ts.map +1 -1
  3. package/dest/array/array.js +11 -11
  4. package/dest/array/index.d.ts +2 -1
  5. package/dest/array/index.d.ts.map +1 -1
  6. package/dest/array/index.js +1 -0
  7. package/dest/array/sorted_array.d.ts +10 -0
  8. package/dest/array/sorted_array.d.ts.map +1 -0
  9. package/dest/array/sorted_array.js +106 -0
  10. package/dest/async-map/index.d.ts +1 -1
  11. package/dest/async-pool/index.d.ts +1 -1
  12. package/dest/async-pool/index.d.ts.map +1 -1
  13. package/dest/async-pool/index.js +1 -0
  14. package/dest/bigint/index.d.ts +7 -0
  15. package/dest/bigint/index.d.ts.map +1 -0
  16. package/dest/bigint/index.js +15 -0
  17. package/dest/bigint-buffer/index.d.ts +1 -3
  18. package/dest/bigint-buffer/index.d.ts.map +1 -1
  19. package/dest/branded-types/block_number.d.ts +53 -0
  20. package/dest/branded-types/block_number.d.ts.map +1 -0
  21. package/dest/branded-types/block_number.js +75 -0
  22. package/dest/branded-types/checkpoint_number.d.ts +54 -0
  23. package/dest/branded-types/checkpoint_number.d.ts.map +1 -0
  24. package/dest/branded-types/checkpoint_number.js +77 -0
  25. package/dest/branded-types/epoch.d.ts +42 -0
  26. package/dest/branded-types/epoch.d.ts.map +1 -0
  27. package/dest/branded-types/epoch.js +59 -0
  28. package/dest/branded-types/index.d.ts +6 -0
  29. package/dest/branded-types/index.d.ts.map +1 -0
  30. package/dest/branded-types/index.js +4 -0
  31. package/dest/branded-types/slot.d.ts +42 -0
  32. package/dest/branded-types/slot.d.ts.map +1 -0
  33. package/dest/branded-types/slot.js +59 -0
  34. package/dest/branded-types/types.d.ts +5 -0
  35. package/dest/branded-types/types.d.ts.map +1 -0
  36. package/dest/branded-types/types.js +1 -0
  37. package/dest/buffer/buffer16.d.ts +77 -0
  38. package/dest/buffer/buffer16.d.ts.map +1 -0
  39. package/dest/buffer/buffer16.js +102 -0
  40. package/dest/buffer/buffer32.d.ts +5 -12
  41. package/dest/buffer/buffer32.d.ts.map +1 -1
  42. package/dest/buffer/buffer32.js +9 -7
  43. package/dest/buffer/index.d.ts +2 -1
  44. package/dest/buffer/index.d.ts.map +1 -1
  45. package/dest/buffer/index.js +1 -0
  46. package/dest/collection/array.d.ts +17 -4
  47. package/dest/collection/array.d.ts.map +1 -1
  48. package/dest/collection/array.js +57 -3
  49. package/dest/collection/index.d.ts +1 -1
  50. package/dest/collection/object.d.ts +17 -1
  51. package/dest/collection/object.d.ts.map +1 -1
  52. package/dest/collection/object.js +25 -0
  53. package/dest/committable/committable.d.ts +1 -1
  54. package/dest/committable/committable.d.ts.map +1 -1
  55. package/dest/committable/index.d.ts +1 -1
  56. package/dest/config/env_var.d.ts +2 -2
  57. package/dest/config/env_var.d.ts.map +1 -1
  58. package/dest/config/index.d.ts +58 -4
  59. package/dest/config/index.d.ts.map +1 -1
  60. package/dest/config/index.js +129 -12
  61. package/dest/config/network_config.d.ts +54 -0
  62. package/dest/config/network_config.d.ts.map +1 -0
  63. package/dest/config/network_config.js +11 -0
  64. package/dest/config/network_name.d.ts +3 -0
  65. package/dest/config/network_name.d.ts.map +1 -0
  66. package/dest/config/network_name.js +19 -0
  67. package/dest/config/parse-env.d.ts +3 -0
  68. package/dest/config/parse-env.d.ts.map +1 -0
  69. package/dest/config/parse-env.js +7 -0
  70. package/dest/config/secret_value.d.ts +28 -0
  71. package/dest/config/secret_value.d.ts.map +1 -0
  72. package/dest/config/secret_value.js +36 -0
  73. package/dest/crypto/aes128/index.d.ts +3 -5
  74. package/dest/crypto/aes128/index.d.ts.map +1 -1
  75. package/dest/crypto/aes128/index.js +19 -6
  76. package/dest/crypto/bls/bn254_keystore.d.ts +296 -0
  77. package/dest/crypto/bls/bn254_keystore.d.ts.map +1 -0
  78. package/dest/crypto/bls/bn254_keystore.js +218 -0
  79. package/dest/crypto/bls/index.d.ts +13 -0
  80. package/dest/crypto/bls/index.d.ts.map +1 -0
  81. package/dest/crypto/bls/index.js +87 -0
  82. package/dest/crypto/bn254/index.d.ts +39 -0
  83. package/dest/crypto/bn254/index.d.ts.map +1 -0
  84. package/dest/crypto/bn254/index.js +56 -0
  85. package/dest/crypto/ecdsa/index.d.ts +3 -3
  86. package/dest/crypto/ecdsa/index.d.ts.map +1 -1
  87. package/dest/crypto/ecdsa/index.js +62 -48
  88. package/dest/crypto/ecdsa/signature.d.ts +3 -14
  89. package/dest/crypto/ecdsa/signature.d.ts.map +1 -1
  90. package/dest/crypto/ecdsa/signature.js +2 -2
  91. package/dest/crypto/grumpkin/index.d.ts +10 -15
  92. package/dest/crypto/grumpkin/index.d.ts.map +1 -1
  93. package/dest/crypto/grumpkin/index.js +61 -55
  94. package/dest/crypto/keccak/index.d.ts +3 -5
  95. package/dest/crypto/keccak/index.d.ts.map +1 -1
  96. package/dest/crypto/keys/index.d.ts +2 -4
  97. package/dest/crypto/keys/index.d.ts.map +1 -1
  98. package/dest/crypto/keys/index.js +8 -5
  99. package/dest/crypto/pedersen/index.d.ts +1 -1
  100. package/dest/crypto/pedersen/pedersen.noble.d.ts +3 -5
  101. package/dest/crypto/pedersen/pedersen.noble.d.ts.map +1 -1
  102. package/dest/crypto/pedersen/pedersen.wasm.d.ts +4 -6
  103. package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +1 -1
  104. package/dest/crypto/pedersen/pedersen.wasm.js +24 -14
  105. package/dest/crypto/poseidon/index.d.ts +2 -4
  106. package/dest/crypto/poseidon/index.d.ts.map +1 -1
  107. package/dest/crypto/poseidon/index.js +33 -18
  108. package/dest/crypto/random/index.d.ts +2 -4
  109. package/dest/crypto/random/index.d.ts.map +1 -1
  110. package/dest/crypto/random/index.js +2 -34
  111. package/dest/crypto/random/randomness_singleton.d.ts +2 -4
  112. package/dest/crypto/random/randomness_singleton.d.ts.map +1 -1
  113. package/dest/crypto/random/randomness_singleton.js +3 -3
  114. package/dest/crypto/schnorr/index.d.ts +3 -2
  115. package/dest/crypto/schnorr/index.d.ts.map +1 -1
  116. package/dest/crypto/schnorr/index.js +30 -38
  117. package/dest/crypto/schnorr/signature.d.ts +5 -7
  118. package/dest/crypto/schnorr/signature.d.ts.map +1 -1
  119. package/dest/crypto/schnorr/signature.js +2 -2
  120. package/dest/crypto/secp256k1/index.d.ts +5 -7
  121. package/dest/crypto/secp256k1/index.d.ts.map +1 -1
  122. package/dest/crypto/secp256k1/index.js +23 -18
  123. package/dest/crypto/secp256k1-signer/index.d.ts +1 -1
  124. package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts +1 -1
  125. package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts.map +1 -1
  126. package/dest/crypto/secp256k1-signer/utils.d.ts +56 -5
  127. package/dest/crypto/secp256k1-signer/utils.d.ts.map +1 -1
  128. package/dest/crypto/secp256k1-signer/utils.js +92 -6
  129. package/dest/crypto/serialize.d.ts +5 -7
  130. package/dest/crypto/serialize.d.ts.map +1 -1
  131. package/dest/crypto/sha256/index.d.ts +23 -6
  132. package/dest/crypto/sha256/index.d.ts.map +1 -1
  133. package/dest/crypto/sha256/index.js +43 -1
  134. package/dest/crypto/sha512/index.d.ts +3 -5
  135. package/dest/crypto/sha512/index.d.ts.map +1 -1
  136. package/dest/crypto/sha512/index.js +1 -1
  137. package/dest/crypto/signature/index.d.ts +2 -4
  138. package/dest/crypto/signature/index.d.ts.map +1 -1
  139. package/dest/crypto/sync/index.d.ts +1 -1
  140. package/dest/crypto/sync/index.js +1 -1
  141. package/dest/crypto/sync/pedersen/index.d.ts +4 -6
  142. package/dest/crypto/sync/pedersen/index.d.ts.map +1 -1
  143. package/dest/crypto/sync/pedersen/index.js +18 -11
  144. package/dest/crypto/sync/poseidon/index.d.ts +2 -4
  145. package/dest/crypto/sync/poseidon/index.d.ts.map +1 -1
  146. package/dest/crypto/sync/poseidon/index.js +28 -13
  147. package/dest/curves/bls12/field.d.ts +148 -0
  148. package/dest/curves/bls12/field.d.ts.map +1 -0
  149. package/dest/curves/bls12/field.js +362 -0
  150. package/dest/curves/bls12/index.d.ts +3 -0
  151. package/dest/curves/bls12/index.d.ts.map +1 -0
  152. package/dest/curves/bls12/index.js +2 -0
  153. package/dest/curves/bls12/point.d.ts +220 -0
  154. package/dest/curves/bls12/point.d.ts.map +1 -0
  155. package/dest/curves/bls12/point.js +400 -0
  156. package/dest/curves/bn254/field.d.ts +180 -0
  157. package/dest/curves/bn254/field.d.ts.map +1 -0
  158. package/dest/{fields/fields.js → curves/bn254/field.js} +90 -62
  159. package/dest/curves/bn254/index.d.ts +3 -0
  160. package/dest/curves/bn254/index.d.ts.map +1 -0
  161. package/dest/curves/bn254/index.js +2 -0
  162. package/dest/curves/bn254/point.d.ts +54 -0
  163. package/dest/curves/bn254/point.d.ts.map +1 -0
  164. package/dest/curves/bn254/point.js +143 -0
  165. package/dest/curves/grumpkin/index.d.ts +10 -0
  166. package/dest/curves/grumpkin/index.d.ts.map +1 -0
  167. package/dest/curves/grumpkin/index.js +3 -0
  168. package/dest/{fields → curves/grumpkin}/point.d.ts +15 -17
  169. package/dest/curves/grumpkin/point.d.ts.map +1 -0
  170. package/dest/{fields → curves/grumpkin}/point.js +27 -10
  171. package/dest/decorators/index.d.ts +1 -1
  172. package/dest/decorators/memoize.d.ts +1 -1
  173. package/dest/decorators/memoize.d.ts.map +1 -1
  174. package/dest/error/index.d.ts +4 -4
  175. package/dest/error/index.d.ts.map +1 -1
  176. package/dest/eth-address/index.d.ts +18 -9
  177. package/dest/eth-address/index.d.ts.map +1 -1
  178. package/dest/eth-address/index.js +31 -2
  179. package/dest/eth-signature/eth_signature.d.ts +17 -18
  180. package/dest/eth-signature/eth_signature.d.ts.map +1 -1
  181. package/dest/eth-signature/eth_signature.js +31 -17
  182. package/dest/eth-signature/index.d.ts +1 -1
  183. package/dest/fs/index.d.ts +2 -1
  184. package/dest/fs/index.d.ts.map +1 -1
  185. package/dest/fs/index.js +1 -0
  186. package/dest/fs/run_in_dir.d.ts +1 -1
  187. package/dest/fs/try_rm_dir.d.ts +3 -0
  188. package/dest/fs/try_rm_dir.d.ts.map +1 -0
  189. package/dest/fs/try_rm_dir.js +16 -0
  190. package/dest/iterable/all.d.ts +1 -1
  191. package/dest/iterable/filter.d.ts +1 -1
  192. package/dest/iterable/filter.js +1 -1
  193. package/dest/iterable/index.d.ts +1 -1
  194. package/dest/iterable/isAsyncIt.d.ts +1 -1
  195. package/dest/iterable/map.d.ts +1 -1
  196. package/dest/iterable/map.js +1 -1
  197. package/dest/iterable/peek.d.ts +1 -1
  198. package/dest/iterable/sort.d.ts +1 -1
  199. package/dest/iterable/take.d.ts +1 -1
  200. package/dest/iterable/toArray.d.ts +1 -1
  201. package/dest/iterator/filter.d.ts +3 -0
  202. package/dest/iterator/filter.d.ts.map +1 -0
  203. package/dest/iterator/filter.js +7 -0
  204. package/dest/iterator/index.d.ts +2 -0
  205. package/dest/iterator/index.d.ts.map +1 -0
  206. package/dest/iterator/index.js +1 -0
  207. package/dest/jest/env.js +48 -0
  208. package/dest/jest/setupAfterEnv.js +3 -0
  209. package/dest/json-rpc/client/fetch.d.ts +3 -3
  210. package/dest/json-rpc/client/fetch.d.ts.map +1 -1
  211. package/dest/json-rpc/client/fetch.js +16 -30
  212. package/dest/json-rpc/client/index.d.ts +1 -1
  213. package/dest/json-rpc/client/safe_json_rpc_client.d.ts +10 -4
  214. package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +1 -1
  215. package/dest/json-rpc/client/safe_json_rpc_client.js +173 -13
  216. package/dest/json-rpc/client/undici.d.ts +1 -1
  217. package/dest/json-rpc/client/undici.d.ts.map +1 -1
  218. package/dest/json-rpc/client/undici.js +6 -7
  219. package/dest/json-rpc/convert.d.ts +3 -10
  220. package/dest/json-rpc/convert.d.ts.map +1 -1
  221. package/dest/json-rpc/convert.js +1 -9
  222. package/dest/json-rpc/errors.d.ts +4 -0
  223. package/dest/json-rpc/errors.d.ts.map +1 -0
  224. package/dest/json-rpc/errors.js +6 -0
  225. package/dest/json-rpc/fixtures/class_a.d.ts +4 -2
  226. package/dest/json-rpc/fixtures/class_a.d.ts.map +1 -1
  227. package/dest/json-rpc/fixtures/class_b.d.ts +4 -2
  228. package/dest/json-rpc/fixtures/class_b.d.ts.map +1 -1
  229. package/dest/json-rpc/fixtures/test_state.d.ts +1 -1
  230. package/dest/json-rpc/fixtures/test_state.d.ts.map +1 -1
  231. package/dest/json-rpc/index.d.ts +3 -2
  232. package/dest/json-rpc/index.d.ts.map +1 -1
  233. package/dest/json-rpc/index.js +2 -1
  234. package/dest/json-rpc/js_utils.d.ts +1 -1
  235. package/dest/json-rpc/js_utils.d.ts.map +1 -1
  236. package/dest/json-rpc/server/index.d.ts +1 -1
  237. package/dest/json-rpc/server/safe_json_rpc_server.d.ts +22 -23
  238. package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -1
  239. package/dest/json-rpc/server/safe_json_rpc_server.js +161 -56
  240. package/dest/json-rpc/test/index.d.ts +1 -1
  241. package/dest/json-rpc/test/integration.d.ts +2 -3
  242. package/dest/json-rpc/test/integration.d.ts.map +1 -1
  243. package/dest/log/console.d.ts +1 -1
  244. package/dest/log/console.d.ts.map +1 -1
  245. package/dest/log/gcloud-logger-config.d.ts +1 -2
  246. package/dest/log/gcloud-logger-config.d.ts.map +1 -1
  247. package/dest/log/gcloud-logger-config.js +1 -9
  248. package/dest/log/index.d.ts +5 -5
  249. package/dest/log/index.d.ts.map +1 -1
  250. package/dest/log/index.js +4 -4
  251. package/dest/log/libp2p_logger.d.ts +1 -1
  252. package/dest/log/libp2p_logger.js +13 -2
  253. package/dest/log/log-filters.d.ts +1 -1
  254. package/dest/log/log-levels.d.ts +1 -1
  255. package/dest/log/log_fn.d.ts +2 -2
  256. package/dest/log/log_fn.d.ts.map +1 -1
  257. package/dest/log/noir_debug_log_util.d.ts +14 -0
  258. package/dest/log/noir_debug_log_util.d.ts.map +1 -0
  259. package/dest/log/noir_debug_log_util.js +14 -0
  260. package/dest/log/pino-logger.d.ts +4 -4
  261. package/dest/log/pino-logger.d.ts.map +1 -1
  262. package/dest/log/pino-logger.js +29 -3
  263. package/dest/message/index.d.ts +1 -1
  264. package/dest/message/index.d.ts.map +1 -1
  265. package/dest/mutex/index.d.ts +1 -1
  266. package/dest/mutex/index.d.ts.map +1 -1
  267. package/dest/mutex/mutex_database.d.ts +1 -1
  268. package/dest/mutex/mutex_database.d.ts.map +1 -1
  269. package/dest/noir/index.d.ts +1 -1
  270. package/dest/noir/noir_package_config.d.ts +9 -9
  271. package/dest/number/index.d.ts +3 -0
  272. package/dest/number/index.d.ts.map +1 -0
  273. package/dest/number/index.js +12 -0
  274. package/dest/profiler/index.d.ts +2 -0
  275. package/dest/profiler/index.d.ts.map +1 -0
  276. package/dest/profiler/index.js +1 -0
  277. package/dest/profiler/profiler.d.ts +8 -0
  278. package/dest/profiler/profiler.d.ts.map +1 -0
  279. package/dest/profiler/profiler.js +97 -0
  280. package/dest/promise/index.d.ts +1 -1
  281. package/dest/promise/running-promise.d.ts +2 -2
  282. package/dest/promise/running-promise.d.ts.map +1 -1
  283. package/dest/promise/running-promise.js +2 -2
  284. package/dest/promise/utils.d.ts +1 -1
  285. package/dest/queue/base_memory_queue.d.ts +1 -1
  286. package/dest/queue/base_memory_queue.d.ts.map +1 -1
  287. package/dest/queue/batch_queue.d.ts +2 -2
  288. package/dest/queue/batch_queue.d.ts.map +1 -1
  289. package/dest/queue/batch_queue.js +1 -1
  290. package/dest/queue/bounded_serial_queue.d.ts +1 -1
  291. package/dest/queue/bounded_serial_queue.d.ts.map +1 -1
  292. package/dest/queue/fifo_memory_queue.d.ts +1 -1
  293. package/dest/queue/fifo_memory_queue.d.ts.map +1 -1
  294. package/dest/queue/index.d.ts +1 -1
  295. package/dest/queue/priority_memory_queue.d.ts +1 -1
  296. package/dest/queue/priority_memory_queue.d.ts.map +1 -1
  297. package/dest/queue/priority_queue.d.ts +1 -1
  298. package/dest/queue/priority_queue.d.ts.map +1 -1
  299. package/dest/queue/semaphore.d.ts +1 -1
  300. package/dest/queue/semaphore.d.ts.map +1 -1
  301. package/dest/queue/serial_queue.d.ts +3 -3
  302. package/dest/queue/serial_queue.d.ts.map +1 -1
  303. package/dest/queue/serial_queue.js +7 -5
  304. package/dest/retry/index.d.ts +4 -3
  305. package/dest/retry/index.d.ts.map +1 -1
  306. package/dest/retry/index.js +2 -2
  307. package/dest/running-promise/index.d.ts +1 -1
  308. package/dest/schemas/api.d.ts +1 -1
  309. package/dest/schemas/api.d.ts.map +1 -1
  310. package/dest/schemas/index.d.ts +1 -1
  311. package/dest/schemas/parse.d.ts +1 -1
  312. package/dest/schemas/parse.js +1 -1
  313. package/dest/schemas/schemas.d.ts +21 -20
  314. package/dest/schemas/schemas.d.ts.map +1 -1
  315. package/dest/schemas/schemas.js +29 -11
  316. package/dest/schemas/types.d.ts +31 -1
  317. package/dest/schemas/types.d.ts.map +1 -1
  318. package/dest/schemas/types.js +25 -1
  319. package/dest/schemas/utils.d.ts +4 -6
  320. package/dest/schemas/utils.d.ts.map +1 -1
  321. package/dest/schemas/utils.js +15 -5
  322. package/dest/serialize/buffer_reader.d.ts +28 -3
  323. package/dest/serialize/buffer_reader.d.ts.map +1 -1
  324. package/dest/serialize/buffer_reader.js +44 -2
  325. package/dest/serialize/field_reader.d.ts +12 -3
  326. package/dest/serialize/field_reader.d.ts.map +1 -1
  327. package/dest/serialize/field_reader.js +19 -2
  328. package/dest/serialize/free_funcs.d.ts +25 -23
  329. package/dest/serialize/free_funcs.d.ts.map +1 -1
  330. package/dest/serialize/free_funcs.js +22 -28
  331. package/dest/serialize/index.d.ts +1 -1
  332. package/dest/serialize/serialize.d.ts +6 -7
  333. package/dest/serialize/serialize.d.ts.map +1 -1
  334. package/dest/serialize/serialize.js +1 -1
  335. package/dest/serialize/type_registry.d.ts +1 -1
  336. package/dest/serialize/type_registry.d.ts.map +1 -1
  337. package/dest/serialize/types.d.ts +1 -1
  338. package/dest/sleep/index.d.ts +3 -1
  339. package/dest/sleep/index.d.ts.map +1 -1
  340. package/dest/sleep/index.js +4 -0
  341. package/dest/string/index.d.ts +8 -3
  342. package/dest/string/index.d.ts.map +1 -1
  343. package/dest/string/index.js +27 -1
  344. package/dest/testing/files/index.d.ts +2 -3
  345. package/dest/testing/files/index.d.ts.map +1 -1
  346. package/dest/testing/files/index.js +3 -3
  347. package/dest/testing/formatting.d.ts +4 -0
  348. package/dest/testing/formatting.d.ts.map +1 -0
  349. package/dest/testing/formatting.js +3 -0
  350. package/dest/testing/index.d.ts +2 -1
  351. package/dest/testing/index.d.ts.map +1 -1
  352. package/dest/testing/index.js +1 -0
  353. package/dest/testing/port_allocator.d.ts +1 -1
  354. package/dest/testing/snapshot_serializer.d.ts +1 -1
  355. package/dest/testing/test_data.d.ts +1 -1
  356. package/dest/timer/date.d.ts +4 -2
  357. package/dest/timer/date.d.ts.map +1 -1
  358. package/dest/timer/date.js +8 -3
  359. package/dest/timer/elapsed.d.ts +1 -1
  360. package/dest/timer/index.d.ts +2 -2
  361. package/dest/timer/index.d.ts.map +1 -1
  362. package/dest/timer/index.js +1 -1
  363. package/dest/timer/timeout.d.ts +19 -6
  364. package/dest/timer/timeout.d.ts.map +1 -1
  365. package/dest/timer/timeout.js +43 -22
  366. package/dest/timer/timer.d.ts +1 -1
  367. package/dest/timer/timer.d.ts.map +1 -1
  368. package/dest/transport/dispatch/create_dispatch_fn.d.ts +1 -1
  369. package/dest/transport/dispatch/create_dispatch_fn.d.ts.map +1 -1
  370. package/dest/transport/dispatch/create_dispatch_proxy.d.ts +1 -1
  371. package/dest/transport/dispatch/messages.d.ts +1 -1
  372. package/dest/transport/index.d.ts +1 -2
  373. package/dest/transport/index.d.ts.map +1 -1
  374. package/dest/transport/index.js +0 -1
  375. package/dest/transport/interface/connector.d.ts +1 -1
  376. package/dest/transport/interface/connector.d.ts.map +1 -1
  377. package/dest/transport/interface/listener.d.ts +1 -2
  378. package/dest/transport/interface/listener.d.ts.map +1 -1
  379. package/dest/transport/interface/socket.d.ts +1 -1
  380. package/dest/transport/interface/socket.d.ts.map +1 -1
  381. package/dest/transport/interface/transferable.d.ts +1 -1
  382. package/dest/transport/node/index.d.ts +1 -1
  383. package/dest/transport/node/node_connector.d.ts +1 -2
  384. package/dest/transport/node/node_connector.d.ts.map +1 -1
  385. package/dest/transport/node/node_connector_socket.d.ts +1 -2
  386. package/dest/transport/node/node_connector_socket.d.ts.map +1 -1
  387. package/dest/transport/node/node_listener.d.ts +1 -2
  388. package/dest/transport/node/node_listener.d.ts.map +1 -1
  389. package/dest/transport/node/node_listener_socket.d.ts +1 -2
  390. package/dest/transport/node/node_listener_socket.d.ts.map +1 -1
  391. package/dest/transport/transport_client.d.ts +1 -2
  392. package/dest/transport/transport_client.d.ts.map +1 -1
  393. package/dest/transport/transport_server.d.ts +1 -10
  394. package/dest/transport/transport_server.d.ts.map +1 -1
  395. package/dest/trees/balanced_merkle_tree.d.ts +22 -0
  396. package/dest/trees/balanced_merkle_tree.d.ts.map +1 -0
  397. package/dest/trees/balanced_merkle_tree.js +66 -0
  398. package/dest/trees/hasher.d.ts +5 -7
  399. package/dest/trees/hasher.d.ts.map +1 -1
  400. package/dest/trees/index.d.ts +3 -1
  401. package/dest/trees/index.d.ts.map +1 -1
  402. package/dest/trees/index.js +2 -0
  403. package/dest/trees/indexed_merkle_tree.d.ts +1 -3
  404. package/dest/trees/indexed_merkle_tree.d.ts.map +1 -1
  405. package/dest/trees/indexed_merkle_tree.js +1 -1
  406. package/dest/trees/indexed_merkle_tree_calculator.d.ts +2 -4
  407. package/dest/trees/indexed_merkle_tree_calculator.d.ts.map +1 -1
  408. package/dest/trees/indexed_tree_leaf.d.ts +1 -3
  409. package/dest/trees/indexed_tree_leaf.d.ts.map +1 -1
  410. package/dest/trees/membership_witness.d.ts +6 -11
  411. package/dest/trees/membership_witness.d.ts.map +1 -1
  412. package/dest/trees/membership_witness.js +14 -1
  413. package/dest/trees/merkle_tree.d.ts +1 -3
  414. package/dest/trees/merkle_tree.d.ts.map +1 -1
  415. package/dest/trees/merkle_tree_calculator.d.ts +2 -4
  416. package/dest/trees/merkle_tree_calculator.d.ts.map +1 -1
  417. package/dest/trees/merkle_tree_calculator.js +1 -1
  418. package/dest/trees/sibling_path.d.ts +6 -42
  419. package/dest/trees/sibling_path.d.ts.map +1 -1
  420. package/dest/trees/sibling_path.js +2 -2
  421. package/dest/trees/unbalanced_merkle_tree.d.ts +25 -10
  422. package/dest/trees/unbalanced_merkle_tree.d.ts.map +1 -1
  423. package/dest/trees/unbalanced_merkle_tree.js +78 -50
  424. package/dest/trees/unbalanced_merkle_tree_calculator.d.ts +48 -0
  425. package/dest/trees/unbalanced_merkle_tree_calculator.d.ts.map +1 -0
  426. package/dest/trees/unbalanced_merkle_tree_calculator.js +154 -0
  427. package/dest/trees/unbalanced_tree_store.d.ts +2 -1
  428. package/dest/trees/unbalanced_tree_store.d.ts.map +1 -1
  429. package/dest/trees/unbalanced_tree_store.js +6 -0
  430. package/dest/types/index.d.ts +28 -3
  431. package/dest/types/index.d.ts.map +1 -1
  432. package/dest/types/index.js +3 -0
  433. package/dest/url/index.d.ts +1 -1
  434. package/dest/url/index.d.ts.map +1 -1
  435. package/dest/url/index.js +1 -1
  436. package/dest/validation/index.d.ts +1 -1
  437. package/package.json +59 -45
  438. package/src/array/array.ts +13 -16
  439. package/src/array/index.ts +1 -0
  440. package/src/array/sorted_array.ts +133 -0
  441. package/src/async-pool/index.ts +1 -0
  442. package/src/bigint/index.ts +20 -0
  443. package/src/branded-types/block_number.ts +112 -0
  444. package/src/branded-types/checkpoint_number.ts +115 -0
  445. package/src/branded-types/epoch.ts +88 -0
  446. package/src/branded-types/index.ts +6 -0
  447. package/src/branded-types/slot.ts +88 -0
  448. package/src/branded-types/types.ts +2 -0
  449. package/src/buffer/buffer16.ts +133 -0
  450. package/src/buffer/buffer32.ts +10 -8
  451. package/src/buffer/index.ts +1 -0
  452. package/src/collection/array.ts +66 -4
  453. package/src/collection/object.ts +37 -0
  454. package/src/config/env_var.ts +177 -58
  455. package/src/config/index.ts +209 -10
  456. package/src/config/network_config.ts +18 -0
  457. package/src/config/network_name.ts +28 -0
  458. package/src/config/parse-env.ts +4 -0
  459. package/src/config/secret_value.ts +49 -0
  460. package/src/crypto/aes128/index.ts +19 -10
  461. package/src/crypto/bls/bn254_keystore.ts +287 -0
  462. package/src/crypto/bls/index.ts +77 -0
  463. package/src/crypto/bn254/index.ts +64 -0
  464. package/src/crypto/ecdsa/index.ts +41 -23
  465. package/src/crypto/ecdsa/signature.ts +2 -2
  466. package/src/crypto/grumpkin/index.ts +38 -46
  467. package/src/crypto/keys/index.ts +6 -6
  468. package/src/crypto/pedersen/pedersen.wasm.ts +23 -19
  469. package/src/crypto/poseidon/index.ts +33 -25
  470. package/src/crypto/random/index.ts +2 -40
  471. package/src/crypto/random/randomness_singleton.ts +2 -4
  472. package/src/crypto/schnorr/index.ts +22 -18
  473. package/src/crypto/schnorr/signature.ts +2 -2
  474. package/src/crypto/secp256k1/index.ts +15 -11
  475. package/src/crypto/secp256k1-signer/utils.ts +120 -7
  476. package/src/crypto/sha256/index.ts +48 -1
  477. package/src/crypto/sha512/index.ts +1 -1
  478. package/src/crypto/signature/index.ts +1 -1
  479. package/src/crypto/sync/index.ts +1 -1
  480. package/src/crypto/sync/pedersen/index.ts +17 -16
  481. package/src/crypto/sync/poseidon/index.ts +28 -23
  482. package/src/curves/bls12/field.ts +463 -0
  483. package/src/curves/bls12/index.ts +2 -0
  484. package/src/curves/bls12/point.ts +450 -0
  485. package/src/{fields/fields.ts → curves/bn254/field.ts} +84 -63
  486. package/src/curves/bn254/index.ts +2 -0
  487. package/src/curves/bn254/point.ts +170 -0
  488. package/src/curves/grumpkin/index.ts +11 -0
  489. package/src/{fields → curves/grumpkin}/point.ts +27 -10
  490. package/src/eth-address/index.ts +35 -3
  491. package/src/eth-signature/eth_signature.ts +44 -22
  492. package/src/fs/index.ts +1 -0
  493. package/src/fs/try_rm_dir.ts +15 -0
  494. package/src/iterable/filter.ts +1 -1
  495. package/src/iterable/map.ts +1 -1
  496. package/src/iterator/filter.ts +11 -0
  497. package/src/iterator/index.ts +1 -0
  498. package/src/jest/env.mjs +52 -0
  499. package/src/jest/setupAfterEnv.mjs +3 -0
  500. package/src/json-rpc/client/fetch.ts +14 -33
  501. package/src/json-rpc/client/safe_json_rpc_client.ts +226 -13
  502. package/src/json-rpc/client/undici.ts +8 -15
  503. package/src/json-rpc/convert.ts +3 -12
  504. package/src/json-rpc/errors.ts +6 -0
  505. package/src/json-rpc/fixtures/class_a.ts +4 -1
  506. package/src/json-rpc/fixtures/class_b.ts +4 -1
  507. package/src/json-rpc/index.ts +2 -1
  508. package/src/json-rpc/server/safe_json_rpc_server.ts +141 -48
  509. package/src/json-rpc/test/integration.ts +1 -1
  510. package/src/log/console.ts +4 -1
  511. package/src/log/gcloud-logger-config.ts +3 -7
  512. package/src/log/index.ts +4 -4
  513. package/src/log/libp2p_logger.ts +21 -2
  514. package/src/log/log_fn.ts +1 -1
  515. package/src/log/noir_debug_log_util.ts +21 -0
  516. package/src/log/pino-logger.ts +35 -3
  517. package/src/message/index.ts +5 -1
  518. package/src/mutex/mutex_database.ts +2 -3
  519. package/src/number/index.ts +14 -0
  520. package/src/profiler/index.ts +1 -0
  521. package/src/profiler/profiler.ts +125 -0
  522. package/src/promise/running-promise.ts +2 -2
  523. package/src/queue/batch_queue.ts +1 -1
  524. package/src/queue/bounded_serial_queue.ts +4 -1
  525. package/src/queue/serial_queue.ts +5 -5
  526. package/src/retry/index.ts +10 -5
  527. package/src/schemas/api.ts +4 -4
  528. package/src/schemas/parse.ts +1 -1
  529. package/src/schemas/schemas.ts +42 -13
  530. package/src/schemas/types.ts +33 -0
  531. package/src/schemas/utils.ts +21 -8
  532. package/src/serialize/buffer_reader.ts +60 -3
  533. package/src/serialize/field_reader.ts +28 -4
  534. package/src/serialize/free_funcs.ts +26 -32
  535. package/src/serialize/serialize.ts +3 -1
  536. package/src/sleep/index.ts +6 -0
  537. package/src/string/index.ts +36 -1
  538. package/src/testing/files/index.ts +7 -3
  539. package/src/testing/formatting.ts +3 -0
  540. package/src/testing/index.ts +1 -0
  541. package/src/timer/date.ts +13 -3
  542. package/src/timer/index.ts +1 -1
  543. package/src/timer/timeout.ts +54 -19
  544. package/src/transport/index.ts +0 -1
  545. package/src/transport/interface/connector.ts +0 -1
  546. package/src/transport/interface/listener.ts +2 -3
  547. package/src/transport/interface/socket.ts +2 -3
  548. package/src/transport/transport_client.ts +3 -4
  549. package/src/transport/transport_server.ts +4 -1
  550. package/src/trees/balanced_merkle_tree.ts +84 -0
  551. package/src/trees/hasher.ts +4 -4
  552. package/src/trees/index.ts +2 -0
  553. package/src/trees/indexed_merkle_tree.ts +6 -2
  554. package/src/trees/indexed_merkle_tree_calculator.ts +2 -2
  555. package/src/trees/membership_witness.ts +14 -1
  556. package/src/trees/merkle_tree.ts +4 -1
  557. package/src/trees/merkle_tree_calculator.ts +10 -5
  558. package/src/trees/sibling_path.ts +2 -2
  559. package/src/trees/unbalanced_merkle_tree.ts +112 -42
  560. package/src/trees/unbalanced_merkle_tree_calculator.ts +177 -0
  561. package/src/trees/unbalanced_tree_store.ts +5 -1
  562. package/src/types/index.ts +30 -4
  563. package/src/url/index.ts +0 -1
  564. package/dest/crypto/index.d.ts +0 -15
  565. package/dest/crypto/index.d.ts.map +0 -1
  566. package/dest/crypto/index.js +0 -14
  567. package/dest/crypto/pedersen/pedersen.elliptic.d.ts +0 -13
  568. package/dest/crypto/pedersen/pedersen.elliptic.d.ts.map +0 -1
  569. package/dest/crypto/pedersen/pedersen.elliptic.js +0 -582
  570. package/dest/fields/coordinate.d.ts +0 -68
  571. package/dest/fields/coordinate.d.ts.map +0 -1
  572. package/dest/fields/coordinate.js +0 -96
  573. package/dest/fields/fields.d.ts +0 -176
  574. package/dest/fields/fields.d.ts.map +0 -1
  575. package/dest/fields/index.d.ts +0 -4
  576. package/dest/fields/index.d.ts.map +0 -1
  577. package/dest/fields/index.js +0 -3
  578. package/dest/fields/point.d.ts.map +0 -1
  579. package/dest/index.d.ts +0 -31
  580. package/dest/index.d.ts.map +0 -1
  581. package/dest/index.js +0 -31
  582. package/dest/json-rpc/server/telemetry.d.ts +0 -2
  583. package/dest/json-rpc/server/telemetry.d.ts.map +0 -1
  584. package/dest/json-rpc/server/telemetry.js +0 -0
  585. package/dest/log/debug.d.ts +0 -56
  586. package/dest/log/debug.d.ts.map +0 -1
  587. package/dest/log/debug.js +0 -75
  588. package/dest/log/log_history.d.ts +0 -31
  589. package/dest/log/log_history.d.ts.map +0 -1
  590. package/dest/log/log_history.js +0 -38
  591. package/dest/transport/browser/index.d.ts +0 -5
  592. package/dest/transport/browser/index.d.ts.map +0 -1
  593. package/dest/transport/browser/index.js +0 -4
  594. package/dest/transport/browser/message_port_socket.d.ts +0 -37
  595. package/dest/transport/browser/message_port_socket.d.ts.map +0 -1
  596. package/dest/transport/browser/message_port_socket.js +0 -42
  597. package/dest/transport/browser/shared_worker_connector.d.ts +0 -19
  598. package/dest/transport/browser/shared_worker_connector.d.ts.map +0 -1
  599. package/dest/transport/browser/shared_worker_connector.js +0 -19
  600. package/dest/transport/browser/shared_worker_listener.d.ts +0 -38
  601. package/dest/transport/browser/shared_worker_listener.d.ts.map +0 -1
  602. package/dest/transport/browser/shared_worker_listener.js +0 -33
  603. package/dest/transport/browser/worker_connector.d.ts +0 -26
  604. package/dest/transport/browser/worker_connector.d.ts.map +0 -1
  605. package/dest/transport/browser/worker_connector.js +0 -30
  606. package/dest/transport/browser/worker_listener.d.ts +0 -39
  607. package/dest/transport/browser/worker_listener.d.ts.map +0 -1
  608. package/dest/transport/browser/worker_listener.js +0 -35
  609. package/dest/wasm/empty_wasi_sdk.d.ts +0 -130
  610. package/dest/wasm/empty_wasi_sdk.d.ts.map +0 -1
  611. package/dest/wasm/empty_wasi_sdk.js +0 -148
  612. package/dest/wasm/index.d.ts +0 -2
  613. package/dest/wasm/index.d.ts.map +0 -1
  614. package/dest/wasm/index.js +0 -1
  615. package/dest/wasm/wasm_module.d.ts +0 -136
  616. package/dest/wasm/wasm_module.d.ts.map +0 -1
  617. package/dest/wasm/wasm_module.js +0 -196
  618. package/dest/worker/browser/index.d.ts +0 -3
  619. package/dest/worker/browser/index.d.ts.map +0 -1
  620. package/dest/worker/browser/index.js +0 -2
  621. package/dest/worker/browser/start_web_module.d.ts +0 -7
  622. package/dest/worker/browser/start_web_module.d.ts.map +0 -1
  623. package/dest/worker/browser/start_web_module.js +0 -27
  624. package/dest/worker/browser/web_data_store.d.ts +0 -24
  625. package/dest/worker/browser/web_data_store.d.ts.map +0 -1
  626. package/dest/worker/browser/web_data_store.js +0 -29
  627. package/dest/worker/browser/web_worker.d.ts +0 -10
  628. package/dest/worker/browser/web_worker.d.ts.map +0 -1
  629. package/dest/worker/browser/web_worker.js +0 -25
  630. package/dest/worker/data_store.d.ts +0 -21
  631. package/dest/worker/data_store.d.ts.map +0 -1
  632. package/dest/worker/data_store.js +0 -3
  633. package/dest/worker/index.d.ts +0 -3
  634. package/dest/worker/index.d.ts.map +0 -1
  635. package/dest/worker/index.js +0 -1
  636. package/dest/worker/node/index.d.ts +0 -3
  637. package/dest/worker/node/index.d.ts.map +0 -1
  638. package/dest/worker/node/index.js +0 -2
  639. package/dest/worker/node/node_data_store.d.ts +0 -13
  640. package/dest/worker/node/node_data_store.d.ts.map +0 -1
  641. package/dest/worker/node/node_data_store.js +0 -20
  642. package/dest/worker/node/node_worker.d.ts +0 -6
  643. package/dest/worker/node/node_worker.d.ts.map +0 -1
  644. package/dest/worker/node/node_worker.js +0 -22
  645. package/dest/worker/node/start_node_module.d.ts +0 -7
  646. package/dest/worker/node/start_node_module.d.ts.map +0 -1
  647. package/dest/worker/node/start_node_module.js +0 -31
  648. package/dest/worker/wasm_worker.d.ts +0 -9
  649. package/dest/worker/wasm_worker.d.ts.map +0 -1
  650. package/dest/worker/wasm_worker.js +0 -3
  651. package/dest/worker/worker_pool.d.ts +0 -40
  652. package/dest/worker/worker_pool.d.ts.map +0 -1
  653. package/dest/worker/worker_pool.js +0 -51
  654. package/src/crypto/index.ts +0 -14
  655. package/src/crypto/pedersen/pedersen.elliptic.ts +0 -584
  656. package/src/fields/coordinate.ts +0 -104
  657. package/src/fields/index.ts +0 -3
  658. package/src/index.ts +0 -31
  659. package/src/json-rpc/server/telemetry.ts +0 -0
  660. package/src/log/debug.ts +0 -104
  661. package/src/log/log_history.ts +0 -44
  662. package/src/transport/browser/index.ts +0 -4
  663. package/src/transport/browser/message_port_socket.ts +0 -48
  664. package/src/transport/browser/shared_worker_connector.ts +0 -21
  665. package/src/transport/browser/shared_worker_listener.ts +0 -53
  666. package/src/transport/browser/worker_connector.ts +0 -30
  667. package/src/transport/browser/worker_listener.ts +0 -54
  668. package/src/wasm/README.md +0 -6
  669. package/src/wasm/empty_wasi_sdk.ts +0 -166
  670. package/src/wasm/fixtures/gcd.wasm +0 -0
  671. package/src/wasm/fixtures/gcd.wat +0 -27
  672. package/src/wasm/index.ts +0 -1
  673. package/src/wasm/wasm_module.ts +0 -260
  674. package/src/worker/browser/index.ts +0 -2
  675. package/src/worker/browser/start_web_module.ts +0 -24
  676. package/src/worker/browser/web_data_store.ts +0 -38
  677. package/src/worker/browser/web_worker.ts +0 -25
  678. package/src/worker/data_store.ts +0 -19
  679. package/src/worker/index.ts +0 -2
  680. package/src/worker/node/index.ts +0 -2
  681. package/src/worker/node/node_data_store.ts +0 -27
  682. package/src/worker/node/node_worker.ts +0 -23
  683. package/src/worker/node/start_node_module.ts +0 -30
  684. package/src/worker/wasm_worker.ts +0 -7
  685. package/src/worker/worker_pool.ts +0 -73
@@ -0,0 +1,400 @@
1
+ var _computedKey;
2
+ /* eslint-disable camelcase */ import { bls12_381 } from '@noble/curves/bls12-381';
3
+ import { inspect } from 'util';
4
+ import { toBufferBE } from '../../bigint-buffer/index.js';
5
+ import { randomBoolean } from '../../crypto/random/index.js';
6
+ import { hexSchemaFor } from '../../schemas/utils.js';
7
+ import { BufferReader, serializeToBuffer } from '../../serialize/index.js';
8
+ import { bufferToHex, hexToBuffer } from '../../string/index.js';
9
+ import { Fr } from '../bn254/field.js';
10
+ import { BLS12Fq } from './field.js';
11
+ _computedKey = inspect.custom;
12
+ /**
13
+ * Represents a Point on an elliptic curve with x and y coordinates.
14
+ * The Point class provides methods for creating instances from different input types,
15
+ * converting instances to various output formats, and checking the equality of points.
16
+ * TODO(#7386): Clean up this class.
17
+ */ export class BLS12Point {
18
+ x;
19
+ y;
20
+ isInfinite;
21
+ static ZERO = new BLS12Point(BLS12Fq.ZERO, BLS12Fq.ZERO, true);
22
+ static ONE = new BLS12Point(new BLS12Fq(bls12_381.G1.CURVE.Gx), new BLS12Fq(bls12_381.G1.CURVE.Gy), false);
23
+ static SIZE_IN_BYTES = BLS12Fq.SIZE_IN_BYTES * 2;
24
+ static COMPRESSED_SIZE_IN_BYTES = BLS12Fq.SIZE_IN_BYTES;
25
+ static COMPRESSED_ZERO = setMask(Buffer.alloc(BLS12Fq.SIZE_IN_BYTES), {
26
+ infinity: true,
27
+ compressed: true
28
+ });
29
+ constructor(/**
30
+ * The point's x coordinate
31
+ */ x, /**
32
+ * The point's y coordinate
33
+ */ y, /**
34
+ * Whether the point is at infinity
35
+ */ isInfinite){
36
+ this.x = x;
37
+ this.y = y;
38
+ this.isInfinite = isInfinite;
39
+ if (!BLS12Point.isOnCurve(x, y)) {
40
+ throw new BLSPointNotOnCurveError(x, y);
41
+ }
42
+ if (isInfinite && !(x.equals(BLS12Fq.ZERO) && y.equals(BLS12Fq.ZERO))) {
43
+ throw new Error(`BLS12-381 G1 point ( ${x.toString()}, ${y.toString()} ) is not infinite.`);
44
+ }
45
+ }
46
+ toJSON() {
47
+ return this.toString();
48
+ }
49
+ [_computedKey]() {
50
+ return `BLS12Point {
51
+ x: ${inspect(this.x)},
52
+ y: ${inspect(this.y)},
53
+ isInfinite: ${inspect(this.isInfinite)},
54
+ }`;
55
+ }
56
+ static get schema() {
57
+ return hexSchemaFor(BLS12Point);
58
+ }
59
+ /**
60
+ * Generate a random Point instance.
61
+ *
62
+ * @returns A randomly generated Point instance.
63
+ */ static random() {
64
+ while(true){
65
+ try {
66
+ return BLS12Point.fromXAndSign(BLS12Fq.random(), randomBoolean());
67
+ } catch (e) {
68
+ if (!(e instanceof BLSPointNotOnCurveError)) {
69
+ throw e;
70
+ }
71
+ continue;
72
+ }
73
+ }
74
+ }
75
+ /**
76
+ * Create a Point instance from a given buffer or BufferReader.
77
+ * The input 'buffer' should have exactly 96 bytes representing the x and y coordinates.
78
+ *
79
+ * @param buffer - The buffer or BufferReader containing the x and y coordinates of the point.
80
+ * @returns A Point instance.
81
+ */ static fromBuffer(buffer) {
82
+ const reader = BufferReader.asReader(buffer);
83
+ const [x, y] = [
84
+ BLS12Fq.fromBuffer(reader),
85
+ BLS12Fq.fromBuffer(reader)
86
+ ];
87
+ return new this(x, y, x.isZero() && y.isZero());
88
+ }
89
+ /**
90
+ * Create a Point instance from a hex-encoded string.
91
+ * The input should be prefixed with '0x' or not, and have exactly 128 hex characters representing the x and y coordinates.
92
+ * Throws an error if the input length is invalid or coordinate values are out of range.
93
+ *
94
+ * @param str - The hex-encoded string representing the Point coordinates.
95
+ * @returns A Point instance.
96
+ */ static fromString(str) {
97
+ return this.fromBuffer(hexToBuffer(str));
98
+ }
99
+ /**
100
+ * Create a compressed buffer instance from a point.
101
+ * @dev NOTE: The compression standard for BLS12-381 differs from BN curves. Instead of
102
+ * one is_positive flag, we have three flags to prepend:
103
+ * - is_compressed: indicator that the point is compressed
104
+ * - is_infinity: whether the point the point at infinity
105
+ * - is_greater: only set if is_compressed && !is_infinity && y > (p - 1)/2
106
+ * See https://github.com/arkworks-rs/algebra/blob/master/curves/bls12_381/src/curves/g1.rs -> serialize_with_mode() -> encoding
107
+ * and noble-curves/src/bls12-381.ts -> setMask()
108
+ * @dev Most of the logic below is taken from noble-curves/src/bls12-381.ts -> toBytes()
109
+ * @param point A BLS12Point instance.
110
+ * @returns The buffer containing the x coordinate and the flags of the y coordinate.
111
+ */ compress() {
112
+ if (this.isZero()) {
113
+ return BLS12Point.COMPRESSED_ZERO;
114
+ }
115
+ const isGreater = this.y.isNegative();
116
+ return setMask(toBufferBE(this.x.toBigInt(), BLS12Fq.SIZE_IN_BYTES), {
117
+ compressed: true,
118
+ sort: isGreater
119
+ });
120
+ }
121
+ /**
122
+ * Create a Point instance from a compressed buffer.
123
+ * @dev See compress() above for compression encoding for BLS12-381.
124
+ * @dev Most of the logic below is taken from noble-curves/src/bls12-381.ts -> fromBytes()
125
+ * @param buffer - The buffer containing the x coordinate and the flags of the y coordinate.
126
+ * @returns A BLS12Point instance.
127
+ */ static decompress(buffer) {
128
+ const { compressed, infinity, sort, value: decompressed } = parseMask(buffer);
129
+ if (decompressed.length === BLS12Fq.SIZE_IN_BYTES && compressed) {
130
+ const x = new BLS12Fq(decompressed);
131
+ if (infinity) {
132
+ if (!x.isZero()) {
133
+ throw new Error('Non-empty compressed G1 point at infinity');
134
+ }
135
+ return new BLS12Point(x, BLS12Fq.ZERO, true);
136
+ }
137
+ let y = this.YFromX(x);
138
+ if (!y) {
139
+ throw new BLSPointNotOnCurveError(x);
140
+ }
141
+ if (y.isNegative() !== sort) {
142
+ y = y.negate();
143
+ }
144
+ return new BLS12Point(x, y, infinity);
145
+ } else {
146
+ throw new Error('Invalid compressed G1 point of BLS12-381');
147
+ }
148
+ }
149
+ /**
150
+ * Converts a Point to two BN254 Fr elements by storing its compressed form (48 bytes) as:
151
+ * +-------------------+------------------------+
152
+ * | 31 bytes | 17 bytes |
153
+ * +-------------------+------------------------+
154
+ * | Field Element 1 | Field Element 2 |
155
+ * | [0][bytes 0-30] | [0...0][bytes 31-47] |
156
+ * +-------------------+------------------------+
157
+ * Used in the rollup circuits to store blob commitments in the native field type. See blob.ts.
158
+ * @param point - A BLS12Point instance.
159
+ * @returns The point fields.
160
+ */ toBN254Fields() {
161
+ const compressed = this.compress();
162
+ return [
163
+ new Fr(compressed.subarray(0, 31)),
164
+ new Fr(compressed.subarray(31, 48))
165
+ ];
166
+ }
167
+ /**
168
+ * Creates a Point instance from 2 BN254 Fr fields as encoded in toBNFields() above.
169
+ * Used in the rollup circuits to store blob commitments in the native field type. See blob.ts.
170
+ * @param fields - The encoded BN254 fields.
171
+ * @returns The point fields.
172
+ */ static fromBN254Fields(fields) {
173
+ return BLS12Point.decompress(Buffer.concat([
174
+ fields[0].toBuffer().subarray(1),
175
+ fields[1].toBuffer().subarray(-17)
176
+ ]));
177
+ }
178
+ /**
179
+ * Creates a point from an array of 2 fields.
180
+ * @returns The point
181
+ */ static fromBLS12FqFields(fields) {
182
+ return new this(fields[0], fields[1], !fields[2].isEmpty());
183
+ }
184
+ /**
185
+ * Creates a point from @noble/curves projective point definition.
186
+ * @returns The point
187
+ */ static fromNobleProjectivePoint(point) {
188
+ const affine = point.toAffine();
189
+ return new BLS12Point(new BLS12Fq(affine.x), new BLS12Fq(affine.y), point.equals(bls12_381.G1.ProjectivePoint.ZERO));
190
+ }
191
+ /**
192
+ * Uses the x coordinate and isPositive flag (+/-) to reconstruct the point.
193
+ * @param x - The x coordinate of the point
194
+ * @param sign - The "sign" of the y coordinate - note that this is not a sign as is known in integer arithmetic.
195
+ * Instead it is a boolean flag that determines whether the y coordinate is <= (Fr.MODULUS - 1) / 2
196
+ * @returns The point as an array of 2 fields
197
+ */ static fromXAndSign(x, sign) {
198
+ const y = BLS12Point.YFromX(x);
199
+ if (y == null) {
200
+ throw new BLSPointNotOnCurveError(x);
201
+ }
202
+ const yPositiveBigInt = y.isNegative() ? BLS12Fq.MODULUS - y.toBigInt() : y.toBigInt();
203
+ const yNegativeBigInt = BLS12Fq.MODULUS - yPositiveBigInt;
204
+ // Choose the positive or negative root based on isPositive
205
+ const finalY = sign ? new BLS12Fq(yPositiveBigInt) : new BLS12Fq(yNegativeBigInt);
206
+ // Create and return the new Point
207
+ return new this(x, finalY, false);
208
+ }
209
+ /**
210
+ * @param x - The x coordinate of the point
211
+ * @returns y^2 such that y^2 = x^3 + 4
212
+ */ static YSquaredFromX(x) {
213
+ return new BLS12Fq(bls12_381.G1.weierstrassEquation(x.toBigInt()));
214
+ }
215
+ /**
216
+ * @param x - The x coordinate of the point
217
+ * @returns The y coordinate of the point, if it exists on BLS12-381
218
+ */ static YFromX(x) {
219
+ const ySquared = this.YSquaredFromX(x);
220
+ // y is then simply the square root. Note however that not all square roots exist in the field: if sqrt returns null
221
+ // then there is no point in the curve with this x coordinate.
222
+ return ySquared.sqrt();
223
+ }
224
+ /**
225
+ * @param x - The x coordinate of the point
226
+ * @param y - The y coordinate of the point
227
+ * @returns Whether the point exists on BLS12-381
228
+ */ static isOnCurve(x, y) {
229
+ if (x.isZero() && y.isZero()) {
230
+ // Representation of inf point
231
+ return true;
232
+ }
233
+ // The BLS12-381 equation is y^2 = x^3 + 4. We could use `YFromX` and then compare to `this.y`, but this would
234
+ // involve computing the square root of y, of which there are two possible valid values. This method is also faster.
235
+ const lhs = y.square();
236
+ const rhs = this.YSquaredFromX(x);
237
+ return lhs.equals(rhs);
238
+ }
239
+ /**
240
+ * Returns the contents of the point as an array of 2 fields.
241
+ * @returns The point as an array of 2 fields
242
+ */ toBLS12FqFields() {
243
+ return [
244
+ this.x,
245
+ this.y,
246
+ new BLS12Fq(this.isInfinite ? 1 : 0)
247
+ ];
248
+ }
249
+ /**
250
+ * Returns the x coordinate and the sign of the y coordinate.
251
+ * @dev The y sign can be determined by checking if the y coordinate is greater than half of the modulus.
252
+ * @returns The x coordinate and the sign of the y coordinate.
253
+ */ toXAndSign() {
254
+ return [
255
+ this.x,
256
+ !this.y.isNegative()
257
+ ];
258
+ }
259
+ /**
260
+ * Returns the contents of the point as BigInts.
261
+ * @returns The point as BigInts
262
+ */ toBigInts() {
263
+ return {
264
+ x: this.x.toBigInt(),
265
+ y: this.y.toBigInt(),
266
+ isInfinite: this.isInfinite ? 1n : 0n
267
+ };
268
+ }
269
+ /**
270
+ * Converts the Point instance to a Buffer representation of the coordinates.
271
+ * @returns A Buffer representation of the Point instance.
272
+ * @dev Note that toBuffer does not include the isInfinite flag and other serialization methods do (e.g. toBigInts).
273
+ */ toBuffer() {
274
+ const buf = serializeToBuffer([
275
+ this.x,
276
+ this.y
277
+ ]);
278
+ if (buf.length !== BLS12Point.SIZE_IN_BYTES) {
279
+ throw new Error(`Invalid buffer length for Point: ${buf.length}`);
280
+ }
281
+ return buf;
282
+ }
283
+ /**
284
+ * Convert the Point instance to a hexadecimal string representation.
285
+ * The output string is prefixed with '0x' and consists of exactly 128 hex characters,
286
+ * representing the concatenated x and y coordinates of the point.
287
+ *
288
+ * @returns A hex-encoded string representing the Point instance.
289
+ */ toString() {
290
+ return bufferToHex(this.toBuffer());
291
+ }
292
+ /**
293
+ * Check if two Point instances are equal by comparing their buffer values.
294
+ * Returns true if the buffer values are the same, and false otherwise.
295
+ *
296
+ * @param rhs - The Point instance to compare with the current instance.
297
+ * @returns A boolean indicating whether the two Point instances are equal.
298
+ */ equals(rhs) {
299
+ return this.x.equals(rhs.x) && this.y.equals(rhs.y);
300
+ }
301
+ /**
302
+ * Check whether the point is zero.
303
+ */ isZero() {
304
+ return this.x.isZero() && this.y.isZero();
305
+ }
306
+ /**
307
+ * Check if this is point at infinity.
308
+ * Check this is consistent with how bb is encoding the point at infinity
309
+ */ get inf() {
310
+ return this.isInfinite;
311
+ }
312
+ /** Arithmetic - wrapper around noble curves */ toNobleProjectivePoint() {
313
+ return bls12_381.G1.ProjectivePoint.fromAffine(this.toBigInts());
314
+ }
315
+ add(rhs) {
316
+ return BLS12Point.fromNobleProjectivePoint(this.toNobleProjectivePoint().add(rhs.toNobleProjectivePoint()));
317
+ }
318
+ negate() {
319
+ return new BLS12Point(this.x, this.y.negate(), this.isInfinite);
320
+ }
321
+ sub(rhs) {
322
+ return BLS12Point.fromNobleProjectivePoint(this.toNobleProjectivePoint().subtract(rhs.toNobleProjectivePoint()));
323
+ }
324
+ /**
325
+ * @dev From noble curves package:
326
+ * Constant time multiplication. Uses wNAF method. Windowed method may be 10% faster,
327
+ * but takes 2x longer to generate and consumes 2x memory.
328
+ * Uses precomputes when available, uses endomorphism for Koblitz curves.
329
+ * @param scalar by which the point would be multiplied
330
+ * @returns New point
331
+ */ mul(rhs) {
332
+ // Note: noble curves throws on 0
333
+ if (rhs.isZero()) {
334
+ return BLS12Point.ZERO;
335
+ }
336
+ return BLS12Point.fromNobleProjectivePoint(this.toNobleProjectivePoint().multiply(rhs.toBigInt()));
337
+ }
338
+ /**
339
+ * @dev From noble curves package:
340
+ * Non-constant-time multiplication. Uses double-and-add algorithm.
341
+ * It's faster, but should only be used when you don't care about an exposed private key e.g. sig verification, which works over *public* keys.
342
+ * @param scalar by which the point would be multiplied
343
+ * @returns New point
344
+ */ mulUnsafe(rhs) {
345
+ return BLS12Point.fromNobleProjectivePoint(this.toNobleProjectivePoint().multiplyUnsafe(rhs.toBigInt()));
346
+ }
347
+ /**
348
+ * @dev From noble curves package:
349
+ * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
350
+ * Not using Strauss-Shamir trick: precomputation tables are faster. The trick could be useful if both P and Q are not G (not in our case).
351
+ * @returns affine point
352
+ */ mulAndAddUnsafe(a, b, Q) {
353
+ const res = this.toNobleProjectivePoint().multiplyAndAddUnsafe(Q.toNobleProjectivePoint(), a.toBigInt(), b.toBigInt());
354
+ return res ? BLS12Point.fromNobleProjectivePoint(res) : BLS12Point.ZERO;
355
+ }
356
+ }
357
+ export class BLSPointNotOnCurveError extends Error {
358
+ constructor(x, y){
359
+ super('The given G1 point is not on the BLS12-381 curve: (' + x.toString() + ', ' + (y ? y.toString() : '') + ')');
360
+ this.name = 'NotOnCurveError';
361
+ }
362
+ }
363
+ /**
364
+ * Lifted from noble curves bls12_381 since it's not exposed. Sets the flags
365
+ * for BLS12-381 point compression.
366
+ * @dev 'sort' refers to 'is_greater' i.e. y > (p - 1)/2
367
+ */ function setMask(bytes, mask) {
368
+ if (bytes[0] & 0b1110_0000) {
369
+ throw new Error('setMask: non-empty mask');
370
+ }
371
+ if (mask.compressed) {
372
+ bytes[0] |= 0b1000_0000;
373
+ }
374
+ if (mask.infinity) {
375
+ bytes[0] |= 0b0100_0000;
376
+ }
377
+ if (mask.sort) {
378
+ bytes[0] |= 0b0010_0000;
379
+ }
380
+ return bytes;
381
+ }
382
+ /**
383
+ * Lifted from noble curves bls12_381 since it's not exposed. Reads the flags
384
+ * for BLS12-381 point compression.
385
+ * @dev 'sort' refers to 'is_greater' i.e. y > (p - 1)/2
386
+ */ function parseMask(bytes) {
387
+ // Copy, so we can remove mask data without affecting input bytes.
388
+ const value = Buffer.from(bytes);
389
+ const mask = value[0] & 0b1110_0000;
390
+ const compressed = !!(mask >> 7 & 1); // compression bit (0b1000_0000)
391
+ const infinity = !!(mask >> 6 & 1); // point at infinity bit (0b0100_0000)
392
+ const sort = !!(mask >> 5 & 1); // sort bit (0b0010_0000)
393
+ value[0] &= 0b0001_1111; // clear mask (zero first 3 bits)
394
+ return {
395
+ compressed,
396
+ infinity,
397
+ sort,
398
+ value
399
+ };
400
+ }
@@ -0,0 +1,180 @@
1
+ import { inspect } from 'util';
2
+ import { BufferReader } from '../../serialize/buffer_reader.js';
3
+ /**
4
+ * Represents a field derived from BaseField.
5
+ */
6
+ type DerivedField<T extends BaseField> = {
7
+ new (value: any): T;
8
+ /**
9
+ * All derived fields will specify a MODULUS.
10
+ */
11
+ MODULUS: bigint;
12
+ };
13
+ /**
14
+ * Base field class.
15
+ * Uses bigint as the internal representation.
16
+ * Buffers are generated on demand from the bigint value.
17
+ */
18
+ declare abstract class BaseField {
19
+ static SIZE_IN_BYTES: number;
20
+ private readonly asBigInt;
21
+ /**
22
+ * Return bigint representation.
23
+ * @deprecated Just to get things compiling. Use toBigInt().
24
+ * */
25
+ get value(): bigint;
26
+ /** Returns the size in bytes. */
27
+ get size(): number;
28
+ protected constructor(value: number | bigint | boolean | BaseField | Buffer);
29
+ protected abstract modulus(): bigint;
30
+ /**
31
+ * Converts the bigint to a Buffer.
32
+ */
33
+ toBuffer(): Buffer;
34
+ toString(): `0x${string}`;
35
+ toBigInt(): bigint;
36
+ toBool(): boolean;
37
+ /**
38
+ * Converts this field to a number.
39
+ * Throws if the underlying value is greater than MAX_SAFE_INTEGER.
40
+ */
41
+ toNumber(): number;
42
+ /**
43
+ * Converts this field to a number.
44
+ * May cause loss of precision if the underlying value is greater than MAX_SAFE_INTEGER.
45
+ */
46
+ toNumberUnsafe(): number;
47
+ toShortString(): string;
48
+ equals(rhs: BaseField): boolean;
49
+ lt(rhs: BaseField): boolean;
50
+ cmp(rhs: BaseField): -1 | 0 | 1;
51
+ static cmp(lhs: BaseField, rhs: BaseField): -1 | 0 | 1;
52
+ isZero(): boolean;
53
+ isEmpty(): boolean;
54
+ toFriendlyJSON(): string;
55
+ toField(): this;
56
+ }
57
+ /**
58
+ * Constructs a field from a Buffer of BufferReader.
59
+ * It maybe not read the full 32 bytes if the Buffer is shorter, but it will padded in BaseField constructor.
60
+ */
61
+ export declare function fromBuffer<T extends BaseField>(buffer: Buffer | BufferReader, f: DerivedField<T>): T;
62
+ /** Branding to ensure fields are not interchangeable types. */
63
+ export interface Fr {
64
+ /** Brand. */
65
+ _branding: 'Fr';
66
+ }
67
+ /**
68
+ * Fr field class.
69
+ * @dev This class is used to represent elements of BN254 scalar field or elements in the base field of Grumpkin.
70
+ * (Grumpkin's scalar field corresponds to BN254's base field and vice versa.)
71
+ */
72
+ export declare class Fr extends BaseField {
73
+ static ZERO: Fr;
74
+ static ONE: Fr;
75
+ static MODULUS: bigint;
76
+ static MAX_FIELD_VALUE: Fr;
77
+ constructor(value: number | bigint | boolean | Fr | Buffer);
78
+ [inspect.custom](): string;
79
+ protected modulus(): bigint;
80
+ static random(): Fr;
81
+ static zero(): Fr;
82
+ static isZero(value: Fr): boolean;
83
+ static fromBuffer(buffer: Buffer | BufferReader): Fr;
84
+ static fromBufferReduce(buffer: Buffer): Fr;
85
+ /**
86
+ * Creates a Fr instance from a string.
87
+ * @param buf - the string to create a Fr from.
88
+ * @returns the Fr instance
89
+ * @remarks if the string only consists of numbers, we assume we are parsing a bigint,
90
+ * otherwise we require the hex string to be prepended with "0x", to ensure there is no misunderstanding
91
+ * as to what is being parsed.
92
+ */
93
+ static fromString(buf: string): Fr;
94
+ /**
95
+ * Creates a Fr instance from a hex string.
96
+ * @param buf - a hex encoded string.
97
+ * @returns the Fr instance
98
+ */
99
+ static fromHexString(buf: string): Fr;
100
+ /** Arithmetic */
101
+ add(rhs: Fr): Fr;
102
+ square(): Fr;
103
+ negate(): Fr;
104
+ sub(rhs: Fr): Fr;
105
+ mul(rhs: Fr): Fr;
106
+ div(rhs: Fr): Fr;
107
+ ediv(rhs: Fr): Fr;
108
+ /**
109
+ * Computes a square root of the field element.
110
+ * @returns A square root of the field element (null if it does not exist).
111
+ */
112
+ sqrt(): Promise<Fr | null>;
113
+ toJSON(): `0x${string}`;
114
+ /**
115
+ * Creates an Fr instance from a plain object without Zod validation.
116
+ * This method is optimized for performance and skips validation, making it suitable
117
+ * for deserializing trusted data (e.g., from C++ via MessagePack).
118
+ * Handles buffers, strings, numbers, bigints, or existing instances.
119
+ * @param obj - Plain object, buffer, string, number, bigint, boolean, or Fr instance
120
+ * @returns An Fr instance
121
+ */
122
+ static fromPlainObject(obj: any): Fr;
123
+ static get schema(): import("zod").ZodType<Fr, any, string>;
124
+ }
125
+ /**
126
+ * Branding to ensure fields are not interchangeable types.
127
+ */
128
+ export interface Fq {
129
+ /** Brand. */
130
+ _branding: 'Fq';
131
+ }
132
+ /**
133
+ * Fq field class.
134
+ * @dev This class is used to represent elements of BN254 base field or elements in the scalar field of Grumpkin.
135
+ * (Grumpkin's scalar field corresponds to BN254's base field and vice versa.)
136
+ */
137
+ export declare class Fq extends BaseField {
138
+ static ZERO: Fq;
139
+ static MODULUS: bigint;
140
+ private static HIGH_SHIFT;
141
+ private static LOW_MASK;
142
+ [inspect.custom](): string;
143
+ get lo(): Fr;
144
+ get hi(): Fr;
145
+ constructor(value: number | bigint | boolean | Fq | Buffer);
146
+ protected modulus(): bigint;
147
+ static random(): Fq;
148
+ static zero(): Fq;
149
+ static fromBuffer(buffer: Buffer | BufferReader): Fq;
150
+ static fromBufferReduce(buffer: Buffer): Fq;
151
+ /**
152
+ * Creates a Fq instance from a string.
153
+ * @param buf - the string to create a Fq from.
154
+ * @returns the Fq instance
155
+ * @remarks if the string only consists of numbers, we assume we are parsing a bigint,
156
+ * otherwise we require the hex string to be prepended with "0x", to ensure there is no misunderstanding
157
+ * as to what is being parsed.
158
+ */
159
+ static fromString(buf: string): Fq;
160
+ /**
161
+ * Creates a Fq instance from a hex string.
162
+ * @param buf - a hex encoded string.
163
+ * @returns the Fq instance
164
+ */
165
+ static fromHexString(buf: string): Fq;
166
+ static fromHighLow(high: Fr, low: Fr): Fq;
167
+ add(rhs: Fq): Fq;
168
+ /**
169
+ * Computes a square root of the field element.
170
+ * @returns A square root of the field element (null if it does not exist).
171
+ */
172
+ sqrt(): Promise<Fq | null>;
173
+ toJSON(): `0x${string}`;
174
+ toFields(): Fr[];
175
+ static get schema(): import("zod").ZodType<Fq, any, string>;
176
+ }
177
+ /** Wraps a function that returns a buffer so that all results are reduced into a field of the given type. */
178
+ export declare function reduceFn<TInput, TField extends BaseField>(fn: (input: TInput) => Buffer, field: DerivedField<TField>): (input: TInput) => TField;
179
+ export {};
180
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmllbGQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jdXJ2ZXMvYm4yNTQvZmllbGQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUsvQixPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0s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