@unlink-xyz/core 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/README.md +9 -0
  2. package/dist/account/{zkAccount.d.ts → account.d.ts} +36 -5
  3. package/dist/account/account.d.ts.map +1 -0
  4. package/dist/account/accounts.d.ts +42 -0
  5. package/dist/account/accounts.d.ts.map +1 -0
  6. package/dist/account/seed.d.ts +45 -0
  7. package/dist/account/seed.d.ts.map +1 -0
  8. package/dist/account/serialization.d.ts +6 -0
  9. package/dist/account/serialization.d.ts.map +1 -0
  10. package/dist/browser/index.js +56221 -0
  11. package/dist/browser/index.js.map +1 -0
  12. package/dist/browser/wallet/index.js +55942 -0
  13. package/dist/browser/wallet/index.js.map +1 -0
  14. package/dist/clients/broadcaster.d.ts +8 -2
  15. package/dist/clients/broadcaster.d.ts.map +1 -1
  16. package/dist/clients/http.d.ts +6 -0
  17. package/dist/clients/http.d.ts.map +1 -1
  18. package/dist/clients/indexer.d.ts +16 -0
  19. package/dist/clients/indexer.d.ts.map +1 -1
  20. package/dist/config.d.ts +30 -9
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/constants.d.ts +6 -0
  23. package/dist/constants.d.ts.map +1 -0
  24. package/dist/core.d.ts.map +1 -1
  25. package/dist/crypto/adapters/index.d.ts +17 -0
  26. package/dist/crypto/adapters/index.d.ts.map +1 -0
  27. package/dist/crypto/adapters/polyfills.d.ts +5 -0
  28. package/dist/crypto/adapters/polyfills.d.ts.map +1 -0
  29. package/dist/crypto/encrypt.d.ts +33 -0
  30. package/dist/crypto/encrypt.d.ts.map +1 -0
  31. package/dist/crypto/secure-memory.d.ts +25 -0
  32. package/dist/crypto/secure-memory.d.ts.map +1 -0
  33. package/dist/errors.d.ts +17 -0
  34. package/dist/errors.d.ts.map +1 -1
  35. package/dist/history/index.d.ts +3 -0
  36. package/dist/history/index.d.ts.map +1 -0
  37. package/dist/history/service.d.ts +46 -0
  38. package/dist/history/service.d.ts.map +1 -0
  39. package/dist/history/types.d.ts +21 -0
  40. package/dist/history/types.d.ts.map +1 -0
  41. package/dist/index.d.ts +16 -7
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +6721 -19
  44. package/dist/index.js.map +1 -0
  45. package/dist/keys/address.d.ts +13 -0
  46. package/dist/keys/address.d.ts.map +1 -0
  47. package/dist/keys/derive.d.ts +37 -0
  48. package/dist/keys/derive.d.ts.map +1 -0
  49. package/dist/keys/hex.d.ts +14 -0
  50. package/dist/keys/hex.d.ts.map +1 -0
  51. package/dist/keys/index.d.ts +5 -0
  52. package/dist/keys/index.d.ts.map +1 -0
  53. package/dist/keys/mnemonic.d.ts +6 -0
  54. package/dist/keys/mnemonic.d.ts.map +1 -0
  55. package/dist/keys.d.ts +5 -1
  56. package/dist/keys.d.ts.map +1 -1
  57. package/dist/prover/config.d.ts +53 -22
  58. package/dist/prover/config.d.ts.map +1 -1
  59. package/dist/prover/integrity.d.ts +20 -0
  60. package/dist/prover/integrity.d.ts.map +1 -0
  61. package/dist/prover/prover.d.ts +16 -20
  62. package/dist/prover/prover.d.ts.map +1 -1
  63. package/dist/prover/registry.d.ts +3 -30
  64. package/dist/prover/registry.d.ts.map +1 -1
  65. package/dist/state/merkle/hydrator.d.ts +21 -19
  66. package/dist/state/merkle/hydrator.d.ts.map +1 -1
  67. package/dist/state/merkle/index.d.ts +2 -2
  68. package/dist/state/merkle/index.d.ts.map +1 -1
  69. package/dist/state/merkle/merkle-tree.d.ts +8 -0
  70. package/dist/state/merkle/merkle-tree.d.ts.map +1 -1
  71. package/dist/state/store/ciphertext-store.d.ts +11 -0
  72. package/dist/state/store/ciphertext-store.d.ts.map +1 -1
  73. package/dist/state/store/history-store.d.ts +24 -0
  74. package/dist/state/store/history-store.d.ts.map +1 -0
  75. package/dist/state/store/index.d.ts +3 -2
  76. package/dist/state/store/index.d.ts.map +1 -1
  77. package/dist/state/store/job-store.d.ts +7 -7
  78. package/dist/state/store/job-store.d.ts.map +1 -1
  79. package/dist/state/store/jobs.d.ts +70 -25
  80. package/dist/state/store/jobs.d.ts.map +1 -1
  81. package/dist/state/store/leaf-store.d.ts +4 -0
  82. package/dist/state/store/leaf-store.d.ts.map +1 -1
  83. package/dist/state/store/note-store.d.ts +7 -7
  84. package/dist/state/store/note-store.d.ts.map +1 -1
  85. package/dist/state/store/nullifier-store.d.ts +9 -0
  86. package/dist/state/store/nullifier-store.d.ts.map +1 -1
  87. package/dist/state/store/records.d.ts +39 -2
  88. package/dist/state/store/records.d.ts.map +1 -1
  89. package/dist/state/store/root-store.d.ts.map +1 -1
  90. package/dist/state/store/store.d.ts +79 -27
  91. package/dist/state/store/store.d.ts.map +1 -1
  92. package/dist/storage/indexeddb.d.ts.map +1 -1
  93. package/dist/storage/memory.d.ts.map +1 -1
  94. package/dist/transactions/adapter.d.ts +31 -0
  95. package/dist/transactions/adapter.d.ts.map +1 -0
  96. package/dist/transactions/deposit.d.ts +12 -15
  97. package/dist/transactions/deposit.d.ts.map +1 -1
  98. package/dist/transactions/index.d.ts +9 -4
  99. package/dist/transactions/index.d.ts.map +1 -1
  100. package/dist/transactions/note-selection.d.ts +17 -0
  101. package/dist/transactions/note-selection.d.ts.map +1 -0
  102. package/dist/transactions/note-sync.d.ts +5 -33
  103. package/dist/transactions/note-sync.d.ts.map +1 -1
  104. package/dist/transactions/reconcile.d.ts +9 -11
  105. package/dist/transactions/reconcile.d.ts.map +1 -1
  106. package/dist/transactions/transact.d.ts +30 -22
  107. package/dist/transactions/transact.d.ts.map +1 -1
  108. package/dist/transactions/transaction-planner.d.ts +34 -0
  109. package/dist/transactions/transaction-planner.d.ts.map +1 -0
  110. package/dist/transactions/transfer-planner.d.ts +37 -0
  111. package/dist/transactions/transfer-planner.d.ts.map +1 -0
  112. package/dist/transactions/types/deposit.d.ts +67 -0
  113. package/dist/transactions/types/deposit.d.ts.map +1 -0
  114. package/dist/transactions/types/domain.d.ts +70 -0
  115. package/dist/transactions/types/domain.d.ts.map +1 -0
  116. package/dist/transactions/types/index.d.ts +18 -0
  117. package/dist/transactions/types/index.d.ts.map +1 -0
  118. package/dist/transactions/types/options.d.ts +54 -0
  119. package/dist/transactions/types/options.d.ts.map +1 -0
  120. package/dist/transactions/types/planning.d.ts +82 -0
  121. package/dist/transactions/types/planning.d.ts.map +1 -0
  122. package/dist/transactions/types/state-stores.d.ts +151 -0
  123. package/dist/transactions/types/state-stores.d.ts.map +1 -0
  124. package/dist/transactions/types/transact.d.ts +83 -0
  125. package/dist/transactions/types/transact.d.ts.map +1 -0
  126. package/dist/transactions/withdrawal-planner.d.ts +58 -0
  127. package/dist/transactions/withdrawal-planner.d.ts.map +1 -0
  128. package/dist/tsconfig.tsbuildinfo +1 -1
  129. package/dist/tsup.browser.config.d.ts +7 -0
  130. package/dist/tsup.browser.config.d.ts.map +1 -0
  131. package/dist/tsup.config.d.ts +8 -0
  132. package/dist/tsup.config.d.ts.map +1 -0
  133. package/dist/types.d.ts +1 -0
  134. package/dist/types.d.ts.map +1 -1
  135. package/dist/utils/amounts.d.ts +26 -0
  136. package/dist/utils/amounts.d.ts.map +1 -0
  137. package/dist/utils/async.d.ts +9 -0
  138. package/dist/utils/async.d.ts.map +1 -1
  139. package/dist/utils/async.js +38 -11
  140. package/dist/utils/async.js.map +1 -0
  141. package/dist/utils/bigint.d.ts +0 -2
  142. package/dist/utils/bigint.d.ts.map +1 -1
  143. package/dist/utils/format.d.ts +25 -0
  144. package/dist/utils/format.d.ts.map +1 -0
  145. package/dist/utils/notes.d.ts +15 -0
  146. package/dist/utils/notes.d.ts.map +1 -0
  147. package/dist/utils/polling.d.ts +5 -0
  148. package/dist/utils/polling.d.ts.map +1 -1
  149. package/dist/utils/random.d.ts +18 -0
  150. package/dist/utils/random.d.ts.map +1 -0
  151. package/dist/utils/signature.d.ts +6 -0
  152. package/dist/utils/signature.d.ts.map +1 -1
  153. package/dist/utils/validators.d.ts +21 -10
  154. package/dist/utils/validators.d.ts.map +1 -1
  155. package/dist/vitest.config.d.ts +3 -0
  156. package/dist/vitest.config.d.ts.map +1 -0
  157. package/dist/wallet/adapter.d.ts +21 -0
  158. package/dist/wallet/adapter.d.ts.map +1 -0
  159. package/dist/wallet/burner/service.d.ts +32 -0
  160. package/dist/wallet/burner/service.d.ts.map +1 -0
  161. package/dist/wallet/burner/types.d.ts +47 -0
  162. package/dist/wallet/burner/types.d.ts.map +1 -0
  163. package/dist/wallet/index.d.ts +20 -0
  164. package/dist/wallet/index.d.ts.map +1 -0
  165. package/dist/wallet/index.js +6462 -0
  166. package/dist/wallet/index.js.map +1 -0
  167. package/dist/wallet/sdk.d.ts +48 -0
  168. package/dist/wallet/sdk.d.ts.map +1 -0
  169. package/dist/wallet/types.d.ts +457 -0
  170. package/dist/wallet/types.d.ts.map +1 -0
  171. package/dist/wallet/unlink-wallet.d.ts +187 -0
  172. package/dist/wallet/unlink-wallet.d.ts.map +1 -0
  173. package/package.json +38 -15
  174. package/.eslintrc.json +0 -4
  175. package/account/zkAccount.test.ts +0 -316
  176. package/account/zkAccount.ts +0 -222
  177. package/circuits.json +0 -26
  178. package/clients/broadcaster.ts +0 -67
  179. package/clients/http.ts +0 -94
  180. package/clients/indexer.ts +0 -150
  181. package/config.ts +0 -39
  182. package/core.ts +0 -17
  183. package/dist/account/railgun-imports-prototype.d.ts +0 -12
  184. package/dist/account/railgun-imports-prototype.d.ts.map +0 -1
  185. package/dist/account/railgun-imports-prototype.js +0 -30
  186. package/dist/account/zkAccount.d.ts.map +0 -1
  187. package/dist/account/zkAccount.js +0 -128
  188. package/dist/circuits.json +0 -26
  189. package/dist/clients/broadcaster.js +0 -23
  190. package/dist/clients/http.js +0 -57
  191. package/dist/clients/indexer.js +0 -67
  192. package/dist/config.js +0 -29
  193. package/dist/core.js +0 -12
  194. package/dist/errors.js +0 -18
  195. package/dist/key-derivation/babyjubjub.d.ts +0 -9
  196. package/dist/key-derivation/babyjubjub.d.ts.map +0 -1
  197. package/dist/key-derivation/babyjubjub.js +0 -9
  198. package/dist/key-derivation/bech32.d.ts +0 -22
  199. package/dist/key-derivation/bech32.d.ts.map +0 -1
  200. package/dist/key-derivation/bech32.js +0 -86
  201. package/dist/key-derivation/bip32.d.ts +0 -17
  202. package/dist/key-derivation/bip32.d.ts.map +0 -1
  203. package/dist/key-derivation/bip32.js +0 -41
  204. package/dist/key-derivation/bip39.d.ts +0 -22
  205. package/dist/key-derivation/bip39.d.ts.map +0 -1
  206. package/dist/key-derivation/bip39.js +0 -56
  207. package/dist/key-derivation/bytes.d.ts +0 -19
  208. package/dist/key-derivation/bytes.d.ts.map +0 -1
  209. package/dist/key-derivation/bytes.js +0 -92
  210. package/dist/key-derivation/hash.d.ts +0 -3
  211. package/dist/key-derivation/hash.d.ts.map +0 -1
  212. package/dist/key-derivation/hash.js +0 -10
  213. package/dist/key-derivation/index.d.ts +0 -8
  214. package/dist/key-derivation/index.d.ts.map +0 -1
  215. package/dist/key-derivation/index.js +0 -7
  216. package/dist/key-derivation/wallet-node.d.ts +0 -45
  217. package/dist/key-derivation/wallet-node.d.ts.map +0 -1
  218. package/dist/key-derivation/wallet-node.js +0 -109
  219. package/dist/keys.js +0 -41
  220. package/dist/prover/config.js +0 -80
  221. package/dist/prover/index.js +0 -1
  222. package/dist/prover/prover.js +0 -274
  223. package/dist/prover/registry.js +0 -57
  224. package/dist/schema.js +0 -14
  225. package/dist/state/ciphertext-store.d.ts +0 -12
  226. package/dist/state/ciphertext-store.d.ts.map +0 -1
  227. package/dist/state/ciphertext-store.js +0 -25
  228. package/dist/state/hydrator.d.ts +0 -16
  229. package/dist/state/hydrator.d.ts.map +0 -1
  230. package/dist/state/hydrator.js +0 -18
  231. package/dist/state/index.js +0 -2
  232. package/dist/state/job-store.d.ts +0 -12
  233. package/dist/state/job-store.d.ts.map +0 -1
  234. package/dist/state/job-store.js +0 -118
  235. package/dist/state/jobs.d.ts +0 -50
  236. package/dist/state/jobs.d.ts.map +0 -1
  237. package/dist/state/jobs.js +0 -1
  238. package/dist/state/leaf-store.d.ts +0 -17
  239. package/dist/state/leaf-store.d.ts.map +0 -1
  240. package/dist/state/leaf-store.js +0 -35
  241. package/dist/state/merkle/hydrator.js +0 -36
  242. package/dist/state/merkle/index.js +0 -2
  243. package/dist/state/merkle/merkle-tree.js +0 -104
  244. package/dist/state/merkle-tree.d.ts +0 -34
  245. package/dist/state/merkle-tree.d.ts.map +0 -1
  246. package/dist/state/merkle-tree.js +0 -104
  247. package/dist/state/note-store.d.ts +0 -37
  248. package/dist/state/note-store.d.ts.map +0 -1
  249. package/dist/state/note-store.js +0 -133
  250. package/dist/state/nullifier-store.d.ts +0 -13
  251. package/dist/state/nullifier-store.d.ts.map +0 -1
  252. package/dist/state/nullifier-store.js +0 -21
  253. package/dist/state/records.d.ts +0 -57
  254. package/dist/state/records.d.ts.map +0 -1
  255. package/dist/state/records.js +0 -1
  256. package/dist/state/root-store.d.ts +0 -13
  257. package/dist/state/root-store.d.ts.map +0 -1
  258. package/dist/state/root-store.js +0 -30
  259. package/dist/state/store/ciphertext-store.js +0 -25
  260. package/dist/state/store/index.js +0 -8
  261. package/dist/state/store/job-store.js +0 -118
  262. package/dist/state/store/jobs.js +0 -1
  263. package/dist/state/store/leaf-store.js +0 -35
  264. package/dist/state/store/note-store.js +0 -142
  265. package/dist/state/store/nullifier-store.js +0 -30
  266. package/dist/state/store/records.js +0 -1
  267. package/dist/state/store/root-store.js +0 -30
  268. package/dist/state/store/store.js +0 -22
  269. package/dist/state/store.d.ts +0 -26
  270. package/dist/state/store.d.ts.map +0 -1
  271. package/dist/state/store.js +0 -19
  272. package/dist/state.d.ts +0 -83
  273. package/dist/state.d.ts.map +0 -1
  274. package/dist/state.js +0 -171
  275. package/dist/storage/index.js +0 -2
  276. package/dist/storage/indexeddb.js +0 -205
  277. package/dist/storage/memory.js +0 -87
  278. package/dist/transactions/deposit.js +0 -169
  279. package/dist/transactions/index.js +0 -4
  280. package/dist/transactions/note-sync.js +0 -320
  281. package/dist/transactions/reconcile.js +0 -39
  282. package/dist/transactions/shield.d.ts +0 -5
  283. package/dist/transactions/shield.d.ts.map +0 -1
  284. package/dist/transactions/shield.js +0 -93
  285. package/dist/transactions/transact.js +0 -561
  286. package/dist/transactions/types.d.ts +0 -114
  287. package/dist/transactions/types.d.ts.map +0 -1
  288. package/dist/transactions/types.js +0 -1
  289. package/dist/transactions/utils.d.ts +0 -10
  290. package/dist/transactions/utils.d.ts.map +0 -1
  291. package/dist/transactions/utils.js +0 -17
  292. package/dist/types.js +0 -1
  293. package/dist/utils/bigint.js +0 -29
  294. package/dist/utils/crypto.d.ts +0 -12
  295. package/dist/utils/crypto.d.ts.map +0 -1
  296. package/dist/utils/crypto.js +0 -39
  297. package/dist/utils/json-codec.js +0 -25
  298. package/dist/utils/polling.js +0 -6
  299. package/dist/utils/signature.js +0 -12
  300. package/dist/utils/time.d.ts +0 -2
  301. package/dist/utils/time.d.ts.map +0 -1
  302. package/dist/utils/time.js +0 -3
  303. package/dist/utils/validators.js +0 -70
  304. package/dist/utils/witness.d.ts +0 -11
  305. package/dist/utils/witness.d.ts.map +0 -1
  306. package/dist/utils/witness.js +0 -19
  307. package/errors.ts +0 -20
  308. package/index.ts +0 -21
  309. package/key-derivation/babyjubjub.ts +0 -11
  310. package/key-derivation/bech32.test.ts +0 -90
  311. package/key-derivation/bech32.ts +0 -124
  312. package/key-derivation/bip32.ts +0 -56
  313. package/key-derivation/bip39.ts +0 -76
  314. package/key-derivation/bytes.ts +0 -118
  315. package/key-derivation/hash.ts +0 -13
  316. package/key-derivation/index.ts +0 -7
  317. package/key-derivation/wallet-node.ts +0 -155
  318. package/keys.ts +0 -47
  319. package/prover/config.ts +0 -104
  320. package/prover/index.ts +0 -1
  321. package/prover/prover.integration.test.ts +0 -162
  322. package/prover/prover.test.ts +0 -309
  323. package/prover/prover.ts +0 -405
  324. package/prover/registry.test.ts +0 -90
  325. package/prover/registry.ts +0 -82
  326. package/schema.ts +0 -17
  327. package/setup-artifacts.sh +0 -57
  328. package/state/index.ts +0 -2
  329. package/state/merkle/hydrator.ts +0 -69
  330. package/state/merkle/index.ts +0 -12
  331. package/state/merkle/merkle-tree.test.ts +0 -50
  332. package/state/merkle/merkle-tree.ts +0 -163
  333. package/state/store/ciphertext-store.ts +0 -28
  334. package/state/store/index.ts +0 -24
  335. package/state/store/job-store.ts +0 -162
  336. package/state/store/jobs.ts +0 -64
  337. package/state/store/leaf-store.ts +0 -39
  338. package/state/store/note-store.ts +0 -177
  339. package/state/store/nullifier-store.ts +0 -39
  340. package/state/store/records.ts +0 -61
  341. package/state/store/root-store.ts +0 -34
  342. package/state/store/store.ts +0 -25
  343. package/state.test.ts +0 -235
  344. package/storage/index.ts +0 -3
  345. package/storage/indexeddb.test.ts +0 -99
  346. package/storage/indexeddb.ts +0 -235
  347. package/storage/memory.test.ts +0 -59
  348. package/storage/memory.ts +0 -93
  349. package/transactions/deposit.test.ts +0 -160
  350. package/transactions/deposit.ts +0 -227
  351. package/transactions/index.ts +0 -20
  352. package/transactions/note-sync.test.ts +0 -155
  353. package/transactions/note-sync.ts +0 -452
  354. package/transactions/reconcile.ts +0 -73
  355. package/transactions/transact.test.ts +0 -451
  356. package/transactions/transact.ts +0 -811
  357. package/transactions/types.ts +0 -141
  358. package/tsconfig.json +0 -15
  359. package/types/global.d.ts +0 -15
  360. package/types.ts +0 -24
  361. package/utils/async.ts +0 -15
  362. package/utils/bigint.ts +0 -34
  363. package/utils/crypto.test.ts +0 -69
  364. package/utils/crypto.ts +0 -58
  365. package/utils/json-codec.ts +0 -38
  366. package/utils/polling.ts +0 -6
  367. package/utils/signature.ts +0 -16
  368. package/utils/validators.test.ts +0 -64
  369. package/utils/validators.ts +0 -86
