@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
|
@@ -207,6 +207,106 @@ interface StarkProof {
|
|
|
207
207
|
publicInputsSeed: Hex;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Circuit Artifact Cache — IndexedDB-based caching for PLONK circuit files.
|
|
212
|
+
*
|
|
213
|
+
* Downloads circuit artifacts (wasm + zkey) with progress reporting via
|
|
214
|
+
* ReadableStream, caches them in IndexedDB, and returns Uint8Array data
|
|
215
|
+
* that can be passed directly to snarkjs.plonk.fullProve().
|
|
216
|
+
*
|
|
217
|
+
* Works in both main thread and Web Worker contexts.
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Current circuit artifact version (date-based).
|
|
222
|
+
* Bump this when circuits are recompiled (new trusted setup, circuit changes).
|
|
223
|
+
* Old cached artifacts are ignored (different key prefix in IndexedDB).
|
|
224
|
+
*/
|
|
225
|
+
declare const CIRCUIT_VERSION = "20260330";
|
|
226
|
+
/** Default CDN base URL for circuit artifacts */
|
|
227
|
+
declare const CIRCUIT_CDN_BASE = "https://circuits.upd.io/20260330/";
|
|
228
|
+
/** Progress report during circuit artifact download */
|
|
229
|
+
interface DownloadProgress {
|
|
230
|
+
circuitType: UPPCircuitType;
|
|
231
|
+
artifact: 'wasm' | 'zkey';
|
|
232
|
+
bytesDownloaded: number;
|
|
233
|
+
totalBytes: number;
|
|
234
|
+
/** 0-100 */
|
|
235
|
+
percent: number;
|
|
236
|
+
}
|
|
237
|
+
/** Resolved (binary) circuit artifacts ready for snarkjs */
|
|
238
|
+
interface ResolvedCircuitArtifacts {
|
|
239
|
+
wasm: Uint8Array;
|
|
240
|
+
zkey: Uint8Array;
|
|
241
|
+
}
|
|
242
|
+
/** Per-circuit cache status */
|
|
243
|
+
interface CircuitCacheStatus {
|
|
244
|
+
cached: boolean;
|
|
245
|
+
wasmSize?: number;
|
|
246
|
+
zkeySize?: number;
|
|
247
|
+
}
|
|
248
|
+
declare class CircuitArtifactCache {
|
|
249
|
+
private static _instance;
|
|
250
|
+
static shared(): CircuitArtifactCache;
|
|
251
|
+
/** In-flight download deduplication */
|
|
252
|
+
private inflight;
|
|
253
|
+
private constructor();
|
|
254
|
+
private key;
|
|
255
|
+
private resolveBaseUrl;
|
|
256
|
+
/**
|
|
257
|
+
* Check if both wasm + zkey are cached for a circuit (current CIRCUIT_VERSION).
|
|
258
|
+
*/
|
|
259
|
+
isCached(circuit: UPPCircuitType): Promise<boolean>;
|
|
260
|
+
/**
|
|
261
|
+
* Download and cache a circuit's artifacts. No-ops if already cached.
|
|
262
|
+
*
|
|
263
|
+
* @param circuit - Which circuit to preload
|
|
264
|
+
* @param baseUrl - CDN base URL (defaults to `https://circuits.upd.io/${CIRCUIT_VERSION}/`)
|
|
265
|
+
* @param onProgress - Byte-level download progress callback
|
|
266
|
+
* @param signal - AbortSignal for cancellation
|
|
267
|
+
*/
|
|
268
|
+
preload(circuit: UPPCircuitType, baseUrl?: string, onProgress?: (p: DownloadProgress) => void, signal?: AbortSignal): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Get artifacts from cache, downloading if needed.
|
|
271
|
+
* Returns Uint8Array data ready to pass to snarkjs.plonk.fullProve().
|
|
272
|
+
*/
|
|
273
|
+
getArtifacts(circuit: UPPCircuitType, baseUrl?: string, onProgress?: (p: DownloadProgress) => void, signal?: AbortSignal): Promise<ResolvedCircuitArtifacts>;
|
|
274
|
+
/**
|
|
275
|
+
* List all cached circuit types (current version only).
|
|
276
|
+
*/
|
|
277
|
+
getCachedCircuits(): Promise<UPPCircuitType[]>;
|
|
278
|
+
/**
|
|
279
|
+
* Get cache size information.
|
|
280
|
+
*/
|
|
281
|
+
getCacheSize(): Promise<{
|
|
282
|
+
total: number;
|
|
283
|
+
circuits: Record<string, number>;
|
|
284
|
+
}>;
|
|
285
|
+
/**
|
|
286
|
+
* Get cache status for all circuit types.
|
|
287
|
+
*/
|
|
288
|
+
getStatus(): Promise<Map<UPPCircuitType, CircuitCacheStatus>>;
|
|
289
|
+
/**
|
|
290
|
+
* Evict a specific circuit from cache (current version).
|
|
291
|
+
*/
|
|
292
|
+
evict(circuit: UPPCircuitType): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Evict all cached circuit artifacts (all versions).
|
|
295
|
+
*/
|
|
296
|
+
evictAll(): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Evict all artifacts for a specific version (for cleaning up after SDK updates).
|
|
299
|
+
*/
|
|
300
|
+
evictVersion(version: string): Promise<void>;
|
|
301
|
+
/**
|
|
302
|
+
* Request persistent storage to prevent browser from evicting the cache.
|
|
303
|
+
* Returns true if granted, false if denied or unavailable.
|
|
304
|
+
*/
|
|
305
|
+
requestPersistence(): Promise<boolean>;
|
|
306
|
+
private getOrDownload;
|
|
307
|
+
private downloadAndStore;
|
|
308
|
+
}
|
|
309
|
+
|
|
210
310
|
/**
|
|
211
311
|
* ZK Proof Generation and Verification (BLS12-381 PLONK)
|
|
212
312
|
*
|
|
@@ -524,17 +624,29 @@ type UPPCircuitInputs = UPPTransferCircuitInputs | UPPWithdrawCircuitInputs | UP
|
|
|
524
624
|
/**
|
|
525
625
|
* PLONK proving stage for progress reporting
|
|
526
626
|
*/
|
|
527
|
-
type PlonkProvingStage = 'loading' | 'witness' | 'round1' | 'round2' | 'round3' | 'round4' | 'round5' | 'done';
|
|
627
|
+
type PlonkProvingStage = 'downloading' | 'loading' | 'witness' | 'round1' | 'round2' | 'round3' | 'round4' | 'round5' | 'done';
|
|
528
628
|
/**
|
|
529
629
|
* Generate a ZK proof for a UPP circuit (BLS12-381 PLONK)
|
|
530
630
|
*
|
|
631
|
+
* Downloads circuit artifacts (with caching) and generates a PLONK proof.
|
|
632
|
+
* Artifacts are cached in IndexedDB after first download.
|
|
633
|
+
*
|
|
531
634
|
* @param circuitType - Which UPP circuit to use
|
|
532
635
|
* @param inputs - Circuit input signals
|
|
533
|
-
* @param baseUrl - Base URL for circuit artifacts (
|
|
636
|
+
* @param baseUrl - Base URL for circuit artifacts (defaults to CDN)
|
|
534
637
|
* @param onProgress - Optional callback for proving progress
|
|
638
|
+
* @param options - Optional pre-loaded artifacts or download progress callback
|
|
535
639
|
* @returns Generated proof and public signals
|
|
536
640
|
*/
|
|
537
|
-
declare function generateUPPProof(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl?: string, onProgress?: (stage: PlonkProvingStage, message: string) => void
|
|
641
|
+
declare function generateUPPProof(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl?: string, onProgress?: (stage: PlonkProvingStage, message: string) => void, options?: {
|
|
642
|
+
/** Pre-loaded artifacts (bypasses download + cache entirely) */
|
|
643
|
+
artifacts?: {
|
|
644
|
+
wasm: Uint8Array;
|
|
645
|
+
zkey: Uint8Array;
|
|
646
|
+
};
|
|
647
|
+
/** Download progress callback (bytes downloaded / total) */
|
|
648
|
+
onDownloadProgress?: (p: DownloadProgress) => void;
|
|
649
|
+
}): Promise<ProofResult>;
|
|
538
650
|
/**
|
|
539
651
|
* @deprecated Use generateUPPProof instead
|
|
540
652
|
*/
|
|
@@ -620,6 +732,10 @@ type ProofWorkerResponse = {
|
|
|
620
732
|
id: string;
|
|
621
733
|
stage: PlonkProvingStage;
|
|
622
734
|
message: string;
|
|
735
|
+
} | {
|
|
736
|
+
type: 'download-progress';
|
|
737
|
+
id: string;
|
|
738
|
+
progress: DownloadProgress;
|
|
623
739
|
} | {
|
|
624
740
|
type: 'result';
|
|
625
741
|
id: string;
|
|
@@ -641,7 +757,7 @@ declare class ProofWorkerManager {
|
|
|
641
757
|
* @param signal - AbortSignal for cancellation. When aborted, the promise
|
|
642
758
|
* rejects with AbortError. Call terminate() for hard cancellation.
|
|
643
759
|
*/
|
|
644
|
-
prove(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl: string, onProgress?: (stage: PlonkProvingStage, message: string) => void, signal?: AbortSignal): Promise<ProofResult>;
|
|
760
|
+
prove(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl: string, onProgress?: (stage: PlonkProvingStage, message: string) => void, signal?: AbortSignal, onDownloadProgress?: (progress: DownloadProgress) => void): Promise<ProofResult>;
|
|
645
761
|
/**
|
|
646
762
|
* Hard-terminate the worker. All pending proofs are rejected.
|
|
647
763
|
*/
|
|
@@ -652,9 +768,12 @@ declare class ProofWorkerManager {
|
|
|
652
768
|
*
|
|
653
769
|
* This is the recommended entry point for proof generation. It provides a
|
|
654
770
|
* unified API regardless of whether a worker is available.
|
|
771
|
+
*
|
|
772
|
+
* Circuit artifacts are automatically cached in IndexedDB after first download.
|
|
655
773
|
*/
|
|
656
774
|
declare function generateUPPProofAsync(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl?: string, options?: {
|
|
657
775
|
onProgress?: (stage: PlonkProvingStage, message: string) => void;
|
|
776
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
658
777
|
signal?: AbortSignal;
|
|
659
778
|
worker?: ProofWorkerManager | null;
|
|
660
779
|
}): Promise<ProofResult>;
|
|
@@ -1476,4 +1595,4 @@ declare function formatOutputForContract(note: NoteCreationResult): {
|
|
|
1476
1595
|
encryptedNote: Hex;
|
|
1477
1596
|
};
|
|
1478
1597
|
|
|
1479
|
-
export { type
|
|
1598
|
+
export { type TransferParams as $, type ASPProof as A, type ShieldParams as B, CIRCUIT_CDN_BASE as C, DEMO_ASP_ID as D, type EncryptedNote as E, type SpendableNote as F, type StarkNote as G, type StarkProof as H, type StarkStealthMetaAddress as I, type Stealth1x2CircuitInputs as J, type Stealth2x2CircuitInputs as K, type StealthAddress as L, type MergeParams as M, NOTE_VERSION as N, type StealthCircuitInputs as O, type PlonkProvingStage as P, type StealthCircuitType as Q, RATE_PRECISION as R, STATE_TREE_DEPTH as S, type StealthMetaAddress as T, type SwapFillEvent as U, type SwapFillParams as V, type SwapOrder as W, type SwapOrderEvent as X, type SwapOrderParams as Y, type TransferBuildResult as Z, type TransferContext as _, type ASPRoot as a, type TransferStage as a0, type UPPCircuitInputs as a1, type UPPCircuitType as a2, type UPPTransferCircuitInputs as a3, type UPPWithdrawCircuitInputs as a4, type WithdrawParams as a5, buildASPTree as a6, buildTransfer as a7, buildUPPTransferCircuitInputs as a8, computeCancelKeyHash as a9, getUPPCircuitArtifacts as aA, isFillerASPAccepted as aB, isOrderActive as aC, removeCancelSecret as aD, storeCancelSecret as aE, syncMerkleTree as aF, verifyASPProof as aG, verifyProof as aH, type NoteCreationResult as aI, type PlonkProofStruct as aJ, type ShieldedNote as aK, useUPPAccount as aL, UPPAccountProvider as aM, type UPPAccountContextType as aN, type ProofSystemType as aO, type IndexerConfig as aP, type SignTypedDataFn as aQ, ASP_TREE_DEPTH as aR, computeFillPercentage as aa, computeGiveAmount as ab, computeMultiOriginASPRoot as ac, computeNullifier as ad, computeRate as ae, computeSingleOriginASPRoot as af, computeTakeAmount as ag, computeTotalBuyAmount as ah, createDemoASPRoot as ai, filterOrdersByASP as aj, filterOrdersByTokenPair as ak, formatOutputForContract as al, formatProofForContract as am, formatRate as an, generateASPProof as ao, generateCancelSecret as ap, generateMultiOriginASPProof as aq, generateProof as ar, generateSingleOriginASPProof as as, generateStealthProof as at, generateUPPProof as au, generateUPPProofAsync as av, getCancelSecret as aw, getMerkleProofsForNotes as ax, getOwnOrderIds as ay, getStealthCircuitArtifacts as az, ASP_TREE_DEPTH$1 as b, CIRCUIT_VERSION as c, CircuitArtifactCache as d, type CircuitArtifacts as e, type CircuitCacheStatus as f, type CircuitType as g, type Commitment as h, DEMO_ASP_NAME as i, type DownloadProgress as j, type MergeRecord as k, type MerkleProofWithNote as l, type Note as m, type NoteWithAmount as n, type Nullifier as o, type Proof as p, type ProofResult as q, ProofWorkerManager as r, type ProofWorkerRequest as s, type ProofWorkerResponse as t, type ResolvedCircuitArtifacts as u, SWAP_EVENTS_ABI as v, SWAP_ORDER_CANCELLED_EVENT as w, SWAP_ORDER_CLAIMED_EVENT as x, SWAP_ORDER_FILLED_EVENT as y, SWAP_ORDER_PLACED_EVENT as z };
|
|
@@ -207,6 +207,106 @@ interface StarkProof {
|
|
|
207
207
|
publicInputsSeed: Hex;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Circuit Artifact Cache — IndexedDB-based caching for PLONK circuit files.
|
|
212
|
+
*
|
|
213
|
+
* Downloads circuit artifacts (wasm + zkey) with progress reporting via
|
|
214
|
+
* ReadableStream, caches them in IndexedDB, and returns Uint8Array data
|
|
215
|
+
* that can be passed directly to snarkjs.plonk.fullProve().
|
|
216
|
+
*
|
|
217
|
+
* Works in both main thread and Web Worker contexts.
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Current circuit artifact version (date-based).
|
|
222
|
+
* Bump this when circuits are recompiled (new trusted setup, circuit changes).
|
|
223
|
+
* Old cached artifacts are ignored (different key prefix in IndexedDB).
|
|
224
|
+
*/
|
|
225
|
+
declare const CIRCUIT_VERSION = "20260330";
|
|
226
|
+
/** Default CDN base URL for circuit artifacts */
|
|
227
|
+
declare const CIRCUIT_CDN_BASE = "https://circuits.upd.io/20260330/";
|
|
228
|
+
/** Progress report during circuit artifact download */
|
|
229
|
+
interface DownloadProgress {
|
|
230
|
+
circuitType: UPPCircuitType;
|
|
231
|
+
artifact: 'wasm' | 'zkey';
|
|
232
|
+
bytesDownloaded: number;
|
|
233
|
+
totalBytes: number;
|
|
234
|
+
/** 0-100 */
|
|
235
|
+
percent: number;
|
|
236
|
+
}
|
|
237
|
+
/** Resolved (binary) circuit artifacts ready for snarkjs */
|
|
238
|
+
interface ResolvedCircuitArtifacts {
|
|
239
|
+
wasm: Uint8Array;
|
|
240
|
+
zkey: Uint8Array;
|
|
241
|
+
}
|
|
242
|
+
/** Per-circuit cache status */
|
|
243
|
+
interface CircuitCacheStatus {
|
|
244
|
+
cached: boolean;
|
|
245
|
+
wasmSize?: number;
|
|
246
|
+
zkeySize?: number;
|
|
247
|
+
}
|
|
248
|
+
declare class CircuitArtifactCache {
|
|
249
|
+
private static _instance;
|
|
250
|
+
static shared(): CircuitArtifactCache;
|
|
251
|
+
/** In-flight download deduplication */
|
|
252
|
+
private inflight;
|
|
253
|
+
private constructor();
|
|
254
|
+
private key;
|
|
255
|
+
private resolveBaseUrl;
|
|
256
|
+
/**
|
|
257
|
+
* Check if both wasm + zkey are cached for a circuit (current CIRCUIT_VERSION).
|
|
258
|
+
*/
|
|
259
|
+
isCached(circuit: UPPCircuitType): Promise<boolean>;
|
|
260
|
+
/**
|
|
261
|
+
* Download and cache a circuit's artifacts. No-ops if already cached.
|
|
262
|
+
*
|
|
263
|
+
* @param circuit - Which circuit to preload
|
|
264
|
+
* @param baseUrl - CDN base URL (defaults to `https://circuits.upd.io/${CIRCUIT_VERSION}/`)
|
|
265
|
+
* @param onProgress - Byte-level download progress callback
|
|
266
|
+
* @param signal - AbortSignal for cancellation
|
|
267
|
+
*/
|
|
268
|
+
preload(circuit: UPPCircuitType, baseUrl?: string, onProgress?: (p: DownloadProgress) => void, signal?: AbortSignal): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Get artifacts from cache, downloading if needed.
|
|
271
|
+
* Returns Uint8Array data ready to pass to snarkjs.plonk.fullProve().
|
|
272
|
+
*/
|
|
273
|
+
getArtifacts(circuit: UPPCircuitType, baseUrl?: string, onProgress?: (p: DownloadProgress) => void, signal?: AbortSignal): Promise<ResolvedCircuitArtifacts>;
|
|
274
|
+
/**
|
|
275
|
+
* List all cached circuit types (current version only).
|
|
276
|
+
*/
|
|
277
|
+
getCachedCircuits(): Promise<UPPCircuitType[]>;
|
|
278
|
+
/**
|
|
279
|
+
* Get cache size information.
|
|
280
|
+
*/
|
|
281
|
+
getCacheSize(): Promise<{
|
|
282
|
+
total: number;
|
|
283
|
+
circuits: Record<string, number>;
|
|
284
|
+
}>;
|
|
285
|
+
/**
|
|
286
|
+
* Get cache status for all circuit types.
|
|
287
|
+
*/
|
|
288
|
+
getStatus(): Promise<Map<UPPCircuitType, CircuitCacheStatus>>;
|
|
289
|
+
/**
|
|
290
|
+
* Evict a specific circuit from cache (current version).
|
|
291
|
+
*/
|
|
292
|
+
evict(circuit: UPPCircuitType): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Evict all cached circuit artifacts (all versions).
|
|
295
|
+
*/
|
|
296
|
+
evictAll(): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Evict all artifacts for a specific version (for cleaning up after SDK updates).
|
|
299
|
+
*/
|
|
300
|
+
evictVersion(version: string): Promise<void>;
|
|
301
|
+
/**
|
|
302
|
+
* Request persistent storage to prevent browser from evicting the cache.
|
|
303
|
+
* Returns true if granted, false if denied or unavailable.
|
|
304
|
+
*/
|
|
305
|
+
requestPersistence(): Promise<boolean>;
|
|
306
|
+
private getOrDownload;
|
|
307
|
+
private downloadAndStore;
|
|
308
|
+
}
|
|
309
|
+
|
|
210
310
|
/**
|
|
211
311
|
* ZK Proof Generation and Verification (BLS12-381 PLONK)
|
|
212
312
|
*
|
|
@@ -524,17 +624,29 @@ type UPPCircuitInputs = UPPTransferCircuitInputs | UPPWithdrawCircuitInputs | UP
|
|
|
524
624
|
/**
|
|
525
625
|
* PLONK proving stage for progress reporting
|
|
526
626
|
*/
|
|
527
|
-
type PlonkProvingStage = 'loading' | 'witness' | 'round1' | 'round2' | 'round3' | 'round4' | 'round5' | 'done';
|
|
627
|
+
type PlonkProvingStage = 'downloading' | 'loading' | 'witness' | 'round1' | 'round2' | 'round3' | 'round4' | 'round5' | 'done';
|
|
528
628
|
/**
|
|
529
629
|
* Generate a ZK proof for a UPP circuit (BLS12-381 PLONK)
|
|
530
630
|
*
|
|
631
|
+
* Downloads circuit artifacts (with caching) and generates a PLONK proof.
|
|
632
|
+
* Artifacts are cached in IndexedDB after first download.
|
|
633
|
+
*
|
|
531
634
|
* @param circuitType - Which UPP circuit to use
|
|
532
635
|
* @param inputs - Circuit input signals
|
|
533
|
-
* @param baseUrl - Base URL for circuit artifacts (
|
|
636
|
+
* @param baseUrl - Base URL for circuit artifacts (defaults to CDN)
|
|
534
637
|
* @param onProgress - Optional callback for proving progress
|
|
638
|
+
* @param options - Optional pre-loaded artifacts or download progress callback
|
|
535
639
|
* @returns Generated proof and public signals
|
|
536
640
|
*/
|
|
537
|
-
declare function generateUPPProof(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl?: string, onProgress?: (stage: PlonkProvingStage, message: string) => void
|
|
641
|
+
declare function generateUPPProof(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl?: string, onProgress?: (stage: PlonkProvingStage, message: string) => void, options?: {
|
|
642
|
+
/** Pre-loaded artifacts (bypasses download + cache entirely) */
|
|
643
|
+
artifacts?: {
|
|
644
|
+
wasm: Uint8Array;
|
|
645
|
+
zkey: Uint8Array;
|
|
646
|
+
};
|
|
647
|
+
/** Download progress callback (bytes downloaded / total) */
|
|
648
|
+
onDownloadProgress?: (p: DownloadProgress) => void;
|
|
649
|
+
}): Promise<ProofResult>;
|
|
538
650
|
/**
|
|
539
651
|
* @deprecated Use generateUPPProof instead
|
|
540
652
|
*/
|
|
@@ -620,6 +732,10 @@ type ProofWorkerResponse = {
|
|
|
620
732
|
id: string;
|
|
621
733
|
stage: PlonkProvingStage;
|
|
622
734
|
message: string;
|
|
735
|
+
} | {
|
|
736
|
+
type: 'download-progress';
|
|
737
|
+
id: string;
|
|
738
|
+
progress: DownloadProgress;
|
|
623
739
|
} | {
|
|
624
740
|
type: 'result';
|
|
625
741
|
id: string;
|
|
@@ -641,7 +757,7 @@ declare class ProofWorkerManager {
|
|
|
641
757
|
* @param signal - AbortSignal for cancellation. When aborted, the promise
|
|
642
758
|
* rejects with AbortError. Call terminate() for hard cancellation.
|
|
643
759
|
*/
|
|
644
|
-
prove(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl: string, onProgress?: (stage: PlonkProvingStage, message: string) => void, signal?: AbortSignal): Promise<ProofResult>;
|
|
760
|
+
prove(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl: string, onProgress?: (stage: PlonkProvingStage, message: string) => void, signal?: AbortSignal, onDownloadProgress?: (progress: DownloadProgress) => void): Promise<ProofResult>;
|
|
645
761
|
/**
|
|
646
762
|
* Hard-terminate the worker. All pending proofs are rejected.
|
|
647
763
|
*/
|
|
@@ -652,9 +768,12 @@ declare class ProofWorkerManager {
|
|
|
652
768
|
*
|
|
653
769
|
* This is the recommended entry point for proof generation. It provides a
|
|
654
770
|
* unified API regardless of whether a worker is available.
|
|
771
|
+
*
|
|
772
|
+
* Circuit artifacts are automatically cached in IndexedDB after first download.
|
|
655
773
|
*/
|
|
656
774
|
declare function generateUPPProofAsync(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl?: string, options?: {
|
|
657
775
|
onProgress?: (stage: PlonkProvingStage, message: string) => void;
|
|
776
|
+
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
658
777
|
signal?: AbortSignal;
|
|
659
778
|
worker?: ProofWorkerManager | null;
|
|
660
779
|
}): Promise<ProofResult>;
|
|
@@ -1476,4 +1595,4 @@ declare function formatOutputForContract(note: NoteCreationResult): {
|
|
|
1476
1595
|
encryptedNote: Hex;
|
|
1477
1596
|
};
|
|
1478
1597
|
|
|
1479
|
-
export { type
|
|
1598
|
+
export { type TransferParams as $, type ASPProof as A, type ShieldParams as B, CIRCUIT_CDN_BASE as C, DEMO_ASP_ID as D, type EncryptedNote as E, type SpendableNote as F, type StarkNote as G, type StarkProof as H, type StarkStealthMetaAddress as I, type Stealth1x2CircuitInputs as J, type Stealth2x2CircuitInputs as K, type StealthAddress as L, type MergeParams as M, NOTE_VERSION as N, type StealthCircuitInputs as O, type PlonkProvingStage as P, type StealthCircuitType as Q, RATE_PRECISION as R, STATE_TREE_DEPTH as S, type StealthMetaAddress as T, type SwapFillEvent as U, type SwapFillParams as V, type SwapOrder as W, type SwapOrderEvent as X, type SwapOrderParams as Y, type TransferBuildResult as Z, type TransferContext as _, type ASPRoot as a, type TransferStage as a0, type UPPCircuitInputs as a1, type UPPCircuitType as a2, type UPPTransferCircuitInputs as a3, type UPPWithdrawCircuitInputs as a4, type WithdrawParams as a5, buildASPTree as a6, buildTransfer as a7, buildUPPTransferCircuitInputs as a8, computeCancelKeyHash as a9, getUPPCircuitArtifacts as aA, isFillerASPAccepted as aB, isOrderActive as aC, removeCancelSecret as aD, storeCancelSecret as aE, syncMerkleTree as aF, verifyASPProof as aG, verifyProof as aH, type NoteCreationResult as aI, type PlonkProofStruct as aJ, type ShieldedNote as aK, useUPPAccount as aL, UPPAccountProvider as aM, type UPPAccountContextType as aN, type ProofSystemType as aO, type IndexerConfig as aP, type SignTypedDataFn as aQ, ASP_TREE_DEPTH as aR, computeFillPercentage as aa, computeGiveAmount as ab, computeMultiOriginASPRoot as ac, computeNullifier as ad, computeRate as ae, computeSingleOriginASPRoot as af, computeTakeAmount as ag, computeTotalBuyAmount as ah, createDemoASPRoot as ai, filterOrdersByASP as aj, filterOrdersByTokenPair as ak, formatOutputForContract as al, formatProofForContract as am, formatRate as an, generateASPProof as ao, generateCancelSecret as ap, generateMultiOriginASPProof as aq, generateProof as ar, generateSingleOriginASPProof as as, generateStealthProof as at, generateUPPProof as au, generateUPPProofAsync as av, getCancelSecret as aw, getMerkleProofsForNotes as ax, getOwnOrderIds as ay, getStealthCircuitArtifacts as az, ASP_TREE_DEPTH$1 as b, CIRCUIT_VERSION as c, CircuitArtifactCache as d, type CircuitArtifacts as e, type CircuitCacheStatus as f, type CircuitType as g, type Commitment as h, DEMO_ASP_NAME as i, type DownloadProgress as j, type MergeRecord as k, type MerkleProofWithNote as l, type Note as m, type NoteWithAmount as n, type Nullifier as o, type Proof as p, type ProofResult as q, ProofWorkerManager as r, type ProofWorkerRequest as s, type ProofWorkerResponse as t, type ResolvedCircuitArtifacts as u, SWAP_EVENTS_ABI as v, SWAP_ORDER_CANCELLED_EVENT as w, SWAP_ORDER_CLAIMED_EVENT as x, SWAP_ORDER_FILLED_EVENT as y, SWAP_ORDER_PLACED_EVENT as z };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkDYSU7JYL_cjs = require('./chunk-DYSU7JYL.cjs');
|
|
4
|
+
require('./chunk-IX7HV5TE.cjs');
|
|
5
5
|
require('./chunk-IIUKM5VE.cjs');
|
|
6
6
|
require('./chunk-XVIICZKW.cjs');
|
|
7
|
+
require('./chunk-VVW5VVY3.cjs');
|
|
7
8
|
require('./chunk-HEHXSV47.cjs');
|
|
8
9
|
require('./chunk-G7VZBCD6.cjs');
|
|
9
10
|
|
|
@@ -11,27 +12,27 @@ require('./chunk-G7VZBCD6.cjs');
|
|
|
11
12
|
|
|
12
13
|
Object.defineProperty(exports, "buildTransfer", {
|
|
13
14
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkDYSU7JYL_cjs.buildTransfer; }
|
|
15
16
|
});
|
|
16
17
|
Object.defineProperty(exports, "buildUPPTransferCircuitInputs", {
|
|
17
18
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkDYSU7JYL_cjs.buildUPPTransferCircuitInputs; }
|
|
19
20
|
});
|
|
20
21
|
Object.defineProperty(exports, "computeNullifier", {
|
|
21
22
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkDYSU7JYL_cjs.computeNullifier; }
|
|
23
24
|
});
|
|
24
25
|
Object.defineProperty(exports, "formatOutputForContract", {
|
|
25
26
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkDYSU7JYL_cjs.formatOutputForContract; }
|
|
27
28
|
});
|
|
28
29
|
Object.defineProperty(exports, "getMerkleProofsForNotes", {
|
|
29
30
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkDYSU7JYL_cjs.getMerkleProofsForNotes; }
|
|
31
32
|
});
|
|
32
33
|
Object.defineProperty(exports, "syncMerkleTree", {
|
|
33
34
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkDYSU7JYL_cjs.syncMerkleTree; }
|
|
35
36
|
});
|
|
36
|
-
//# sourceMappingURL=transfer-
|
|
37
|
-
//# sourceMappingURL=transfer-
|
|
37
|
+
//# sourceMappingURL=transfer-H6UWWUSN.cjs.map
|
|
38
|
+
//# sourceMappingURL=transfer-H6UWWUSN.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-H6UWWUSN.cjs"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from './chunk-XDWRMHLY.js';
|
|
2
|
+
import './chunk-KR4GB6VC.js';
|
|
3
3
|
import './chunk-GPF72JFR.js';
|
|
4
4
|
import './chunk-6IEYWJVS.js';
|
|
5
|
+
import './chunk-2BSIUEPO.js';
|
|
5
6
|
import './chunk-5QSSX3KR.js';
|
|
6
7
|
import './chunk-Z6ZWNWWR.js';
|
|
7
|
-
//# sourceMappingURL=transfer-
|
|
8
|
-
//# sourceMappingURL=transfer-
|
|
8
|
+
//# sourceMappingURL=transfer-MLVRASM3.js.map
|
|
9
|
+
//# sourceMappingURL=transfer-MLVRASM3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-MLVRASM3.js"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
"UniversalPrivatePool": "
|
|
2
|
+
"UniversalPrivatePool": "0xba5405375ee4c1b5fdcb1b755381edcc38ae28f2",
|
|
3
3
|
"ASPRegistryHub": "0xfd11c56a23314aa88dfbcc36254f33e5e8b010df",
|
|
4
|
-
"TestToken": "
|
|
5
|
-
"TestToken2": "
|
|
4
|
+
"TestToken": "0xc3cef670aae8228de206c98b67c3d25c520b8f14",
|
|
5
|
+
"TestToken2": "0x4de3efd64d4ce9a4b45f538104bdbaadaf170bed",
|
|
6
6
|
"verifiers": {
|
|
7
|
-
"TransferVerifier": "
|
|
8
|
-
"MergeVerifier": "
|
|
9
|
-
"WithdrawVerifier": "
|
|
10
|
-
"JoinSplitVerifier": "
|
|
11
|
-
"MergeTransfer2x2Verifier": "
|
|
12
|
-
"MergeTransfer4x2Verifier": "
|
|
7
|
+
"TransferVerifier": "0xe4a737e8e3100709986e1992d8e18cf324965320",
|
|
8
|
+
"MergeVerifier": "0x3a844672f792d3b1216e4e64acd8c5d0301a3a3e",
|
|
9
|
+
"WithdrawVerifier": "0x387afb8566d446c8344e03b8a9c54ba96b22233d",
|
|
10
|
+
"JoinSplitVerifier": "0xe03c270de9b33f72a0656b07ed43f3269d586607",
|
|
11
|
+
"MergeTransfer2x2Verifier": "0xbc1378d567abdfad063cd32b684e03ca29e79b99",
|
|
12
|
+
"MergeTransfer4x2Verifier": "0xd1f75b988e6fd6003204bda6e83eb3186a8dec34"
|
|
13
13
|
},
|
|
14
14
|
"starkVerifiers": {
|
|
15
|
-
"CircleStarkVerifier": "
|
|
15
|
+
"CircleStarkVerifier": "0xc92ba214653c616c4546d7edcb7aba8ced3e0a94"
|
|
16
16
|
},
|
|
17
|
-
"deployBlock":
|
|
18
|
-
"deployTimestamp":
|
|
17
|
+
"deployBlock": 10555332,
|
|
18
|
+
"deployTimestamp": 1774895534634,
|
|
19
19
|
"proofSystem": "PLONK",
|
|
20
20
|
"curve": "BLS12-381",
|
|
21
21
|
"verifierType": "PlonkVerifierBLS12381"
|