@permissionless-technologies/upp-sdk 0.4.6 → 0.4.8

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.
@@ -3,7 +3,7 @@ import { computeSingleOriginASPRoot } from '../chunk-6IEYWJVS.js';
3
3
  export { ASP_TREE_DEPTH, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof } from '../chunk-6IEYWJVS.js';
4
4
  import { createAutoAdapter } from '../chunk-XV72HNHN.js';
5
5
  import '../chunk-UQIM2KT3.js';
6
- import { init_poseidon, BABYJUBJUB_SUBORDER } from '../chunk-5QSSX3KR.js';
6
+ import { init_poseidon, computeOwnerHash } 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';
@@ -1596,7 +1596,7 @@ function usePoolTransfer(config) {
1596
1596
  const recipientNote = await createNoteForSelf(amount, origin, token);
1597
1597
  const changeNote = await createNoteForSelf(changeAmount, origin, token);
1598
1598
  const [transferModule, proofModule, aspModule] = await Promise.all([
1599
- import('../transfer-SGPJB6AK.js'),
1599
+ import('../transfer-WYG6422Y.js'),
1600
1600
  import('../proof-XQG5DN5N.js'),
1601
1601
  import('../asp-72WUGTQE.js')
1602
1602
  ]);
@@ -1745,7 +1745,7 @@ function useWithdraw(config) {
1745
1745
  const token = BigInt(selectedNote.token);
1746
1746
  setStage("creating_outputs");
1747
1747
  const [transferModule, proofModule, sdk] = await Promise.all([
1748
- import('../transfer-SGPJB6AK.js'),
1748
+ import('../transfer-WYG6422Y.js'),
1749
1749
  import('../proof-XQG5DN5N.js'),
1750
1750
  import('../index.js')
1751
1751
  ]);
@@ -1768,11 +1768,10 @@ function useWithdraw(config) {
1768
1768
  const merkleProof = noteProof.proof;
1769
1769
  const stateRootBI = merkleProof.root;
1770
1770
  const actualLeafIndex = merkleProof.leafIndex;
1771
- const inputPubkey = await sdk.privateToPublic(BigInt(selectedNote.ownerSecret));
1771
+ const inputOwnerHash = computeOwnerHash(BigInt(selectedNote.ownerSecret));
1772
1772
  const localCommitment = await sdk.poseidon([
1773
1773
  selectedNote.amount,
1774
- inputPubkey.x,
1775
- inputPubkey.y,
1774
+ inputOwnerHash,
1776
1775
  selectedNote.blinding,
1777
1776
  BigInt(selectedNote.origin),
1778
1777
  BigInt(selectedNote.token)
@@ -1784,7 +1783,7 @@ function useWithdraw(config) {
1784
1783
  );
1785
1784
  }
1786
1785
  const nullifier = await sdk.poseidon([
1787
- BigInt(selectedNote.ownerSecret) % BABYJUBJUB_SUBORDER,
1786
+ BigInt(selectedNote.ownerSecret),
1788
1787
  BigInt(actualLeafIndex),
1789
1788
  storedCommitment
1790
1789
  ]);
@@ -1800,7 +1799,7 @@ function useWithdraw(config) {
1800
1799
  // Private inputs - Input Note
1801
1800
  // IMPORTANT: Use actualLeafIndex from Merkle proof, not stored leafIndex
1802
1801
  inputAmount: selectedNote.amount.toString(),
1803
- inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) % BABYJUBJUB_SUBORDER).toString(),
1802
+ inputOneTimeSecret: BigInt(selectedNote.ownerSecret).toString(),
1804
1803
  inputBlinding: selectedNote.blinding.toString(),
1805
1804
  inputOrigin: origin.toString(),
1806
1805
  inputLeafIndex: actualLeafIndex.toString(),
@@ -2115,7 +2114,7 @@ function useSwap(config) {
2115
2114
  }
2116
2115
  setStage("creating_outputs");
2117
2116
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2118
- import('../transfer-SGPJB6AK.js'),
2117
+ import('../transfer-WYG6422Y.js'),
2119
2118
  import('../proof-XQG5DN5N.js'),
2120
2119
  import('../index.js'),
2121
2120
  import('../asp-72WUGTQE.js')
@@ -2142,11 +2141,10 @@ function useSwap(config) {
2142
2141
  const stateRootBI = merkleProof.root;
2143
2142
  const actualLeafIndex = merkleProof.leafIndex;
2144
2143
  setStage("generating_proof");
2145
- const inputPubkey = await sdk.privateToPublic(BigInt(selectedNote.ownerSecret));
2144
+ const inputOwnerHash = computeOwnerHash(BigInt(selectedNote.ownerSecret));
2146
2145
  const localCommitment = await sdk.poseidon([
2147
2146
  selectedNote.amount,
2148
- inputPubkey.x,
2149
- inputPubkey.y,
2147
+ inputOwnerHash,
2150
2148
  selectedNote.blinding,
2151
2149
  origin,
2152
2150
  token
@@ -2158,7 +2156,7 @@ function useSwap(config) {
2158
2156
  );
2159
2157
  }
2160
2158
  const nullifier = await sdk.poseidon([
2161
- BigInt(selectedNote.ownerSecret) % BABYJUBJUB_SUBORDER,
2159
+ BigInt(selectedNote.ownerSecret),
2162
2160
  BigInt(actualLeafIndex),
2163
2161
  storedCommitment
2164
2162
  ]);
@@ -2172,7 +2170,7 @@ function useSwap(config) {
2172
2170
  token: token.toString(),
2173
2171
  isRagequit: "0",
2174
2172
  inputAmount: selectedNote.amount.toString(),
2175
- inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) % BABYJUBJUB_SUBORDER).toString(),
2173
+ inputOneTimeSecret: BigInt(selectedNote.ownerSecret).toString(),
2176
2174
  inputBlinding: selectedNote.blinding.toString(),
2177
2175
  inputOrigin: origin.toString(),
2178
2176
  inputLeafIndex: actualLeafIndex.toString(),
@@ -2257,7 +2255,7 @@ function useSwap(config) {
2257
2255
  }
2258
2256
  setStage("creating_outputs");
2259
2257
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2260
- import('../transfer-SGPJB6AK.js'),
2258
+ import('../transfer-WYG6422Y.js'),
2261
2259
  import('../proof-XQG5DN5N.js'),
2262
2260
  import('../index.js'),
2263
2261
  import('../asp-72WUGTQE.js')
@@ -2290,11 +2288,10 @@ function useSwap(config) {
2290
2288
  const stateRootBI = merkleProof.root;
2291
2289
  const actualLeafIndex = merkleProof.leafIndex;
2292
2290
  setStage("generating_proof");
2293
- const inputPubkeyF = await sdk.privateToPublic(BigInt(selectedNote.ownerSecret));
2291
+ const inputOwnerHashF = computeOwnerHash(BigInt(selectedNote.ownerSecret));
2294
2292
  const localCommitmentF = await sdk.poseidon([
2295
2293
  selectedNote.amount,
2296
- inputPubkeyF.x,
2297
- inputPubkeyF.y,
2294
+ inputOwnerHashF,
2298
2295
  selectedNote.blinding,
2299
2296
  origin,
2300
2297
  token
@@ -2306,7 +2303,7 @@ function useSwap(config) {
2306
2303
  );
2307
2304
  }
2308
2305
  const nullifier = await sdk.poseidon([
2309
- BigInt(selectedNote.ownerSecret) % BABYJUBJUB_SUBORDER,
2306
+ BigInt(selectedNote.ownerSecret),
2310
2307
  BigInt(actualLeafIndex),
2311
2308
  storedCommitmentF
2312
2309
  ]);
@@ -2320,7 +2317,7 @@ function useSwap(config) {
2320
2317
  token: token.toString(),
2321
2318
  isRagequit: "0",
2322
2319
  inputAmount: selectedNote.amount.toString(),
2323
- inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) % BABYJUBJUB_SUBORDER).toString(),
2320
+ inputOneTimeSecret: BigInt(selectedNote.ownerSecret).toString(),
2324
2321
  inputBlinding: selectedNote.blinding.toString(),
2325
2322
  inputOrigin: origin.toString(),
2326
2323
  inputLeafIndex: actualLeafIndex.toString(),
@@ -2477,7 +2474,7 @@ function useSwap(config) {
2477
2474
  createNoteForSelf(changeAmount, origin, token)
2478
2475
  ]);
2479
2476
  const [transferModule, proofModule, aspModule] = await Promise.all([
2480
- import('../transfer-SGPJB6AK.js'),
2477
+ import('../transfer-WYG6422Y.js'),
2481
2478
  import('../proof-XQG5DN5N.js'),
2482
2479
  import('../asp-72WUGTQE.js')
2483
2480
  ]);