@permissionless-technologies/upp-sdk 0.3.5 → 0.4.0

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 (140) hide show
  1. package/dist/{asp-ZA3RGN7G.js → asp-72WUGTQE.js} +3 -3
  2. package/dist/asp-72WUGTQE.js.map +1 -0
  3. package/dist/{asp-TXSAFFD3.cjs → asp-CUE3NMBN.cjs} +14 -14
  4. package/dist/asp-CUE3NMBN.cjs.map +1 -0
  5. package/dist/{chunk-KXPZUBPI.cjs → chunk-23B5XSS4.cjs} +12 -12
  6. package/dist/{chunk-KXPZUBPI.cjs.map → chunk-23B5XSS4.cjs.map} +1 -1
  7. package/dist/{chunk-SQKBT2SH.cjs → chunk-2G22R7AJ.cjs} +18 -7
  8. package/dist/chunk-2G22R7AJ.cjs.map +1 -0
  9. package/dist/chunk-5QSSX3KR.js +64 -0
  10. package/dist/chunk-5QSSX3KR.js.map +1 -0
  11. package/dist/{chunk-P37MRZ73.js → chunk-6IEYWJVS.js} +8 -8
  12. package/dist/chunk-6IEYWJVS.js.map +1 -0
  13. package/dist/{chunk-5V5HSN6Y.js → chunk-6TFDBBAQ.js} +3 -3
  14. package/dist/{chunk-5V5HSN6Y.js.map → chunk-6TFDBBAQ.js.map} +1 -1
  15. package/dist/{chunk-ZKZV6OI3.cjs → chunk-7BNJV2ZS.cjs} +21 -21
  16. package/dist/{chunk-ZKZV6OI3.cjs.map → chunk-7BNJV2ZS.cjs.map} +1 -1
  17. package/dist/{chunk-XBNYAAMU.js → chunk-7T4CUE6E.js} +3 -3
  18. package/dist/{chunk-XBNYAAMU.js.map → chunk-7T4CUE6E.js.map} +1 -1
  19. package/dist/{chunk-OD2SDC4L.js → chunk-CEJN5ZE5.js} +3 -3
  20. package/dist/{chunk-OD2SDC4L.js.map → chunk-CEJN5ZE5.js.map} +1 -1
  21. package/dist/{chunk-2JQISXBD.js → chunk-DTEAFJG7.js} +8 -8
  22. package/dist/{chunk-2JQISXBD.js.map → chunk-DTEAFJG7.js.map} +1 -1
  23. package/dist/chunk-EHGH6TAW.js +100 -0
  24. package/dist/chunk-EHGH6TAW.js.map +1 -0
  25. package/dist/{chunk-ZU6J7KMY.js → chunk-GPF72JFR.js} +3 -3
  26. package/dist/{chunk-ZU6J7KMY.js.map → chunk-GPF72JFR.js.map} +1 -1
  27. package/dist/chunk-HEHXSV47.cjs +77 -0
  28. package/dist/chunk-HEHXSV47.cjs.map +1 -0
  29. package/dist/chunk-I5EKGD4P.cjs +113 -0
  30. package/dist/chunk-I5EKGD4P.cjs.map +1 -0
  31. package/dist/{chunk-EUP7MBAH.cjs → chunk-IIUKM5VE.cjs} +7 -7
  32. package/dist/{chunk-EUP7MBAH.cjs.map → chunk-IIUKM5VE.cjs.map} +1 -1
  33. package/dist/{chunk-PJLRCR2T.js → chunk-OBBSIPEK.js} +30 -35
  34. package/dist/chunk-OBBSIPEK.js.map +1 -0
  35. package/dist/{chunk-QSL4XPNU.cjs → chunk-Q2E432UK.cjs} +41 -46
  36. package/dist/chunk-Q2E432UK.cjs.map +1 -0
  37. package/dist/{chunk-QKI4QWLT.js → chunk-RNUG3EFC.js} +6 -6
  38. package/dist/{chunk-QKI4QWLT.js.map → chunk-RNUG3EFC.js.map} +1 -1
  39. package/dist/{chunk-3YZSIYJC.cjs → chunk-SWTNJPK5.cjs} +11 -11
  40. package/dist/{chunk-3YZSIYJC.cjs.map → chunk-SWTNJPK5.cjs.map} +1 -1
  41. package/dist/{chunk-BH24DZ5S.cjs → chunk-U3YFYMWF.cjs} +5 -5
  42. package/dist/{chunk-BH24DZ5S.cjs.map → chunk-U3YFYMWF.cjs.map} +1 -1
  43. package/dist/{chunk-3HQ7A6ZM.cjs → chunk-UFEDJJSH.cjs} +5 -5
  44. package/dist/{chunk-3HQ7A6ZM.cjs.map → chunk-UFEDJJSH.cjs.map} +1 -1
  45. package/dist/{chunk-W77GRBO4.js → chunk-UQIM2KT3.js} +3 -3
  46. package/dist/{chunk-W77GRBO4.js.map → chunk-UQIM2KT3.js.map} +1 -1
  47. package/dist/{chunk-SJDPDHSD.cjs → chunk-UTAJSERA.cjs} +4 -4
  48. package/dist/{chunk-SJDPDHSD.cjs.map → chunk-UTAJSERA.cjs.map} +1 -1
  49. package/dist/{chunk-KLGLXF6H.cjs → chunk-UYE2JASE.cjs} +2 -2
  50. package/dist/{chunk-KLGLXF6H.cjs.map → chunk-UYE2JASE.cjs.map} +1 -1
  51. package/dist/{chunk-S4B7GYLN.js → chunk-W3HLIKC2.js} +18 -8
  52. package/dist/chunk-W3HLIKC2.js.map +1 -0
  53. package/dist/{chunk-NDM5EJEV.cjs → chunk-XVIICZKW.cjs} +7 -7
  54. package/dist/chunk-XVIICZKW.cjs.map +1 -0
  55. package/dist/{chunk-OFA2DP7S.js → chunk-ZTVXII74.js} +2 -2
  56. package/dist/{chunk-OFA2DP7S.js.map → chunk-ZTVXII74.js.map} +1 -1
  57. package/dist/core/index.cjs +82 -82
  58. package/dist/core/index.d.cts +2 -2
  59. package/dist/core/index.d.ts +2 -2
  60. package/dist/core/index.js +10 -10
  61. package/dist/{index-B45-okum.d.cts → index-BgPdYxFS.d.cts} +18 -18
  62. package/dist/{index-o-Ds3YAq.d.cts → index-CL4vb3ej.d.cts} +1 -1
  63. package/dist/{index-BIcvNMPt.d.ts → index-CtcXgof_.d.ts} +18 -18
  64. package/dist/{index-DwAJBoU7.d.ts → index-D6nvfm59.d.ts} +1 -1
  65. package/dist/index.cjs +175 -176
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.d.cts +3 -3
  68. package/dist/index.d.ts +3 -3
  69. package/dist/index.js +29 -30
  70. package/dist/index.js.map +1 -1
  71. package/dist/indexer/index.cjs +6 -6
  72. package/dist/indexer/index.d.cts +5 -5
  73. package/dist/indexer/index.d.ts +5 -5
  74. package/dist/indexer/index.js +1 -1
  75. package/dist/keys/index.cjs +18 -18
  76. package/dist/keys/index.js +4 -4
  77. package/dist/merkle-DZHEOPH3.cjs +30 -0
  78. package/dist/{merkle-HGDC6OB4.cjs.map → merkle-DZHEOPH3.cjs.map} +1 -1
  79. package/dist/merkle-IF2RMWCF.js +5 -0
  80. package/dist/{merkle-7KS2EHRF.js.map → merkle-IF2RMWCF.js.map} +1 -1
  81. package/dist/poseidon-ACM7E2OH.js +7 -0
  82. package/dist/{poseidon-UHTJLWQM.js.map → poseidon-ACM7E2OH.js.map} +1 -1
  83. package/dist/poseidon-PUSGUIVZ.cjs +61 -0
  84. package/dist/{poseidon-WHJSZSNP.cjs.map → poseidon-PUSGUIVZ.cjs.map} +1 -1
  85. package/dist/proof-JME3IZTX.js +4 -0
  86. package/dist/{proof-C4YBP6RY.js.map → proof-JME3IZTX.js.map} +1 -1
  87. package/dist/proof-XR6XE5PJ.cjs +49 -0
  88. package/dist/{proof-5OECB3RQ.cjs.map → proof-XR6XE5PJ.cjs.map} +1 -1
  89. package/dist/react/index.cjs +52 -55
  90. package/dist/react/index.cjs.map +1 -1
  91. package/dist/react/index.d.cts +2 -2
  92. package/dist/react/index.d.ts +2 -2
  93. package/dist/react/index.js +25 -28
  94. package/dist/react/index.js.map +1 -1
  95. package/dist/{transfer-BzyernBd.d.cts → transfer-D111ihqN.d.cts} +108 -56
  96. package/dist/{transfer-sqS6mJko.d.ts → transfer-DvIXqHCr.d.ts} +108 -56
  97. package/dist/transfer-MQMGSXTH.js +8 -0
  98. package/dist/{transfer-P4D57KJ5.js.map → transfer-MQMGSXTH.js.map} +1 -1
  99. package/dist/transfer-PB6D5VCW.cjs +37 -0
  100. package/dist/{transfer-XCVVZ7FF.cjs.map → transfer-PB6D5VCW.cjs.map} +1 -1
  101. package/dist/utils/index.cjs +60 -61
  102. package/dist/utils/index.d.cts +37 -14
  103. package/dist/utils/index.d.ts +37 -14
  104. package/dist/utils/index.js +6 -7
  105. package/package.json +4 -2
  106. package/src/contracts/interfaces/IUniversalPrivatePool.sol +10 -8
  107. package/src/contracts/interfaces/IVerifiers.sol +16 -52
  108. package/src/deployments/11155111.json +15 -12
  109. package/dist/asp-TXSAFFD3.cjs.map +0 -1
  110. package/dist/asp-ZA3RGN7G.js.map +0 -1
  111. package/dist/babyjubjub-2MGQVCKB.js +0 -5
  112. package/dist/babyjubjub-2MGQVCKB.js.map +0 -1
  113. package/dist/babyjubjub-MWZLJOVZ.cjs +0 -66
  114. package/dist/babyjubjub-MWZLJOVZ.cjs.map +0 -1
  115. package/dist/chunk-JWNXBALH.cjs +0 -57
  116. package/dist/chunk-JWNXBALH.cjs.map +0 -1
  117. package/dist/chunk-NDM5EJEV.cjs.map +0 -1
  118. package/dist/chunk-P37MRZ73.js.map +0 -1
  119. package/dist/chunk-PJLRCR2T.js.map +0 -1
  120. package/dist/chunk-PTDVGWHU.cjs +0 -10
  121. package/dist/chunk-PTDVGWHU.cjs.map +0 -1
  122. package/dist/chunk-QSL4XPNU.cjs.map +0 -1
  123. package/dist/chunk-S4B7GYLN.js.map +0 -1
  124. package/dist/chunk-SQKBT2SH.cjs.map +0 -1
  125. package/dist/chunk-TSF6HEVS.cjs +0 -201
  126. package/dist/chunk-TSF6HEVS.cjs.map +0 -1
  127. package/dist/chunk-UAVWYXDN.js +0 -8
  128. package/dist/chunk-UAVWYXDN.js.map +0 -1
  129. package/dist/chunk-V23OSL25.js +0 -48
  130. package/dist/chunk-V23OSL25.js.map +0 -1
  131. package/dist/chunk-YOWDERVC.js +0 -186
  132. package/dist/chunk-YOWDERVC.js.map +0 -1
  133. package/dist/merkle-7KS2EHRF.js +0 -5
  134. package/dist/merkle-HGDC6OB4.cjs +0 -30
  135. package/dist/poseidon-UHTJLWQM.js +0 -7
  136. package/dist/poseidon-WHJSZSNP.cjs +0 -45
  137. package/dist/proof-5OECB3RQ.cjs +0 -45
  138. package/dist/proof-C4YBP6RY.js +0 -4
  139. package/dist/transfer-P4D57KJ5.js +0 -8
  140. package/dist/transfer-XCVVZ7FF.cjs +0 -37
