@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,5 +1,5 @@
1
- import { ax as NoteCreationResult, ay as PlonkProofStruct, az as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-CwwsNdGL.cjs';
2
- export { A as ASPProof, aG as ASP_TREE_DEPTH, aE as IndexerConfig, aD as ProofSystemType, aF as SignTypedDataFn, aC as UPPAccountContextType, aB as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, aA as useUPPAccount } from '../transfer-CwwsNdGL.cjs';
1
+ import { aC as NoteCreationResult, m as ProofWorkerManager, aD as PlonkProofStruct, aE as ShieldedNote, W as TransferStage, P as PlonkProvingStage, O as SwapOrderEvent } from '../transfer-BDYID3Hn.cjs';
2
+ export { A as ASPProof, aL as ASP_TREE_DEPTH, aJ as IndexerConfig, aI as ProofSystemType, aK as SignTypedDataFn, aH as UPPAccountContextType, aG as UPPAccountProvider, a0 as buildASPTree, a6 as computeMultiOriginASPRoot, a9 as computeSingleOriginASPRoot, ai as generateASPProof, ak as generateMultiOriginASPProof, am as generateSingleOriginASPProof, ap as generateUPPProofAsync, aF as useUPPAccount } from '../transfer-BDYID3Hn.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { CSSProperties } from 'react';
@@ -237,6 +237,8 @@ interface PoolTransferConfig {
237
237
  aspId?: bigint;
238
238
  /** All approved origins in the ASP tree (enables multi-origin proofs) */
239
239
  aspApprovedOrigins?: bigint[];
240
+ /** Optional proof worker for off-main-thread proving */
241
+ proofWorker?: ProofWorkerManager | null;
240
242
  }
241
243
  /**
242
244
  * Pool transfer parameters
@@ -290,6 +292,11 @@ interface UsePoolTransferReturn {
290
292
  isPending: boolean;
291
293
  /** Current stage for UI feedback */
292
294
  stage: TransferStage | null;
295
+ /** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
296
+ provingProgress: {
297
+ stage: PlonkProvingStage;
298
+ message: string;
299
+ } | null;
293
300
  /** Error from last attempt */
294
301
  error: Error | null;
295
302
  /** Reset error state */
@@ -316,6 +323,8 @@ interface WithdrawConfig {
316
323
  publicClient: PublicClient;
317
324
  /** Circuit artifacts base URL (default: '/circuits/') */
318
325
  circuitBaseUrl?: string;
326
+ /** Optional proof worker for off-main-thread proving */
327
+ proofWorker?: ProofWorkerManager | null;
319
328
  }
320
329
  /**
321
330
  * Withdraw parameters
@@ -376,6 +385,11 @@ interface UseWithdrawReturn {
376
385
  isPending: boolean;
377
386
  /** Current stage for UI feedback */
378
387
  stage: TransferStage | null;
388
+ /** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
389
+ provingProgress: {
390
+ stage: PlonkProvingStage;
391
+ message: string;
392
+ } | null;
379
393
  /** Error from last attempt */
380
394
  error: Error | null;
381
395
  /** Reset error state */
@@ -540,6 +554,8 @@ interface SwapConfig {
540
554
  circuitBaseUrl?: string;
541
555
  /** All approved origins in the ASP tree (enables multi-origin proofs) */
542
556
  aspApprovedOrigins?: bigint[];
557
+ /** Optional proof worker for off-main-thread proving */
558
+ proofWorker?: ProofWorkerManager | null;
543
559
  }
544
560
  /**
545
561
  * Build data returned by buildPlaceOrder — everything needed for the contract call
@@ -689,6 +705,11 @@ interface SplitNoteBuildData {
689
705
  interface UseSwapReturn {
690
706
  /** Current operation stage */
691
707
  stage: TransferStage | null;
708
+ /** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
709
+ provingProgress: {
710
+ stage: PlonkProvingStage;
711
+ message: string;
712
+ } | null;
692
713
  /** Whether building is in progress */
693
714
  isPending: boolean;
694
715
  /** Error from last attempt */
@@ -781,4 +802,6 @@ declare function useSwapOrderBook(config: SwapOrderBookConfig): UseSwapOrderBook
781
802
  */
782
803
  declare function useSwap(config: SwapConfig): UseSwapReturn;
783
804
 
784
- export { type AvatarData, type AvatarShape, type CancelOrderBuildData, type CancelOrderParams, type ClaimOrderBuildData, type ClaimOrderParams, type FillOrderBuildData, type FillOrderParams, NoteCreationResult, type PersonalASPConfig, type PersonalASPInfo, type PlaceOrderBuildData, type PlaceOrderParams, type PoolTransferBuildData, type PoolTransferConfig, type PoolTransferParams, type ShieldBuildData, type ShieldConfig, type ShieldParams, ShieldedNote, type SplitNoteBuildData, type SplitNoteParams, type SwapConfig, type SwapOrderBookConfig, type SwapStage, TransferStage, UPPAvatar, type UPPAvatarProps, UPPModal, type UPPModalProps, UPPPrivateButton, type UPPPrivateButtonProps, type UsePersonalASPReturn, type UsePoolTransferReturn, type UseShieldReturn, type UseSwapOrderBookReturn, type UseSwapReturn, type UseWithdrawReturn, type WithdrawBuildData, type WithdrawConfig, type WithdrawParams, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, useShield, useSwap, useSwapOrderBook, useUPPCrypto, useWithdraw };
805
+ declare function useProofWorker(worker: Worker | null | undefined): ProofWorkerManager | null;
806
+
807
+ export { type AvatarData, type AvatarShape, type CancelOrderBuildData, type CancelOrderParams, type ClaimOrderBuildData, type ClaimOrderParams, type FillOrderBuildData, type FillOrderParams, NoteCreationResult, type PersonalASPConfig, type PersonalASPInfo, type PlaceOrderBuildData, type PlaceOrderParams, PlonkProvingStage, type PoolTransferBuildData, type PoolTransferConfig, type PoolTransferParams, ProofWorkerManager, type ShieldBuildData, type ShieldConfig, type ShieldParams, ShieldedNote, type SplitNoteBuildData, type SplitNoteParams, type SwapConfig, type SwapOrderBookConfig, type SwapStage, TransferStage, UPPAvatar, type UPPAvatarProps, UPPModal, type UPPModalProps, UPPPrivateButton, type UPPPrivateButtonProps, type UsePersonalASPReturn, type UsePoolTransferReturn, type UseShieldReturn, type UseSwapOrderBookReturn, type UseSwapReturn, type UseWithdrawReturn, type WithdrawBuildData, type WithdrawConfig, type WithdrawParams, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, useProofWorker, useShield, useSwap, useSwapOrderBook, useUPPCrypto, useWithdraw };
@@ -1,5 +1,5 @@
1
- import { ax as NoteCreationResult, ay as PlonkProofStruct, az as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-Crvdq4VN.js';
2
- export { A as ASPProof, aG as ASP_TREE_DEPTH, aE as IndexerConfig, aD as ProofSystemType, aF as SignTypedDataFn, aC as UPPAccountContextType, aB as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, aA as useUPPAccount } from '../transfer-Crvdq4VN.js';
1
+ import { aC as NoteCreationResult, m as ProofWorkerManager, aD as PlonkProofStruct, aE as ShieldedNote, W as TransferStage, P as PlonkProvingStage, O as SwapOrderEvent } from '../transfer-DLukr6ed.js';
2
+ export { A as ASPProof, aL as ASP_TREE_DEPTH, aJ as IndexerConfig, aI as ProofSystemType, aK as SignTypedDataFn, aH as UPPAccountContextType, aG as UPPAccountProvider, a0 as buildASPTree, a6 as computeMultiOriginASPRoot, a9 as computeSingleOriginASPRoot, ai as generateASPProof, ak as generateMultiOriginASPProof, am as generateSingleOriginASPProof, ap as generateUPPProofAsync, aF as useUPPAccount } from '../transfer-DLukr6ed.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { CSSProperties } from 'react';
@@ -237,6 +237,8 @@ interface PoolTransferConfig {
237
237
  aspId?: bigint;
238
238
  /** All approved origins in the ASP tree (enables multi-origin proofs) */
239
239
  aspApprovedOrigins?: bigint[];
240
+ /** Optional proof worker for off-main-thread proving */
241
+ proofWorker?: ProofWorkerManager | null;
240
242
  }
241
243
  /**
242
244
  * Pool transfer parameters
@@ -290,6 +292,11 @@ interface UsePoolTransferReturn {
290
292
  isPending: boolean;
291
293
  /** Current stage for UI feedback */
292
294
  stage: TransferStage | null;
295
+ /** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
296
+ provingProgress: {
297
+ stage: PlonkProvingStage;
298
+ message: string;
299
+ } | null;
293
300
  /** Error from last attempt */
294
301
  error: Error | null;
295
302
  /** Reset error state */
@@ -316,6 +323,8 @@ interface WithdrawConfig {
316
323
  publicClient: PublicClient;
317
324
  /** Circuit artifacts base URL (default: '/circuits/') */
318
325
  circuitBaseUrl?: string;
326
+ /** Optional proof worker for off-main-thread proving */
327
+ proofWorker?: ProofWorkerManager | null;
319
328
  }
320
329
  /**
321
330
  * Withdraw parameters
@@ -376,6 +385,11 @@ interface UseWithdrawReturn {
376
385
  isPending: boolean;
377
386
  /** Current stage for UI feedback */
378
387
  stage: TransferStage | null;
388
+ /** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
389
+ provingProgress: {
390
+ stage: PlonkProvingStage;
391
+ message: string;
392
+ } | null;
379
393
  /** Error from last attempt */
380
394
  error: Error | null;
381
395
  /** Reset error state */
@@ -540,6 +554,8 @@ interface SwapConfig {
540
554
  circuitBaseUrl?: string;
541
555
  /** All approved origins in the ASP tree (enables multi-origin proofs) */
542
556
  aspApprovedOrigins?: bigint[];
557
+ /** Optional proof worker for off-main-thread proving */
558
+ proofWorker?: ProofWorkerManager | null;
543
559
  }
544
560
  /**
545
561
  * Build data returned by buildPlaceOrder — everything needed for the contract call
@@ -689,6 +705,11 @@ interface SplitNoteBuildData {
689
705
  interface UseSwapReturn {
690
706
  /** Current operation stage */
691
707
  stage: TransferStage | null;
708
+ /** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
709
+ provingProgress: {
710
+ stage: PlonkProvingStage;
711
+ message: string;
712
+ } | null;
692
713
  /** Whether building is in progress */
693
714
  isPending: boolean;
694
715
  /** Error from last attempt */
@@ -781,4 +802,6 @@ declare function useSwapOrderBook(config: SwapOrderBookConfig): UseSwapOrderBook
781
802
  */
782
803
  declare function useSwap(config: SwapConfig): UseSwapReturn;
783
804
 
784
- export { type AvatarData, type AvatarShape, type CancelOrderBuildData, type CancelOrderParams, type ClaimOrderBuildData, type ClaimOrderParams, type FillOrderBuildData, type FillOrderParams, NoteCreationResult, type PersonalASPConfig, type PersonalASPInfo, type PlaceOrderBuildData, type PlaceOrderParams, type PoolTransferBuildData, type PoolTransferConfig, type PoolTransferParams, type ShieldBuildData, type ShieldConfig, type ShieldParams, ShieldedNote, type SplitNoteBuildData, type SplitNoteParams, type SwapConfig, type SwapOrderBookConfig, type SwapStage, TransferStage, UPPAvatar, type UPPAvatarProps, UPPModal, type UPPModalProps, UPPPrivateButton, type UPPPrivateButtonProps, type UsePersonalASPReturn, type UsePoolTransferReturn, type UseShieldReturn, type UseSwapOrderBookReturn, type UseSwapReturn, type UseWithdrawReturn, type WithdrawBuildData, type WithdrawConfig, type WithdrawParams, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, useShield, useSwap, useSwapOrderBook, useUPPCrypto, useWithdraw };
805
+ declare function useProofWorker(worker: Worker | null | undefined): ProofWorkerManager | null;
806
+
807
+ export { type AvatarData, type AvatarShape, type CancelOrderBuildData, type CancelOrderParams, type ClaimOrderBuildData, type ClaimOrderParams, type FillOrderBuildData, type FillOrderParams, NoteCreationResult, type PersonalASPConfig, type PersonalASPInfo, type PlaceOrderBuildData, type PlaceOrderParams, PlonkProvingStage, type PoolTransferBuildData, type PoolTransferConfig, type PoolTransferParams, ProofWorkerManager, type ShieldBuildData, type ShieldConfig, type ShieldParams, ShieldedNote, type SplitNoteBuildData, type SplitNoteParams, type SwapConfig, type SwapOrderBookConfig, type SwapStage, TransferStage, UPPAvatar, type UPPAvatarProps, UPPModal, type UPPModalProps, UPPPrivateButton, type UPPPrivateButtonProps, type UsePersonalASPReturn, type UsePoolTransferReturn, type UseShieldReturn, type UseSwapOrderBookReturn, type UseSwapReturn, type UseWithdrawReturn, type WithdrawBuildData, type WithdrawConfig, type WithdrawParams, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, useProofWorker, useShield, useSwap, useSwapOrderBook, useUPPCrypto, useWithdraw };
@@ -1,4 +1,5 @@
1
- import { StorableAccountAdapter, init_stealth, stealth_exports, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, NoteStore } from '../chunk-RNUG3EFC.js';
1
+ import { StorableAccountAdapter, init_stealth, stealth_exports, generateUPPProofAsync, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, ProofWorkerManager, NoteStore } from '../chunk-NIGEAKQP.js';
2
+ export { ProofWorkerManager, generateUPPProofAsync } from '../chunk-NIGEAKQP.js';
2
3
  import { computeSingleOriginASPRoot } from '../chunk-6IEYWJVS.js';
3
4
  export { ASP_TREE_DEPTH, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof } from '../chunk-6IEYWJVS.js';
4
5
  import { createAutoAdapter } from '../chunk-XV72HNHN.js';
@@ -1662,6 +1663,7 @@ function usePoolTransfer(config) {
1662
1663
  } = useUPPAccount();
1663
1664
  const [isPending, setIsPending] = useState(false);
1664
1665
  const [stage, setStage] = useState(null);
1666
+ const [provingProgress, setProvingProgress] = useState(null);
1665
1667
  const [error, setError] = useState(null);
1666
1668
  const configRef = useRef(config);
1667
1669
  configRef.current = config;
@@ -1704,7 +1706,7 @@ function usePoolTransfer(config) {
1704
1706
  const recipientNote = await createNoteForSelf(amount, origin, token);
1705
1707
  const changeNote = await createNoteForSelf(changeAmount, origin, token);
1706
1708
  const [transferModule, proofModule, aspModule] = await Promise.all([
1707
- import('../transfer-LGR44CER.js'),
1709
+ import('../transfer-LT2VGGPZ.js'),
1708
1710
  import('../proof-XQG5DN5N.js'),
1709
1711
  import('../asp-72WUGTQE.js')
1710
1712
  ]);
@@ -1713,7 +1715,7 @@ function usePoolTransfer(config) {
1713
1715
  getMerkleProofsForNotes,
1714
1716
  buildUPPTransferCircuitInputs
1715
1717
  } = transferModule;
1716
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
1718
+ const { formatPlonkProofForContract } = proofModule;
1717
1719
  const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
1718
1720
  setStage("syncing_merkle");
1719
1721
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
@@ -1742,10 +1744,15 @@ function usePoolTransfer(config) {
1742
1744
  recipientNoteWithAmount,
1743
1745
  changeNoteWithAmount
1744
1746
  );
1745
- const { proof } = await generateUPPProof(
1747
+ setProvingProgress(null);
1748
+ const { proof } = await generateUPPProofAsync(
1746
1749
  "transfer",
1747
1750
  circuitInputs,
1748
- cfg.circuitBaseUrl ?? "/circuits/"
1751
+ cfg.circuitBaseUrl ?? "/circuits/",
1752
+ {
1753
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
1754
+ worker: cfg.proofWorker
1755
+ }
1749
1756
  );
1750
1757
  const formattedProof = await formatPlonkProofForContract(proof);
1751
1758
  return {
@@ -1770,6 +1777,7 @@ function usePoolTransfer(config) {
1770
1777
  } finally {
1771
1778
  setIsPending(false);
1772
1779
  setStage(null);
1780
+ setProvingProgress(null);
1773
1781
  }
1774
1782
  },
1775
1783
  [isSetup, masterKeys, unspentNotes, createNoteForSelf]
@@ -1778,6 +1786,7 @@ function usePoolTransfer(config) {
1778
1786
  build,
1779
1787
  isPending,
1780
1788
  stage,
1789
+ provingProgress,
1781
1790
  error,
1782
1791
  reset
1783
1792
  };
@@ -1799,6 +1808,7 @@ function useWithdraw(config) {
1799
1808
  } = useUPPAccount();
1800
1809
  const [isPending, setIsPending] = useState(false);
1801
1810
  const [stage, setStage] = useState(null);
1811
+ const [provingProgress, setProvingProgress] = useState(null);
1802
1812
  const [error, setError] = useState(null);
1803
1813
  const configRef = useRef(config);
1804
1814
  configRef.current = config;
@@ -1853,12 +1863,12 @@ function useWithdraw(config) {
1853
1863
  const token = BigInt(selectedNote.token);
1854
1864
  setStage("creating_outputs");
1855
1865
  const [transferModule, proofModule, sdk] = await Promise.all([
1856
- import('../transfer-LGR44CER.js'),
1866
+ import('../transfer-LT2VGGPZ.js'),
1857
1867
  import('../proof-XQG5DN5N.js'),
1858
1868
  import('../index.js')
1859
1869
  ]);
1860
1870
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
1861
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
1871
+ const { formatPlonkProofForContract } = proofModule;
1862
1872
  setStage("syncing_merkle");
1863
1873
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
1864
1874
  const spendableNote = {
@@ -1917,10 +1927,15 @@ function useWithdraw(config) {
1917
1927
  aspPathElements: Array(ASP_TREE_DEPTH2).fill("0"),
1918
1928
  aspPathIndices: Array(ASP_TREE_DEPTH2).fill("0")
1919
1929
  };
1920
- const { proof } = await generateUPPProof(
1930
+ setProvingProgress(null);
1931
+ const { proof } = await generateUPPProofAsync(
1921
1932
  "withdraw",
1922
1933
  circuitInputs,
1923
- cfg.circuitBaseUrl ?? "/circuits/"
1934
+ cfg.circuitBaseUrl ?? "/circuits/",
1935
+ {
1936
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
1937
+ worker: cfg.proofWorker
1938
+ }
1924
1939
  );
1925
1940
  const formattedProof = await formatPlonkProofForContract(proof);
1926
1941
  const stateRoot = stateRootBI;
@@ -1946,6 +1961,7 @@ function useWithdraw(config) {
1946
1961
  } finally {
1947
1962
  setIsPending(false);
1948
1963
  setStage(null);
1964
+ setProvingProgress(null);
1949
1965
  }
1950
1966
  },
1951
1967
  [isSetup, masterKeys, unspentNotes]
@@ -1954,6 +1970,7 @@ function useWithdraw(config) {
1954
1970
  build,
1955
1971
  isPending,
1956
1972
  stage,
1973
+ provingProgress,
1957
1974
  error,
1958
1975
  reset
1959
1976
  };
@@ -2176,6 +2193,7 @@ function useSwap(config) {
2176
2193
  } = useUPPAccount();
2177
2194
  const [isPending, setIsPending] = useState(false);
2178
2195
  const [stage, setStage] = useState(null);
2196
+ const [provingProgress, setProvingProgress] = useState(null);
2179
2197
  const [error, setError] = useState(null);
2180
2198
  const configRef = useRef(config);
2181
2199
  configRef.current = config;
@@ -2222,13 +2240,13 @@ function useSwap(config) {
2222
2240
  }
2223
2241
  setStage("creating_outputs");
2224
2242
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2225
- import('../transfer-LGR44CER.js'),
2243
+ import('../transfer-LT2VGGPZ.js'),
2226
2244
  import('../proof-XQG5DN5N.js'),
2227
2245
  import('../index.js'),
2228
2246
  import('../asp-72WUGTQE.js')
2229
2247
  ]);
2230
2248
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
2231
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
2249
+ const { formatPlonkProofForContract } = proofModule;
2232
2250
  const { generateASPProof: generateASPProof2 } = aspModule;
2233
2251
  setStage("syncing_merkle");
2234
2252
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
@@ -2287,10 +2305,15 @@ function useSwap(config) {
2287
2305
  aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
2288
2306
  aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
2289
2307
  };
2290
- const { proof } = await generateUPPProof(
2308
+ setProvingProgress(null);
2309
+ const { proof } = await generateUPPProofAsync(
2291
2310
  "withdraw",
2292
2311
  circuitInputs,
2293
- cfg.circuitBaseUrl ?? "/circuits/"
2312
+ cfg.circuitBaseUrl ?? "/circuits/",
2313
+ {
2314
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
2315
+ worker: cfg.proofWorker
2316
+ }
2294
2317
  );
2295
2318
  const formattedProof = await formatPlonkProofForContract(proof);
2296
2319
  const cancelSecret = generateCancelSecret();
@@ -2320,6 +2343,7 @@ function useSwap(config) {
2320
2343
  } finally {
2321
2344
  setIsPending(false);
2322
2345
  setStage(null);
2346
+ setProvingProgress(null);
2323
2347
  }
2324
2348
  },
2325
2349
  [isSetup, masterKeys, unspentNotes]
@@ -2363,13 +2387,13 @@ function useSwap(config) {
2363
2387
  }
2364
2388
  setStage("creating_outputs");
2365
2389
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2366
- import('../transfer-LGR44CER.js'),
2390
+ import('../transfer-LT2VGGPZ.js'),
2367
2391
  import('../proof-XQG5DN5N.js'),
2368
2392
  import('../index.js'),
2369
2393
  import('../asp-72WUGTQE.js')
2370
2394
  ]);
2371
2395
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
2372
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
2396
+ const { formatPlonkProofForContract } = proofModule;
2373
2397
  const { generateASPProof: generateASPProof2 } = aspModule;
2374
2398
  const fillerOrigin = ethAddress ? BigInt(ethAddress) : BigInt(masterKeys.ownerHash);
2375
2399
  const fillerNoteData = await createNoteForSelf(
@@ -2434,10 +2458,15 @@ function useSwap(config) {
2434
2458
  aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
2435
2459
  aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
2436
2460
  };
2437
- const { proof } = await generateUPPProof(
2461
+ setProvingProgress(null);
2462
+ const { proof } = await generateUPPProofAsync(
2438
2463
  "withdraw",
2439
2464
  circuitInputs,
2440
- cfg.circuitBaseUrl ?? "/circuits/"
2465
+ cfg.circuitBaseUrl ?? "/circuits/",
2466
+ {
2467
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
2468
+ worker: cfg.proofWorker
2469
+ }
2441
2470
  );
2442
2471
  const formattedProof = await formatPlonkProofForContract(proof);
2443
2472
  const { encodePacked: encodePacked3 } = await import('viem');
@@ -2465,6 +2494,7 @@ function useSwap(config) {
2465
2494
  } finally {
2466
2495
  setIsPending(false);
2467
2496
  setStage(null);
2497
+ setProvingProgress(null);
2468
2498
  }
2469
2499
  },
2470
2500
  [isSetup, masterKeys, unspentNotes, createNoteForSelf]
@@ -2520,6 +2550,7 @@ function useSwap(config) {
2520
2550
  } finally {
2521
2551
  setIsPending(false);
2522
2552
  setStage(null);
2553
+ setProvingProgress(null);
2523
2554
  }
2524
2555
  },
2525
2556
  [isSetup, masterKeys, createNoteForSelf]
@@ -2553,6 +2584,7 @@ function useSwap(config) {
2553
2584
  } finally {
2554
2585
  setIsPending(false);
2555
2586
  setStage(null);
2587
+ setProvingProgress(null);
2556
2588
  }
2557
2589
  },
2558
2590
  [isSetup, masterKeys, createNoteForSelf]
@@ -2582,12 +2614,12 @@ function useSwap(config) {
2582
2614
  createNoteForSelf(changeAmount, origin, token)
2583
2615
  ]);
