@permissionless-technologies/upp-sdk 0.4.0 → 0.4.1

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 chunkUYE2JASE_cjs = require('../chunk-UYE2JASE.cjs');
3
+ var chunkBZD5KJL3_cjs = require('../chunk-BZD5KJL3.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 chunkUYE2JASE_cjs.computeSearchTag; }
11
+ get: function () { return chunkBZD5KJL3_cjs.computeSearchTag; }
12
12
  });
13
13
  Object.defineProperty(exports, "makeRpcIndexer", {
14
14
  enumerable: true,
15
- get: function () { return chunkUYE2JASE_cjs.makeRpcIndexer; }
15
+ get: function () { return chunkBZD5KJL3_cjs.makeRpcIndexer; }
16
16
  });
17
17
  Object.defineProperty(exports, "matchesSearchTag", {
18
18
  enumerable: true,
19
- get: function () { return chunkUYE2JASE_cjs.matchesSearchTag; }
19
+ get: function () { return chunkBZD5KJL3_cjs.matchesSearchTag; }
20
20
  });
21
21
  Object.defineProperty(exports, "tryDecryptNote", {
22
22
  enumerable: true,
23
- get: function () { return chunkUYE2JASE_cjs.tryDecryptNote; }
23
+ get: function () { return chunkBZD5KJL3_cjs.tryDecryptNote; }
24
24
  });