@@ -212,9 +212,10 @@ interface StarkProof {
212
212
  }
213
213
 
214
214
  /**
215
- * ZK Proof Generation and Verification
215
+ * ZK Proof Generation and Verification (BLS12-381 PLONK)
216
216
  *
217
- * Uses snarkjs for Groth16 proof generation in the browser.
217
+ * Uses snarkjs for PLONK proof generation over the BLS12-381 curve.
218
+ * PLONK provides a universal trusted setup (no per-circuit ceremony).
218
219
  */
219
220
 
220
221
  /** State tree depth (32 levels = ~4B notes) */
@@ -234,10 +235,12 @@ type CircuitType = 'shield' | 'transfer' | 'merge' | 'withdraw';
234
235
  */
235
236
  type StealthCircuitType = '1x2' | '2x2';
236
237
  /**
237
- * Input signals for UPP transfer circuit (1-in-2-out)
238
+ * Input signals for UPP transfer circuit (1-in-2-out, BLS12-381 PLONK)
238
239
  *
239
240
  * Matches transfer.circom: Transfer(32, 20)
240
241
  * Public: stateRoot, aspRoot, nullifier, outputCommitment1, outputCommitment2, token
242
+ *
243
+ * Note: Uses hash-based ownership (ownerHash) instead of BabyJubJub pubkeys.
241
244
  */
