@permissionless-technologies/upp-sdk 0.4.13 → 0.4.15

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 (53) hide show
  1. package/dist/{chunk-O6ALW7DB.js → chunk-5WLAZA3M.js} +3 -3
  2. package/dist/{chunk-O6ALW7DB.js.map → chunk-5WLAZA3M.js.map} +1 -1
  3. package/dist/{chunk-4MWEJDTR.cjs → chunk-7Y6O4P2P.cjs} +3 -3
  4. package/dist/{chunk-4MWEJDTR.cjs.map → chunk-7Y6O4P2P.cjs.map} +1 -1
  5. package/dist/{chunk-KZ7PY2PR.cjs → chunk-CTBLNYYB.cjs} +2 -2
  6. package/dist/{chunk-KZ7PY2PR.cjs.map → chunk-CTBLNYYB.cjs.map} +1 -1
  7. package/dist/{chunk-23B5XSS4.cjs → chunk-CZLMCMYE.cjs} +90 -2
  8. package/dist/chunk-CZLMCMYE.cjs.map +1 -0
  9. package/dist/{chunk-3I6ERQO3.js → chunk-GQ6JMNJI.js} +3 -3
  10. package/dist/{chunk-3I6ERQO3.js.map → chunk-GQ6JMNJI.js.map} +1 -1
  11. package/dist/{chunk-RNUG3EFC.js → chunk-NIGEAKQP.js} +89 -3
  12. package/dist/chunk-NIGEAKQP.js.map +1 -0
  13. package/dist/{chunk-5BLMSTFQ.cjs → chunk-TBGDQM33.cjs} +4 -4
  14. package/dist/{chunk-5BLMSTFQ.cjs.map → chunk-TBGDQM33.cjs.map} +1 -1
  15. package/dist/{chunk-DUBWGEB5.js → chunk-YMZM2ABJ.js} +2 -2
  16. package/dist/{chunk-DUBWGEB5.js.map → chunk-YMZM2ABJ.js.map} +1 -1
  17. package/dist/core/index.cjs +100 -92
  18. package/dist/core/index.d.cts +2 -2
  19. package/dist/core/index.d.ts +2 -2
  20. package/dist/core/index.js +4 -4
  21. package/dist/core/proof-worker-entry.cjs +60 -0
  22. package/dist/core/proof-worker-entry.cjs.map +1 -0
  23. package/dist/core/proof-worker-entry.d.cts +2 -0
  24. package/dist/core/proof-worker-entry.d.ts +2 -0
  25. package/dist/core/proof-worker-entry.js +58 -0
  26. package/dist/core/proof-worker-entry.js.map +1 -0
  27. package/dist/{index-CKCDqv2e.d.cts → index-DKFupAA8.d.cts} +8 -3
  28. package/dist/{index-DLczKlnM.d.ts → index-M91G-og3.d.ts} +8 -3
  29. package/dist/{index--eNkOLiP.d.ts → index-S2fzWmLW.d.ts} +1 -1
  30. package/dist/{index-CRaFsQD3.d.cts → index-qTwnREeK.d.cts} +1 -1
  31. package/dist/index.cjs +108 -100
  32. package/dist/index.d.cts +3 -3
  33. package/dist/index.d.ts +3 -3
  34. package/dist/index.js +5 -5
  35. package/dist/indexer/index.cjs +6 -6
  36. package/dist/indexer/index.d.cts +5 -5
  37. package/dist/indexer/index.d.ts +5 -5
  38. package/dist/indexer/index.js +1 -1
  39. package/dist/react/index.cjs +94 -31
  40. package/dist/react/index.cjs.map +1 -1
  41. package/dist/react/index.d.cts +26 -3
  42. package/dist/react/index.d.ts +26 -3
  43. package/dist/react/index.js +77 -22
  44. package/dist/react/index.js.map +1 -1
  45. package/dist/{transfer-CwwsNdGL.d.cts → transfer-BDYID3Hn.d.cts} +75 -1
  46. package/dist/{transfer-Crvdq4VN.d.ts → transfer-DLukr6ed.d.ts} +75 -1
  47. package/dist/{transfer-LGR44CER.js → transfer-LT2VGGPZ.js} +4 -4
  48. package/dist/{transfer-LGR44CER.js.map → transfer-LT2VGGPZ.js.map} +1 -1
  49. package/dist/{transfer-UZBU47HC.cjs → transfer-OPGKWWX2.cjs} +10 -10
  50. package/dist/{transfer-UZBU47HC.cjs.map → transfer-OPGKWWX2.cjs.map} +1 -1
  51. package/package.json +5 -1
  52. package/dist/chunk-23B5XSS4.cjs.map +0 -1
  53. package/dist/chunk-RNUG3EFC.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk23B5XSS4_cjs = require('../chunk-23B5XSS4.cjs');
