@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.
- package/dist/{asp-ZA3RGN7G.js → asp-72WUGTQE.js} +3 -3
- package/dist/asp-72WUGTQE.js.map +1 -0
- package/dist/{asp-TXSAFFD3.cjs → asp-CUE3NMBN.cjs} +14 -14
- package/dist/asp-CUE3NMBN.cjs.map +1 -0
- package/dist/{chunk-KXPZUBPI.cjs → chunk-23B5XSS4.cjs} +12 -12
- package/dist/{chunk-KXPZUBPI.cjs.map → chunk-23B5XSS4.cjs.map} +1 -1
- package/dist/{chunk-SQKBT2SH.cjs → chunk-2G22R7AJ.cjs} +18 -7
- package/dist/chunk-2G22R7AJ.cjs.map +1 -0
- package/dist/chunk-5QSSX3KR.js +64 -0
- package/dist/chunk-5QSSX3KR.js.map +1 -0
- package/dist/{chunk-P37MRZ73.js → chunk-6IEYWJVS.js} +8 -8
- package/dist/chunk-6IEYWJVS.js.map +1 -0
- package/dist/{chunk-5V5HSN6Y.js → chunk-6TFDBBAQ.js} +3 -3
- package/dist/{chunk-5V5HSN6Y.js.map → chunk-6TFDBBAQ.js.map} +1 -1
- package/dist/{chunk-ZKZV6OI3.cjs → chunk-7BNJV2ZS.cjs} +21 -21
- package/dist/{chunk-ZKZV6OI3.cjs.map → chunk-7BNJV2ZS.cjs.map} +1 -1
- package/dist/{chunk-XBNYAAMU.js → chunk-7T4CUE6E.js} +3 -3
- package/dist/{chunk-XBNYAAMU.js.map → chunk-7T4CUE6E.js.map} +1 -1
- package/dist/{chunk-OD2SDC4L.js → chunk-CEJN5ZE5.js} +3 -3
- package/dist/{chunk-OD2SDC4L.js.map → chunk-CEJN5ZE5.js.map} +1 -1
- package/dist/{chunk-2JQISXBD.js → chunk-DTEAFJG7.js} +8 -8
- package/dist/{chunk-2JQISXBD.js.map → chunk-DTEAFJG7.js.map} +1 -1
- package/dist/chunk-EHGH6TAW.js +100 -0
- package/dist/chunk-EHGH6TAW.js.map +1 -0
- package/dist/{chunk-ZU6J7KMY.js → chunk-GPF72JFR.js} +3 -3
- package/dist/{chunk-ZU6J7KMY.js.map → chunk-GPF72JFR.js.map} +1 -1
- package/dist/chunk-HEHXSV47.cjs +77 -0
- package/dist/chunk-HEHXSV47.cjs.map +1 -0
- package/dist/chunk-I5EKGD4P.cjs +113 -0
- package/dist/chunk-I5EKGD4P.cjs.map +1 -0
- package/dist/{chunk-EUP7MBAH.cjs → chunk-IIUKM5VE.cjs} +7 -7
- package/dist/{chunk-EUP7MBAH.cjs.map → chunk-IIUKM5VE.cjs.map} +1 -1
- package/dist/{chunk-PJLRCR2T.js → chunk-OBBSIPEK.js} +30 -35
- package/dist/chunk-OBBSIPEK.js.map +1 -0
- package/dist/{chunk-QSL4XPNU.cjs → chunk-Q2E432UK.cjs} +41 -46
- package/dist/chunk-Q2E432UK.cjs.map +1 -0
- package/dist/{chunk-QKI4QWLT.js → chunk-RNUG3EFC.js} +6 -6
- package/dist/{chunk-QKI4QWLT.js.map → chunk-RNUG3EFC.js.map} +1 -1
- package/dist/{chunk-3YZSIYJC.cjs → chunk-SWTNJPK5.cjs} +11 -11
- package/dist/{chunk-3YZSIYJC.cjs.map → chunk-SWTNJPK5.cjs.map} +1 -1
- package/dist/{chunk-BH24DZ5S.cjs → chunk-U3YFYMWF.cjs} +5 -5
- package/dist/{chunk-BH24DZ5S.cjs.map → chunk-U3YFYMWF.cjs.map} +1 -1
- package/dist/{chunk-3HQ7A6ZM.cjs → chunk-UFEDJJSH.cjs} +5 -5
- package/dist/{chunk-3HQ7A6ZM.cjs.map → chunk-UFEDJJSH.cjs.map} +1 -1
- package/dist/{chunk-W77GRBO4.js → chunk-UQIM2KT3.js} +3 -3
- package/dist/{chunk-W77GRBO4.js.map → chunk-UQIM2KT3.js.map} +1 -1
- package/dist/{chunk-SJDPDHSD.cjs → chunk-UTAJSERA.cjs} +4 -4
- package/dist/{chunk-SJDPDHSD.cjs.map → chunk-UTAJSERA.cjs.map} +1 -1
- package/dist/{chunk-KLGLXF6H.cjs → chunk-UYE2JASE.cjs} +2 -2
- package/dist/{chunk-KLGLXF6H.cjs.map → chunk-UYE2JASE.cjs.map} +1 -1
- package/dist/{chunk-S4B7GYLN.js → chunk-W3HLIKC2.js} +18 -8
- package/dist/chunk-W3HLIKC2.js.map +1 -0
- package/dist/{chunk-NDM5EJEV.cjs → chunk-XVIICZKW.cjs} +7 -7
- package/dist/chunk-XVIICZKW.cjs.map +1 -0
- package/dist/{chunk-OFA2DP7S.js → chunk-ZTVXII74.js} +2 -2
- package/dist/{chunk-OFA2DP7S.js.map → chunk-ZTVXII74.js.map} +1 -1
- package/dist/core/index.cjs +82 -82
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +10 -10
- package/dist/{index-B45-okum.d.cts → index-BgPdYxFS.d.cts} +18 -18
- package/dist/{index-o-Ds3YAq.d.cts → index-CL4vb3ej.d.cts} +1 -1
- package/dist/{index-BIcvNMPt.d.ts → index-CtcXgof_.d.ts} +18 -18
- package/dist/{index-DwAJBoU7.d.ts → index-D6nvfm59.d.ts} +1 -1
- package/dist/index.cjs +175 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +29 -30
- package/dist/index.js.map +1 -1
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.d.cts +5 -5
- package/dist/indexer/index.d.ts +5 -5
- package/dist/indexer/index.js +1 -1
- package/dist/keys/index.cjs +18 -18
- package/dist/keys/index.js +4 -4
- package/dist/merkle-DZHEOPH3.cjs +30 -0
- package/dist/{merkle-HGDC6OB4.cjs.map → merkle-DZHEOPH3.cjs.map} +1 -1
- package/dist/merkle-IF2RMWCF.js +5 -0
- package/dist/{merkle-7KS2EHRF.js.map → merkle-IF2RMWCF.js.map} +1 -1
- package/dist/poseidon-ACM7E2OH.js +7 -0
- package/dist/{poseidon-UHTJLWQM.js.map → poseidon-ACM7E2OH.js.map} +1 -1
- package/dist/poseidon-PUSGUIVZ.cjs +61 -0
- package/dist/{poseidon-WHJSZSNP.cjs.map → poseidon-PUSGUIVZ.cjs.map} +1 -1
- package/dist/proof-JME3IZTX.js +4 -0
- package/dist/{proof-C4YBP6RY.js.map → proof-JME3IZTX.js.map} +1 -1
- package/dist/proof-XR6XE5PJ.cjs +49 -0
- package/dist/{proof-5OECB3RQ.cjs.map → proof-XR6XE5PJ.cjs.map} +1 -1
- package/dist/react/index.cjs +52 -55
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +25 -28
- package/dist/react/index.js.map +1 -1
- package/dist/{transfer-BzyernBd.d.cts → transfer-D111ihqN.d.cts} +108 -56
- package/dist/{transfer-sqS6mJko.d.ts → transfer-DvIXqHCr.d.ts} +108 -56
- package/dist/transfer-MQMGSXTH.js +8 -0
- package/dist/{transfer-P4D57KJ5.js.map → transfer-MQMGSXTH.js.map} +1 -1
- package/dist/transfer-PB6D5VCW.cjs +37 -0
- package/dist/{transfer-XCVVZ7FF.cjs.map → transfer-PB6D5VCW.cjs.map} +1 -1
- package/dist/utils/index.cjs +60 -61
- package/dist/utils/index.d.cts +37 -14
- package/dist/utils/index.d.ts +37 -14
- package/dist/utils/index.js +6 -7
- package/package.json +4 -2
- package/src/contracts/interfaces/IUniversalPrivatePool.sol +10 -8
- package/src/contracts/interfaces/IVerifiers.sol +16 -52
- package/src/deployments/11155111.json +15 -12
- package/dist/asp-TXSAFFD3.cjs.map +0 -1
- package/dist/asp-ZA3RGN7G.js.map +0 -1
- package/dist/babyjubjub-2MGQVCKB.js +0 -5
- package/dist/babyjubjub-2MGQVCKB.js.map +0 -1
- package/dist/babyjubjub-MWZLJOVZ.cjs +0 -66
- package/dist/babyjubjub-MWZLJOVZ.cjs.map +0 -1
- package/dist/chunk-JWNXBALH.cjs +0 -57
- package/dist/chunk-JWNXBALH.cjs.map +0 -1
- package/dist/chunk-NDM5EJEV.cjs.map +0 -1
- package/dist/chunk-P37MRZ73.js.map +0 -1
- package/dist/chunk-PJLRCR2T.js.map +0 -1
- package/dist/chunk-PTDVGWHU.cjs +0 -10
- package/dist/chunk-PTDVGWHU.cjs.map +0 -1
- package/dist/chunk-QSL4XPNU.cjs.map +0 -1
- package/dist/chunk-S4B7GYLN.js.map +0 -1
- package/dist/chunk-SQKBT2SH.cjs.map +0 -1
- package/dist/chunk-TSF6HEVS.cjs +0 -201
- package/dist/chunk-TSF6HEVS.cjs.map +0 -1
- package/dist/chunk-UAVWYXDN.js +0 -8
- package/dist/chunk-UAVWYXDN.js.map +0 -1
- package/dist/chunk-V23OSL25.js +0 -48
- package/dist/chunk-V23OSL25.js.map +0 -1
- package/dist/chunk-YOWDERVC.js +0 -186
- package/dist/chunk-YOWDERVC.js.map +0 -1
- package/dist/merkle-7KS2EHRF.js +0 -5
- package/dist/merkle-HGDC6OB4.cjs +0 -30
- package/dist/poseidon-UHTJLWQM.js +0 -7
- package/dist/poseidon-WHJSZSNP.cjs +0 -45
- package/dist/proof-5OECB3RQ.cjs +0 -45
- package/dist/proof-C4YBP6RY.js +0 -4
- package/dist/transfer-P4D57KJ5.js +0 -8
- package/dist/transfer-XCVVZ7FF.cjs +0 -37
package/dist/react/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk23B5XSS4_cjs = require('../chunk-23B5XSS4.cjs');
|
|
4
|
+
var chunkXVIICZKW_cjs = require('../chunk-XVIICZKW.cjs');
|
|
5
5
|
var chunkERQE57IA_cjs = require('../chunk-ERQE57IA.cjs');
|
|
6
|
-
require('../chunk-
|
|
7
|
-
var
|
|
6
|
+
require('../chunk-UFEDJJSH.cjs');
|
|
7
|
+
var chunkHEHXSV47_cjs = require('../chunk-HEHXSV47.cjs');
|
|
8
8
|
var chunkG7VZBCD6_cjs = require('../chunk-G7VZBCD6.cjs');
|
|
9
9
|
var react = require('react');
|
|
10
10
|
var viem = require('viem');
|
|
@@ -107,7 +107,7 @@ function UPPAccountProvider({
|
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
const accountStorage = chunkERQE57IA_cjs.createAutoAdapter(`upp_account`);
|
|
110
|
-
const adapter = new
|
|
110
|
+
const adapter = new chunk23B5XSS4_cjs.StorableAccountAdapter(accountStorage, ethAddress);
|
|
111
111
|
accountAdapterRef.current = adapter;
|
|
112
112
|
const legacyKey = getStorageKey(ethAddress);
|
|
113
113
|
const legacySaved = typeof window !== "undefined" ? localStorage.getItem(legacyKey) : null;
|
|
@@ -148,7 +148,7 @@ function UPPAccountProvider({
|
|
|
148
148
|
const ownerHashHex2 = viem.toHex(account.keys.ownerHash, { size: 32 });
|
|
149
149
|
const storagePrefix = `upp_${chainId}_${ownerHashHex2.slice(0, 12)}`;
|
|
150
150
|
const noteStorage = chunkERQE57IA_cjs.createAutoAdapter(storagePrefix);
|
|
151
|
-
const store = new
|
|
151
|
+
const store = new chunk23B5XSS4_cjs.NoteStore(noteStorage, "notes");
|
|
152
152
|
noteStoreRef.current = store;
|
|
153
153
|
noteStoreUnsub = store.onChange(() => {
|
|
154
154
|
if (!cancelled) setNotes([...store.getNotes()]);
|
|
@@ -742,7 +742,7 @@ function UPPAccountProvider({
|
|
|
742
742
|
const stealthAddress = react.useMemo(() => {
|
|
743
743
|
if (!masterKeys) return null;
|
|
744
744
|
try {
|
|
745
|
-
const { encodeStealthAddress } = (
|
|
745
|
+
const { encodeStealthAddress } = (chunk23B5XSS4_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunk23B5XSS4_cjs.stealth_exports));
|
|
746
746
|
return encodeStealthAddress(masterKeys.ownerHash, masterKeys.viewingHash);
|
|
747
747
|
} catch {
|
|
748
748
|
return null;
|
|
@@ -751,7 +751,7 @@ function UPPAccountProvider({
|
|
|
751
751
|
const starkStealthAddress = react.useMemo(() => {
|
|
752
752
|
if (!starkMasterKeys) return null;
|
|
753
753
|
try {
|
|
754
|
-
const { encodeStarkStealthAddress } = (
|
|
754
|
+
const { encodeStarkStealthAddress } = (chunk23B5XSS4_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunk23B5XSS4_cjs.stealth_exports));
|
|
755
755
|
return encodeStarkStealthAddress(starkMasterKeys.starkOwnerHash, starkMasterKeys.starkViewingHash);
|
|
756
756
|
} catch {
|
|
757
757
|
return null;
|
|
@@ -803,11 +803,9 @@ function useUPPAccount() {
|
|
|
803
803
|
}
|
|
804
804
|
async function createHashBasedNote(sdk, amount, spendingSecret, ownerHash, viewingSecret, origin, token) {
|
|
805
805
|
const blinding = await sdk.randomFieldElement();
|
|
806
|
-
const pubkey = await sdk.privateToPublic(spendingSecret);
|
|
807
806
|
const commitment = await sdk.poseidon([
|
|
808
807
|
amount,
|
|
809
|
-
|
|
810
|
-
pubkey.y,
|
|
808
|
+
ownerHash,
|
|
811
809
|
blinding,
|
|
812
810
|
origin,
|
|
813
811
|
token
|
|
@@ -819,8 +817,6 @@ async function createHashBasedNote(sdk, amount, spendingSecret, ownerHash, viewi
|
|
|
819
817
|
commitment,
|
|
820
818
|
ownerSecret: spendingSecret,
|
|
821
819
|
ownerHash,
|
|
822
|
-
pubkeyX: pubkey.x,
|
|
823
|
-
pubkeyY: pubkey.y,
|
|
824
820
|
blinding,
|
|
825
821
|
encryptedNote,
|
|
826
822
|
searchTag,
|
|
@@ -1602,9 +1598,9 @@ function usePoolTransfer(config) {
|
|
|
1602
1598
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1603
1599
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1604
1600
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1605
|
-
import('../transfer-
|
|
1606
|
-
import('../proof-
|
|
1607
|
-
import('../asp-
|
|
1601
|
+
import('../transfer-PB6D5VCW.cjs'),
|
|
1602
|
+
import('../proof-XR6XE5PJ.cjs'),
|
|
1603
|
+
import('../asp-CUE3NMBN.cjs')
|
|
1608
1604
|
]);
|
|
1609
1605
|
const {
|
|
1610
1606
|
syncMerkleTree,
|
|
@@ -1690,7 +1686,7 @@ function usePoolTransfer(config) {
|
|
|
1690
1686
|
reset
|
|
1691
1687
|
};
|
|
1692
1688
|
}
|
|
1693
|
-
|
|
1689
|
+
chunkHEHXSV47_cjs.init_poseidon();
|
|
1694
1690
|
var STATE_TREE_DEPTH = 32;
|
|
1695
1691
|
var ASP_TREE_DEPTH2 = 20;
|
|
1696
1692
|
function padToDepth(arr, padValue, depth) {
|
|
@@ -1761,8 +1757,8 @@ function useWithdraw(config) {
|
|
|
1761
1757
|
const token = BigInt(selectedNote.token);
|
|
1762
1758
|
setStage("creating_outputs");
|
|
1763
1759
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1764
|
-
import('../transfer-
|
|
1765
|
-
import('../proof-
|
|
1760
|
+
import('../transfer-PB6D5VCW.cjs'),
|
|
1761
|
+
import('../proof-XR6XE5PJ.cjs'),
|
|
1766
1762
|
import('../index.cjs')
|
|
1767
1763
|
]);
|
|
1768
1764
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
@@ -1800,7 +1796,7 @@ function useWithdraw(config) {
|
|
|
1800
1796
|
);
|
|
1801
1797
|
}
|
|
1802
1798
|
const nullifier = await sdk.poseidon([
|
|
1803
|
-
BigInt(selectedNote.ownerSecret) %
|
|
1799
|
+
BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER,
|
|
1804
1800
|
BigInt(actualLeafIndex),
|
|
1805
1801
|
storedCommitment
|
|
1806
1802
|
]);
|
|
@@ -1816,7 +1812,7 @@ function useWithdraw(config) {
|
|
|
1816
1812
|
// Private inputs - Input Note
|
|
1817
1813
|
// IMPORTANT: Use actualLeafIndex from Merkle proof, not stored leafIndex
|
|
1818
1814
|
inputAmount: selectedNote.amount.toString(),
|
|
1819
|
-
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) %
|
|
1815
|
+
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER).toString(),
|
|
1820
1816
|
inputBlinding: selectedNote.blinding.toString(),
|
|
1821
1817
|
inputOrigin: origin.toString(),
|
|
1822
1818
|
inputLeafIndex: actualLeafIndex.toString(),
|
|
@@ -1924,7 +1920,7 @@ function usePersonalASP(config) {
|
|
|
1924
1920
|
});
|
|
1925
1921
|
if (aspData.operator.toLowerCase() === userAddress.toLowerCase()) {
|
|
1926
1922
|
const userOrigin = BigInt(userAddress);
|
|
1927
|
-
const expectedRoot = await
|
|
1923
|
+
const expectedRoot = await chunkXVIICZKW_cjs.computeSingleOriginASPRoot(userOrigin);
|
|
1928
1924
|
const isApproved = aspData.currentRoot === expectedRoot;
|
|
1929
1925
|
setAspInfo({
|
|
1930
1926
|
aspId: storedAspId,
|
|
@@ -1956,7 +1952,7 @@ function usePersonalASP(config) {
|
|
|
1956
1952
|
const isOriginApproved = react.useCallback(async (origin) => {
|
|
1957
1953
|
if (!aspInfo?.isRegistered || !publicClient) return false;
|
|
1958
1954
|
try {
|
|
1959
|
-
const expectedRoot = await
|
|
1955
|
+
const expectedRoot = await chunkXVIICZKW_cjs.computeSingleOriginASPRoot(origin);
|
|
1960
1956
|
const isValid = await publicClient.readContract({
|
|
1961
1957
|
address: aspHubAddress,
|
|
1962
1958
|
abi: upcSdk.ASP_REGISTRY_HUB_ABI,
|
|
@@ -1972,7 +1968,7 @@ function usePersonalASP(config) {
|
|
|
1972
1968
|
return aspInfo?.isRegistered ? aspInfo.aspId : null;
|
|
1973
1969
|
}, [aspInfo]);
|
|
1974
1970
|
const getASPRootForOrigin = react.useCallback(async (origin) => {
|
|
1975
|
-
return
|
|
1971
|
+
return chunkXVIICZKW_cjs.computeSingleOriginASPRoot(origin);
|
|
1976
1972
|
}, []);
|
|
1977
1973
|
return {
|
|
1978
1974
|
aspInfo,
|
|
@@ -1987,8 +1983,9 @@ function usePersonalASP(config) {
|
|
|
1987
1983
|
function storePersonalASPId(chainId, address, aspId) {
|
|
1988
1984
|
storeASPId(chainId, address, aspId);
|
|
1989
1985
|
}
|
|
1990
|
-
|
|
1986
|
+
chunkHEHXSV47_cjs.init_poseidon();
|
|
1991
1987
|
var STATE_TREE_DEPTH2 = 32;
|
|
1988
|
+
var ASP_TREE_DEPTH3 = 20;
|
|
1992
1989
|
function padToDepth2(arr, padValue, depth) {
|
|
1993
1990
|
if (arr.length >= depth) return arr.slice(0, depth);
|
|
1994
1991
|
return [...arr, ...Array(depth - arr.length).fill(padValue)];
|
|
@@ -2024,7 +2021,7 @@ function useSwapOrderBook(config) {
|
|
|
2024
2021
|
try {
|
|
2025
2022
|
const logs = await config.publicClient.getLogs({
|
|
2026
2023
|
address: config.poolAddress,
|
|
2027
|
-
event:
|
|
2024
|
+
event: chunk23B5XSS4_cjs.SWAP_ORDER_PLACED_EVENT,
|
|
2028
2025
|
fromBlock: config.fromBlock ?? 0n,
|
|
2029
2026
|
toBlock: "latest"
|
|
2030
2027
|
});
|
|
@@ -2040,10 +2037,10 @@ function useSwapOrderBook(config) {
|
|
|
2040
2037
|
blockNumber: log.blockNumber ?? 0n
|
|
2041
2038
|
}));
|
|
2042
2039
|
if (config.sellToken && config.buyToken) {
|
|
2043
|
-
parsedOrders =
|
|
2040
|
+
parsedOrders = chunk23B5XSS4_cjs.filterOrdersByTokenPair(parsedOrders, config.sellToken, config.buyToken);
|
|
2044
2041
|
}
|
|
2045
2042
|
if (config.acceptableAspIds && config.acceptableAspIds.length > 0) {
|
|
2046
|
-
parsedOrders =
|
|
2043
|
+
parsedOrders = chunk23B5XSS4_cjs.filterOrdersByASP(parsedOrders, config.acceptableAspIds);
|
|
2047
2044
|
}
|
|
2048
2045
|
const enriched = [];
|
|
2049
2046
|
for (const order of parsedOrders) {
|
|
@@ -2140,10 +2137,10 @@ function useSwap(config) {
|
|
|
2140
2137
|
}
|
|
2141
2138
|
setStage("creating_outputs");
|
|
2142
2139
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2143
|
-
import('../transfer-
|
|
2144
|
-
import('../proof-
|
|
2140
|
+
import('../transfer-PB6D5VCW.cjs'),
|
|
2141
|
+
import('../proof-XR6XE5PJ.cjs'),
|
|
2145
2142
|
import('../index.cjs'),
|
|
2146
|
-
import('../asp-
|
|
2143
|
+
import('../asp-CUE3NMBN.cjs')
|
|
2147
2144
|
]);
|
|
2148
2145
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
2149
2146
|
const { generateUPPProof, formatProofForContract } = proofModule;
|
|
@@ -2183,7 +2180,7 @@ function useSwap(config) {
|
|
|
2183
2180
|
);
|
|
2184
2181
|
}
|
|
2185
2182
|
const nullifier = await sdk.poseidon([
|
|
2186
|
-
BigInt(selectedNote.ownerSecret) %
|
|
2183
|
+
BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER,
|
|
2187
2184
|
BigInt(actualLeafIndex),
|
|
2188
2185
|
storedCommitment
|
|
2189
2186
|
]);
|
|
@@ -2197,14 +2194,14 @@ function useSwap(config) {
|
|
|
2197
2194
|
token: token.toString(),
|
|
2198
2195
|
isRagequit: "0",
|
|
2199
2196
|
inputAmount: selectedNote.amount.toString(),
|
|
2200
|
-
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) %
|
|
2197
|
+
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER).toString(),
|
|
2201
2198
|
inputBlinding: selectedNote.blinding.toString(),
|
|
2202
2199
|
inputOrigin: origin.toString(),
|
|
2203
2200
|
inputLeafIndex: actualLeafIndex.toString(),
|
|
2204
2201
|
inputPathElements: padToDepth2(merkleProof.pathElements.map(String), "0", STATE_TREE_DEPTH2),
|
|
2205
2202
|
inputPathIndices: padToDepth2(merkleProof.pathIndices.map(String), "0", STATE_TREE_DEPTH2),
|
|
2206
|
-
aspPathElements: aspProofData.aspPathElements.map(String),
|
|
2207
|
-
aspPathIndices: aspProofData.aspPathIndices.map(String)
|
|
2203
|
+
aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
|
|
2204
|
+
aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
|
|
2208
2205
|
};
|
|
2209
2206
|
const { proof } = await generateUPPProof(
|
|
2210
2207
|
"withdraw",
|
|
@@ -2222,8 +2219,8 @@ function useSwap(config) {
|
|
|
2222
2219
|
formattedProof.c[0],
|
|
2223
2220
|
formattedProof.c[1]
|
|
2224
2221
|
];
|
|
2225
|
-
const cancelSecret =
|
|
2226
|
-
const cancelKeyHash =
|
|
2222
|
+
const cancelSecret = chunk23B5XSS4_cjs.generateCancelSecret();
|
|
2223
|
+
const cancelKeyHash = chunk23B5XSS4_cjs.computeCancelKeyHash(cancelSecret);
|
|
2227
2224
|
const currentBlock = await cfg.publicClient.getBlockNumber();
|
|
2228
2225
|
const expiry = currentBlock + expiryBlocks;
|
|
2229
2226
|
return {
|
|
@@ -2271,7 +2268,7 @@ function useSwap(config) {
|
|
|
2271
2268
|
noteOverride
|
|
2272
2269
|
} = params;
|
|
2273
2270
|
const cfg = configRef.current;
|
|
2274
|
-
const giveAmount =
|
|
2271
|
+
const giveAmount = chunk23B5XSS4_cjs.computeGiveAmount(takeAmount, rate);
|
|
2275
2272
|
setStage("selecting_notes");
|
|
2276
2273
|
let selectedNote;
|
|
2277
2274
|
if (noteOverride) {
|
|
@@ -2292,10 +2289,10 @@ function useSwap(config) {
|
|
|
2292
2289
|
}
|
|
2293
2290
|
setStage("creating_outputs");
|
|
2294
2291
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2295
|
-
import('../transfer-
|
|
2296
|
-
import('../proof-
|
|
2292
|
+
import('../transfer-PB6D5VCW.cjs'),
|
|
2293
|
+
import('../proof-XR6XE5PJ.cjs'),
|
|
2297
2294
|
import('../index.cjs'),
|
|
2298
|
-
import('../asp-
|
|
2295
|
+
import('../asp-CUE3NMBN.cjs')
|
|
2299
2296
|
]);
|
|
2300
2297
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
2301
2298
|
const { generateUPPProof, formatProofForContract } = proofModule;
|
|
@@ -2341,7 +2338,7 @@ function useSwap(config) {
|
|
|
2341
2338
|
);
|
|
2342
2339
|
}
|
|
2343
2340
|
const nullifier = await sdk.poseidon([
|
|
2344
|
-
BigInt(selectedNote.ownerSecret) %
|
|
2341
|
+
BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER,
|
|
2345
2342
|
BigInt(actualLeafIndex),
|
|
2346
2343
|
storedCommitmentF
|
|
2347
2344
|
]);
|
|
@@ -2355,14 +2352,14 @@ function useSwap(config) {
|
|
|
2355
2352
|
token: token.toString(),
|
|
2356
2353
|
isRagequit: "0",
|
|
2357
2354
|
inputAmount: selectedNote.amount.toString(),
|
|
2358
|
-
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) %
|
|
2355
|
+
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER).toString(),
|
|
2359
2356
|
inputBlinding: selectedNote.blinding.toString(),
|
|
2360
2357
|
inputOrigin: origin.toString(),
|
|
2361
2358
|
inputLeafIndex: actualLeafIndex.toString(),
|
|
2362
2359
|
inputPathElements: padToDepth2(merkleProof.pathElements.map(String), "0", STATE_TREE_DEPTH2),
|
|
2363
2360
|
inputPathIndices: padToDepth2(merkleProof.pathIndices.map(String), "0", STATE_TREE_DEPTH2),
|
|
2364
|
-
aspPathElements: aspProofData.aspPathElements.map(String),
|
|
2365
|
-
aspPathIndices: aspProofData.aspPathIndices.map(String)
|
|
2361
|
+
aspPathElements: padToDepth2(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH3),
|
|
2362
|
+
aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
|
|
2366
2363
|
};
|
|
2367
2364
|
const { proof } = await generateUPPProof(
|
|
2368
2365
|
"withdraw",
|
|
@@ -2522,9 +2519,9 @@ function useSwap(config) {
|
|
|
2522
2519
|
createNoteForSelf(changeAmount, origin, token)
|
|
2523
2520
|
]);
|
|
2524
2521
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2525
|
-
import('../transfer-
|
|
2526
|
-
import('../proof-
|
|
2527
|
-
import('../asp-
|
|
2522
|
+
import('../transfer-PB6D5VCW.cjs'),
|
|
2523
|
+
import('../proof-XR6XE5PJ.cjs'),
|
|
2524
|
+
import('../asp-CUE3NMBN.cjs')
|
|
2528
2525
|
]);
|
|
2529
2526
|
const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
|
|
2530
2527
|
const { generateUPPProof, formatProofForContract } = proofModule;
|
|
@@ -2642,31 +2639,31 @@ function useSwap(config) {
|
|
|
2642
2639
|
|
|
2643
2640
|
Object.defineProperty(exports, "ASP_TREE_DEPTH", {
|
|
2644
2641
|
enumerable: true,
|
|
2645
|
-
get: function () { return
|
|
2642
|
+
get: function () { return chunkXVIICZKW_cjs.ASP_TREE_DEPTH; }
|
|
2646
2643
|
});
|
|
2647
2644
|
Object.defineProperty(exports, "buildASPTree", {
|
|
2648
2645
|
enumerable: true,
|
|
2649
|
-
get: function () { return
|
|
2646
|
+
get: function () { return chunkXVIICZKW_cjs.buildASPTree; }
|
|
2650
2647
|
});
|
|
2651
2648
|
Object.defineProperty(exports, "computeMultiOriginASPRoot", {
|
|
2652
2649
|
enumerable: true,
|
|
2653
|
-
get: function () { return
|
|
2650
|
+
get: function () { return chunkXVIICZKW_cjs.computeMultiOriginASPRoot; }
|
|
2654
2651
|
});
|
|
2655
2652
|
Object.defineProperty(exports, "computeSingleOriginASPRoot", {
|
|
2656
2653
|
enumerable: true,
|
|
2657
|
-
get: function () { return
|
|
2654
|
+
get: function () { return chunkXVIICZKW_cjs.computeSingleOriginASPRoot; }
|
|
2658
2655
|
});
|
|
2659
2656
|
Object.defineProperty(exports, "generateASPProof", {
|
|
2660
2657
|
enumerable: true,
|
|
2661
|
-
get: function () { return
|
|
2658
|
+
get: function () { return chunkXVIICZKW_cjs.generateASPProof; }
|
|
2662
2659
|
});
|
|
2663
2660
|
Object.defineProperty(exports, "generateMultiOriginASPProof", {
|
|
2664
2661
|
enumerable: true,
|
|
2665
|
-
get: function () { return
|
|
2662
|
+
get: function () { return chunkXVIICZKW_cjs.generateMultiOriginASPProof; }
|
|
2666
2663
|
});
|
|
2667
2664
|
Object.defineProperty(exports, "generateSingleOriginASPProof", {
|
|
2668
2665
|
enumerable: true,
|
|
2669
|
-
get: function () { return
|
|
2666
|
+
get: function () { return chunkXVIICZKW_cjs.generateSingleOriginASPProof; }
|
|
2670
2667
|
});
|
|
2671
2668
|
exports.UPPAccountProvider = UPPAccountProvider;
|
|
2672
2669
|
exports.UPPAvatar = UPPAvatar;
|