@permissionless-technologies/upp-sdk 0.3.6 → 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-CWSUBAV3.js → chunk-OBBSIPEK.js} +30 -35
- package/dist/chunk-OBBSIPEK.js.map +1 -0
- package/dist/{chunk-FVT2XRRL.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-NI62M3W3.cjs → chunk-UYE2JASE.cjs} +2 -2
- package/dist/{chunk-NI62M3W3.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-7Q4RSSHM.js → chunk-ZTVXII74.js} +2 -2
- package/dist/{chunk-7Q4RSSHM.js.map → chunk-ZTVXII74.js.map} +1 -1
- package/dist/core/index.cjs +85 -85
- 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 +265 -266
- 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 +47 -51
- 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 +20 -24
- 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-F6YOQTUL.js.map → transfer-MQMGSXTH.js.map} +1 -1
- package/dist/transfer-PB6D5VCW.cjs +37 -0
- package/dist/{transfer-42C4DXYA.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-CWSUBAV3.js.map +0 -1
- package/dist/chunk-FVT2XRRL.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-PTDVGWHU.cjs +0 -10
- package/dist/chunk-PTDVGWHU.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-42C4DXYA.cjs +0 -37
- package/dist/transfer-F6YOQTUL.js +0 -8
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,7 +1983,7 @@ 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;
|
|
1992
1988
|
var ASP_TREE_DEPTH3 = 20;
|
|
1993
1989
|
function padToDepth2(arr, padValue, depth) {
|
|
@@ -2025,7 +2021,7 @@ function useSwapOrderBook(config) {
|
|
|
2025
2021
|
try {
|
|
2026
2022
|
const logs = await config.publicClient.getLogs({
|
|
2027
2023
|
address: config.poolAddress,
|
|
2028
|
-
event:
|
|
2024
|
+
event: chunk23B5XSS4_cjs.SWAP_ORDER_PLACED_EVENT,
|
|
2029
2025
|
fromBlock: config.fromBlock ?? 0n,
|
|
2030
2026
|
toBlock: "latest"
|
|
2031
2027
|
});
|
|
@@ -2041,10 +2037,10 @@ function useSwapOrderBook(config) {
|
|
|
2041
2037
|
blockNumber: log.blockNumber ?? 0n
|
|
2042
2038
|
}));
|
|
2043
2039
|
if (config.sellToken && config.buyToken) {
|
|
2044
|
-
parsedOrders =
|
|
2040
|
+
parsedOrders = chunk23B5XSS4_cjs.filterOrdersByTokenPair(parsedOrders, config.sellToken, config.buyToken);
|
|
2045
2041
|
}
|
|
2046
2042
|
if (config.acceptableAspIds && config.acceptableAspIds.length > 0) {
|
|
2047
|
-
parsedOrders =
|
|
2043
|
+
parsedOrders = chunk23B5XSS4_cjs.filterOrdersByASP(parsedOrders, config.acceptableAspIds);
|
|
2048
2044
|
}
|
|
2049
2045
|
const enriched = [];
|
|
2050
2046
|
for (const order of parsedOrders) {
|
|
@@ -2141,10 +2137,10 @@ function useSwap(config) {
|
|
|
2141
2137
|
}
|
|
2142
2138
|
setStage("creating_outputs");
|
|
2143
2139
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2144
|
-
import('../transfer-
|
|
2145
|
-
import('../proof-
|
|
2140
|
+
import('../transfer-PB6D5VCW.cjs'),
|
|
2141
|
+
import('../proof-XR6XE5PJ.cjs'),
|
|
2146
2142
|
import('../index.cjs'),
|
|
2147
|
-
import('../asp-
|
|
2143
|
+
import('../asp-CUE3NMBN.cjs')
|
|
2148
2144
|
]);
|
|
2149
2145
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
2150
2146
|
const { generateUPPProof, formatProofForContract } = proofModule;
|
|
@@ -2184,7 +2180,7 @@ function useSwap(config) {
|
|
|
2184
2180
|
);
|
|
2185
2181
|
}
|
|
2186
2182
|
const nullifier = await sdk.poseidon([
|
|
2187
|
-
BigInt(selectedNote.ownerSecret) %
|
|
2183
|
+
BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER,
|
|
2188
2184
|
BigInt(actualLeafIndex),
|
|
2189
2185
|
storedCommitment
|
|
2190
2186
|
]);
|
|
@@ -2198,7 +2194,7 @@ function useSwap(config) {
|
|
|
2198
2194
|
token: token.toString(),
|
|
2199
2195
|
isRagequit: "0",
|
|
2200
2196
|
inputAmount: selectedNote.amount.toString(),
|
|
2201
|
-
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) %
|
|
2197
|
+
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER).toString(),
|
|
2202
2198
|
inputBlinding: selectedNote.blinding.toString(),
|
|
2203
2199
|
inputOrigin: origin.toString(),
|
|
2204
2200
|
inputLeafIndex: actualLeafIndex.toString(),
|
|
@@ -2223,8 +2219,8 @@ function useSwap(config) {
|
|
|
2223
2219
|
formattedProof.c[0],
|
|
2224
2220
|
formattedProof.c[1]
|
|
2225
2221
|
];
|
|
2226
|
-
const cancelSecret =
|
|
2227
|
-
const cancelKeyHash =
|
|
2222
|
+
const cancelSecret = chunk23B5XSS4_cjs.generateCancelSecret();
|
|
2223
|
+
const cancelKeyHash = chunk23B5XSS4_cjs.computeCancelKeyHash(cancelSecret);
|
|
2228
2224
|
const currentBlock = await cfg.publicClient.getBlockNumber();
|
|
2229
2225
|
const expiry = currentBlock + expiryBlocks;
|
|
2230
2226
|
return {
|
|
@@ -2272,7 +2268,7 @@ function useSwap(config) {
|
|
|
2272
2268
|
noteOverride
|
|
2273
2269
|
} = params;
|
|
2274
2270
|
const cfg = configRef.current;
|
|
2275
|
-
const giveAmount =
|
|
2271
|
+
const giveAmount = chunk23B5XSS4_cjs.computeGiveAmount(takeAmount, rate);
|
|
2276
2272
|
setStage("selecting_notes");
|
|
2277
2273
|
let selectedNote;
|
|
2278
2274
|
if (noteOverride) {
|
|
@@ -2293,10 +2289,10 @@ function useSwap(config) {
|
|
|
2293
2289
|
}
|
|
2294
2290
|
setStage("creating_outputs");
|
|
2295
2291
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2296
|
-
import('../transfer-
|
|
2297
|
-
import('../proof-
|
|
2292
|
+
import('../transfer-PB6D5VCW.cjs'),
|
|
2293
|
+
import('../proof-XR6XE5PJ.cjs'),
|
|
2298
2294
|
import('../index.cjs'),
|
|
2299
|
-
import('../asp-
|
|
2295
|
+
import('../asp-CUE3NMBN.cjs')
|
|
2300
2296
|
]);
|
|
2301
2297
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
2302
2298
|
const { generateUPPProof, formatProofForContract } = proofModule;
|
|
@@ -2342,7 +2338,7 @@ function useSwap(config) {
|
|
|
2342
2338
|
);
|
|
2343
2339
|
}
|
|
2344
2340
|
const nullifier = await sdk.poseidon([
|
|
2345
|
-
BigInt(selectedNote.ownerSecret) %
|
|
2341
|
+
BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER,
|
|
2346
2342
|
BigInt(actualLeafIndex),
|
|
2347
2343
|
storedCommitmentF
|
|
2348
2344
|
]);
|
|
@@ -2356,7 +2352,7 @@ function useSwap(config) {
|
|
|
2356
2352
|
token: token.toString(),
|
|
2357
2353
|
isRagequit: "0",
|
|
2358
2354
|
inputAmount: selectedNote.amount.toString(),
|
|
2359
|
-
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) %
|
|
2355
|
+
inputOneTimeSecret: (BigInt(selectedNote.ownerSecret) % chunkHEHXSV47_cjs.BABYJUBJUB_SUBORDER).toString(),
|
|
2360
2356
|
inputBlinding: selectedNote.blinding.toString(),
|
|
2361
2357
|
inputOrigin: origin.toString(),
|
|
2362
2358
|
inputLeafIndex: actualLeafIndex.toString(),
|
|
@@ -2523,9 +2519,9 @@ function useSwap(config) {
|
|
|
2523
2519
|
createNoteForSelf(changeAmount, origin, token)
|
|
2524
2520
|
]);
|
|
2525
2521
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2526
|
-
import('../transfer-
|
|
2527
|
-
import('../proof-
|
|
2528
|
-
import('../asp-
|
|
2522
|
+
import('../transfer-PB6D5VCW.cjs'),
|
|
2523
|
+
import('../proof-XR6XE5PJ.cjs'),
|
|
2524
|
+
import('../asp-CUE3NMBN.cjs')
|
|
2529
2525
|
]);
|
|
2530
2526
|
const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
|
|
2531
2527
|
const { generateUPPProof, formatProofForContract } = proofModule;
|
|
@@ -2643,31 +2639,31 @@ function useSwap(config) {
|
|
|
2643
2639
|
|
|
2644
2640
|
Object.defineProperty(exports, "ASP_TREE_DEPTH", {
|
|
2645
2641
|
enumerable: true,
|
|
2646
|
-
get: function () { return
|
|
2642
|
+
get: function () { return chunkXVIICZKW_cjs.ASP_TREE_DEPTH; }
|
|
2647
2643
|
});
|
|
2648
2644
|
Object.defineProperty(exports, "buildASPTree", {
|
|
2649
2645
|
enumerable: true,
|
|
2650
|
-
get: function () { return
|
|
2646
|
+
get: function () { return chunkXVIICZKW_cjs.buildASPTree; }
|
|
2651
2647
|
});
|
|
2652
2648
|
Object.defineProperty(exports, "computeMultiOriginASPRoot", {
|
|
2653
2649
|
enumerable: true,
|
|
2654
|
-
get: function () { return
|
|
2650
|
+
get: function () { return chunkXVIICZKW_cjs.computeMultiOriginASPRoot; }
|
|
2655
2651
|
});
|
|
2656
2652
|
Object.defineProperty(exports, "computeSingleOriginASPRoot", {
|
|
2657
2653
|
enumerable: true,
|
|
2658
|
-
get: function () { return
|
|
2654
|
+
get: function () { return chunkXVIICZKW_cjs.computeSingleOriginASPRoot; }
|
|
2659
2655
|
});
|
|
2660
2656
|
Object.defineProperty(exports, "generateASPProof", {
|
|
2661
2657
|
enumerable: true,
|
|
2662
|
-
get: function () { return
|
|
2658
|
+
get: function () { return chunkXVIICZKW_cjs.generateASPProof; }
|
|
2663
2659
|
});
|
|
2664
2660
|
Object.defineProperty(exports, "generateMultiOriginASPProof", {
|
|
2665
2661
|
enumerable: true,
|
|
2666
|
-
get: function () { return
|
|
2662
|
+
get: function () { return chunkXVIICZKW_cjs.generateMultiOriginASPProof; }
|
|
2667
2663
|
});
|
|
2668
2664
|
Object.defineProperty(exports, "generateSingleOriginASPProof", {
|
|
2669
2665
|
enumerable: true,
|
|
2670
|
-
get: function () { return
|
|
2666
|
+
get: function () { return chunkXVIICZKW_cjs.generateSingleOriginASPProof; }
|
|
2671
2667
|
});
|
|
2672
2668
|
exports.UPPAccountProvider = UPPAccountProvider;
|
|
2673
2669
|
exports.UPPAvatar = UPPAvatar;
|