@permissionless-technologies/upp-sdk 0.4.21 → 0.4.22
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/README.md +7 -3
- package/dist/chunk-2BSIUEPO.js +343 -0
- package/dist/chunk-2BSIUEPO.js.map +1 -0
- package/dist/{chunk-V6MW5VOF.cjs → chunk-632LPXPX.cjs} +4 -4
- package/dist/{chunk-V6MW5VOF.cjs.map → chunk-632LPXPX.cjs.map} +1 -1
- package/dist/{chunk-ND56VNCF.js → chunk-D4VCRPKS.js} +2 -2
- package/dist/{chunk-ND56VNCF.js.map → chunk-D4VCRPKS.js.map} +1 -1
- package/dist/{chunk-YHBUCKVS.cjs → chunk-DYSU7JYL.cjs} +23 -23
- package/dist/{chunk-YHBUCKVS.cjs.map → chunk-DYSU7JYL.cjs.map} +1 -1
- package/dist/{chunk-RYEYGGE7.cjs → chunk-IX7HV5TE.cjs} +18 -5
- package/dist/chunk-IX7HV5TE.cjs.map +1 -0
- package/dist/{chunk-5H27F6W6.cjs → chunk-IYRCJAME.cjs} +13 -9
- package/dist/chunk-IYRCJAME.cjs.map +1 -0
- package/dist/{chunk-KRLRJ3HN.js → chunk-KR4GB6VC.js} +18 -5
- package/dist/chunk-KR4GB6VC.js.map +1 -0
- package/dist/{chunk-C7DUABSG.js → chunk-Q6BLTPWV.js} +13 -9
- package/dist/chunk-Q6BLTPWV.js.map +1 -0
- package/dist/{chunk-7VPW5T5R.js → chunk-UMWY4ICQ.js} +3 -3
- package/dist/{chunk-7VPW5T5R.js.map → chunk-UMWY4ICQ.js.map} +1 -1
- package/dist/{chunk-PZAV2S5E.cjs → chunk-UYPIWBKM.cjs} +2 -2
- package/dist/{chunk-PZAV2S5E.cjs.map → chunk-UYPIWBKM.cjs.map} +1 -1
- package/dist/chunk-VVW5VVY3.cjs +347 -0
- package/dist/chunk-VVW5VVY3.cjs.map +1 -0
- package/dist/{chunk-OLJFKARA.js → chunk-XDWRMHLY.js} +15 -15
- package/dist/{chunk-OLJFKARA.js.map → chunk-XDWRMHLY.js.map} +1 -1
- package/dist/core/index.cjs +80 -67
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +5 -4
- package/dist/core/proof-worker-entry.cjs +8 -8
- package/dist/core/proof-worker-entry.cjs.map +1 -1
- package/dist/core/proof-worker-entry.js +8 -8
- package/dist/core/proof-worker-entry.js.map +1 -1
- package/dist/{index-PgqOAfcc.d.cts → index-AooYZ0kF.d.cts} +1 -1
- package/dist/{index-DsXMd8zh.d.ts → index-CpfUNGm9.d.ts} +1 -1
- package/dist/{index-DmowSsZb.d.ts → index-De5B4r0l.d.ts} +9 -3
- package/dist/{index-DcfqeWvk.d.cts → index-hNuffoCo.d.cts} +9 -3
- package/dist/index.cjs +88 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- 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/{proof-VINVGL4F.cjs → proof-X3MVQFFZ.cjs} +14 -13
- package/dist/{proof-VINVGL4F.cjs.map → proof-X3MVQFFZ.cjs.map} +1 -1
- package/dist/{proof-XQG5DN5N.js → proof-YMXBL4D5.js} +4 -3
- package/dist/{proof-XQG5DN5N.js.map → proof-YMXBL4D5.js.map} +1 -1
- package/dist/react/index.cjs +123 -39
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +44 -6
- package/dist/react/index.d.ts +44 -6
- package/dist/react/index.js +90 -18
- package/dist/react/index.js.map +1 -1
- package/dist/{transfer-Cqg235q6.d.ts → transfer-BGzySIhC.d.ts} +124 -5
- package/dist/{transfer-B4q3ZTJK.d.cts → transfer-BhB-UuBP.d.cts} +124 -5
- package/dist/{transfer-7IFAXV5K.cjs → transfer-H6UWWUSN.cjs} +11 -10
- package/dist/{transfer-7IFAXV5K.cjs.map → transfer-H6UWWUSN.cjs.map} +1 -1
- package/dist/{transfer-FWCRUWWM.js → transfer-MLVRASM3.js} +5 -4
- package/dist/{transfer-FWCRUWWM.js.map → transfer-MLVRASM3.js.map} +1 -1
- package/package.json +1 -1
- package/src/deployments/11155111.json +12 -12
- package/dist/chunk-5H27F6W6.cjs.map +0 -1
- package/dist/chunk-C7DUABSG.js.map +0 -1
- package/dist/chunk-KRLRJ3HN.js.map +0 -1
- package/dist/chunk-RYEYGGE7.cjs.map +0 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ASPProof,
|
|
1
|
+
import { aI as NoteCreationResult, r as ProofWorkerManager, j as DownloadProgress, aJ as PlonkProofStruct, aK as ShieldedNote, a0 as TransferStage, P as PlonkProvingStage, X as SwapOrderEvent, a2 as UPPCircuitType, f as CircuitCacheStatus } from '../transfer-BhB-UuBP.cjs';
|
|
2
|
+
export { A as ASPProof, aR as ASP_TREE_DEPTH, C as CIRCUIT_CDN_BASE, c as CIRCUIT_VERSION, d as CircuitArtifactCache, aP as IndexerConfig, aO as ProofSystemType, aQ as SignTypedDataFn, aN as UPPAccountContextType, aM as UPPAccountProvider, a6 as buildASPTree, ac as computeMultiOriginASPRoot, af as computeSingleOriginASPRoot, ao as generateASPProof, aq as generateMultiOriginASPProof, as as generateSingleOriginASPProof, av as generateUPPProofAsync, aL as useUPPAccount } from '../transfer-BhB-UuBP.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';
|
|
@@ -231,7 +231,7 @@ interface PoolTransferConfig {
|
|
|
231
231
|
tokenAddress: Address;
|
|
232
232
|
/** viem PublicClient for reading chain data */
|
|
233
233
|
publicClient: PublicClient;
|
|
234
|
-
/** Circuit artifacts base URL (
|
|
234
|
+
/** Circuit artifacts base URL (defaults to CDN) */
|
|
235
235
|
circuitBaseUrl?: string;
|
|
236
236
|
/** ASP ID to use (default: DEMO_ASP_ID) */
|
|
237
237
|
aspId?: bigint;
|
|
@@ -239,6 +239,8 @@ interface PoolTransferConfig {
|
|
|
239
239
|
aspApprovedOrigins?: bigint[];
|
|
240
240
|
/** Optional proof worker for off-main-thread proving */
|
|
241
241
|
proofWorker?: ProofWorkerManager | null;
|
|
242
|
+
/** Optional callback for circuit download progress (first-time download) */
|
|
243
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
242
244
|
}
|
|
243
245
|
/**
|
|
244
246
|
* Pool transfer parameters
|
|
@@ -321,10 +323,12 @@ interface WithdrawConfig {
|
|
|
321
323
|
tokenAddress: Address;
|
|
322
324
|
/** viem PublicClient for reading chain data */
|
|
323
325
|
publicClient: PublicClient;
|
|
324
|
-
/** Circuit artifacts base URL (
|
|
326
|
+
/** Circuit artifacts base URL (defaults to CDN) */
|
|
325
327
|
circuitBaseUrl?: string;
|
|
326
328
|
/** Optional proof worker for off-main-thread proving */
|
|
327
329
|
proofWorker?: ProofWorkerManager | null;
|
|
330
|
+
/** Optional callback for circuit download progress (first-time download) */
|
|
331
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
328
332
|
}
|
|
329
333
|
/**
|
|
330
334
|
* Withdraw parameters
|
|
@@ -550,12 +554,14 @@ interface SwapConfig {
|
|
|
550
554
|
poolAddress: Address;
|
|
551
555
|
/** viem PublicClient for reading chain data */
|
|
552
556
|
publicClient: PublicClient;
|
|
553
|
-
/** Circuit artifacts base URL (
|
|
557
|
+
/** Circuit artifacts base URL (defaults to CDN) */
|
|
554
558
|
circuitBaseUrl?: string;
|
|
555
559
|
/** All approved origins in the ASP tree (enables multi-origin proofs) */
|
|
556
560
|
aspApprovedOrigins?: bigint[];
|
|
557
561
|
/** Optional proof worker for off-main-thread proving */
|
|
558
562
|
proofWorker?: ProofWorkerManager | null;
|
|
563
|
+
/** Optional callback for circuit download progress (first-time download) */
|
|
564
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
559
565
|
}
|
|
560
566
|
/**
|
|
561
567
|
* Build data returned by buildPlaceOrder — everything needed for the contract call
|
|
@@ -804,6 +810,38 @@ declare function useSwap(config: SwapConfig): UseSwapReturn;
|
|
|
804
810
|
|
|
805
811
|
declare function useProofWorker(worker: Worker | null | undefined): ProofWorkerManager | null;
|
|
806
812
|
|
|
813
|
+
interface UseCircuitCacheReturn {
|
|
814
|
+
/** Check if a specific circuit is cached (synchronous, from last refresh) */
|
|
815
|
+
isCached: (circuit: UPPCircuitType) => boolean;
|
|
816
|
+
/** Preload a circuit (download + cache) with progress */
|
|
817
|
+
preload: (circuit: UPPCircuitType) => Promise<void>;
|
|
818
|
+
/** Current download progress (null if not downloading) */
|
|
819
|
+
downloadProgress: DownloadProgress | null;
|
|
820
|
+
/** Whether a download is in progress */
|
|
821
|
+
isDownloading: boolean;
|
|
822
|
+
/** Evict a specific circuit from cache */
|
|
823
|
+
evict: (circuit: UPPCircuitType) => Promise<void>;
|
|
824
|
+
/** Evict all cached circuits */
|
|
825
|
+
evictAll: () => Promise<void>;
|
|
826
|
+
/** Cache status for all circuit types (from last refresh) */
|
|
827
|
+
status: Map<UPPCircuitType, CircuitCacheStatus>;
|
|
828
|
+
/** Refresh cache status from IndexedDB */
|
|
829
|
+
refresh: () => Promise<void>;
|
|
830
|
+
/** Request persistent storage */
|
|
831
|
+
requestPersistence: () => Promise<boolean>;
|
|
832
|
+
/** Current circuit version */
|
|
833
|
+
version: string;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* React hook for managing circuit artifact cache.
|
|
837
|
+
*
|
|
838
|
+
* Provides reactive state for download progress and cache status,
|
|
839
|
+
* enabling UI components like download managers and progress bars.
|
|
840
|
+
*
|
|
841
|
+
* @param baseUrl - CDN base URL (defaults to SDK's built-in CDN URL)
|
|
842
|
+
*/
|
|
843
|
+
declare function useCircuitCache(baseUrl?: string): UseCircuitCacheReturn;
|
|
844
|
+
|
|
807
845
|
interface TokenBalanceEntry {
|
|
808
846
|
/** Token contract address */
|
|
809
847
|
token: Address;
|
|
@@ -861,4 +899,4 @@ interface UsePrivateBalanceReturn {
|
|
|
861
899
|
}
|
|
862
900
|
declare function usePrivateBalance(config: PrivateBalanceConfig): UsePrivateBalanceReturn;
|
|
863
901
|
|
|
864
|
-
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, type PrivateBalanceConfig, ProofWorkerManager, type ShieldBuildData, type ShieldConfig, type ShieldParams, ShieldedNote, type SplitNoteBuildData, type SplitNoteParams, type SwapConfig, type SwapOrderBookConfig, type SwapStage, type TokenBalanceEntry, type TokenListItem, TransferStage, UPPAvatar, type UPPAvatarProps, UPPModal, type UPPModalProps, UPPPrivateButton, type UPPPrivateButtonProps, type UsePersonalASPReturn, type UsePoolTransferReturn, type UsePrivateBalanceReturn, type UseShieldReturn, type UseSwapOrderBookReturn, type UseSwapReturn, type UseWithdrawReturn, type WithdrawBuildData, type WithdrawConfig, type WithdrawParams, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, usePrivateBalance, useProofWorker, useShield, useSwap, useSwapOrderBook, useUPPCrypto, useWithdraw };
|
|
902
|
+
export { type AvatarData, type AvatarShape, type CancelOrderBuildData, type CancelOrderParams, CircuitCacheStatus, type ClaimOrderBuildData, type ClaimOrderParams, DownloadProgress, type FillOrderBuildData, type FillOrderParams, NoteCreationResult, type PersonalASPConfig, type PersonalASPInfo, type PlaceOrderBuildData, type PlaceOrderParams, PlonkProvingStage, type PoolTransferBuildData, type PoolTransferConfig, type PoolTransferParams, type PrivateBalanceConfig, ProofWorkerManager, type ShieldBuildData, type ShieldConfig, type ShieldParams, ShieldedNote, type SplitNoteBuildData, type SplitNoteParams, type SwapConfig, type SwapOrderBookConfig, type SwapStage, type TokenBalanceEntry, type TokenListItem, TransferStage, UPPAvatar, type UPPAvatarProps, UPPModal, type UPPModalProps, UPPPrivateButton, type UPPPrivateButtonProps, type UseCircuitCacheReturn, type UsePersonalASPReturn, type UsePoolTransferReturn, type UsePrivateBalanceReturn, type UseShieldReturn, type UseSwapOrderBookReturn, type UseSwapReturn, type UseWithdrawReturn, type WithdrawBuildData, type WithdrawConfig, type WithdrawParams, generateAvatarData, renderAvatarSVG, storePersonalASPId, useCircuitCache, usePersonalASP, usePoolTransfer, usePrivateBalance, 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 { aI as NoteCreationResult, r as ProofWorkerManager, j as DownloadProgress, aJ as PlonkProofStruct, aK as ShieldedNote, a0 as TransferStage, P as PlonkProvingStage, X as SwapOrderEvent, a2 as UPPCircuitType, f as CircuitCacheStatus } from '../transfer-BGzySIhC.js';
|
|
2
|
+
export { A as ASPProof, aR as ASP_TREE_DEPTH, C as CIRCUIT_CDN_BASE, c as CIRCUIT_VERSION, d as CircuitArtifactCache, aP as IndexerConfig, aO as ProofSystemType, aQ as SignTypedDataFn, aN as UPPAccountContextType, aM as UPPAccountProvider, a6 as buildASPTree, ac as computeMultiOriginASPRoot, af as computeSingleOriginASPRoot, ao as generateASPProof, aq as generateMultiOriginASPProof, as as generateSingleOriginASPProof, av as generateUPPProofAsync, aL as useUPPAccount } from '../transfer-BGzySIhC.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';
|
|
@@ -231,7 +231,7 @@ interface PoolTransferConfig {
|
|
|
231
231
|
tokenAddress: Address;
|
|
232
232
|
/** viem PublicClient for reading chain data */
|
|
233
233
|
publicClient: PublicClient;
|
|
234
|
-
/** Circuit artifacts base URL (
|
|
234
|
+
/** Circuit artifacts base URL (defaults to CDN) */
|
|
235
235
|
circuitBaseUrl?: string;
|
|
236
236
|
/** ASP ID to use (default: DEMO_ASP_ID) */
|
|
237
237
|
aspId?: bigint;
|
|
@@ -239,6 +239,8 @@ interface PoolTransferConfig {
|
|
|
239
239
|
aspApprovedOrigins?: bigint[];
|
|
240
240
|
/** Optional proof worker for off-main-thread proving */
|
|
241
241
|
proofWorker?: ProofWorkerManager | null;
|
|
242
|
+
/** Optional callback for circuit download progress (first-time download) */
|
|
243
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
242
244
|
}
|
|
243
245
|
/**
|
|
244
246
|
* Pool transfer parameters
|
|
@@ -321,10 +323,12 @@ interface WithdrawConfig {
|
|
|
321
323
|
tokenAddress: Address;
|
|
322
324
|
/** viem PublicClient for reading chain data */
|
|
323
325
|
publicClient: PublicClient;
|
|
324
|
-
/** Circuit artifacts base URL (
|
|
326
|
+
/** Circuit artifacts base URL (defaults to CDN) */
|
|
325
327
|
circuitBaseUrl?: string;
|
|
326
328
|
/** Optional proof worker for off-main-thread proving */
|
|
327
329
|
proofWorker?: ProofWorkerManager | null;
|
|
330
|
+
/** Optional callback for circuit download progress (first-time download) */
|
|
331
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
328
332
|
}
|
|
329
333
|
/**
|
|
330
334
|
* Withdraw parameters
|
|
@@ -550,12 +554,14 @@ interface SwapConfig {
|
|
|
550
554
|
poolAddress: Address;
|
|
551
555
|
/** viem PublicClient for reading chain data */
|
|
552
556
|
publicClient: PublicClient;
|
|
553
|
-
/** Circuit artifacts base URL (
|
|
557
|
+
/** Circuit artifacts base URL (defaults to CDN) */
|
|
554
558
|
circuitBaseUrl?: string;
|
|
555
559
|
/** All approved origins in the ASP tree (enables multi-origin proofs) */
|
|
556
560
|
aspApprovedOrigins?: bigint[];
|
|
557
561
|
/** Optional proof worker for off-main-thread proving */
|
|
558
562
|
proofWorker?: ProofWorkerManager | null;
|
|
563
|
+
/** Optional callback for circuit download progress (first-time download) */
|
|
564
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
559
565
|
}
|
|
560
566
|
/**
|
|
561
567
|
* Build data returned by buildPlaceOrder — everything needed for the contract call
|
|
@@ -804,6 +810,38 @@ declare function useSwap(config: SwapConfig): UseSwapReturn;
|
|
|
804
810
|
|
|
805
811
|
declare function useProofWorker(worker: Worker | null | undefined): ProofWorkerManager | null;
|
|
806
812
|
|
|
813
|
+
interface UseCircuitCacheReturn {
|
|
814
|
+
/** Check if a specific circuit is cached (synchronous, from last refresh) */
|
|
815
|
+
isCached: (circuit: UPPCircuitType) => boolean;
|
|
816
|
+
/** Preload a circuit (download + cache) with progress */
|
|
817
|
+
preload: (circuit: UPPCircuitType) => Promise<void>;
|
|
818
|
+
/** Current download progress (null if not downloading) */
|
|
819
|
+
downloadProgress: DownloadProgress | null;
|
|
820
|
+
/** Whether a download is in progress */
|
|
821
|
+
isDownloading: boolean;
|
|
822
|
+
/** Evict a specific circuit from cache */
|
|
823
|
+
evict: (circuit: UPPCircuitType) => Promise<void>;
|
|
824
|
+
/** Evict all cached circuits */
|
|
825
|
+
evictAll: () => Promise<void>;
|
|
826
|
+
/** Cache status for all circuit types (from last refresh) */
|
|
827
|
+
status: Map<UPPCircuitType, CircuitCacheStatus>;
|
|
828
|
+
/** Refresh cache status from IndexedDB */
|
|
829
|
+
refresh: () => Promise<void>;
|
|
830
|
+
/** Request persistent storage */
|
|
831
|
+
requestPersistence: () => Promise<boolean>;
|
|
832
|
+
/** Current circuit version */
|
|
833
|
+
version: string;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* React hook for managing circuit artifact cache.
|
|
837
|
+
*
|
|
838
|
+
* Provides reactive state for download progress and cache status,
|
|
839
|
+
* enabling UI components like download managers and progress bars.
|
|
840
|
+
*
|
|
841
|
+
* @param baseUrl - CDN base URL (defaults to SDK's built-in CDN URL)
|
|
842
|
+
*/
|
|
843
|
+
declare function useCircuitCache(baseUrl?: string): UseCircuitCacheReturn;
|
|
844
|
+
|
|
807
845
|
interface TokenBalanceEntry {
|
|
808
846
|
/** Token contract address */
|
|
809
847
|
token: Address;
|
|
@@ -861,4 +899,4 @@ interface UsePrivateBalanceReturn {
|
|
|
861
899
|
}
|
|
862
900
|
declare function usePrivateBalance(config: PrivateBalanceConfig): UsePrivateBalanceReturn;
|
|
863
901
|
|
|
864
|
-
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, type PrivateBalanceConfig, ProofWorkerManager, type ShieldBuildData, type ShieldConfig, type ShieldParams, ShieldedNote, type SplitNoteBuildData, type SplitNoteParams, type SwapConfig, type SwapOrderBookConfig, type SwapStage, type TokenBalanceEntry, type TokenListItem, TransferStage, UPPAvatar, type UPPAvatarProps, UPPModal, type UPPModalProps, UPPPrivateButton, type UPPPrivateButtonProps, type UsePersonalASPReturn, type UsePoolTransferReturn, type UsePrivateBalanceReturn, type UseShieldReturn, type UseSwapOrderBookReturn, type UseSwapReturn, type UseWithdrawReturn, type WithdrawBuildData, type WithdrawConfig, type WithdrawParams, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, usePrivateBalance, useProofWorker, useShield, useSwap, useSwapOrderBook, useUPPCrypto, useWithdraw };
|
|
902
|
+
export { type AvatarData, type AvatarShape, type CancelOrderBuildData, type CancelOrderParams, CircuitCacheStatus, type ClaimOrderBuildData, type ClaimOrderParams, DownloadProgress, type FillOrderBuildData, type FillOrderParams, NoteCreationResult, type PersonalASPConfig, type PersonalASPInfo, type PlaceOrderBuildData, type PlaceOrderParams, PlonkProvingStage, type PoolTransferBuildData, type PoolTransferConfig, type PoolTransferParams, type PrivateBalanceConfig, ProofWorkerManager, type ShieldBuildData, type ShieldConfig, type ShieldParams, ShieldedNote, type SplitNoteBuildData, type SplitNoteParams, type SwapConfig, type SwapOrderBookConfig, type SwapStage, type TokenBalanceEntry, type TokenListItem, TransferStage, UPPAvatar, type UPPAvatarProps, UPPModal, type UPPModalProps, UPPPrivateButton, type UPPPrivateButtonProps, type UseCircuitCacheReturn, type UsePersonalASPReturn, type UsePoolTransferReturn, type UsePrivateBalanceReturn, type UseShieldReturn, type UseSwapOrderBookReturn, type UseSwapReturn, type UseWithdrawReturn, type WithdrawBuildData, type WithdrawConfig, type WithdrawParams, generateAvatarData, renderAvatarSVG, storePersonalASPId, useCircuitCache, usePersonalASP, usePoolTransfer, usePrivateBalance, useProofWorker, useShield, useSwap, useSwapOrderBook, useUPPCrypto, useWithdraw };
|
package/dist/react/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { StorableAccountAdapter, init_stealth, stealth_exports, generateUPPProofAsync, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, ProofWorkerManager, getCancelSecret, SWAP_ORDER_FILLED_EVENT, SWAP_ORDER_CLAIMED_EVENT, SWAP_ORDER_CANCELLED_EVENT, NoteStore } from '../chunk-
|
|
2
|
-
export { ProofWorkerManager, generateUPPProofAsync } from '../chunk-
|
|
1
|
+
import { StorableAccountAdapter, init_stealth, stealth_exports, generateUPPProofAsync, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, ProofWorkerManager, getCancelSecret, SWAP_ORDER_FILLED_EVENT, SWAP_ORDER_CLAIMED_EVENT, SWAP_ORDER_CANCELLED_EVENT, NoteStore } from '../chunk-Q6BLTPWV.js';
|
|
2
|
+
export { ProofWorkerManager, generateUPPProofAsync } from '../chunk-Q6BLTPWV.js';
|
|
3
3
|
import { computeSingleOriginASPRoot } from '../chunk-6IEYWJVS.js';
|
|
4
4
|
export { ASP_TREE_DEPTH, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof } from '../chunk-6IEYWJVS.js';
|
|
5
|
+
import { CircuitArtifactCache, CIRCUIT_VERSION } from '../chunk-2BSIUEPO.js';
|
|
6
|
+
export { CIRCUIT_CDN_BASE, CIRCUIT_VERSION, CircuitArtifactCache } from '../chunk-2BSIUEPO.js';
|
|
5
7
|
import { createAutoAdapter } from '../chunk-XV72HNHN.js';
|
|
6
8
|
import '../chunk-UQIM2KT3.js';
|
|
7
9
|
import { init_poseidon, computeOwnerHash } from '../chunk-5QSSX3KR.js';
|
|
@@ -1710,8 +1712,8 @@ function usePoolTransfer(config) {
|
|
|
1710
1712
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1711
1713
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1712
1714
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1713
|
-
import('../transfer-
|
|
1714
|
-
import('../proof-
|
|
1715
|
+
import('../transfer-MLVRASM3.js'),
|
|
1716
|
+
import('../proof-YMXBL4D5.js'),
|
|
1715
1717
|
import('../asp-72WUGTQE.js')
|
|
1716
1718
|
]);
|
|
1717
1719
|
const {
|
|
@@ -1752,9 +1754,10 @@ function usePoolTransfer(config) {
|
|
|
1752
1754
|
const { proof } = await generateUPPProofAsync(
|
|
1753
1755
|
"transfer",
|
|
1754
1756
|
circuitInputs,
|
|
1755
|
-
cfg.circuitBaseUrl
|
|
1757
|
+
cfg.circuitBaseUrl,
|
|
1756
1758
|
{
|
|
1757
1759
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
1760
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
1758
1761
|
worker: cfg.proofWorker
|
|
1759
1762
|
}
|
|
1760
1763
|
);
|
|
@@ -1867,8 +1870,8 @@ function useWithdraw(config) {
|
|
|
1867
1870
|
const token = BigInt(selectedNote.token);
|
|
1868
1871
|
setStage("creating_outputs");
|
|
1869
1872
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1870
|
-
import('../transfer-
|
|
1871
|
-
import('../proof-
|
|
1873
|
+
import('../transfer-MLVRASM3.js'),
|
|
1874
|
+
import('../proof-YMXBL4D5.js'),
|
|
1872
1875
|
import('../index.js')
|
|
1873
1876
|
]);
|
|
1874
1877
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
@@ -1935,9 +1938,10 @@ function useWithdraw(config) {
|
|
|
1935
1938
|
const { proof } = await generateUPPProofAsync(
|
|
1936
1939
|
"withdraw",
|
|
1937
1940
|
circuitInputs,
|
|
1938
|
-
cfg.circuitBaseUrl
|
|
1941
|
+
cfg.circuitBaseUrl,
|
|
1939
1942
|
{
|
|
1940
1943
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
1944
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
1941
1945
|
worker: cfg.proofWorker
|
|
1942
1946
|
}
|
|
1943
1947
|
);
|
|
@@ -2244,8 +2248,8 @@ function useSwap(config) {
|
|
|
2244
2248
|
}
|
|
2245
2249
|
setStage("creating_outputs");
|
|
2246
2250
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2247
|
-
import('../transfer-
|
|
2248
|
-
import('../proof-
|
|
2251
|
+
import('../transfer-MLVRASM3.js'),
|
|
2252
|
+
import('../proof-YMXBL4D5.js'),
|
|
2249
2253
|
import('../index.js'),
|
|
2250
2254
|
import('../asp-72WUGTQE.js')
|
|
2251
2255
|
]);
|
|
@@ -2313,9 +2317,10 @@ function useSwap(config) {
|
|
|
2313
2317
|
const { proof } = await generateUPPProofAsync(
|
|
2314
2318
|
"withdraw",
|
|
2315
2319
|
circuitInputs,
|
|
2316
|
-
cfg.circuitBaseUrl
|
|
2320
|
+
cfg.circuitBaseUrl,
|
|
2317
2321
|
{
|
|
2318
2322
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
2323
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
2319
2324
|
worker: cfg.proofWorker
|
|
2320
2325
|
}
|
|
2321
2326
|
);
|
|
@@ -2391,8 +2396,8 @@ function useSwap(config) {
|
|
|
2391
2396
|
}
|
|
2392
2397
|
setStage("creating_outputs");
|
|
2393
2398
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2394
|
-
import('../transfer-
|
|
2395
|
-
import('../proof-
|
|
2399
|
+
import('../transfer-MLVRASM3.js'),
|
|
2400
|
+
import('../proof-YMXBL4D5.js'),
|
|
2396
2401
|
import('../index.js'),
|
|
2397
2402
|
import('../asp-72WUGTQE.js')
|
|
2398
2403
|
]);
|
|
@@ -2466,9 +2471,10 @@ function useSwap(config) {
|
|
|
2466
2471
|
const { proof } = await generateUPPProofAsync(
|
|
2467
2472
|
"withdraw",
|
|
2468
2473
|
circuitInputs,
|
|
2469
|
-
cfg.circuitBaseUrl
|
|
2474
|
+
cfg.circuitBaseUrl,
|
|
2470
2475
|
{
|
|
2471
2476
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
2477
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
2472
2478
|
worker: cfg.proofWorker
|
|
2473
2479
|
}
|
|
2474
2480
|
);
|
|
@@ -2628,8 +2634,8 @@ function useSwap(config) {
|
|
|
2628
2634
|
createNoteForSelf(changeAmount, origin, token)
|
|
2629
2635
|
]);
|
|
2630
2636
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2631
|
-
import('../transfer-
|
|
2632
|
-
import('../proof-
|
|
2637
|
+
import('../transfer-MLVRASM3.js'),
|
|
2638
|
+
import('../proof-YMXBL4D5.js'),
|
|
2633
2639
|
import('../asp-72WUGTQE.js')
|
|
2634
2640
|
]);
|
|
2635
2641
|
const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
|
|
@@ -2662,9 +2668,10 @@ function useSwap(config) {
|
|
|
2662
2668
|
const { proof } = await generateUPPProofAsync(
|
|
2663
2669
|
"transfer",
|
|
2664
2670
|
circuitInputs,
|
|
2665
|
-
cfg.circuitBaseUrl
|
|
2671
|
+
cfg.circuitBaseUrl,
|
|
2666
2672
|
{
|
|
2667
2673
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
2674
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
2668
2675
|
worker: cfg.proofWorker
|
|
2669
2676
|
}
|
|
2670
2677
|
);
|
|
@@ -2758,6 +2765,71 @@ function useProofWorker(worker) {
|
|
|
2758
2765
|
}, [worker]);
|
|
2759
2766
|
return manager;
|
|
2760
2767
|
}
|
|
2768
|
+
function useCircuitCache(baseUrl) {
|
|
2769
|
+
const [status, setStatus] = useState(/* @__PURE__ */ new Map());
|
|
2770
|
+
const [downloadProgress, setDownloadProgress] = useState(null);
|
|
2771
|
+
const [isDownloading, setIsDownloading] = useState(false);
|
|
2772
|
+
const cacheRef = useRef(null);
|
|
2773
|
+
if (!cacheRef.current) {
|
|
2774
|
+
cacheRef.current = CircuitArtifactCache.shared();
|
|
2775
|
+
}
|
|
2776
|
+
const cache = cacheRef.current;
|
|
2777
|
+
const refresh = useCallback(async () => {
|
|
2778
|
+
const s = await cache.getStatus();
|
|
2779
|
+
setStatus(s);
|
|
2780
|
+
}, [cache]);
|
|
2781
|
+
useEffect(() => {
|
|
2782
|
+
refresh();
|
|
2783
|
+
}, [refresh]);
|
|
2784
|
+
const isCached = useCallback(
|
|
2785
|
+
(circuit) => {
|
|
2786
|
+
return status.get(circuit)?.cached ?? false;
|
|
2787
|
+
},
|
|
2788
|
+
[status]
|
|
2789
|
+
);
|
|
2790
|
+
const preload = useCallback(
|
|
2791
|
+
async (circuit) => {
|
|
2792
|
+
setIsDownloading(true);
|
|
2793
|
+
setDownloadProgress(null);
|
|
2794
|
+
try {
|
|
2795
|
+
await cache.preload(circuit, baseUrl, (p) => {
|
|
2796
|
+
setDownloadProgress(p);
|
|
2797
|
+
});
|
|
2798
|
+
await refresh();
|
|
2799
|
+
} finally {
|
|
2800
|
+
setIsDownloading(false);
|
|
2801
|
+
setDownloadProgress(null);
|
|
2802
|
+
}
|
|
2803
|
+
},
|
|
2804
|
+
[cache, baseUrl, refresh]
|
|
2805
|
+
);
|
|
2806
|
+
const evict = useCallback(
|
|
2807
|
+
async (circuit) => {
|
|
2808
|
+
await cache.evict(circuit);
|
|
2809
|
+
await refresh();
|
|
2810
|
+
},
|
|
2811
|
+
[cache, refresh]
|
|
2812
|
+
);
|
|
2813
|
+
const evictAll = useCallback(async () => {
|
|
2814
|
+
await cache.evictAll();
|
|
2815
|
+
await refresh();
|
|
2816
|
+
}, [cache, refresh]);
|
|
2817
|
+
const requestPersistence = useCallback(async () => {
|
|
2818
|
+
return cache.requestPersistence();
|
|
2819
|
+
}, [cache]);
|
|
2820
|
+
return {
|
|
2821
|
+
isCached,
|
|
2822
|
+
preload,
|
|
2823
|
+
downloadProgress,
|
|
2824
|
+
isDownloading,
|
|
2825
|
+
evict,
|
|
2826
|
+
evictAll,
|
|
2827
|
+
status,
|
|
2828
|
+
refresh,
|
|
2829
|
+
requestPersistence,
|
|
2830
|
+
version: CIRCUIT_VERSION
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2761
2833
|
function usePrivateBalance(config) {
|
|
2762
2834
|
const { unspentNotes, syncNotes, isSyncing: isNoteSyncing } = useUPPAccount();
|
|
2763
2835
|
const { poolAddress, publicClient, walletAddress, tokenList, autoSync = true, fromBlock = 0n } = config;
|
|
@@ -2907,6 +2979,6 @@ function usePrivateBalance(config) {
|
|
|
2907
2979
|
};
|
|
2908
2980
|
}
|
|
2909
2981
|
|
|
2910
|
-
export { UPPAccountProvider, UPPAvatar, UPPModal, UPPPrivateButton, generateAvatarData, renderAvatarSVG, storePersonalASPId, usePersonalASP, usePoolTransfer, usePrivateBalance, useProofWorker, useShield, useSwap, useSwapOrderBook, useUPPAccount, useUPPCrypto, useWithdraw };
|
|
2982
|
+
export { UPPAccountProvider, UPPAvatar, UPPModal, UPPPrivateButton, generateAvatarData, renderAvatarSVG, storePersonalASPId, useCircuitCache, usePersonalASP, usePoolTransfer, usePrivateBalance, useProofWorker, useShield, useSwap, useSwapOrderBook, useUPPAccount, useUPPCrypto, useWithdraw };
|
|
2911
2983
|
//# sourceMappingURL=index.js.map
|
|
2912
2984
|
//# sourceMappingURL=index.js.map
|