242
245
  interface UPPTransferCircuitInputs {
243
246
  stateRoot: string;
@@ -256,16 +259,14 @@ interface UPPTransferCircuitInputs {
256
259
  aspPathElements: string[];
257
260
  aspPathIndices: string[];
258
261
  outputAmount1: string;
259
- outputPubkeyX1: string;
260
- outputPubkeyY1: string;
262
+ outputOwnerHash1: string;
261
263
  outputBlinding1: string;
262
264
  outputAmount2: string;
263
- outputPubkeyX2: string;
264
- outputPubkeyY2: string;
265
+ outputOwnerHash2: string;
265
266
  outputBlinding2: string;
266
267
  }
267
268
  /**
268
- * Input signals for UPP withdraw circuit
269
+ * Input signals for UPP withdraw circuit (BLS12-381 PLONK)
269
270
  *
270
271
  * Matches withdraw.circom with optional ASP check (ragequit support)
271
272
  */
@@ -287,6 +288,84 @@ interface UPPWithdrawCircuitInputs {
287
288
  aspPathElements: string[];
288
289
  aspPathIndices: string[];
289
290
  }
291
+ /**
292
+ * Input signals for UPP merge circuit (2-in-1-out, BLS12-381 PLONK)
293
+ */
294
+ interface UPPMergeCircuitInputs {
295
+ stateRoot: string;
296
+ nullifier1: string;
297
+ nullifier2: string;
298
+ outputCommitment: string;
299
+ merger: string;
300
+ token: string;
301
+ inputAmount1: string;
302
+ inputOneTimeSecret1: string;
303
+ inputBlinding1: string;
304
+ inputOrigin1: string;
305
+ inputLeafIndex1: string;
306
+ inputPathElements1: string[];
307
+ inputPathIndices1: string[];
308
+ inputAmount2: string;
309
+ inputOneTimeSecret2: string;
310
+ inputBlinding2: string;
311
+ inputOrigin2: string;
312
+ inputLeafIndex2: string;
313
+ inputPathElements2: string[];
314
+ inputPathIndices2: string[];
315
+ outputAmount: string;
316
+ outputOwnerHash: string;
317
+ outputBlinding: string;
318
+ }
319
+ /**
320
+ * Input signals for UPP joinsplit circuit (4-in-2-out, BLS12-381 PLONK)
321
+ */
322
+ interface UPPJoinSplitCircuitInputs {
323
+ stateRoot: string;
324
+ aspRoot: string;
325
+ nullifier1: string;
326
+ nullifier2: string;
327
+ nullifier3: string;
328
+ nullifier4: string;
329
+ outputCommitment1: string;
330
+ outputCommitment2: string;
331
+ token: string;
332
+ inputAmount1: string;
333
+ inputOneTimeSecret1: string;
334
+ inputBlinding1: string;
335
+ inputOrigin1: string;
336
+ inputLeafIndex1: string;
337
+ inputPathElements1: string[];
338
+ inputPathIndices1: string[];
339
+ inputAmount2: string;
340
+ inputOneTimeSecret2: string;
341
+ inputBlinding2: string;
342
+ inputOrigin2: string;
343
+ inputLeafIndex2: string;
344
+ inputPathElements2: string[];
345
+ inputPathIndices2: string[];
346
+ inputAmount3: string;
347
+ inputOneTimeSecret3: string;
348
+ inputBlinding3: string;
349
+ inputOrigin3: string;
350
+ inputLeafIndex3: string;
351
+ inputPathElements3: string[];
352
+ inputPathIndices3: string[];
353
+ inputAmount4: string;
354
+ inputOneTimeSecret4: string;
355
+ inputBlinding4: string;
356
+ inputOrigin4: string;
357
+ inputLeafIndex4: string;
358
+ inputPathElements4: string[];
359
+ inputPathIndices4: string[];
360
+ aspPathElements: string[];
361
+ aspPathIndices: string[];
362
+ outputAmount1: string;
363
+ outputOwnerHash1: string;
364
+ outputBlinding1: string;
365
+ outputAmount2: string;
366
+ outputOwnerHash2: string;
367
+ outputBlinding2: string;
368
+ }
290
369
  /**
291
370
  * @deprecated Use UPPTransferCircuitInputs instead
292
371
  */
@@ -368,7 +447,7 @@ interface WithdrawCircuitInputs {
368
447
  */
369
448
  type CircuitInputs = ShieldCircuitInputs | TransferCircuitInputs | MergeCircuitInputs | WithdrawCircuitInputs;
370
449
  /**
371
- * Circuit input for 1x2 stealth transfer (1-in-2-out)
450
+ * @deprecated
372
451
  */
373
452
  interface Stealth1x2CircuitInputs {
374
453
  root: string;
@@ -392,7 +471,7 @@ interface Stealth1x2CircuitInputs {
392
471
  outputBlinding2: string;
393
472
  }
394
473
  /**
395
- * Circuit input for 2x2 stealth transfer (2-in-2-out)
474
+ * @deprecated
396
475
  */
397
476
  interface Stealth2x2CircuitInputs {
398
477
  root: string;
@@ -422,9 +501,7 @@ interface Stealth2x2CircuitInputs {
422
501
  outputPubkeyY2: string;
423
502
  outputBlinding2: string;
424
503
  }
425
- /**
426
- * Stealth circuit inputs union
427
- */
504
+ /** @deprecated */
428
505
  type StealthCircuitInputs = Stealth1x2CircuitInputs | Stealth2x2CircuitInputs;
429
506
  /**
430
507
  * Circuit artifact paths
@@ -442,18 +519,14 @@ interface CircuitArtifacts {
442
519
  declare function getUPPCircuitArtifacts(circuit: UPPCircuitType, baseUrl?: string): CircuitArtifacts;
443
520
  /**
444
521
  * @deprecated Use getUPPCircuitArtifacts instead
445
- * Get circuit artifacts for a stealth circuit
446
- *
447
- * @param circuit - Circuit type ('1x2' or '2x2')
448
- * @param baseUrl - Base URL for circuit files (default: '/circuits/')
449
522
  */
450
523
  declare function getStealthCircuitArtifacts(circuit: StealthCircuitType, baseUrl?: string): CircuitArtifacts;
451
524
  /**
452
525
  * UPP circuit inputs union type
453
526
  */
454
- type UPPCircuitInputs = UPPTransferCircuitInputs | UPPWithdrawCircuitInputs;
527
+ type UPPCircuitInputs = UPPTransferCircuitInputs | UPPWithdrawCircuitInputs | UPPMergeCircuitInputs | UPPJoinSplitCircuitInputs;
455
528
  /**
456
- * Generate a ZK proof for a UPP circuit
529
+ * Generate a ZK proof for a UPP circuit (BLS12-381 PLONK)
457
530
  *
458
531
  * @param circuitType - Which UPP circuit to use
459
532
  * @param inputs - Circuit input signals
@@ -472,7 +545,6 @@ type UPPCircuitInputs = UPPTransferCircuitInputs | UPPWithdrawCircuitInputs;
472
545
  declare function generateUPPProof(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl?: string): Promise<ProofResult>;
473
546
  /**
474
547
  * @deprecated Use generateUPPProof instead
475
- * Generate a ZK proof for a circuit (UPP protocol circuits)
476
548
  */
477
549
  declare function generateProof(_circuitType: CircuitType, _inputs: CircuitInputs): Promise<Proof>;
478
550
  /**
@@ -483,35 +555,17 @@ interface ProofResult {
483
555
  publicSignals: string[];
484
556
  }
485
557
  /**
486
- * Generate a ZK proof for stealth circuit (1x2 or 2x2)
487
- *
488
- * @param circuit - Circuit type ('1x2' or '2x2')
489
- * @param inputs - Circuit input signals
490
- * @param baseUrl - Base URL for circuit artifacts (default: '/circuits/')
491
- * @returns Generated proof and public signals
492
- *
493
- * @example
494
- * ```ts
495
- * const { proof, publicSignals } = await generateStealthProof('1x2', {
496
- * root: String(merkleRoot),
497
- * nullifierHash: String(nullifier),
498
- * // ... other inputs
499
- * })
500
- * ```
558
+ * @deprecated Stealth circuits use old Groth16 format
501
559
  */
502
560
  declare function generateStealthProof(circuit: StealthCircuitType, inputs: StealthCircuitInputs, baseUrl?: string): Promise<ProofResult>;
503
561
  /**
504
562
  * Verify a ZK proof
505
- *
506
- * @param circuitType - Which circuit was used
507
- * @param proof - The proof to verify
508
- * @returns True if proof is valid
509
563
  */
510
564
  declare function verifyProof(_circuitType: CircuitType, _proof: Proof): Promise<boolean>;
511
565
  /**
512
- * Format proof for on-chain verification
566
+ * @deprecated Use formatPlonkProofForContract for PLONK proofs.
513
567
  *
514
- * Converts snarkjs proof format to Solidity verifier format
568
+ * Format Groth16 proof for on-chain verification (old format).
515
569
  */
516
570
  declare function formatProofForContract(proof: Proof): {
517
571
  a: [bigint, bigint];
@@ -876,6 +930,9 @@ declare function computeFillPercentage(order: SwapOrder): number;
876
930
  * Merkle tree operations to the compliance SDK.
877
931
  *
878
932
  * In UPP, every transfer must prove the origin is in an approved ASP's allowlist.
933
+ *
934
+ * Uses BLS12-381 Poseidon (128-bit security) for Merkle tree operations,
935
+ * matching the circuit hash function.
879
936
  */
880
937
  declare const ASP_TREE_DEPTH = 20;
881
938
  /**
@@ -964,21 +1021,17 @@ interface ShieldedNote {
964
1021
  proofSystem?: ProofSystemType;
965
1022
  }
966
1023
  /**
967
- * Note creation result
1024
+ * Note creation result (BLS12-381, hash-based ownership)
968
1025
  *
969
- * Commitment = Poseidon(amount, pubkeyX, pubkeyY, blinding, origin, token)
970
- * where (pubkeyX, pubkeyY) = BabyJubJub(ownerSecret)
1026
+ * Commitment = Poseidon(amount, ownerHash, blinding, origin, token)
1027
+ * where ownerHash = Poseidon(ownerSecret)
971
1028
  */
972
1029
  interface NoteCreationResult {
973
1030
  commitment: bigint;
974
- /** The secret whose hash is in the commitment (BabyJubJub private key) */
1031
+ /** The spending secret whose hash proves ownership */
975
1032
  ownerSecret: bigint;
976
- /** Poseidon(ownerSecret) - used for search/display */
1033
+ /** Poseidon(ownerSecret) committed in the note, used for ownership proof */
977
1034
  ownerHash: bigint;
978
- /** BabyJubJub public key X coordinate - used in note commitment */
979
- pubkeyX: bigint;
980
- /** BabyJubJub public key Y coordinate - used in note commitment */
981
- pubkeyY: bigint;
982
1035
  blinding: bigint;
983
1036
  encryptedNote: string;
984
1037
  searchTag: bigint;
@@ -1167,11 +1220,10 @@ interface TransferContext {
1167
1220
  interface TransferBuildResult {
1168
1221
  /** Circuit type used */
1169
1222
  circuit: UPPCircuitType;
1170
- /** Formatted proof for contract */
1223
+ /** Formatted PLONK proof for contract */
1171
1224
  proof: {
1172
- a: [bigint, bigint];
1173
- b: [[bigint, bigint], [bigint, bigint]];
1174
- c: [bigint, bigint];
1225
+ proofBytes: `0x${string}`;
1226
+ publicSignals: bigint[];
1175
1227
  };
1176
1228
  /** Public signals from proof */
1177
1229
  publicSignals: string[];
@@ -1215,9 +1267,9 @@ declare function syncMerkleTree(publicClient: PublicClient, contractAddress: Add
1215
1267
  */
1216
1268
  declare function getMerkleProofsForNotes(notes: SpendableNote[], leaves: bigint[], tree: ReturnType<typeof buildMerkleTree>): Promise<MerkleProofWithNote[]>;
1217
1269
  /**
1218
- * Compute nullifier for a UPP note
1270
+ * Compute nullifier for a UPP note (BLS12-381)
1219
1271
  *
1220
- * Post-quantum nullifier: Poseidon(ownerSecret, leafIndex, commitment)
1272
+ * nullifier = Poseidon(ownerSecret, leafIndex, commitment)
1221
1273
  *
1222
1274
  * @param ownerSecret - Owner secret (hash preimage)
1223
1275
  * @param leafIndex - Leaf index in Merkle tree
@@ -212,9 +212,10 @@ interface StarkProof {
212
212
  }
213
213
 
214
214
  /**
215
- * ZK Proof Generation and Verification
215
+ * ZK Proof Generation and Verification (BLS12-381 PLONK)
216
216
  *
217
- * Uses snarkjs for Groth16 proof generation in the browser.
217
+ * Uses snarkjs for PLONK proof generation over the BLS12-381 curve.
218
+ * PLONK provides a universal trusted setup (no per-circuit ceremony).
218
219
  */
219
220
 
220
221
  /** State tree depth (32 levels = ~4B notes) */
@@ -234,10 +235,12 @@ type CircuitType = 'shield' | 'transfer' | 'merge' | 'withdraw';
234
235
  */
235
236
  type StealthCircuitType = '1x2' | '2x2';
236
237
  /**
237
- * Input signals for UPP transfer circuit (1-in-2-out)
238
+ * Input signals for UPP transfer circuit (1-in-2-out, BLS12-381 PLONK)
238
239
  *
239
240
  * Matches transfer.circom: Transfer(32, 20)
240
241
  * Public: stateRoot, aspRoot, nullifier, outputCommitment1, outputCommitment2, token
242
+ *
243
+ * Note: Uses hash-based ownership (ownerHash) instead of BabyJubJub pubkeys.
241
244
  */
242
245
  interface UPPTransferCircuitInputs {
243
246
  stateRoot: string;
@@ -256,16 +259,14 @@ interface UPPTransferCircuitInputs {
256
259
  aspPathElements: string[];
257
260
  aspPathIndices: string[];
258
261
  outputAmount1: string;
259
- outputPubkeyX1: string;
260
- outputPubkeyY1: string;
262
+ outputOwnerHash1: string;
261
263
  outputBlinding1: string;
262
264
  outputAmount2: string;
263
- outputPubkeyX2: string;
264
- outputPubkeyY2: string;
265
+ outputOwnerHash2: string;
265
266
  outputBlinding2: string;
266
267
  }
267
268
  /**
268
- * Input signals for UPP withdraw circuit
269
+ * Input signals for UPP withdraw circuit (BLS12-381 PLONK)
269
270
  *
270
271
  * Matches withdraw.circom with optional ASP check (ragequit support)
271
272
  */
@@ -287,6 +288,84 @@ interface UPPWithdrawCircuitInputs {
287
288
  aspPathElements: string[];
288
289
  aspPathIndices: string[];
289
290
  }
291
+ /**
292
+ * Input signals for UPP merge circuit (2-in-1-out, BLS12-381 PLONK)
293
+ */
294
+ interface UPPMergeCircuitInputs {
295
+ stateRoot: string;
296
+ nullifier1: string;
297
+ nullifier2: string;
298
+ outputCommitment: string;
299
+ merger: string;
300
+ token: string;
301
+ inputAmount1: string;
302
+ inputOneTimeSecret1: string;
303
+ inputBlinding1: string;
304
+ inputOrigin1: string;
305
+ inputLeafIndex1: string;
306
+ inputPathElements1: string[];
307
+ inputPathIndices1: string[];
308
+ inputAmount2: string;
309
+ inputOneTimeSecret2: string;
310
+ inputBlinding2: string;
311
+ inputOrigin2: string;
312
+ inputLeafIndex2: string;
313
+ inputPathElements2: string[];
314
+ inputPathIndices2: string[];
315
+ outputAmount: string;
316
+ outputOwnerHash: string;
317
+ outputBlinding: string;
318
+ }
319
+ /**
320
+ * Input signals for UPP joinsplit circuit (4-in-2-out, BLS12-381 PLONK)
321
+ */
322
+ interface UPPJoinSplitCircuitInputs {
323
+ stateRoot: string;
324
+ aspRoot: string;
325
+ nullifier1: string;
326
+ nullifier2: string;
327
+ nullifier3: string;
328
+ nullifier4: string;
329
+ outputCommitment1: string;
330
+ outputCommitment2: string;
331
+ token: string;
332
+ inputAmount1: string;
333
+ inputOneTimeSecret1: string;
334
+ inputBlinding1: string;
335
+ inputOrigin1: string;
336
+ inputLeafIndex1: string;
337
+ inputPathElements1: string[];
338
+ inputPathIndices1: string[];
339
+ inputAmount2: string;
340
+ inputOneTimeSecret2: string;
341
+ inputBlinding2: string;
342
+ inputOrigin2: string;
343
+ inputLeafIndex2: string;
344
+ inputPathElements2: string[];
345
+ inputPathIndices2: string[];
346
+ inputAmount3: string;
347
+ inputOneTimeSecret3: string;
348
+ inputBlinding3: string;
349
+ inputOrigin3: string;
350
+ inputLeafIndex3: string;
351
+ inputPathElements3: string[];
352
+ inputPathIndices3: string[];
353
+ inputAmount4: string;
354
+ inputOneTimeSecret4: string;
355
+ inputBlinding4: string;
356
+ inputOrigin4: string;
357
+ inputLeafIndex4: string;
358
+ inputPathElements4: string[];
359
+ inputPathIndices4: string[];
360
+ aspPathElements: string[];
361
+ aspPathIndices: string[];
362
+ outputAmount1: string;
363
+ outputOwnerHash1: string;
364
+ outputBlinding1: string;
365
+ outputAmount2: string;
366
+ outputOwnerHash2: string;
367
+ outputBlinding2: string;
368
+ }
290
369
  /**
291
370
  * @deprecated Use UPPTransferCircuitInputs instead
292
371
  */
@@ -368,7 +447,7 @@ interface WithdrawCircuitInputs {
368
447
  */
369
448
  type CircuitInputs = ShieldCircuitInputs | TransferCircuitInputs | MergeCircuitInputs | WithdrawCircuitInputs;
370
449
  /**
371
- * Circuit input for 1x2 stealth transfer (1-in-2-out)
450
+ * @deprecated
372
451
  */
373
452
  interface Stealth1x2CircuitInputs {
374
453
  root: string;
@@ -392,7 +471,7 @@ interface Stealth1x2CircuitInputs {
392
471
  outputBlinding2: string;
393
472
  }
394
473
  /**
395
- * Circuit input for 2x2 stealth transfer (2-in-2-out)
474
+ * @deprecated
396
475
  */
397
476
  interface Stealth2x2CircuitInputs {
398
477
  root: string;
@@ -422,9 +501,7 @@ interface Stealth2x2CircuitInputs {
422
501
  outputPubkeyY2: string;
423
502
  outputBlinding2: string;
424
503
  }
425
- /**
426
- * Stealth circuit inputs union
427
- */
504
+ /** @deprecated */
428
505
  type StealthCircuitInputs = Stealth1x2CircuitInputs | Stealth2x2CircuitInputs;
429
506
  /**
430
507
  * Circuit artifact paths
@@ -442,18 +519,14 @@ interface CircuitArtifacts {
442
519
  declare function getUPPCircuitArtifacts(circuit: UPPCircuitType, baseUrl?: string): CircuitArtifacts;
443
520
  /**
444
521
  * @deprecated Use getUPPCircuitArtifacts instead
445
- * Get circuit artifacts for a stealth circuit
446
- *
447
- * @param circuit - Circuit type ('1x2' or '2x2')
448
- * @param baseUrl - Base URL for circuit files (default: '/circuits/')
449
522
  */
450
523
  declare function getStealthCircuitArtifacts(circuit: StealthCircuitType, baseUrl?: string): CircuitArtifacts;
451
524
  /**
452
525
  * UPP circuit inputs union type
453
526
  */
454
- type UPPCircuitInputs = UPPTransferCircuitInputs | UPPWithdrawCircuitInputs;
527
+ type UPPCircuitInputs = UPPTransferCircuitInputs | UPPWithdrawCircuitInputs | UPPMergeCircuitInputs | UPPJoinSplitCircuitInputs;
455
528
  /**
456
- * Generate a ZK proof for a UPP circuit
529
+ * Generate a ZK proof for a UPP circuit (BLS12-381 PLONK)
457
530
  *
458
531
  * @param circuitType - Which UPP circuit to use
459
532
  * @param inputs - Circuit input signals
@@ -472,7 +545,6 @@ type UPPCircuitInputs = UPPTransferCircuitInputs | UPPWithdrawCircuitInputs;
472
545
  declare function generateUPPProof(circuitType: UPPCircuitType, inputs: UPPCircuitInputs, baseUrl?: string): Promise<ProofResult>;
473
546
  /**
474
547
  * @deprecated Use generateUPPProof instead
475
- * Generate a ZK proof for a circuit (UPP protocol circuits)
476
548
  */
477
549
  declare function generateProof(_circuitType: CircuitType, _inputs: CircuitInputs): Promise<Proof>;
478
550
  /**
@@ -483,35 +555,17 @@ interface ProofResult {
483
555
  publicSignals: string[];
484
556
  }
485
557
  /**
486
- * Generate a ZK proof for stealth circuit (1x2 or 2x2)
487
- *
488
- * @param circuit - Circuit type ('1x2' or '2x2')
489
- * @param inputs - Circuit input signals
490
- * @param baseUrl - Base URL for circuit artifacts (default: '/circuits/')
491
- * @returns Generated proof and public signals
492
- *
493
- * @example
494
- * ```ts
495
- * const { proof, publicSignals } = await generateStealthProof('1x2', {
496
- * root: String(merkleRoot),
497
- * nullifierHash: String(nullifier),
498
- * // ... other inputs
499
- * })
500
- * ```
558
+ * @deprecated Stealth circuits use old Groth16 format
501
559
  */
502
560
  declare function generateStealthProof(circuit: StealthCircuitType, inputs: StealthCircuitInputs, baseUrl?: string): Promise<ProofResult>;
503
561
  /**
504
562
  * Verify a ZK proof
505
- *
506
- * @param circuitType - Which circuit was used
507
- * @param proof - The proof to verify
508
- * @returns True if proof is valid
509
563
  */
510
564
  declare function verifyProof(_circuitType: CircuitType, _proof: Proof): Promise<boolean>;
511
565
  /**
512
- * Format proof for on-chain verification
566
+ * @deprecated Use formatPlonkProofForContract for PLONK proofs.
513
567
  *
514
- * Converts snarkjs proof format to Solidity verifier format
568
+ * Format Groth16 proof for on-chain verification (old format).
515
569
  */
516
570
  declare function formatProofForContract(proof: Proof): {
517
571
  a: [bigint, bigint];
@@ -876,6 +930,9 @@ declare function computeFillPercentage(order: SwapOrder): number;
876
930
  * Merkle tree operations to the compliance SDK.
877
931
  *
878
932
  * In UPP, every transfer must prove the origin is in an approved ASP's allowlist.
933
+ *
934
+ * Uses BLS12-381 Poseidon (128-bit security) for Merkle tree operations,
935
+ * matching the circuit hash function.
879
936
  */
880
937
  declare const ASP_TREE_DEPTH = 20;
881
938
  /**
@@ -964,21 +1021,17 @@ interface ShieldedNote {
964
1021
  proofSystem?: ProofSystemType;
965
1022
  }
966
1023
  /**
967
- * Note creation result
1024
+ * Note creation result (BLS12-381, hash-based ownership)
968
1025
  *
969
- * Commitment = Poseidon(amount, pubkeyX, pubkeyY, blinding, origin, token)
970
- * where (pubkeyX, pubkeyY) = BabyJubJub(ownerSecret)
1026
+ * Commitment = Poseidon(amount, ownerHash, blinding, origin, token)
1027
+ * where ownerHash = Poseidon(ownerSecret)
971
1028
  */
972
1029
  interface NoteCreationResult {
973
1030
  commitment: bigint;
974
- /** The secret whose hash is in the commitment (BabyJubJub private key) */
1031
+ /** The spending secret whose hash proves ownership */
975
1032
  ownerSecret: bigint;
976
- /** Poseidon(ownerSecret) - used for search/display */
1033
+ /** Poseidon(ownerSecret) committed in the note, used for ownership proof */
977
1034
  ownerHash: bigint;
978
- /** BabyJubJub public key X coordinate - used in note commitment */
979
- pubkeyX: bigint;
980
- /** BabyJubJub public key Y coordinate - used in note commitment */
981
- pubkeyY: bigint;
982
1035
  blinding: bigint;
983
1036
  encryptedNote: string;
984
1037
  searchTag: bigint;
@@ -1167,11 +1220,10 @@ interface TransferContext {
1167
1220
  interface TransferBuildResult {
1168
1221
  /** Circuit type used */
1169
1222
  circuit: UPPCircuitType;
1170
- /** Formatted proof for contract */
1223
+ /** Formatted PLONK proof for contract */
1171
1224
  proof: {
1172
- a: [bigint, bigint];
1173
- b: [[bigint, bigint], [bigint, bigint]];
1174
- c: [bigint, bigint];
1225
+ proofBytes: `0x${string}`;
1226
+ publicSignals: bigint[];
1175
1227
  };
1176
1228
  /** Public signals from proof */
1177
1229
  publicSignals: string[];
@@ -1215,9 +1267,9 @@ declare function syncMerkleTree(publicClient: PublicClient, contractAddress: Add
1215
1267
  */
1216
1268
  declare function getMerkleProofsForNotes(notes: SpendableNote[], leaves: bigint[], tree: ReturnType<typeof buildMerkleTree>): Promise<MerkleProofWithNote[]>;
1217
1269
  /**
1218
- * Compute nullifier for a UPP note
1270
+ * Compute nullifier for a UPP note (BLS12-381)
1219
1271
  *
1220
- * Post-quantum nullifier: Poseidon(ownerSecret, leafIndex, commitment)
1272
+ * nullifier = Poseidon(ownerSecret, leafIndex, commitment)
1221
1273
  *
1222
1274
  * @param ownerSecret - Owner secret (hash preimage)
1223
1275
  * @param leafIndex - Leaf index in Merkle tree
@@ -0,0 +1,8 @@
1
+ export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from './chunk-OBBSIPEK.js';
2
+ import './chunk-GPF72JFR.js';
3
+ import './chunk-6IEYWJVS.js';
4
+ import './chunk-5QSSX3KR.js';
5
+ import './chunk-W3HLIKC2.js';
6
+ import './chunk-Z6ZWNWWR.js';
7
+ //# sourceMappingURL=transfer-MQMGSXTH.js.map
8
+ //# sourceMappingURL=transfer-MQMGSXTH.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-P4D57KJ5.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-MQMGSXTH.js"}
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ var chunkQ2E432UK_cjs = require('./chunk-Q2E432UK.cjs');
4
+ require('./chunk-IIUKM5VE.cjs');
5
+ require('./chunk-XVIICZKW.cjs');
6
+ require('./chunk-HEHXSV47.cjs');
7
+ require('./chunk-2G22R7AJ.cjs');
8
+ require('./chunk-G7VZBCD6.cjs');
9
+
10
+
11
+
12
+ Object.defineProperty(exports, "buildTransfer", {
13
+ enumerable: true,
14
+ get: function () { return chunkQ2E432UK_cjs.buildTransfer; }
15
+ });
16
+ Object.defineProperty(exports, "buildUPPTransferCircuitInputs", {
17
+ enumerable: true,
18
+ get: function () { return chunkQ2E432UK_cjs.buildUPPTransferCircuitInputs; }
19
+ });
20
+ Object.defineProperty(exports, "computeNullifier", {
21
+ enumerable: true,
22
+ get: function () { return chunkQ2E432UK_cjs.computeNullifier; }
23
+ });
24
+ Object.defineProperty(exports, "formatOutputForContract", {
25
+ enumerable: true,
26
+ get: function () { return chunkQ2E432UK_cjs.formatOutputForContract; }
27
+ });
28
+ Object.defineProperty(exports, "getMerkleProofsForNotes", {
29
+ enumerable: true,
30
+ get: function () { return chunkQ2E432UK_cjs.getMerkleProofsForNotes; }
31
+ });
32
+ Object.defineProperty(exports, "syncMerkleTree", {
33
+ enumerable: true,
34
+ get: function () { return chunkQ2E432UK_cjs.syncMerkleTree; }
35
+ });
36
+ //# sourceMappingURL=transfer-PB6D5VCW.cjs.map
37
+ //# sourceMappingURL=transfer-PB6D5VCW.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-XCVVZ7FF.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-PB6D5VCW.cjs"}