2584
2616
  const [transferModule, proofModule, aspModule] = await Promise.all([
2585
- import('../transfer-LGR44CER.js'),
2617
+ import('../transfer-LT2VGGPZ.js'),
2586
2618
  import('../proof-XQG5DN5N.js'),
2587
2619
  import('../asp-72WUGTQE.js')
2588
2620
  ]);
2589
2621
  const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
2590
- const { generateUPPProof, formatPlonkProofForContract } = proofModule;
2622
+ const { formatPlonkProofForContract } = proofModule;
2591
2623
  const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
2592
2624
  setStage("syncing_merkle");
2593
2625
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
@@ -2612,10 +2644,15 @@ function useSwap(config) {
2612
2644
  exactNoteWithAmount,
2613
2645
  changeNoteWithAmount
2614
2646
  );
2615
- const { proof } = await generateUPPProof(
2647
+ setProvingProgress(null);
2648
+ const { proof } = await generateUPPProofAsync(
2616
2649
  "transfer",
2617
2650
  circuitInputs,
2618
- cfg.circuitBaseUrl ?? "/circuits/"
2651
+ cfg.circuitBaseUrl ?? "/circuits/",
2652
+ {
2653
+ onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
2654
+ worker: cfg.proofWorker
2655
+ }
2619
2656
  );
2620
2657
  const formattedProof = await formatPlonkProofForContract(proof);
2621
2658
  const { encodePacked: encodePacked3 } = await import('viem');
@@ -2673,12 +2710,14 @@ function useSwap(config) {
2673
2710
  } finally {
2674
2711
  setIsPending(false);
2675
2712
  setStage(null);
2713
+ setProvingProgress(null);
2676
2714
  }
2677
2715
  },
