@permissionless-technologies/upp-sdk 0.3.4 → 0.3.6

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkRZE7Z5BR_cjs = require('../chunk-RZE7Z5BR.cjs');
3
+ var chunkNI62M3W3_cjs = require('../chunk-NI62M3W3.cjs');
4
4
  var chunkERQE57IA_cjs = require('../chunk-ERQE57IA.cjs');
5
5
  require('../chunk-G7VZBCD6.cjs');
6
6
 
@@ -8,23 +8,23 @@ require('../chunk-G7VZBCD6.cjs');
8
8
 
9
9
  Object.defineProperty(exports, "computeSearchTag", {
10
10
  enumerable: true,
11
- get: function () { return chunkRZE7Z5BR_cjs.computeSearchTag; }
11
+ get: function () { return chunkNI62M3W3_cjs.computeSearchTag; }
12
12
  });
13
13
  Object.defineProperty(exports, "makeRpcIndexer", {
14
14
  enumerable: true,
15
- get: function () { return chunkRZE7Z5BR_cjs.makeRpcIndexer; }
15
+ get: function () { return chunkNI62M3W3_cjs.makeRpcIndexer; }
16
16
  });
17
17
  Object.defineProperty(exports, "matchesSearchTag", {
18
18
  enumerable: true,
19
- get: function () { return chunkRZE7Z5BR_cjs.matchesSearchTag; }
19
+ get: function () { return chunkNI62M3W3_cjs.matchesSearchTag; }
20
20
  });
21
21
  Object.defineProperty(exports, "tryDecryptNote", {
22
22
  enumerable: true,
23
- get: function () { return chunkRZE7Z5BR_cjs.tryDecryptNote; }
23
+ get: function () { return chunkNI62M3W3_cjs.tryDecryptNote; }
24
24
  });
25
25
  Object.defineProperty(exports, "unpackNoteData", {
26
26
  enumerable: true,
27
- get: function () { return chunkRZE7Z5BR_cjs.unpackNoteData; }
27
+ get: function () { return chunkNI62M3W3_cjs.unpackNoteData; }
28
28
  });
