@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
@@ -1,5 +1,5 @@
1
- import { ax as NoteCreationResult, ay as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-BzyernBd.cjs';
2
- export { A as ASPProof, aF as ASP_TREE_DEPTH, aD as IndexerConfig, aC as ProofSystemType, aE as SignTypedDataFn, aB as UPPAccountContextType, aA as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, az as useUPPAccount } from '../transfer-BzyernBd.cjs';
1
+ import { ax as NoteCreationResult, ay as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-D111ihqN.cjs';
2
+ export { A as ASPProof, aF as ASP_TREE_DEPTH, aD as IndexerConfig, aC as ProofSystemType, aE as SignTypedDataFn, aB as UPPAccountContextType, aA as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, az as useUPPAccount } from '../transfer-D111ihqN.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';
@@ -1,5 +1,5 @@
1
- import { ax as NoteCreationResult, ay as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-sqS6mJko.js';
2
- export { A as ASPProof, aF as ASP_TREE_DEPTH, aD as IndexerConfig, aC as ProofSystemType, aE as SignTypedDataFn, aB as UPPAccountContextType, aA as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, az as useUPPAccount } from '../transfer-sqS6mJko.js';
1
+ import { ax as NoteCreationResult, ay as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-DvIXqHCr.js';
2
+ export { A as ASPProof, aF as ASP_TREE_DEPTH, aD as IndexerConfig, aC as ProofSystemType, aE as SignTypedDataFn, aB as UPPAccountContextType, aA as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, az as useUPPAccount } from '../transfer-DvIXqHCr.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';
@@ -1,9 +1,9 @@
1
- import { StorableAccountAdapter, init_stealth, stealth_exports, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, NoteStore } from '../chunk-QKI4QWLT.js';
2
- import { computeSingleOriginASPRoot } from '../chunk-P37MRZ73.js';
3
- export { ASP_TREE_DEPTH, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof } from '../chunk-P37MRZ73.js';
1
+ import { StorableAccountAdapter, init_stealth, stealth_exports, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, NoteStore } from '../chunk-RNUG3EFC.js';
2
+ import { computeSingleOriginASPRoot } from '../chunk-6IEYWJVS.js';
3
+ export { ASP_TREE_DEPTH, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof } from '../chunk-6IEYWJVS.js';
4
4
  import { createAutoAdapter } from '../chunk-XV72HNHN.js';
5
- import '../chunk-W77GRBO4.js';
6
- import { init_poseidon, BABYJUBJUB_SUBORDER } from '../chunk-V23OSL25.js';
5
+ import '../chunk-UQIM2KT3.js';
6
+ import { init_poseidon, BABYJUBJUB_SUBORDER } from '../chunk-5QSSX3KR.js';
7
7
  import { __toCommonJS } from '../chunk-Z6ZWNWWR.js';
8
8
  import { createContext, useState, useRef, useEffect, useCallback, useMemo, useContext } from 'react';
9
9
  import { keccak256, toBytes, toHex, getAddress, encodePacked } from 'viem';
@@ -802,11 +802,9 @@ function useUPPAccount() {
802
802
  }
803
803
  async function createHashBasedNote(sdk, amount, spendingSecret, ownerHash, viewingSecret, origin, token) {
804
804
  const blinding = await sdk.randomFieldElement();
805
- const pubkey = await sdk.privateToPublic(spendingSecret);
806
805
  const commitment = await sdk.poseidon([
807
806
  amount,
808
- pubkey.x,
809
- pubkey.y,
807
+ ownerHash,
810
808
  blinding,
811
809
  origin,
812
810
  token
@@ -818,8 +816,6 @@ async function createHashBasedNote(sdk, amount, spendingSecret, ownerHash, viewi
818
816
  commitment,
819
817
  ownerSecret: spendingSecret,
820
818
  ownerHash,
821
- pubkeyX: pubkey.x,
822
- pubkeyY: pubkey.y,
823
819
  blinding,
824
820
  encryptedNote,
825
821
  searchTag,
@@ -1601,9 +1597,9 @@ function usePoolTransfer(config) {
1601
1597
  const recipientNote = await createNoteForSelf(amount, origin, token);
1602
1598
  const changeNote = await createNoteForSelf(changeAmount, origin, token);
1603
1599
  const [transferModule, proofModule, aspModule] = await Promise.all([
1604
- import('../transfer-P4D57KJ5.js'),
1605
- import('../proof-C4YBP6RY.js'),
1606
- import('../asp-ZA3RGN7G.js')
1600
+ import('../transfer-MQMGSXTH.js'),
1601
+ import('../proof-JME3IZTX.js'),
1602
+ import('../asp-72WUGTQE.js')
1607
1603
  ]);
1608
1604
  const {
1609
1605
  syncMerkleTree,
@@ -1760,8 +1756,8 @@ function useWithdraw(config) {
1760
1756
  const token = BigInt(selectedNote.token);
1761
1757
  setStage("creating_outputs");
1762
1758
  const [transferModule, proofModule, sdk] = await Promise.all([
1763
- import('../transfer-P4D57KJ5.js'),
1764
- import('../proof-C4YBP6RY.js'),
1759
+ import('../transfer-MQMGSXTH.js'),
1760
+ import('../proof-JME3IZTX.js'),
1765
1761
  import('../index.js')
1766
1762
  ]);
1767
1763
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
@@ -1988,6 +1984,7 @@ function storePersonalASPId(chainId, address, aspId) {
1988
1984
  }
1989
1985
  init_poseidon();
1990
1986
  var STATE_TREE_DEPTH2 = 32;
1987
+ var ASP_TREE_DEPTH3 = 20;
1991
1988
  function padToDepth2(arr, padValue, depth) {
1992
1989
  if (arr.length >= depth) return arr.slice(0, depth);
1993
1990
  return [...arr, ...Array(depth - arr.length).fill(padValue)];
@@ -2139,10 +2136,10 @@ function useSwap(config) {
2139
2136
  }
2140
2137
  setStage("creating_outputs");
2141
2138
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2142
- import('../transfer-P4D57KJ5.js'),
2143
- import('../proof-C4YBP6RY.js'),
2139
+ import('../transfer-MQMGSXTH.js'),
2140
+ import('../proof-JME3IZTX.js'),
2144
2141
  import('../index.js'),
2145
- import('../asp-ZA3RGN7G.js')
2142
+ import('../asp-72WUGTQE.js')
2146
2143
  ]);
2147
2144
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
2148
2145
  const { generateUPPProof, formatProofForContract } = proofModule;
@@ -2202,8 +2199,8 @@ function useSwap(config) {
2202
2199
  inputLeafIndex: actualLeafIndex.toString(),
2203
2200
  inputPathElements: padToDepth2(merkleProof.pathElements.map(String), "0", STATE_TREE_DEPTH2),
2204
2201
  inputPathIndices: padToDepth2(merkleProof.pathIndices.map(String), "0", STATE_TREE_DEPTH2),
2205
- aspPathElements: aspProofData.aspPathElements.map(String),
2206
- aspPathIndices: aspProofData.aspPathIndices.map(String)
2202
+ aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
2203
+ aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
2207
2204
  };
2208
2205
  const { proof } = await generateUPPProof(
2209
2206
  "withdraw",
@@ -2291,10 +2288,10 @@ function useSwap(config) {
2291
2288
  }
2292
2289
  setStage("creating_outputs");
2293
2290
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2294
- import('../transfer-P4D57KJ5.js'),
2295
- import('../proof-C4YBP6RY.js'),
2291
+ import('../transfer-MQMGSXTH.js'),
2292
+ import('../proof-JME3IZTX.js'),
2296
2293
  import('../index.js'),
2297
- import('../asp-ZA3RGN7G.js')
2294
+ import('../asp-72WUGTQE.js')
2298
2295
  ]);
2299
2296
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
2300
2297
  const { generateUPPProof, formatProofForContract } = proofModule;
@@ -2360,8 +2357,8 @@ function useSwap(config) {
2360
2357
  inputLeafIndex: actualLeafIndex.toString(),
2361
2358
  inputPathElements: padToDepth2(merkleProof.pathElements.map(String), "0", STATE_TREE_DEPTH2),
2362
2359
  inputPathIndices: padToDepth2(merkleProof.pathIndices.map(String), "0", STATE_TREE_DEPTH2),
2363
- aspPathElements: aspProofData.aspPathElements.map(String),
2364
- aspPathIndices: aspProofData.aspPathIndices.map(String)
2360
+ aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
2361
+ aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
2365
2362
  };
2366
2363
  const { proof } = await generateUPPProof(
2367
2364
  "withdraw",
@@ -2521,9 +2518,9 @@ function useSwap(config) {
2521
2518
  createNoteForSelf(changeAmount, origin, token)
2522
2519
  ]);
2523
2520
  const [transferModule, proofModule, aspModule] = await Promise.all([
2524
- import('../transfer-P4D57KJ5.js'),
2525
- import('../proof-C4YBP6RY.js'),
2526
- import('../asp-ZA3RGN7G.js')
2521
+ import('../transfer-MQMGSXTH.js'),
2522
+ import('../proof-JME3IZTX.js'),
2523
+ import('../asp-72WUGTQE.js')
2527
2524
  ]);
2528
2525
  const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
2529
2526
  const { generateUPPProof, formatProofForContract } = proofModule;