2678
2716
  [isSetup, masterKeys, createNoteForSelf]
2679
2717
  );
2680
2718
  return {
2681
2719
  stage,
2720
+ provingProgress,
2682
2721
  isPending,
2683
2722
  error,
2684
2723
  buildNoteSplit,
@@ -2689,7 +2728,23 @@ function useSwap(config) {
2689
2728
  reset
2690
2729
  };
2691
2730
  }
2731
+ function useProofWorker(worker) {
2732
+ const managerRef = useRef(null);
2733
+ useEffect(() => {
2734
+ if (!worker) {
2735
+ managerRef.current = null;
2736
+ return;
2737
+ }
2738
+ const manager = new ProofWorkerManager(worker);
2739
+ managerRef.current = manager;
2740
+ return () => {
2741
+ manager.terminate();
2742
+ managerRef.current = null;
2743
+ };
2744
+ }, [worker]);
2745
+ return managerRef.current;
2746
+ }
2692
2747
 
2693
- export { UPPAccountProvider, UPPAvatar, UPPModal, UPPPrivateButton, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, useShield, useSwap, useSwapOrderBook, useUPPAccount, useUPPCrypto, useWithdraw };
2748
+ export { UPPAccountProvider, UPPAvatar, UPPModal, UPPPrivateButton, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, useProofWorker, useShield, useSwap, useSwapOrderBook, useUPPAccount, useUPPCrypto, useWithdraw };
2694
2749
  //# sourceMappingURL=index.js.map
2695
2750
  //# sourceMappingURL=index.js.map