25
25
  Object.defineProperty(exports, "unpackNoteData", {
26
26
  enumerable: true,
27
- get: function () { return chunkUYE2JASE_cjs.unpackNoteData; }
27
+ get: function () { return chunkBZD5KJL3_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-ZTVXII74.js';
1
+ export { computeSearchTag, makeRpcIndexer, matchesSearchTag, tryDecryptNote, unpackNoteData } from '../chunk-MDF37354.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
@@ -1607,7 +1607,7 @@ function usePoolTransfer(config) {
1607
1607
  getMerkleProofsForNotes,
1608
1608
  buildUPPTransferCircuitInputs
1609
1609
  } = transferModule;
1610
- const { generateUPPProof, formatProofForContract } = proofModule;
1610
+ const { generateUPPProof, formatPlonkProofForContract } = proofModule;
1611
1611
  const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
1612
1612
  setStage("syncing_merkle");
1613
1613
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
@@ -1641,20 +1641,10 @@ function usePoolTransfer(config) {
1641
1641
  circuitInputs,
1642
1642
  cfg.circuitBaseUrl ?? "/circuits/"
1643
1643
  );
1644
- const formattedProof = formatProofForContract(proof);
1645
- const proofArray = [
1646
- formattedProof.a[0],
1647
- formattedProof.a[1],
1648
- formattedProof.b[0][0],
1649
- formattedProof.b[0][1],
1650
- formattedProof.b[1][0],
1651
- formattedProof.b[1][1],
1652
- formattedProof.c[0],
1653
- formattedProof.c[1]
1654
- ];
1644
+ const formattedProof = await formatPlonkProofForContract(proof);
1655
1645
  return {
1656
1646
  circuit: "transfer",
1657
- proof: proofArray,
1647
+ proof: formattedProof,
1658
1648
  nullifier: viem.toHex(BigInt(circuitInputs.nullifier), { size: 32 }),
1659
1649
  stateRoot: BigInt(circuitInputs.stateRoot),
1660
1650
  aspRoot: BigInt(circuitInputs.aspRoot),
@@ -1762,7 +1752,7 @@ function useWithdraw(config) {
1762
1752
  import('../index.cjs')
1763
1753
  ]);
1764
1754
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
1765
- const { generateUPPProof, formatProofForContract } = proofModule;
1755
+ const { generateUPPProof, formatPlonkProofForContract } = proofModule;
1766
1756
  setStage("syncing_merkle");
1767
1757
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
1768
1758
  const spendableNote = {
@@ -1827,20 +1817,10 @@ function useWithdraw(config) {
1827
1817
  circuitInputs,
1828
1818
  cfg.circuitBaseUrl ?? "/circuits/"
1829
1819
  );
1830
- const formattedProof = formatProofForContract(proof);
1820
+ const formattedProof = await formatPlonkProofForContract(proof);
1831
1821
  const stateRoot = stateRootBI;
1832
- const proofArray = [
1833
- formattedProof.a[0],
1834
- formattedProof.a[1],
1835
- formattedProof.b[0][0],
1836
- formattedProof.b[0][1],
1837
- formattedProof.b[1][0],
1838
- formattedProof.b[1][1],
1839
- formattedProof.c[0],
1840
- formattedProof.c[1]
1841
- ];
1842
1822
  return {
1843
- proof: proofArray,
1823
+ proof: formattedProof,
1844
1824
  nullifier: viem.toHex(nullifier, { size: 32 }),
1845
1825
  stateRoot,
1846
1826
  aspRoot,
@@ -2143,7 +2123,7 @@ function useSwap(config) {
2143
2123
  import('../asp-CUE3NMBN.cjs')
2144
2124
  ]);
2145
2125
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
2146
- const { generateUPPProof, formatProofForContract } = proofModule;
2126
+ const { generateUPPProof, formatPlonkProofForContract } = proofModule;
2147
2127
  const { generateASPProof: generateASPProof2 } = aspModule;
2148
2128
  setStage("syncing_merkle");
2149
2129
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
@@ -2208,23 +2188,13 @@ function useSwap(config) {
2208
2188
  circuitInputs,
2209
2189
  cfg.circuitBaseUrl ?? "/circuits/"
2210
2190
  );
2211
- const formattedProof = formatProofForContract(proof);
2212
- const proofArray = [
2213
- formattedProof.a[0],
2214
- formattedProof.a[1],
2215
- formattedProof.b[0][0],
2216
- formattedProof.b[0][1],
2217
- formattedProof.b[1][0],
2218
- formattedProof.b[1][1],
2219
- formattedProof.c[0],
2220
- formattedProof.c[1]
2221
- ];
2191
+ const formattedProof = await formatPlonkProofForContract(proof);
2222
2192
  const cancelSecret = chunk23B5XSS4_cjs.generateCancelSecret();
2223
2193
  const cancelKeyHash = chunk23B5XSS4_cjs.computeCancelKeyHash(cancelSecret);
2224
2194
  const currentBlock = await cfg.publicClient.getBlockNumber();
2225
2195
  const expiry = currentBlock + expiryBlocks;
2226
2196
  return {
2227
- proof: proofArray,
2197
+ proof: formattedProof,
2228
2198
  nullifier: viem.toHex(nullifier, { size: 32 }),
2229
2199
  stateRoot: stateRootBI,
2230
2200
  aspRoot: aspProofData.aspRoot,
@@ -2295,7 +2265,7 @@ function useSwap(config) {
2295
2265
  import('../asp-CUE3NMBN.cjs')
2296
2266
  ]);
2297
2267
  const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
2298
- const { generateUPPProof, formatProofForContract } = proofModule;
2268
+ const { generateUPPProof, formatPlonkProofForContract } = proofModule;
2299
2269
  const { generateASPProof: generateASPProof2 } = aspModule;
2300
2270
  const fillerOrigin = ethAddress ? BigInt(ethAddress) : BigInt(masterKeys.ownerHash);
2301
2271
  const fillerNoteData = await createNoteForSelf(
@@ -2366,24 +2336,14 @@ function useSwap(config) {
2366
2336
  circuitInputs,
2367
2337
  cfg.circuitBaseUrl ?? "/circuits/"
2368
2338
  );
2369
- const formattedProof = formatProofForContract(proof);
2370
- const proofArray = [
2371
- formattedProof.a[0],
2372
- formattedProof.a[1],
2373
- formattedProof.b[0][0],
2374
- formattedProof.b[0][1],
2375
- formattedProof.b[1][0],
2376
- formattedProof.b[1][1],
2377
- formattedProof.c[0],
2378
- formattedProof.c[1]
2379
- ];
2339
+ const formattedProof = await formatPlonkProofForContract(proof);
2380
2340
  const { encodePacked: encodePacked3 } = await import('viem');
2381
2341
  const packedFillerNote = encodePacked3(
2382
2342
  ["uint64", "uint256", "bytes"],
2383
2343
  [fillerNoteData.searchTag, fillerNoteData.ownerHash, fillerNoteData.encryptedNote]
2384
2344
  );
2385
2345
  return {
2386
- proof: proofArray,
2346
+ proof: formattedProof,
2387
2347
  nullifier: viem.toHex(nullifier, { size: 32 }),
2388
2348
  stateRoot: stateRootBI,
2389
2349
  aspRoot: aspProofData.aspRoot,
@@ -2524,7 +2484,7 @@ function useSwap(config) {
2524
2484
  import('../asp-CUE3NMBN.cjs')
2525
2485
  ]);
2526
2486
  const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
2527
- const { generateUPPProof, formatProofForContract } = proofModule;
2487
+ const { generateUPPProof, formatPlonkProofForContract } = proofModule;
2528
2488
  const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
2529
2489
  setStage("syncing_merkle");
2530
2490
  const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
@@ -2554,17 +2514,7 @@ function useSwap(config) {
2554
2514
  circuitInputs,
2555
2515
  cfg.circuitBaseUrl ?? "/circuits/"
2556
2516
  );
2557
- const formattedProof = formatProofForContract(proof);
2558
- const proofArray = [
2559
- formattedProof.a[0],
2560
- formattedProof.a[1],
2561
- formattedProof.b[0][0],
2562
- formattedProof.b[0][1],
2563
- formattedProof.b[1][0],
2564
- formattedProof.b[1][1],
2565
- formattedProof.c[0],
2566
- formattedProof.c[1]
2567
- ];
2517
+ const formattedProof = await formatPlonkProofForContract(proof);
2568
2518
  const { encodePacked: encodePacked3 } = await import('viem');
2569
2519
  const packNote = (n) => encodePacked3(
2570
2520
  ["uint64", "uint256", "bytes"],
@@ -2598,7 +2548,7 @@ function useSwap(config) {
2598
2548
  timestamp: Date.now()
2599
2549
  };
2600
2550
  return {
2601
- proof: proofArray,
2551
+ proof: formattedProof,
2602
2552
  nullifier: viem.toHex(BigInt(circuitInputs.nullifier), { size: 32 }),
2603
2553
  stateRoot: BigInt(circuitInputs.stateRoot),
2604
2554
  aspRoot: BigInt(circuitInputs.aspRoot),