@permissionless-technologies/upp-sdk 0.4.7 → 0.4.9
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.
- package/dist/react/index.cjs +14 -17
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +15 -18
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -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,
|
|
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';
|
|
@@ -603,7 +603,7 @@ function UPPAccountProvider({
|
|
|
603
603
|
const ownerSecret = BigInt(note.ownerSecret);
|
|
604
604
|
const commitment = BigInt(note.commitment);
|
|
605
605
|
const nullifier = await sdk2.poseidon([
|
|
606
|
-
ownerSecret
|
|
606
|
+
ownerSecret,
|
|
607
607
|
BigInt(correctLeaf),
|
|
608
608
|
commitment
|
|
609
609
|
]);
|
|
@@ -636,7 +636,7 @@ function UPPAccountProvider({
|
|
|
636
636
|
const ownerSecret = BigInt(note.ownerSecret);
|
|
637
637
|
const commitment = BigInt(note.commitment);
|
|
638
638
|
const nullifier = await sdk2.poseidon([
|
|
639
|
-
ownerSecret
|
|
639
|
+
ownerSecret,
|
|
640
640
|
BigInt(correctLeaf),
|
|
641
641
|
commitment
|
|
642
642
|
]);
|
|
@@ -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
|
|
1771
|
+
const inputOwnerHash = computeOwnerHash(BigInt(selectedNote.ownerSecret));
|
|
1772
1772
|
const localCommitment = await sdk.poseidon([
|
|
1773
1773
|
selectedNote.amount,
|
|
1774
|
-
|
|
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)
|
|
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:
|
|
1802
|
+
inputOneTimeSecret: BigInt(selectedNote.ownerSecret).toString(),
|
|
1804
1803
|
inputBlinding: selectedNote.blinding.toString(),
|
|
1805
1804
|
inputOrigin: origin.toString(),
|
|
1806
1805
|
inputLeafIndex: actualLeafIndex.toString(),
|
|
@@ -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
|
|
2144
|
+
const inputOwnerHash = computeOwnerHash(BigInt(selectedNote.ownerSecret));
|
|
2146
2145
|
const localCommitment = await sdk.poseidon([
|
|
2147
2146
|
selectedNote.amount,
|
|
2148
|
-
|
|
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)
|
|
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:
|
|
2173
|
+
inputOneTimeSecret: BigInt(selectedNote.ownerSecret).toString(),
|
|
2176
2174
|
inputBlinding: selectedNote.blinding.toString(),
|
|
2177
2175
|
inputOrigin: origin.toString(),
|
|
2178
2176
|
inputLeafIndex: actualLeafIndex.toString(),
|
|
@@ -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
|
|
2291
|
+
const inputOwnerHashF = computeOwnerHash(BigInt(selectedNote.ownerSecret));
|
|
2294
2292
|
const localCommitmentF = await sdk.poseidon([
|
|
2295
2293
|
selectedNote.amount,
|
|
2296
|
-
|
|
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)
|
|
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:
|
|
2320
|
+
inputOneTimeSecret: BigInt(selectedNote.ownerSecret).toString(),
|
|
2324
2321
|
inputBlinding: selectedNote.blinding.toString(),
|
|
2325
2322
|
inputOrigin: origin.toString(),
|
|
2326
2323
|
inputLeafIndex: actualLeafIndex.toString(),
|