@@ -1,274 +0,0 @@
1
- import * as snarkjs from "snarkjs";
2
- import { CoreError } from "../errors.js";
3
- import { ArtifactType, buildArtifactUrl, DEFAULT_CONFIG, getLocalArtifactPath, Runtime, } from "./config.js";
4
- import { getCircuitConfig, SUPPORTED_CIRCUITS, } from "./registry.js";
5
- // Cache for loaded artifacts to avoid reloading 18MB of files on every call
6
- // Now keyed by circuit name to support multiple circuits
7
- const artifactCache = {};
8
- /**
9
- * Select the appropriate circuit based on input/output dimensions
10
- * @param inputs Number of inputs (nullifiers)
11
- * @param outputs Number of outputs (commitments)
12
- * @returns Circuit configuration
13
- * @throws CoreError if no matching circuit is found
14
- */
15
- function selectCircuit(inputs, outputs) {
16
- const config = getCircuitConfig(inputs, outputs);
17
- if (!config) {
18
- throw new CoreError(`No circuit available for ${inputs} inputs and ${outputs} outputs. ` +
19
- `Supported circuits: ${SUPPORTED_CIRCUITS.join(", ")}`);
20
- }
21
- return config;
22
- }
23
- /**
24
- * Fetch circuit artifacts for a specific circuit
25
- * Supports both browser (remote) and Node.js (local) environments
26
- * @param circuitName Full circuit name (e.g., "joinsplit_2x3_16")
27
- * @returns Artifacts object with wasm, zkey, and vkey
28
- */
29
- async function fetchCircuitArtifacts(circuitName) {
30
- // Check cache first
31
- if (artifactCache[circuitName]) {
32
- return artifactCache[circuitName];
33
- }
34
- let wasm;
35
- let zkey;
36
- let vkey;
37
- // Browser environment: fetch from artifact server
38
- if (Runtime.isBrowser()) {
39
- try {
40
- const baseUrl = DEFAULT_CONFIG.rpcUrl;
41
- const wasmUrl = buildArtifactUrl(circuitName, ArtifactType.WASM, baseUrl);
42
- const zkeyUrl = buildArtifactUrl(circuitName, ArtifactType.ZKEY, baseUrl);
43
- const vkeyUrl = buildArtifactUrl(circuitName, ArtifactType.VKEY, baseUrl);
44
- const [wasmRes, zkeyRes, vkeyRes] = await Promise.all([
45
- fetch(wasmUrl),
46
- fetch(zkeyUrl),
47
- fetch(vkeyUrl),
48
- ]);
49
- if (!wasmRes.ok || !zkeyRes.ok || !vkeyRes.ok) {
50
- throw new CoreError(`Failed to fetch artifacts for ${circuitName} from ${baseUrl}. ` +
51
- `Status: wasm=${wasmRes.status}, zkey=${zkeyRes.status}, vkey=${vkeyRes.status}`);
52
- }
53
- wasm = new Uint8Array(await wasmRes.arrayBuffer());
54
- zkey = new Uint8Array(await zkeyRes.arrayBuffer());
55
- vkey = await vkeyRes.json();
56
- }
57
- catch (error) {
58
- throw new CoreError(`Failed to fetch artifacts from server for ${circuitName}: ${error.message}`);
59
- }
60
- }
61
- // Node.js environment: try local file paths
62
- else {
63
- const wasmCandidates = getLocalArtifactPath(circuitName, ArtifactType.WASM);
64
- const zkeyCandidates = getLocalArtifactPath(circuitName, ArtifactType.ZKEY);
65
- const vkeyCandidates = getLocalArtifactPath(circuitName, ArtifactType.VKEY);
66
- let wasmLoaded = false;
67
- for (const candidate of wasmCandidates) {
68
- try {
69
- wasm = await readBinaryResource(candidate);
70
- wasmLoaded = true;
71
- break;
72
- }
73
- catch {
74
- // Try next candidate
75
- }
76
- }
77
- if (!wasmLoaded) {
78
- throw new CoreError(`Could not find WASM artifact for ${circuitName}. ` +
79
- `Please run 'pnpm run build:all' in the circuits package.`);
80
- }
81
- // Load zkey
82
- let zkeyLoaded = false;
83
- for (const candidate of zkeyCandidates) {
84
- try {
85
- zkey = await readBinaryResource(candidate);
86
- zkeyLoaded = true;
87
- break;
88
- }
89
- catch {
90
- // Try next candidate
91
- }
92
- }
93
- if (!zkeyLoaded) {
94
- throw new CoreError(`Could not find zkey artifact for ${circuitName}. ` +
95
- `Please run 'pnpm run build:all' in the circuits package.`);
96
- }
97
- // Load vkey
98
- let vkeyLoaded = false;
99
- for (const candidate of vkeyCandidates) {
100
- try {
101
- const vkeyText = await readTextResource(candidate);
102
- vkey = JSON.parse(vkeyText);
103
- vkeyLoaded = true;
104
- break;
105
- }
106
- catch {
107
- // Try next candidate
108
- }
109
- }
110
- if (!vkeyLoaded) {
111
- throw new CoreError(`Could not find verification key for ${circuitName}. ` +
112
- `Please run 'pnpm run build:all' in the circuits package.`);
113
- }
114
- }
115
- // Verify all artifacts were loaded
116
- if (!wasm || !zkey || !vkey) {
117
- throw new CoreError(`Failed to load all artifacts for ${circuitName}. ` +
118
- `Missing: ${!wasm ? "wasm " : ""}${!zkey ? "zkey " : ""}${!vkey ? "vkey" : ""}`);
119
- }
120
- // Cache the artifacts for future calls
121
- // TypeScript now knows these are defined after the check above
122
- const artifacts = { wasm, zkey, vkey };
123
- artifactCache[circuitName] = artifacts;
124
- return artifacts;
125
- }
126
- async function readBinaryResource(relativePath) {
127
- const url = new URL(relativePath, import.meta.url);
128
- try {
129
- if (url.protocol === "file:") {
130
- const fs = (await import("fs")).default;
131
- const readPromise = new Promise((resolve, reject) => {
132
- fs.readFile(url.pathname, (err, data) => {
133
- if (err) {
134
- reject(err);
135
- }
136
- else {
137
- resolve(data);
138
- }
139
- });
140
- });
141
- const buf = await readPromise;
142
- return new Uint8Array(buf);
143
- }
144
- const response = await fetch(url);
145
- if (!response.ok) {
146
- throw new CoreError(`failed to fetch ${relativePath}: ${response.statusText}`);
147
- }
148
- return new Uint8Array(await response.arrayBuffer());
149
- }
150
- catch (error) {
151
- throw new CoreError(`failed to read binary resource ${relativePath}: ${error.message}`);
152
- }
153
- }
154
- async function readTextResource(relativePath) {
155
- const url = new URL(relativePath, import.meta.url);
156
- if (url.protocol === "file:") {
157
- const fs = (await import("fs")).default;
158
- const readPromise = new Promise((resolve, reject) => {
159
- fs.readFile(url.pathname, (err, data) => {
160
- if (err) {
161
- reject(err);
162
- }
163
- else {
164
- resolve(data);
165
- }
166
- });
167
- });
168
- const buf = await readPromise;
169
- return buf.toString("utf-8");
170
- }
171
- const response = await fetch(url);
172
- if (!response.ok) {
173
- throw new CoreError(`failed to fetch ${relativePath}: ${response.statusText}`);
174
- }
175
- return response.text();
176
- }
177
- export async function proveTransaction(input) {
178
- try {
179
- // Auto-detect circuit based on input dimensions
180
- const nInputs = input.nullifiers.length;
181
- const nOutputs = input.commitmentsOut.length;
182
- const circuit = selectCircuit(nInputs, nOutputs);
183
- // Fetch circuit artifacts (wasm and zkey)
184
- const { wasm, vkey, zkey } = await fetchCircuitArtifacts(circuit.name);
185
- const inputSignals = input;
186
- const { proof, publicSignals } = await snarkjs.groth16.fullProve(inputSignals, wasm, zkey);
187
- // Additional verification step (optional)
188
- const isValid = await snarkjs.groth16.verify(vkey, publicSignals, proof);
189
- if (!isValid) {
190
- throw new CoreError("generated proof is invalid");
191
- }
192
- return {
193
- proof,
194
- publicSignals,
195
- };
196
- }
197
- catch (error) {
198
- throw new CoreError("proof generation failed: " + error.message);
199
- }
200
- }
201
- /**
202
- * Get verification key for a specific circuit configuration
203
- * @param inputs Number of inputs (nullifiers)
204
- * @param outputs Number of outputs (commitments)
205
- * @returns Verification key for the circuit
206
- */
207
- export async function getVerificationKey(inputs, outputs) {
208
- try {
209
- const circuit = selectCircuit(inputs, outputs);
210
- const { vkey } = await fetchCircuitArtifacts(circuit.name);
211
- return vkey;
212
- }
213
- catch (error) {
214
- throw new CoreError("failed to load verification key: " + error.message);
215
- }
216
- }
217
- /**
218
- * Verify a proof with public signals
219
- * Auto-detects the circuit from the public signals structure
220
- * @param proof Groth16 proof
221
- * @param publicSignals Public signals array
222
- * @returns True if proof is valid
223
- */
224
- export async function verifyProof(proof, publicSignals) {
225
- try {
226
- // Public signals structure: [merkleRoot, boundParamsHash, ...nullifiers, ...commitments]
227
- // We need to determine the circuit from the length
228
- // This is tricky without additional context, so we'll need to try to infer
229
- // or require explicit circuit specification
230
- // For now, extract nullifier and commitment counts from the public signals
231
- // The caller should know this information, but we can make an educated guess
232
- // based on the total length and circuit registry
233
- // Length = 2 (root + hash) + nInputs + nOutputs
234
- const totalLength = publicSignals.length;
235
- const variableCount = totalLength - 2; // Remove merkleRoot and boundParamsHash
236
- // Try to find a matching circuit
237
- let vkey = null;
238
- for (const circuitKey of SUPPORTED_CIRCUITS) {
239
- const parts = circuitKey.split("x");
240
- const config = getCircuitConfig(parseInt(parts[0]), parseInt(parts[1]));
241
- if (config && config.inputs + config.outputs === variableCount) {
242
- const artifacts = await fetchCircuitArtifacts(config.name);
243
- vkey = artifacts.vkey;
244
- break;
245
- }
246
- }
247
- if (!vkey) {
248
- throw new CoreError(`Could not determine circuit from ${totalLength} public signals`);
249
- }
250
- return await snarkjs.groth16.verify(vkey, publicSignals, proof);
251
- }
252
- catch (error) {
253
- throw new CoreError("proof verification failed: " + error.message);
254
- }
255
- }
256
- /**
257
- * Verify a proof with explicit circuit specification
258
- * Preferred method when you know the circuit dimensions
259
- * @param proof Groth16 proof
260
- * @param publicSignals Public signals array
261
- * @param inputs Number of inputs (nullifiers)
262
- * @param outputs Number of outputs (commitments)
263
- * @returns True if proof is valid
264
- */
265
- export async function verifyProofWithCircuit(proof, publicSignals, inputs, outputs) {
266
- try {
267
- const circuit = selectCircuit(inputs, outputs);
268
- const { vkey } = await fetchCircuitArtifacts(circuit.name);
269
- return await snarkjs.groth16.verify(vkey, publicSignals, proof);
270
- }
271
- catch (error) {
272
- throw new CoreError("proof verification failed: " + error.message);
273
- }
274
- }
@@ -1,57 +0,0 @@
1
- // AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
2
- // Generated by scripts/generate-registry.ts
3
- // Source: circuits/circuits.json
4
- // Generated at: 2025-11-25T13:26:58.576Z
5
- /**
6
- * Registry of available circuits
7
- * Auto-generated from circuits/circuits.json
8
- */
9
- export const CIRCUIT_REGISTRY = {
10
- "3x3": {
11
- name: "joinsplit_3x3_16",
12
- inputs: 3,
13
- outputs: 3,
14
- depth: 16,
15
- },
16
- "2x3": {
17
- name: "joinsplit_2x3_16",
18
- inputs: 2,
19
- outputs: 3,
20
- depth: 16,
21
- },
22
- "1x2": {
23
- name: "joinsplit_1x2_16",
24
- inputs: 1,
25
- outputs: 2,
26
- depth: 16,
27
- },
28
- "1x1": {
29
- name: "joinsplit_1x1_16",
30
- inputs: 1,
31
- outputs: 1,
32
- depth: 16,
33
- },
34
- };
35
- /**
36
- * Get list of all supported circuit keys
37
- */
38
- export const SUPPORTED_CIRCUITS = Object.keys(CIRCUIT_REGISTRY);
39
- /**
40
- * Get circuit configuration by dimensions
41
- * @param inputs Number of inputs (nullifiers)
42
- * @param outputs Number of outputs (commitments)
43
- * @returns Circuit configuration or undefined if not supported
44
- */
45
- export function getCircuitConfig(inputs, outputs) {
46
- const key = `${inputs}x${outputs}`;
47
- return CIRCUIT_REGISTRY[key];
48
- }
49
- /**
50
- * Check if a circuit configuration is supported
51
- * @param inputs Number of inputs (nullifiers)
52
- * @param outputs Number of outputs (commitments)
53
- * @returns True if supported
54
- */
55
- export function isCircuitSupported(inputs, outputs) {
56
- return getCircuitConfig(inputs, outputs) !== undefined;
57
- }
package/dist/schema.js DELETED
@@ -1,14 +0,0 @@
1
- import { SchemaMismatchError } from "./errors.js";
2
- export const CORE_SCHEMA_VERSION = 1;
3
- export async function migrate(storage) {
4
- await storage.open();
5
- const current = await storage.getSchemaVersion();
6
- if (current === 0) {
7
- // seed structures if needed
8
- await storage.setSchemaVersion(CORE_SCHEMA_VERSION);
9
- return;
10
- }
11
- if (current !== CORE_SCHEMA_VERSION) {
12
- throw new SchemaMismatchError(current, CORE_SCHEMA_VERSION);
13
- }
14
- }
@@ -1,12 +0,0 @@
1
- import type { Storage } from "../types.js";
2
- export declare function createCiphertextStore(storage: Storage): {
3
- /**
4
- * Store encrypted note payloads alongside their on-chain commitments.
5
- */
6
- putCiphertext(chainId: number, index: number, payload: Uint8Array): Promise<void>;
7
- /**
8
- * Retrieve encrypted note payloads; returns null when the ciphertext is missing.
9
- */
10
- getCiphertext(chainId: number, index: number): Promise<Uint8Array<ArrayBuffer> | null>;
11
- };
12
- //# sourceMappingURL=ciphertext-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ciphertext-store.d.ts","sourceRoot":"","sources":["../../state/ciphertext-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO;IAElD;;OAEG;2BAC0B,MAAM,SAAS,MAAM,WAAW,UAAU;IAQvE;;OAEG;2BAC0B,MAAM,SAAS,MAAM;EAOrD"}
@@ -1,25 +0,0 @@
1
- import { keys, validateKey } from "../keys.js";
2
- import { ensureChainId, ensurePositiveInt } from "../utils/validators.js";
3
- export function createCiphertextStore(storage) {
4
- return {
5
- /**
6
- * Store encrypted note payloads alongside their on-chain commitments.
7
- */
8
- async putCiphertext(chainId, index, payload) {
9
- ensureChainId(chainId);
10
- ensurePositiveInt("ciphertext index", index);
11
- const key = keys.ciphertext(chainId, index);
12
- validateKey(key);
13
- await storage.put(key, new Uint8Array(payload));
14
- },
15
- /**
16
- * Retrieve encrypted note payloads; returns null when the ciphertext is missing.
17
- */
18
- async getCiphertext(chainId, index) {
19
- ensureChainId(chainId);
20
- ensurePositiveInt("ciphertext index", index);
21
- const data = await storage.get(keys.ciphertext(chainId, index));
22
- return data ? new Uint8Array(data) : null;
23
- },
24
- };
25
- }
@@ -1,16 +0,0 @@
1
- export type LeafLoader = (chainId: number, index: number) => Promise<{
2
- commitment: string;
3
- } | null>;
4
- export type HydrateChainParams = {
5
- chainId: number;
6
- trees: {
7
- reset(chainId: number): void;
8
- addLeaf(chainId: number, value: bigint): {
9
- index: number;
10
- };
11
- };
12
- loadLeaf: LeafLoader;
13
- hydrated: Set<number>;
14
- };
15
- export declare function hydrateChain({ chainId, trees, loadLeaf, hydrated, }: HydrateChainParams): Promise<void>;
16
- //# sourceMappingURL=hydrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hydrator.d.ts","sourceRoot":"","sources":["../../state/hydrator.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,CACvB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,KACV,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAAC;AAE5C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QACL,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5D,CAAC;IACF,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB,CAAC;AAEF,wBAAsB,YAAY,CAAC,EACjC,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,EAAE,kBAAkB,iBAcpB"}
@@ -1,18 +0,0 @@
1
- import { parseHexToBigInt } from "../utils/bigint.js";
2
- export async function hydrateChain({ chainId, trees, loadLeaf, hydrated, }) {
3
- if (hydrated.has(chainId))
4
- return;
5
- trees.reset(chainId);
6
- let idx = 0;
7
- for (;;) {
8
- const leaf = await loadLeaf(chainId, idx);
9
- if (!leaf)
10
- break;
11
- const { index } = trees.addLeaf(chainId, parseHexToBigInt(leaf.commitment));
12
- if (index !== idx) {
13
- throw new Error("stored leaves are inconsistent with local tree");
14
- }
15
- idx += 1;
16
- }
17
- hydrated.add(chainId);
18
- }
@@ -1,2 +0,0 @@
1
- export * from "./merkle/index.js";
2
- export * from "./store/index.js";
@@ -1,12 +0,0 @@
1
- import type { Storage } from "../types.js";
2
- import type { JobStatus, PendingJobKind, PendingJobRecord } from "./jobs.js";
3
- export declare function createJobStore(storage: Storage): {
4
- putPendingJob(job: PendingJobRecord): Promise<void>;
5
- getPendingJob(relayId: string): Promise<PendingJobRecord | null>;
6
- listPendingJobs(filter?: {
7
- kind?: PendingJobKind;
8
- statuses?: JobStatus[];
9
- }): Promise<PendingJobRecord[]>;
10
- deletePendingJob(relayId: string): Promise<void>;
11
- };
12
- //# sourceMappingURL=job-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"job-store.d.ts","sourceRoot":"","sources":["../../state/job-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACd,gBAAgB,EAGjB,MAAM,WAAW,CAAC;AA4GnB,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO;uBAElB,gBAAgB;2BASZ,MAAM;6BAKzB;QACN,IAAI,CAAC,EAAE,cAAc,CAAC;QACtB,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;KACxB;8BAe6B,MAAM;EAIzC"}
@@ -1,118 +0,0 @@
1
- import { keys } from "../keys.js";
2
- import { decodeJson, encodeJson, getJson } from "../utils/json-codec.js";
3
- import { ensureAddress, ensureChainId, ensurePositiveInt, } from "../utils/validators.js";
4
- import { DEFAULT_JOB_TIMEOUT_MS } from "./jobs.js";
5
- const VALID_STATUSES = [
6
- "pending",
7
- "submitted",
8
- "broadcasting",
9
- "succeeded",
10
- "failed",
11
- "dead",
12
- ];
13
- function assertStatus(status) {
14
- if (!VALID_STATUSES.includes(status)) {
15
- throw new Error(`invalid job status: ${status}`);
16
- }
17
- }
18
- function assertKind(kind) {
19
- if (kind !== "deposit" && kind !== "transact") {
20
- throw new Error(`invalid job kind: ${kind}`);
21
- }
22
- }
23
- function normalizeTimestamps(job) {
24
- const createdAt = typeof job.createdAt === "number" && Number.isFinite(job.createdAt)
25
- ? job.createdAt
26
- : Date.now();
27
- const timeoutMs = typeof job.timeoutMs === "number" && job.timeoutMs > 0
28
- ? job.timeoutMs
29
- : DEFAULT_JOB_TIMEOUT_MS;
30
- return {
31
- ...job,
32
- createdAt,
33
- timeoutMs,
34
- };
35
- }
36
- function validateTransactContext(context) {
37
- ensurePositiveInt("context index", context.index);
38
- if (!context.nullifier) {
39
- throw new Error("context nullifier is required");
40
- }
41
- const { witness } = context;
42
- if (!witness) {
43
- throw new Error("context witness is required");
44
- }
45
- ensurePositiveInt("witness leafIndex", witness.leafIndex);
46
- if (!Array.isArray(witness.pathElements) ||
47
- !Array.isArray(witness.pathIndices)) {
48
- throw new Error("witness pathElements and pathIndices are required");
49
- }
50
- }
51
- function validateTransactJob(job) {
52
- ensureAddress("pool address", job.poolAddress);
53
- if (!job.calldata) {
54
- throw new Error("calldata is required for transact job");
55
- }
56
- job.contexts.forEach(validateTransactContext);
57
- job.predictedOutputs.forEach((output) => {
58
- if (!output.hex) {
59
- throw new Error("predicted output hex is required");
60
- }
61
- ensurePositiveInt("predicted output index", output.index);
62
- });
63
- }
64
- function validateDepositJob(job) {
65
- if (!job.predictedCommitment?.hex) {
66
- throw new Error("predicted commitment hex is required");
67
- }
68
- if (job.predictedCommitment.index !== undefined) {
69
- ensurePositiveInt("predicted commitment index", job.predictedCommitment.index);
70
- }
71
- }
72
- function validateJob(job) {
73
- if (!job.relayId) {
74
- throw new Error("relayId is required");
75
- }
76
- ensureChainId(job.chainId);
77
- assertStatus(job.status);
78
- assertKind(job.kind);
79
- ensurePositiveInt("job createdAt", job.createdAt);
80
- ensurePositiveInt("job timeoutMs", job.timeoutMs);
81
- if (job.lastCheckedAt !== undefined) {
82
- ensurePositiveInt("job lastCheckedAt", job.lastCheckedAt);
83
- }
84
- if (job.kind === "deposit") {
85
- validateDepositJob(job);
86
- }
87
- else {
88
- validateTransactJob(job);
89
- }
90
- }
91
- function buildJobKey(relayId) {
92
- return keys.job(relayId);
93
- }
94
- export function createJobStore(storage) {
95
- return {
96
- async putPendingJob(job) {
97
- const normalized = normalizeTimestamps(job);
98
- validateJob(normalized);
99
- await storage.put(buildJobKey(normalized.relayId), encodeJson(normalized));
100
- },
101
- async getPendingJob(relayId) {
102
- return getJson(storage, buildJobKey(relayId));
103
- },
104
- async listPendingJobs(filter = {}) {
105
- const entries = await storage.iter({ prefix: "jobs:" });
106
- const statuses = filter.statuses ?? VALID_STATUSES;
107
- const filtered = entries
108
- .map(({ value }) => decodeJson(value))
109
- .filter((job) => (filter.kind === undefined || job.kind === filter.kind) &&
110
- statuses.includes(job.status));
111
- filtered.sort((a, b) => a.createdAt - b.createdAt);
112
- return filtered;
113
- },
114
- async deletePendingJob(relayId) {
115
- await storage.delete(buildJobKey(relayId));
116
- },
117
- };
118
- }
@@ -1,50 +0,0 @@
1
- export type JobStatus = "pending" | "submitted" | "broadcasting" | "succeeded" | "failed" | "dead";
2
- export type PendingJobKind = "deposit" | "transact";
3
- export type PendingJobBase = {
4
- relayId: string;
5
- kind: PendingJobKind;
6
- chainId: number;
7
- status: JobStatus;
8
- broadcasterRelayId?: string | null;
9
- txHash?: string | null;
10
- createdAt: number;
11
- lastCheckedAt?: number;
12
- timeoutMs: number;
13
- error?: string | null;
14
- };
15
- export type PendingDepositJob = PendingJobBase & {
16
- kind: "deposit";
17
- predictedCommitment: {
18
- hex: string;
19
- index?: number;
20
- root?: string;
21
- };
22
- };
23
- export type PendingTransactContext = {
24
- index: number;
25
- nullifier: string;
26
- witness: {
27
- root: string;
28
- leaf: string;
29
- pathElements: string[][];
30
- pathIndices: number[];
31
- leafIndex: number;
32
- };
33
- root: string;
34
- };
35
- export type PendingTransactOutput = {
36
- hex: string;
37
- index: number;
38
- root?: string;
39
- };
40
- export type PendingTransactJob = PendingJobBase & {
41
- kind: "transact";
42
- poolAddress: string;
43
- calldata: string;
44
- contexts: PendingTransactContext[];
45
- predictedOutputs: PendingTransactOutput[];
46
- expectedRoot?: string;
47
- };
48
- export type PendingJobRecord = PendingDepositJob | PendingTransactJob;
49
- export declare const DEFAULT_JOB_TIMEOUT_MS: number;
50
- //# sourceMappingURL=jobs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../state/jobs.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,WAAW,GACX,cAAc,GACd,WAAW,GACX,QAAQ,GACR,MAAM,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG;IAC/C,IAAI,EAAE,SAAS,CAAC;IAChB,mBAAmB,EAAE;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAElB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;QACzB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG;IAChD,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAEtE,eAAO,MAAM,sBAAsB,QAAgB,CAAC"}
@@ -1 +0,0 @@
1
- export const DEFAULT_JOB_TIMEOUT_MS = 5 * 60 * 1000;
@@ -1,17 +0,0 @@
1
- import type { Storage } from "../types.js";
2
- import type { LeafRecord } from "./records.js";
3
- export declare function createLeafStore(storage: Storage): {
4
- /**
5
- * Cache public leaf data pulled from the on-chain Merkle tree.
6
- */
7
- putLeaf(leaf: LeafRecord): Promise<void>;
8
- /**
9
- * Load a leaf commitment by tree index.
10
- */
11
- getLeaf(chainId: number, index: number): Promise<LeafRecord | null>;
12
- /**
13
- * Remove all cached leaves for a chain.
14
- */
15
- clearLeaves(chainId: number): Promise<void>;
16
- };
17
- //# sourceMappingURL=leaf-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leaf-store.d.ts","sourceRoot":"","sources":["../../state/leaf-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IAE5C;;OAEG;kBACiB,UAAU;IAM9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;IAM5C;;OAEG;yBACwB,MAAM;EASpC"}