29
29
  Object.defineProperty(exports, "createAutoAdapter", {
30
30
  enumerable: true,
@@ -1,4 +1,4 @@
1
- export { computeSearchTag, makeRpcIndexer, matchesSearchTag, tryDecryptNote, unpackNoteData } from '../chunk-YVFH6RBX.js';
1
+ export { computeSearchTag, makeRpcIndexer, matchesSearchTag, tryDecryptNote, unpackNoteData } from '../chunk-7Q4RSSHM.js';
2
2
  export { createAutoAdapter, createIndexedDBAdapter, createLocalStorageAdapter, createMemoryAdapter, indexedDBAdapter, localStorageAdapter, memoryAdapter } from '../chunk-XV72HNHN.js';
3
3
  import '../chunk-Z6ZWNWWR.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -1602,7 +1602,7 @@ function usePoolTransfer(config) {
1602
1602
  const recipientNote = await createNoteForSelf(amount, origin, token);
1603
1603
  const changeNote = await createNoteForSelf(changeAmount, origin, token);
1604
1604
  const [transferModule, proofModule, aspModule] = await Promise.all([
1605
- import('../transfer-RCVNV4VC.cjs'),
1605
+ import('../transfer-42C4DXYA.cjs'),
1606
1606
  import('../proof-5OECB3RQ.cjs'),
1607
1607
  import('../asp-TXSAFFD3.cjs')
1608
1608
  ]);
@@ -1761,7 +1761,7 @@ function useWithdraw(config) {
1761
1761
  const token = BigInt(selectedNote.token);
1762
1762
  setStage("creating_outputs");
1763
1763
  const [transferModule, proofModule, sdk] = await Promise.all([
1764
- import('../transfer-RCVNV4VC.cjs'),
1764
+ import('../transfer-42C4DXYA.cjs'),
1765
1765
  import('../proof-5OECB3RQ.cjs'),
1766
1766
  import('../index.cjs')
1767
1767
  ]);
@@ -1989,6 +1989,7 @@ function storePersonalASPId(chainId, address, aspId) {
1989
1989
  }
1990
1990
  chunkJWNXBALH_cjs.init_poseidon();
1991
1991
  var STATE_TREE_DEPTH2 = 32;
1992
+ var ASP_TREE_DEPTH3 = 20;
1992
1993
  function padToDepth2(arr, padValue, depth) {
1993
1994
  if (arr.length >= depth) return arr.slice(0, depth);
1994
1995
  return [...arr, ...Array(depth - arr.length).fill(padValue)];
@@ -2140,7 +2141,7 @@ function useSwap(config) {
2140
2141
  }
2141
2142
  setStage("creating_outputs");
2142
2143
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2143
- import('../transfer-RCVNV4VC.cjs'),
2144
+ import('../transfer-42C4DXYA.cjs'),
2144
2145
  import('../proof-5OECB3RQ.cjs'),
2145
2146
  import('../index.cjs'),
2146
2147
  import('../asp-TXSAFFD3.cjs')
@@ -2187,7 +2188,7 @@ function useSwap(config) {
2187
2188
  BigInt(actualLeafIndex),
2188
2189
  storedCommitment
2189
2190
  ]);
2190
- const aspProofData = await generateASPProof2(aspId, origin, cfg.aspApprovedOrigins);
2191
+ const aspProofData = params.aspProof ? { aspId, aspRoot: params.aspProof.root, aspPathElements: params.aspProof.pathElements, aspPathIndices: params.aspProof.pathIndices } : await generateASPProof2(aspId, origin, cfg.aspApprovedOrigins);
2191
2192
  const circuitInputs = {
2192
2193
  stateRoot: stateRootBI.toString(),
2193
2194
  aspRoot: aspProofData.aspRoot.toString(),
@@ -2203,8 +2204,8 @@ function useSwap(config) {
2203
2204
  inputLeafIndex: actualLeafIndex.toString(),
2204
2205
  inputPathElements: padToDepth2(merkleProof.pathElements.map(String), "0", STATE_TREE_DEPTH2),
2205
2206
  inputPathIndices: padToDepth2(merkleProof.pathIndices.map(String), "0", STATE_TREE_DEPTH2),
2206
- aspPathElements: aspProofData.aspPathElements.map(String),
2207
- aspPathIndices: aspProofData.aspPathIndices.map(String)
2207
+ aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
2208
+ aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
2208
2209
  };
2209
2210
  const { proof } = await generateUPPProof(
2210
2211
  "withdraw",
@@ -2292,7 +2293,7 @@ function useSwap(config) {
2292
2293
  }
2293
2294
  setStage("creating_outputs");
2294
2295
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2295
- import('../transfer-RCVNV4VC.cjs'),
2296
+ import('../transfer-42C4DXYA.cjs'),
2296
2297
  import('../proof-5OECB3RQ.cjs'),
2297
2298
  import('../index.cjs'),
2298
2299
  import('../asp-TXSAFFD3.cjs')
@@ -2345,7 +2346,7 @@ function useSwap(config) {
2345
2346
  BigInt(actualLeafIndex),
2346
2347
  storedCommitmentF
2347
2348
  ]);
2348
- const aspProofData = await generateASPProof2(aspId, origin, cfg.aspApprovedOrigins);
2349
+ const aspProofData = params.aspProof ? { aspId, aspRoot: params.aspProof.root, aspPathElements: params.aspProof.pathElements, aspPathIndices: params.aspProof.pathIndices } : await generateASPProof2(aspId, origin, cfg.aspApprovedOrigins);
2349
2350
  const circuitInputs = {
2350
2351
  stateRoot: stateRootBI.toString(),
2351
2352
  aspRoot: aspProofData.aspRoot.toString(),
@@ -2361,8 +2362,8 @@ function useSwap(config) {
2361
2362
  inputLeafIndex: actualLeafIndex.toString(),
2362
2363
  inputPathElements: padToDepth2(merkleProof.pathElements.map(String), "0", STATE_TREE_DEPTH2),
2363
2364
  inputPathIndices: padToDepth2(merkleProof.pathIndices.map(String), "0", STATE_TREE_DEPTH2),
2364
- aspPathElements: aspProofData.aspPathElements.map(String),
2365
- aspPathIndices: aspProofData.aspPathIndices.map(String)
2365
+ aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
2366
+ aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
2366
2367
  };
2367
2368
  const { proof } = await generateUPPProof(
2368
2369
  "withdraw",
@@ -2522,7 +2523,7 @@ function useSwap(config) {
2522
2523
  createNoteForSelf(changeAmount, origin, token)
2523
2524
  ]);
2524
2525
  const [transferModule, proofModule, aspModule] = await Promise.all([
2525
- import('../transfer-RCVNV4VC.cjs'),
2526
+ import('../transfer-42C4DXYA.cjs'),
2526
2527
  import('../proof-5OECB3RQ.cjs'),
2527
2528
  import('../asp-TXSAFFD3.cjs')
2528
2529
  ]);
@@ -2542,7 +2543,7 @@ function useSwap(config) {
2542
2543
  token
2543
2544
  };
2544
2545
  const [noteProof] = await getMerkleProofsForNotes([spendableNote], leaves, tree);
2545
- const aspProof = await generateASPProof2(splitAspId ?? DEMO_ASP_ID, origin, cfg.aspApprovedOrigins);
2546
+ const aspProof = params.aspProof ? { aspId: splitAspId ?? DEMO_ASP_ID, aspRoot: params.aspProof.root, aspPathElements: params.aspProof.pathElements, aspPathIndices: params.aspProof.pathIndices } : await generateASPProof2(splitAspId ?? DEMO_ASP_ID, origin, cfg.aspApprovedOrigins);
2546
2547
  setStage("generating_proof");
2547
2548
  const exactNoteWithAmount = { ...exactNoteData, amount: targetAmount };
2548
2549
  const changeNoteWithAmount = { ...changeNoteData, amount: changeAmount };