@permissionless-technologies/upp-sdk 0.4.13 → 0.4.14
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.
- package/dist/{chunk-O6ALW7DB.js → chunk-5WLAZA3M.js} +3 -3
- package/dist/{chunk-O6ALW7DB.js.map → chunk-5WLAZA3M.js.map} +1 -1
- package/dist/{chunk-4MWEJDTR.cjs → chunk-7Y6O4P2P.cjs} +3 -3
- package/dist/{chunk-4MWEJDTR.cjs.map → chunk-7Y6O4P2P.cjs.map} +1 -1
- package/dist/{chunk-KZ7PY2PR.cjs → chunk-CTBLNYYB.cjs} +2 -2
- package/dist/{chunk-KZ7PY2PR.cjs.map → chunk-CTBLNYYB.cjs.map} +1 -1
- package/dist/{chunk-23B5XSS4.cjs → chunk-CZLMCMYE.cjs} +90 -2
- package/dist/chunk-CZLMCMYE.cjs.map +1 -0
- package/dist/{chunk-3I6ERQO3.js → chunk-GQ6JMNJI.js} +3 -3
- package/dist/{chunk-3I6ERQO3.js.map → chunk-GQ6JMNJI.js.map} +1 -1
- package/dist/{chunk-RNUG3EFC.js → chunk-NIGEAKQP.js} +89 -3
- package/dist/chunk-NIGEAKQP.js.map +1 -0
- package/dist/{chunk-5BLMSTFQ.cjs → chunk-TBGDQM33.cjs} +4 -4
- package/dist/{chunk-5BLMSTFQ.cjs.map → chunk-TBGDQM33.cjs.map} +1 -1
- package/dist/{chunk-DUBWGEB5.js → chunk-YMZM2ABJ.js} +2 -2
- package/dist/{chunk-DUBWGEB5.js.map → chunk-YMZM2ABJ.js.map} +1 -1
- package/dist/core/index.cjs +100 -92
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +4 -4
- package/dist/core/proof-worker-entry.cjs +60 -0
- package/dist/core/proof-worker-entry.cjs.map +1 -0
- package/dist/core/proof-worker-entry.d.cts +2 -0
- package/dist/core/proof-worker-entry.d.ts +2 -0
- package/dist/core/proof-worker-entry.js +58 -0
- package/dist/core/proof-worker-entry.js.map +1 -0
- package/dist/{index-CKCDqv2e.d.cts → index-DKFupAA8.d.cts} +8 -3
- package/dist/{index-DLczKlnM.d.ts → index-M91G-og3.d.ts} +8 -3
- package/dist/{index--eNkOLiP.d.ts → index-S2fzWmLW.d.ts} +1 -1
- package/dist/{index-CRaFsQD3.d.cts → index-qTwnREeK.d.cts} +1 -1
- package/dist/index.cjs +108 -100
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.d.cts +5 -5
- package/dist/indexer/index.d.ts +5 -5
- package/dist/indexer/index.js +1 -1
- package/dist/react/index.cjs +69 -21
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +20 -3
- package/dist/react/index.d.ts +20 -3
- package/dist/react/index.js +52 -12
- package/dist/react/index.js.map +1 -1
- package/dist/{transfer-CwwsNdGL.d.cts → transfer-BDYID3Hn.d.cts} +75 -1
- package/dist/{transfer-Crvdq4VN.d.ts → transfer-DLukr6ed.d.ts} +75 -1
- package/dist/{transfer-LGR44CER.js → transfer-LT2VGGPZ.js} +4 -4
- package/dist/{transfer-LGR44CER.js.map → transfer-LT2VGGPZ.js.map} +1 -1
- package/dist/{transfer-UZBU47HC.cjs → transfer-OPGKWWX2.cjs} +10 -10
- package/dist/{transfer-UZBU47HC.cjs.map → transfer-OPGKWWX2.cjs.map} +1 -1
- package/package.json +5 -1
- package/dist/chunk-23B5XSS4.cjs.map +0 -1
- package/dist/chunk-RNUG3EFC.js.map +0 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ASPProof,
|
|
1
|
+
import { aC as NoteCreationResult, aD as PlonkProofStruct, aE as ShieldedNote, W as TransferStage, P as PlonkProvingStage, O as SwapOrderEvent, m as ProofWorkerManager } 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';
|
|
@@ -290,6 +290,11 @@ interface UsePoolTransferReturn {
|
|
|
290
290
|
isPending: boolean;
|
|
291
291
|
/** Current stage for UI feedback */
|
|
292
292
|
stage: TransferStage | null;
|
|
293
|
+
/** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
|
|
294
|
+
provingProgress: {
|
|
295
|
+
stage: PlonkProvingStage;
|
|
296
|
+
message: string;
|
|
297
|
+
} | null;
|
|
293
298
|
/** Error from last attempt */
|
|
294
299
|
error: Error | null;
|
|
295
300
|
/** Reset error state */
|
|
@@ -376,6 +381,11 @@ interface UseWithdrawReturn {
|
|
|
376
381
|
isPending: boolean;
|
|
377
382
|
/** Current stage for UI feedback */
|
|
378
383
|
stage: TransferStage | null;
|
|
384
|
+
/** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
|
|
385
|
+
provingProgress: {
|
|
386
|
+
stage: PlonkProvingStage;
|
|
387
|
+
message: string;
|
|
388
|
+
} | null;
|
|
379
389
|
/** Error from last attempt */
|
|
380
390
|
error: Error | null;
|
|
381
391
|
/** Reset error state */
|
|
@@ -689,6 +699,11 @@ interface SplitNoteBuildData {
|
|
|
689
699
|
interface UseSwapReturn {
|
|
690
700
|
/** Current operation stage */
|
|
691
701
|
stage: TransferStage | null;
|
|
702
|
+
/** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
|
|
703
|
+
provingProgress: {
|
|
704
|
+
stage: PlonkProvingStage;
|
|
705
|
+
message: string;
|
|
706
|
+
} | null;
|
|
692
707
|
/** Whether building is in progress */
|
|
693
708
|
isPending: boolean;
|
|
694
709
|
/** Error from last attempt */
|
|
@@ -781,4 +796,6 @@ declare function useSwapOrderBook(config: SwapOrderBookConfig): UseSwapOrderBook
|
|
|
781
796
|
*/
|
|
782
797
|
declare function useSwap(config: SwapConfig): UseSwapReturn;
|
|
783
798
|
|
|
784
|
-
|
|
799
|
+
declare function useProofWorker(worker: Worker | null | undefined): ProofWorkerManager | null;
|
|
800
|
+
|
|
801
|
+
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 };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ASPProof,
|
|
1
|
+
import { aC as NoteCreationResult, aD as PlonkProofStruct, aE as ShieldedNote, W as TransferStage, P as PlonkProvingStage, O as SwapOrderEvent, m as ProofWorkerManager } 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';
|
|
@@ -290,6 +290,11 @@ interface UsePoolTransferReturn {
|
|
|
290
290
|
isPending: boolean;
|
|
291
291
|
/** Current stage for UI feedback */
|
|
292
292
|
stage: TransferStage | null;
|
|
293
|
+
/** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
|
|
294
|
+
provingProgress: {
|
|
295
|
+
stage: PlonkProvingStage;
|
|
296
|
+
message: string;
|
|
297
|
+
} | null;
|
|
293
298
|
/** Error from last attempt */
|
|
294
299
|
error: Error | null;
|
|
295
300
|
/** Reset error state */
|
|
@@ -376,6 +381,11 @@ interface UseWithdrawReturn {
|
|
|
376
381
|
isPending: boolean;
|
|
377
382
|
/** Current stage for UI feedback */
|
|
378
383
|
stage: TransferStage | null;
|
|
384
|
+
/** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
|
|
385
|
+
provingProgress: {
|
|
386
|
+
stage: PlonkProvingStage;
|
|
387
|
+
message: string;
|
|
388
|
+
} | null;
|
|
379
389
|
/** Error from last attempt */
|
|
380
390
|
error: Error | null;
|
|
381
391
|
/** Reset error state */
|
|
@@ -689,6 +699,11 @@ interface SplitNoteBuildData {
|
|
|
689
699
|
interface UseSwapReturn {
|
|
690
700
|
/** Current operation stage */
|
|
691
701
|
stage: TransferStage | null;
|
|
702
|
+
/** Granular PLONK proving progress (non-null when stage === 'generating_proof') */
|
|
703
|
+
provingProgress: {
|
|
704
|
+
stage: PlonkProvingStage;
|
|
705
|
+
message: string;
|
|
706
|
+
} | null;
|
|
692
707
|
/** Whether building is in progress */
|
|
693
708
|
isPending: boolean;
|
|
694
709
|
/** Error from last attempt */
|
|
@@ -781,4 +796,6 @@ declare function useSwapOrderBook(config: SwapOrderBookConfig): UseSwapOrderBook
|
|
|
781
796
|
*/
|
|
782
797
|
declare function useSwap(config: SwapConfig): UseSwapReturn;
|
|
783
798
|
|
|
784
|
-
|
|
799
|
+
declare function useProofWorker(worker: Worker | null | undefined): ProofWorkerManager | null;
|
|
800
|
+
|
|
801
|
+
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 };
|
package/dist/react/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { StorableAccountAdapter, init_stealth, stealth_exports, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, NoteStore } from '../chunk-
|
|
1
|
+
import { StorableAccountAdapter, init_stealth, stealth_exports, 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-
|
|
1709
|
+
import('../transfer-LT2VGGPZ.js'),
|
|
1708
1710
|
import('../proof-XQG5DN5N.js'),
|
|
1709
1711
|
import('../asp-72WUGTQE.js')
|
|
1710
1712
|
]);
|
|
@@ -1742,10 +1744,12 @@ function usePoolTransfer(config) {
|
|
|
1742
1744
|
recipientNoteWithAmount,
|
|
1743
1745
|
changeNoteWithAmount
|
|
1744
1746
|
);
|
|
1747
|
+
setProvingProgress(null);
|
|
1745
1748
|
const { proof } = await generateUPPProof(
|
|
1746
1749
|
"transfer",
|
|
1747
1750
|
circuitInputs,
|
|
1748
|
-
cfg.circuitBaseUrl ?? "/circuits/"
|
|
1751
|
+
cfg.circuitBaseUrl ?? "/circuits/",
|
|
1752
|
+
(s, msg) => setProvingProgress({ stage: s, message: msg })
|
|
1749
1753
|
);
|
|
1750
1754
|
const formattedProof = await formatPlonkProofForContract(proof);
|
|
1751
1755
|
return {
|
|
@@ -1770,6 +1774,7 @@ function usePoolTransfer(config) {
|
|
|
1770
1774
|
} finally {
|
|
1771
1775
|
setIsPending(false);
|
|
1772
1776
|
setStage(null);
|
|
1777
|
+
setProvingProgress(null);
|
|
1773
1778
|
}
|
|
1774
1779
|
},
|
|
1775
1780
|
[isSetup, masterKeys, unspentNotes, createNoteForSelf]
|
|
@@ -1778,6 +1783,7 @@ function usePoolTransfer(config) {
|
|
|
1778
1783
|
build,
|
|
1779
1784
|
isPending,
|
|
1780
1785
|
stage,
|
|
1786
|
+
provingProgress,
|
|
1781
1787
|
error,
|
|
1782
1788
|
reset
|
|
1783
1789
|
};
|
|
@@ -1799,6 +1805,7 @@ function useWithdraw(config) {
|
|
|
1799
1805
|
} = useUPPAccount();
|
|
1800
1806
|
const [isPending, setIsPending] = useState(false);
|
|
1801
1807
|
const [stage, setStage] = useState(null);
|
|
1808
|
+
const [provingProgress, setProvingProgress] = useState(null);
|
|
1802
1809
|
const [error, setError] = useState(null);
|
|
1803
1810
|
const configRef = useRef(config);
|
|
1804
1811
|
configRef.current = config;
|
|
@@ -1853,7 +1860,7 @@ function useWithdraw(config) {
|
|
|
1853
1860
|
const token = BigInt(selectedNote.token);
|
|
1854
1861
|
setStage("creating_outputs");
|
|
1855
1862
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1856
|
-
import('../transfer-
|
|
1863
|
+
import('../transfer-LT2VGGPZ.js'),
|
|
1857
1864
|
import('../proof-XQG5DN5N.js'),
|
|
1858
1865
|
import('../index.js')
|
|
1859
1866
|
]);
|
|
@@ -1917,10 +1924,12 @@ function useWithdraw(config) {
|
|
|
1917
1924
|
aspPathElements: Array(ASP_TREE_DEPTH2).fill("0"),
|
|
1918
1925
|
aspPathIndices: Array(ASP_TREE_DEPTH2).fill("0")
|
|
1919
1926
|
};
|
|
1927
|
+
setProvingProgress(null);
|
|
1920
1928
|
const { proof } = await generateUPPProof(
|
|
1921
1929
|
"withdraw",
|
|
1922
1930
|
circuitInputs,
|
|
1923
|
-
cfg.circuitBaseUrl ?? "/circuits/"
|
|
1931
|
+
cfg.circuitBaseUrl ?? "/circuits/",
|
|
1932
|
+
(s, msg) => setProvingProgress({ stage: s, message: msg })
|
|
1924
1933
|
);
|
|
1925
1934
|
const formattedProof = await formatPlonkProofForContract(proof);
|
|
1926
1935
|
const stateRoot = stateRootBI;
|
|
@@ -1946,6 +1955,7 @@ function useWithdraw(config) {
|
|
|
1946
1955
|
} finally {
|
|
1947
1956
|
setIsPending(false);
|
|
1948
1957
|
setStage(null);
|
|
1958
|
+
setProvingProgress(null);
|
|
1949
1959
|
}
|
|
1950
1960
|
},
|
|
1951
1961
|
[isSetup, masterKeys, unspentNotes]
|
|
@@ -1954,6 +1964,7 @@ function useWithdraw(config) {
|
|
|
1954
1964
|
build,
|
|
1955
1965
|
isPending,
|
|
1956
1966
|
stage,
|
|
1967
|
+
provingProgress,
|
|
1957
1968
|
error,
|
|
1958
1969
|
reset
|
|
1959
1970
|
};
|
|
@@ -2176,6 +2187,7 @@ function useSwap(config) {
|
|
|
2176
2187
|
} = useUPPAccount();
|
|
2177
2188
|
const [isPending, setIsPending] = useState(false);
|
|
2178
2189
|
const [stage, setStage] = useState(null);
|
|
2190
|
+
const [provingProgress, setProvingProgress] = useState(null);
|
|
2179
2191
|
const [error, setError] = useState(null);
|
|
2180
2192
|
const configRef = useRef(config);
|
|
2181
2193
|
configRef.current = config;
|
|
@@ -2222,7 +2234,7 @@ function useSwap(config) {
|
|
|
2222
2234
|
}
|
|
2223
2235
|
setStage("creating_outputs");
|
|
2224
2236
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2225
|
-
import('../transfer-
|
|
2237
|
+
import('../transfer-LT2VGGPZ.js'),
|
|
2226
2238
|
import('../proof-XQG5DN5N.js'),
|
|
2227
2239
|
import('../index.js'),
|
|
2228
2240
|
import('../asp-72WUGTQE.js')
|
|
@@ -2287,10 +2299,12 @@ function useSwap(config) {
|
|
|
2287
2299
|
aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
|
|
2288
2300
|
aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
|
|
2289
2301
|
};
|
|
2302
|
+
setProvingProgress(null);
|
|
2290
2303
|
const { proof } = await generateUPPProof(
|
|
2291
2304
|
"withdraw",
|
|
2292
2305
|
circuitInputs,
|
|
2293
|
-
cfg.circuitBaseUrl ?? "/circuits/"
|
|
2306
|
+
cfg.circuitBaseUrl ?? "/circuits/",
|
|
2307
|
+
(s, msg) => setProvingProgress({ stage: s, message: msg })
|
|
2294
2308
|
);
|
|
2295
2309
|
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2296
2310
|
const cancelSecret = generateCancelSecret();
|
|
@@ -2320,6 +2334,7 @@ function useSwap(config) {
|
|
|
2320
2334
|
} finally {
|
|
2321
2335
|
setIsPending(false);
|
|
2322
2336
|
setStage(null);
|
|
2337
|
+
setProvingProgress(null);
|
|
2323
2338
|
}
|
|
2324
2339
|
},
|
|
2325
2340
|
[isSetup, masterKeys, unspentNotes]
|
|
@@ -2363,7 +2378,7 @@ function useSwap(config) {
|
|
|
2363
2378
|
}
|
|
2364
2379
|
setStage("creating_outputs");
|
|
2365
2380
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2366
|
-
import('../transfer-
|
|
2381
|
+
import('../transfer-LT2VGGPZ.js'),
|
|
2367
2382
|
import('../proof-XQG5DN5N.js'),
|
|
2368
2383
|
import('../index.js'),
|
|
2369
2384
|
import('../asp-72WUGTQE.js')
|
|
@@ -2434,10 +2449,12 @@ function useSwap(config) {
|
|
|
2434
2449
|
aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
|
|
2435
2450
|
aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
|
|
2436
2451
|
};
|
|
2452
|
+
setProvingProgress(null);
|
|
2437
2453
|
const { proof } = await generateUPPProof(
|
|
2438
2454
|
"withdraw",
|
|
2439
2455
|
circuitInputs,
|
|
2440
|
-
cfg.circuitBaseUrl ?? "/circuits/"
|
|
2456
|
+
cfg.circuitBaseUrl ?? "/circuits/",
|
|
2457
|
+
(s, msg) => setProvingProgress({ stage: s, message: msg })
|
|
2441
2458
|
);
|
|
2442
2459
|
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2443
2460
|
const { encodePacked: encodePacked3 } = await import('viem');
|
|
@@ -2465,6 +2482,7 @@ function useSwap(config) {
|
|
|
2465
2482
|
} finally {
|
|
2466
2483
|
setIsPending(false);
|
|
2467
2484
|
setStage(null);
|
|
2485
|
+
setProvingProgress(null);
|
|
2468
2486
|
}
|
|
2469
2487
|
},
|
|
2470
2488
|
[isSetup, masterKeys, unspentNotes, createNoteForSelf]
|
|
@@ -2520,6 +2538,7 @@ function useSwap(config) {
|
|
|
2520
2538
|
} finally {
|
|
2521
2539
|
setIsPending(false);
|
|
2522
2540
|
setStage(null);
|
|
2541
|
+
setProvingProgress(null);
|
|
2523
2542
|
}
|
|
2524
2543
|
},
|
|
2525
2544
|
[isSetup, masterKeys, createNoteForSelf]
|
|
@@ -2553,6 +2572,7 @@ function useSwap(config) {
|
|
|
2553
2572
|
} finally {
|
|
2554
2573
|
setIsPending(false);
|
|
2555
2574
|
setStage(null);
|
|
2575
|
+
setProvingProgress(null);
|
|
2556
2576
|
}
|
|
2557
2577
|
},
|
|
2558
2578
|
[isSetup, masterKeys, createNoteForSelf]
|
|
@@ -2582,7 +2602,7 @@ function useSwap(config) {
|
|
|
2582
2602
|
createNoteForSelf(changeAmount, origin, token)
|
|
2583
2603
|
]);
|
|
2584
2604
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2585
|
-
import('../transfer-
|
|
2605
|
+
import('../transfer-LT2VGGPZ.js'),
|
|
2586
2606
|
import('../proof-XQG5DN5N.js'),
|
|
2587
2607
|
import('../asp-72WUGTQE.js')
|
|
2588
2608
|
]);
|
|
@@ -2612,10 +2632,12 @@ function useSwap(config) {
|
|
|
2612
2632
|
exactNoteWithAmount,
|
|
2613
2633
|
changeNoteWithAmount
|
|
2614
2634
|
);
|
|
2635
|
+
setProvingProgress(null);
|
|
2615
2636
|
const { proof } = await generateUPPProof(
|
|
2616
2637
|
"transfer",
|
|
2617
2638
|
circuitInputs,
|
|
2618
|
-
cfg.circuitBaseUrl ?? "/circuits/"
|
|
2639
|
+
cfg.circuitBaseUrl ?? "/circuits/",
|
|
2640
|
+
(s, msg) => setProvingProgress({ stage: s, message: msg })
|
|
2619
2641
|
);
|
|
2620
2642
|
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2621
2643
|
const { encodePacked: encodePacked3 } = await import('viem');
|
|
@@ -2673,12 +2695,14 @@ function useSwap(config) {
|
|
|
2673
2695
|
} finally {
|
|
2674
2696
|
setIsPending(false);
|
|
2675
2697
|
setStage(null);
|
|
2698
|
+
setProvingProgress(null);
|
|
2676
2699
|
}
|
|
2677
2700
|
},
|
|
2678
2701
|
[isSetup, masterKeys, createNoteForSelf]
|
|
2679
2702
|
);
|
|
2680
2703
|
return {
|
|
2681
2704
|
stage,
|
|
2705
|
+
provingProgress,
|
|
2682
2706
|
isPending,
|
|
2683
2707
|
error,
|
|
2684
2708
|
buildNoteSplit,
|
|
@@ -2689,7 +2713,23 @@ function useSwap(config) {
|
|
|
2689
2713
|
reset
|
|
2690
2714
|
};
|
|
2691
2715
|
}
|
|
2716
|
+
function useProofWorker(worker) {
|
|
2717
|
+
const managerRef = useRef(null);
|
|
2718
|
+
useEffect(() => {
|
|
2719
|
+
if (!worker) {
|
|
2720
|
+
managerRef.current = null;
|
|
2721
|
+
return;
|
|
2722
|
+
}
|
|
2723
|
+
const manager = new ProofWorkerManager(worker);
|
|
2724
|
+
managerRef.current = manager;
|
|
2725
|
+
return () => {
|
|
2726
|
+
manager.terminate();
|
|
2727
|
+
managerRef.current = null;
|
|
2728
|
+
};
|
|
2729
|
+
}, [worker]);
|
|
2730
|
+
return managerRef.current;
|
|
2731
|
+
}
|
|
2692
2732
|
|
|
2693
|
-
export { UPPAccountProvider, UPPAvatar, UPPModal, UPPPrivateButton, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, useShield, useSwap, useSwapOrderBook, useUPPAccount, useUPPCrypto, useWithdraw };
|
|
2733
|
+
export { UPPAccountProvider, UPPAvatar, UPPModal, UPPPrivateButton, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, useProofWorker, useShield, useSwap, useSwapOrderBook, useUPPAccount, useUPPCrypto, useWithdraw };
|
|
2694
2734
|
//# sourceMappingURL=index.js.map
|
|
2695
2735
|
//# sourceMappingURL=index.js.map
|