3
+ var chunkCZLMCMYE_cjs = require('../chunk-CZLMCMYE.cjs');
4
4
  var chunkXVIICZKW_cjs = require('../chunk-XVIICZKW.cjs');
5
5
  var chunkERQE57IA_cjs = require('../chunk-ERQE57IA.cjs');
6
6
  require('../chunk-UFEDJJSH.cjs');
@@ -107,7 +107,7 @@ function UPPAccountProvider({
107
107
  return;
108
108
  }
109
109
  const accountStorage = chunkERQE57IA_cjs.createAutoAdapter(`upp_account`);
110
- const adapter = new chunk23B5XSS4_cjs.StorableAccountAdapter(accountStorage, ethAddress);
110
+ const adapter = new chunkCZLMCMYE_cjs.StorableAccountAdapter(accountStorage, ethAddress);
111
111
  accountAdapterRef.current = adapter;
112
112
  const legacyKey = getStorageKey(ethAddress);
113
113
  const legacySaved = typeof window !== "undefined" ? localStorage.getItem(legacyKey) : null;
@@ -148,7 +148,7 @@ function UPPAccountProvider({
148
148
  const ownerHashHex2 = viem.toHex(account.keys.ownerHash, { size: 32 });
149
149
  const storagePrefix = `upp_${chainId}_${ownerHashHex2.slice(0, 12)}`;
150
150
  const noteStorage = chunkERQE57IA_cjs.createAutoAdapter(storagePrefix);
151
- const store = new chunk23B5XSS4_cjs.NoteStore(noteStorage, "notes");
151
+ const store = new chunkCZLMCMYE_cjs.NoteStore(noteStorage, "notes");
152
152
  noteStoreRef.current = store;
153
153
  noteStoreUnsub = store.onChange(() => {
154
154
  if (!cancelled) setNotes([...store.getNotes()]);
@@ -849,7 +849,7 @@ function UPPAccountProvider({
849
849
  const stealthAddress = react.useMemo(() => {
850
850
  if (!masterKeys) return null;
851
851
  try {
852
- const { encodeStealthAddress } = (chunk23B5XSS4_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunk23B5XSS4_cjs.stealth_exports));
852
+ const { encodeStealthAddress } = (chunkCZLMCMYE_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkCZLMCMYE_cjs.stealth_exports));
853
853
  return encodeStealthAddress(masterKeys.ownerHash, masterKeys.viewingHash);
854
854
  } catch {
855
855
  return null;
@@ -858,7 +858,7 @@ function UPPAccountProvider({
858
858
  const starkStealthAddress = react.useMemo(() => {
859
859
  if (!starkMasterKeys) return null;
860
860
  try {
861
- const { encodeStarkStealthAddress } = (chunk23B5XSS4_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunk23B5XSS4_cjs.stealth_exports));
861
+ const { encodeStarkStealthAddress } = (chunkCZLMCMYE_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkCZLMCMYE_cjs.stealth_exports));
862
862
  return encodeStarkStealthAddress(starkMasterKeys.starkOwnerHash, starkMasterKeys.starkViewingHash);
863
863
  } catch {
864
864
  return null;
@@ -1663,6 +1663,7 @@ function usePoolTransfer(config) {
1663
1663
  } = useUPPAccount();
1664
1664
  const [isPending, setIsPending] = react.useState(false);
1665
1665
  const [stage, setStage] = react.useState(null);
1666
+ const [provingProgress, setProvingProgress] = react.useState(null);
1666
1667
  const [error, setError] = react.useState(null);
1667
1668
  const configRef = react.useRef(config);
1668
1669
  configRef.current = config;
@@ -1705,7 +1706,7 @@ function usePoolTransfer(config) {
1705
1706
  const recipientNote = await createNoteForSelf(amount, origin, token);
1706
1707
  const changeNote = await createNoteForSelf(changeAmount, origin, token);
1707
1708
  const [transferModule, proofModule, aspModule] = await Promise.all([
1708
- import('../transfer-UZBU47HC.cjs'),
1709
+ import('../transfer-OPGKWWX2.cjs'),
1709
1710
  import('../proof-VINVGL4F.cjs'),
1710
1711
  import('../asp-CUE3NMBN.cjs')
1711
1712
  ]);
@@ -1714,7 +1715,7 @@ function usePoolTransfer(config) {
1714
1715
  getMerkleProofsForNotes,
1715
1716
  buildUPPTransferCircuitInputs
1716
1717
  } = transferModule;
1717
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
1718
+ const { formatPlonkProofForContract } = proofModule;
1718
1719
  const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
1719
1720
  setStage("syncing_merkle");
1720
1721
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
@@ -1743,10 +1744,15 @@ function usePoolTransfer(config) {
1743
1744
  recipientNoteWithAmount,
1744
1745
  changeNoteWithAmount
1745
1746
  );
1746
- const { proof } = await generateUPPProof(
1747
+ setProvingProgress(null);
1748
+ const { proof } = await chunkCZLMCMYE_cjs.generateUPPProofAsync(
1747
1749
  "transfer",
1748
1750
  circuitInputs,
1749
- cfg.circuitBaseUrl ?? "/circuits/"
1751
+ cfg.circuitBaseUrl ?? "/circuits/",
1752
+ {
1753
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
1754
+ worker: cfg.proofWorker
1755
+ }
1750
1756
  );
1751
1757
  const formattedProof = await formatPlonkProofForContract(proof);
1752
1758
  return {
@@ -1771,6 +1777,7 @@ function usePoolTransfer(config) {
1771
1777
  } finally {
1772
1778
  setIsPending(false);
1773
1779
  setStage(null);
1780
+ setProvingProgress(null);
1774
1781
  }
1775
1782
  },
1776
1783
  [isSetup, masterKeys, unspentNotes, createNoteForSelf]
@@ -1779,6 +1786,7 @@ function usePoolTransfer(config) {
1779
1786
  build,
1780
1787
  isPending,
1781
1788
  stage,
1789
+ provingProgress,
1782
1790
  error,
1783
1791
  reset
1784
1792
  };
@@ -1800,6 +1808,7 @@ function useWithdraw(config) {
1800
1808
  } = useUPPAccount();
1801
1809
  const [isPending, setIsPending] = react.useState(false);
1802
1810
  const [stage, setStage] = react.useState(null);
1811
+ const [provingProgress, setProvingProgress] = react.useState(null);
1803
1812
  const [error, setError] = react.useState(null);
1804
1813
  const configRef = react.useRef(config);
1805
1814
  configRef.current = config;
@@ -1854,12 +1863,12 @@ function useWithdraw(config) {
1854
1863
  const token = BigInt(selectedNote.token);
1855
1864
  setStage("creating_outputs");
1856
1865
  const [transferModule, proofModule, sdk] = await Promise.all([
1857
- import('../transfer-UZBU47HC.cjs'),
1866
+ import('../transfer-OPGKWWX2.cjs'),
1858
1867
  import('../proof-VINVGL4F.cjs'),
1859
1868
  import('../index.cjs')
1860
1869
  ]);
1861
1870
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
1862
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
1871
+ const { formatPlonkProofForContract } = proofModule;
1863
1872
  setStage("syncing_merkle");
1864
1873
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
1865
1874
  const spendableNote = {
@@ -1918,10 +1927,15 @@ function useWithdraw(config) {
1918
1927
  aspPathElements: Array(ASP_TREE_DEPTH2).fill("0"),
1919
1928
  aspPathIndices: Array(ASP_TREE_DEPTH2).fill("0")
1920
1929
  };
1921
- const { proof } = await generateUPPProof(
1930
+ setProvingProgress(null);
1931
+ const { proof } = await chunkCZLMCMYE_cjs.generateUPPProofAsync(
1922
1932
  "withdraw",
1923
1933
  circuitInputs,
1924
- cfg.circuitBaseUrl ?? "/circuits/"
1934
+ cfg.circuitBaseUrl ?? "/circuits/",
1935
+ {
1936
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
1937
+ worker: cfg.proofWorker
1938
+ }
1925
1939
  );
1926
1940
  const formattedProof = await formatPlonkProofForContract(proof);
1927
1941
  const stateRoot = stateRootBI;
@@ -1947,6 +1961,7 @@ function useWithdraw(config) {
1947
1961
  } finally {
1948
1962
  setIsPending(false);
1949
1963
  setStage(null);
1964
+ setProvingProgress(null);
1950
1965
  }
1951
1966
  },
1952
1967
  [isSetup, masterKeys, unspentNotes]
@@ -1955,6 +1970,7 @@ function useWithdraw(config) {
1955
1970
  build,
1956
1971
  isPending,
1957
1972
  stage,
1973
+ provingProgress,
1958
1974
  error,
1959
1975
  reset
1960
1976
  };
@@ -2107,7 +2123,7 @@ function useSwapOrderBook(config) {
2107
2123
  try {
2108
2124
  const logs = await config.publicClient.getLogs({
2109
2125
  address: config.poolAddress,
2110
- event: chunk23B5XSS4_cjs.SWAP_ORDER_PLACED_EVENT,
2126
+ event: chunkCZLMCMYE_cjs.SWAP_ORDER_PLACED_EVENT,
2111
2127
  fromBlock: config.fromBlock ?? 0n,
2112
2128
  toBlock: "latest"
2113
2129
  });
@@ -2123,10 +2139,10 @@ function useSwapOrderBook(config) {
2123
2139
  blockNumber: log.blockNumber ?? 0n
2124
2140
  }));
2125
2141
  if (config.sellToken && config.buyToken) {
2126
- parsedOrders = chunk23B5XSS4_cjs.filterOrdersByTokenPair(parsedOrders, config.sellToken, config.buyToken);
2142
+ parsedOrders = chunkCZLMCMYE_cjs.filterOrdersByTokenPair(parsedOrders, config.sellToken, config.buyToken);
2127
2143
  }
2128
2144
  if (config.acceptableAspIds && config.acceptableAspIds.length > 0) {
2129
- parsedOrders = chunk23B5XSS4_cjs.filterOrdersByASP(parsedOrders, config.acceptableAspIds);
2145
+ parsedOrders = chunkCZLMCMYE_cjs.filterOrdersByASP(parsedOrders, config.acceptableAspIds);
2130
2146
  }
2131
2147
  const enriched = [];
2132
2148
  for (const order of parsedOrders) {
@@ -2177,6 +2193,7 @@ function useSwap(config) {
2177
2193
  } = useUPPAccount();
2178
2194
  const [isPending, setIsPending] = react.useState(false);
2179
2195
  const [stage, setStage] = react.useState(null);
2196
+ const [provingProgress, setProvingProgress] = react.useState(null);
2180
2197
  const [error, setError] = react.useState(null);
2181
2198
  const configRef = react.useRef(config);
2182
2199
  configRef.current = config;
@@ -2223,13 +2240,13 @@ function useSwap(config) {
2223
2240
  }
2224
2241
  setStage("creating_outputs");
2225
2242
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2226
- import('../transfer-UZBU47HC.cjs'),
2243
+ import('../transfer-OPGKWWX2.cjs'),
2227
2244
  import('../proof-VINVGL4F.cjs'),
2228
2245
  import('../index.cjs'),
2229
2246
  import('../asp-CUE3NMBN.cjs')
2230
2247
  ]);
2231
2248
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
2232
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
2249
+ const { formatPlonkProofForContract } = proofModule;
2233
2250
  const { generateASPProof: generateASPProof2 } = aspModule;
2234
2251
  setStage("syncing_merkle");
2235
2252
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
@@ -2288,14 +2305,19 @@ function useSwap(config) {
2288
2305
  aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
2289
2306
  aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
2290
2307
  };
2291
- const { proof } = await generateUPPProof(
2308
+ setProvingProgress(null);
2309
+ const { proof } = await chunkCZLMCMYE_cjs.generateUPPProofAsync(
2292
2310
  "withdraw",
2293
2311
  circuitInputs,
2294
- cfg.circuitBaseUrl ?? "/circuits/"
2312
+ cfg.circuitBaseUrl ?? "/circuits/",
2313
+ {
2314
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
2315
+ worker: cfg.proofWorker
2316
+ }
2295
2317
  );
2296
2318
  const formattedProof = await formatPlonkProofForContract(proof);
2297
- const cancelSecret = chunk23B5XSS4_cjs.generateCancelSecret();
2298
- const cancelKeyHash = chunk23B5XSS4_cjs.computeCancelKeyHash(cancelSecret);
2319
+ const cancelSecret = chunkCZLMCMYE_cjs.generateCancelSecret();
2320
+ const cancelKeyHash = chunkCZLMCMYE_cjs.computeCancelKeyHash(cancelSecret);
2299
2321
  const currentBlock = await cfg.publicClient.getBlockNumber();
2300
2322
  const expiry = currentBlock + expiryBlocks;
2301
2323
  return {
@@ -2321,6 +2343,7 @@ function useSwap(config) {
2321
2343
  } finally {
2322
2344
  setIsPending(false);
2323
2345
  setStage(null);
2346
+ setProvingProgress(null);
2324
2347
  }
2325
2348
  },
2326
2349
  [isSetup, masterKeys, unspentNotes]
@@ -2343,7 +2366,7 @@ function useSwap(config) {
2343
2366
  noteOverride
2344
2367
  } = params;
2345
2368
  const cfg = configRef.current;
2346
- const giveAmount = chunk23B5XSS4_cjs.computeGiveAmount(takeAmount, rate);
2369
+ const giveAmount = chunkCZLMCMYE_cjs.computeGiveAmount(takeAmount, rate);
2347
2370
  setStage("selecting_notes");
2348
2371
  let selectedNote;
2349
2372
  if (noteOverride) {
@@ -2364,13 +2387,13 @@ function useSwap(config) {
2364
2387
  }
2365
2388
  setStage("creating_outputs");
2366
2389
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2367
- import('../transfer-UZBU47HC.cjs'),
2390
+ import('../transfer-OPGKWWX2.cjs'),
2368
2391
  import('../proof-VINVGL4F.cjs'),
2369
2392
  import('../index.cjs'),
2370
2393
  import('../asp-CUE3NMBN.cjs')
2371
2394
  ]);
2372
2395
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
2373
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
2396
+ const { formatPlonkProofForContract } = proofModule;
2374
2397
  const { generateASPProof: generateASPProof2 } = aspModule;
2375
2398
  const fillerOrigin = ethAddress ? BigInt(ethAddress) : BigInt(masterKeys.ownerHash);
2376
2399
  const fillerNoteData = await createNoteForSelf(
@@ -2435,10 +2458,15 @@ function useSwap(config) {
2435
2458
  aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
2436
2459
  aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
2437
2460
  };
2438
- const { proof } = await generateUPPProof(
2461
+ setProvingProgress(null);
2462
+ const { proof } = await chunkCZLMCMYE_cjs.generateUPPProofAsync(
2439
2463
  "withdraw",
2440
2464
  circuitInputs,
2441
- cfg.circuitBaseUrl ?? "/circuits/"
2465
+ cfg.circuitBaseUrl ?? "/circuits/",
2466
+ {
2467
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
2468
+ worker: cfg.proofWorker
2469
+ }
2442
2470
  );
2443
2471
  const formattedProof = await formatPlonkProofForContract(proof);
2444
2472
  const { encodePacked: encodePacked3 } = await import('viem');
@@ -2466,6 +2494,7 @@ function useSwap(config) {
2466
2494
  } finally {
2467
2495
  setIsPending(false);
2468
2496
  setStage(null);
2497
+ setProvingProgress(null);
2469
2498
  }
2470
2499
  },
2471
2500
  [isSetup, masterKeys, unspentNotes, createNoteForSelf]
@@ -2521,6 +2550,7 @@ function useSwap(config) {
2521
2550
  } finally {
2522
2551
  setIsPending(false);
2523
2552
  setStage(null);
2553
+ setProvingProgress(null);
2524
2554
  }
2525
2555
  },
2526
2556
  [isSetup, masterKeys, createNoteForSelf]
@@ -2554,6 +2584,7 @@ function useSwap(config) {
2554
2584
  } finally {
2555
2585
  setIsPending(false);
2556
2586
  setStage(null);
2587
+ setProvingProgress(null);
2557
2588
  }
2558
2589
  },
2559
2590
  [isSetup, masterKeys, createNoteForSelf]
@@ -2583,12 +2614,12 @@ function useSwap(config) {
2583
2614
  createNoteForSelf(changeAmount, origin, token)
2584
2615
  ]);
2585
2616
  const [transferModule, proofModule, aspModule] = await Promise.all([
2586
- import('../transfer-UZBU47HC.cjs'),
2617
+ import('../transfer-OPGKWWX2.cjs'),
2587
2618
  import('../proof-VINVGL4F.cjs'),
2588
2619
  import('../asp-CUE3NMBN.cjs')
2589
2620
  ]);
2590
2621
  const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
2591
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
2622
+ const { formatPlonkProofForContract } = proofModule;
2592
2623
  const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
2593
2624
  setStage("syncing_merkle");
2594
2625
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
@@ -2613,10 +2644,15 @@ function useSwap(config) {
2613
2644
  exactNoteWithAmount,
2614
2645
  changeNoteWithAmount
2615
2646
  );
2616
- const { proof } = await generateUPPProof(
2647
+ setProvingProgress(null);
2648
+ const { proof } = await chunkCZLMCMYE_cjs.generateUPPProofAsync(
2617
2649
  "transfer",
2618
2650
  circuitInputs,
2619
- cfg.circuitBaseUrl ?? "/circuits/"
2651
+ cfg.circuitBaseUrl ?? "/circuits/",
2652
+ {
2653
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
2654
+ worker: cfg.proofWorker
2655
+ }
2620
2656
  );
2621
2657
  const formattedProof = await formatPlonkProofForContract(proof);
2622
2658
  const { encodePacked: encodePacked3 } = await import('viem');
@@ -2674,12 +2710,14 @@ function useSwap(config) {
2674
2710
  } finally {
2675
2711
  setIsPending(false);
2676
2712
  setStage(null);
2713
+ setProvingProgress(null);
2677
2714
  }
2678
2715
  },
2679
2716
  [isSetup, masterKeys, createNoteForSelf]
2680
2717
  );
2681
2718
  return {
2682
2719
  stage,
2720
+ provingProgress,
2683
2721
  isPending,
2684
2722
  error,
2685
2723
  buildNoteSplit,
@@ -2690,7 +2728,31 @@ function useSwap(config) {
2690
2728
  reset
2691
2729
  };
2692
2730
  }
2731
+ function useProofWorker(worker) {
2732
+ const managerRef = react.useRef(null);
2733
+ react.useEffect(() => {
2734
+ if (!worker) {
2735
+ managerRef.current = null;
2736
+ return;
2737
+ }
2738
+ const manager = new chunkCZLMCMYE_cjs.ProofWorkerManager(worker);
2739
+ managerRef.current = manager;
2740
+ return () => {
2741
+ manager.terminate();
2742
+ managerRef.current = null;
2743
+ };
2744
+ }, [worker]);
2745
+ return managerRef.current;
2746
+ }
2693
2747
 
2748
+ Object.defineProperty(exports, "ProofWorkerManager", {
2749
+ enumerable: true,
2750
+ get: function () { return chunkCZLMCMYE_cjs.ProofWorkerManager; }
2751
+ });
2752
+ Object.defineProperty(exports, "generateUPPProofAsync", {
2753
+ enumerable: true,
2754
+ get: function () { return chunkCZLMCMYE_cjs.generateUPPProofAsync; }
2755
+ });
2694
2756
  Object.defineProperty(exports, "ASP_TREE_DEPTH", {
2695
2757
  enumerable: true,
2696
2758
  get: function () { return chunkXVIICZKW_cjs.ASP_TREE_DEPTH; }
@@ -2728,6 +2790,7 @@ exports.renderAvatarSVG = renderAvatarSVG;
2728
2790
  exports.storePersonalASPId = storePersonalASPId;
2729
2791
  exports.usePersonalASP = usePersonalASP;
2730
2792
  exports.usePoolTransfer = usePoolTransfer;
2793
+ exports.useProofWorker = useProofWorker;
2731
2794
  exports.useShield = useShield;
2732
2795
  exports.useSwap = useSwap;
2733
2796
  exports.useSwapOrderBook = useSwapOrderBook;