@permissionless-technologies/upp-sdk 0.5.6 → 0.5.7
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/{chunk-CRUJLZV7.js → chunk-N2VHE47N.js} +72 -7
- package/dist/chunk-N2VHE47N.js.map +1 -0
- package/dist/{chunk-UHMHZQZV.js → chunk-OG6TNEAT.js} +2 -2
- package/dist/{chunk-UHMHZQZV.js.map → chunk-OG6TNEAT.js.map} +1 -1
- package/dist/{chunk-HVSP62AH.cjs → chunk-TKUOY2PQ.cjs} +2 -2
- package/dist/{chunk-HVSP62AH.cjs.map → chunk-TKUOY2PQ.cjs.map} +1 -1
- package/dist/{chunk-P6E3LE7T.cjs → chunk-Y3VL3LOE.cjs} +72 -4
- package/dist/chunk-Y3VL3LOE.cjs.map +1 -0
- package/dist/core/index.cjs +63 -63
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +3 -3
- package/dist/{index-DLvLv3mg.d.ts → index-2eL8ZLD0.d.ts} +1 -1
- package/dist/{index-DY0XAmFw.d.ts → index-B31tBTbC.d.ts} +2 -2
- package/dist/{index-DOiHUft6.d.cts → index-CzmvOht6.d.cts} +2 -2
- package/dist/{index-KTJgQUxb.d.cts → index-a_f935pS.d.cts} +1 -1
- package/dist/index.cjs +113 -113
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/indexer/index.cjs +11 -11
- 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/react/index.cjs +52 -90
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +6 -2
- package/dist/react/index.d.ts +6 -2
- package/dist/react/index.js +44 -82
- package/dist/react/index.js.map +1 -1
- package/dist/transfer-27GZNGCI.js +9 -0
- package/dist/{transfer-2UYFZMIK.js.map → transfer-27GZNGCI.js.map} +1 -1
- package/dist/{transfer-6OW3XKVC.cjs → transfer-TJNDCZF2.cjs} +13 -9
- package/dist/{transfer-6OW3XKVC.cjs.map → transfer-TJNDCZF2.cjs.map} +1 -1
- package/dist/{transfer-C1XU_z-6.d.cts → transfer-_qaZXsv7.d.cts} +1 -0
- package/dist/{transfer-DgjxZlR7.d.ts → transfer-x7UChjh7.d.ts} +1 -0
- package/dist/utils/index.cjs +21 -21
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/src/deployments/31337.json +2 -2
- package/dist/chunk-CRUJLZV7.js.map +0 -1
- package/dist/chunk-P6E3LE7T.cjs.map +0 -1
- package/dist/transfer-2UYFZMIK.js +0 -9
package/dist/react/index.d.cts
CHANGED
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import { ReactNode, CSSProperties } from 'react';
|
|
4
4
|
import { Hex, Address, PublicClient } from 'viem';
|
|
5
5
|
import { M as MasterKeys, b as StarkMasterKeys } from '../types-CJSbxv4q.cjs';
|
|
6
|
-
import { H as ShieldedNote, aL as NoteCreationResult, s as ProofSystem, t as ProofWorkerManager, j as DownloadProgress, aM as PlonkProofStruct, a3 as TransferStage, P as PlonkProvingStage, _ as SwapOrderEvent, a5 as UPPCircuitType, f as CircuitCacheStatus } from '../transfer-
|
|
7
|
-
export { A as ASPProof, aN as ASP_TREE_DEPTH, C as CIRCUIT_CDN_BASE, c as CIRCUIT_VERSION, d as CircuitArtifactCache, a9 as buildASPTree, af as computeMultiOriginASPRoot, ai as computeSingleOriginASPRoot, ar as generateASPProof, at as generateMultiOriginASPProof, av as generateSingleOriginASPProof, ay as generateUPPProofAsync } from '../transfer-
|
|
6
|
+
import { H as ShieldedNote, aL as NoteCreationResult, s as ProofSystem, t as ProofWorkerManager, j as DownloadProgress, aM as PlonkProofStruct, a3 as TransferStage, P as PlonkProvingStage, _ as SwapOrderEvent, a5 as UPPCircuitType, f as CircuitCacheStatus } from '../transfer-_qaZXsv7.cjs';
|
|
7
|
+
export { A as ASPProof, aN as ASP_TREE_DEPTH, C as CIRCUIT_CDN_BASE, c as CIRCUIT_VERSION, d as CircuitArtifactCache, a9 as buildASPTree, af as computeMultiOriginASPRoot, ai as computeSingleOriginASPRoot, ar as generateASPProof, at as generateMultiOriginASPProof, av as generateSingleOriginASPProof, ay as generateUPPProofAsync } from '../transfer-_qaZXsv7.cjs';
|
|
8
8
|
import { P as Point } from '../merkle-mteVOlDf.cjs';
|
|
9
9
|
import '../keccak-m31-B_AqBbRF.cjs';
|
|
10
10
|
import '@permissionless-technologies/upc-sdk';
|
|
@@ -474,6 +474,10 @@ interface WithdrawParams {
|
|
|
474
474
|
aspId?: bigint;
|
|
475
475
|
/** ASP root for compliance (default: 0 for ragequit) */
|
|
476
476
|
aspRoot?: bigint;
|
|
477
|
+
/** ASP Merkle proof path elements (required when not ragequit) */
|
|
478
|
+
aspPathElements?: bigint[];
|
|
479
|
+
/** ASP Merkle proof path indices (required when not ragequit) */
|
|
480
|
+
aspPathIndices?: number[];
|
|
477
481
|
/** Enable ragequit mode (bypass ASP check, requires recipient = origin) */
|
|
478
482
|
isRagequit?: boolean;
|
|
479
483
|
}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import { ReactNode, CSSProperties } from 'react';
|
|
4
4
|
import { Hex, Address, PublicClient } from 'viem';
|
|
5
5
|
import { M as MasterKeys, b as StarkMasterKeys } from '../types-mLybMxNR.js';
|
|
6
|
-
import { H as ShieldedNote, aL as NoteCreationResult, s as ProofSystem, t as ProofWorkerManager, j as DownloadProgress, aM as PlonkProofStruct, a3 as TransferStage, P as PlonkProvingStage, _ as SwapOrderEvent, a5 as UPPCircuitType, f as CircuitCacheStatus } from '../transfer-
|
|
7
|
-
export { A as ASPProof, aN as ASP_TREE_DEPTH, C as CIRCUIT_CDN_BASE, c as CIRCUIT_VERSION, d as CircuitArtifactCache, a9 as buildASPTree, af as computeMultiOriginASPRoot, ai as computeSingleOriginASPRoot, ar as generateASPProof, at as generateMultiOriginASPProof, av as generateSingleOriginASPProof, ay as generateUPPProofAsync } from '../transfer-
|
|
6
|
+
import { H as ShieldedNote, aL as NoteCreationResult, s as ProofSystem, t as ProofWorkerManager, j as DownloadProgress, aM as PlonkProofStruct, a3 as TransferStage, P as PlonkProvingStage, _ as SwapOrderEvent, a5 as UPPCircuitType, f as CircuitCacheStatus } from '../transfer-x7UChjh7.js';
|
|
7
|
+
export { A as ASPProof, aN as ASP_TREE_DEPTH, C as CIRCUIT_CDN_BASE, c as CIRCUIT_VERSION, d as CircuitArtifactCache, a9 as buildASPTree, af as computeMultiOriginASPRoot, ai as computeSingleOriginASPRoot, ar as generateASPProof, at as generateMultiOriginASPProof, av as generateSingleOriginASPProof, ay as generateUPPProofAsync } from '../transfer-x7UChjh7.js';
|
|
8
8
|
import { P as Point } from '../merkle-mteVOlDf.js';
|
|
9
9
|
import '../keccak-m31-B_AqBbRF.js';
|
|
10
10
|
import '@permissionless-technologies/upc-sdk';
|
|
@@ -474,6 +474,10 @@ interface WithdrawParams {
|
|
|
474
474
|
aspId?: bigint;
|
|
475
475
|
/** ASP root for compliance (default: 0 for ragequit) */
|
|
476
476
|
aspRoot?: bigint;
|
|
477
|
+
/** ASP Merkle proof path elements (required when not ragequit) */
|
|
478
|
+
aspPathElements?: bigint[];
|
|
479
|
+
/** ASP Merkle proof path indices (required when not ragequit) */
|
|
480
|
+
aspPathIndices?: number[];
|
|
477
481
|
/** Enable ragequit mode (bypass ASP check, requires recipient = origin) */
|
|
478
482
|
isRagequit?: boolean;
|
|
479
483
|
}
|
package/dist/react/index.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { StorableAccountAdapter, init_stealth, stealth_exports, generateUPPProofAsync, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, ProofWorkerManager, getCancelSecret, SWAP_ORDER_FILLED_EVENT, SWAP_ORDER_CLAIMED_EVENT, SWAP_ORDER_CANCELLED_EVENT, NoteStore } from '../chunk-2NKFTLPD.js';
|
|
2
2
|
export { ProofWorkerManager, generateUPPProofAsync } from '../chunk-2NKFTLPD.js';
|
|
3
|
+
import { packNoteData, buildWithdrawCircuitInputs, padToDepth } from '../chunk-N2VHE47N.js';
|
|
4
|
+
import '../chunk-KR4GB6VC.js';
|
|
3
5
|
import { computeSingleOriginASPRoot } from '../chunk-6IEYWJVS.js';
|
|
4
6
|
export { ASP_TREE_DEPTH, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof } from '../chunk-6IEYWJVS.js';
|
|
5
7
|
import { CircuitArtifactCache, CIRCUIT_VERSION } from '../chunk-2BSIUEPO.js';
|
|
6
8
|
export { CIRCUIT_CDN_BASE, CIRCUIT_VERSION, CircuitArtifactCache } from '../chunk-2BSIUEPO.js';
|
|
9
|
+
import '../chunk-GPF72JFR.js';
|
|
7
10
|
import { createSyncEngine } from '../chunk-FW2U6TKQ.js';
|
|
8
11
|
import { createIndexedDBAdapter } from '../chunk-ABVALIIG.js';
|
|
9
12
|
import { init_crypto, hexToBytes, bigintToBytes } from '../chunk-4E23V3AT.js';
|
|
10
13
|
import { init_poseidon, computeOwnerHash } from '../chunk-5QSSX3KR.js';
|
|
11
14
|
import { __toCommonJS } from '../chunk-Z6ZWNWWR.js';
|
|
12
15
|
import { createContext, useState, useRef, useEffect, useCallback, useMemo, useContext } from 'react';
|
|
13
|
-
import { keccak256, toBytes, toHex
|
|
16
|
+
import { keccak256, toBytes, toHex } from 'viem';
|
|
14
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
15
18
|
import { createPortal } from 'react-dom';
|
|
16
19
|
import { ASP_REGISTRY_HUB_ABI } from '@permissionless-technologies/upc-sdk';
|
|
@@ -181,7 +184,9 @@ function UPPAccountProvider({
|
|
|
181
184
|
const [lastSyncedBlock, _setLastSyncedBlock] = useState(0);
|
|
182
185
|
const [liveSyncInterval, setLiveSyncInterval] = useState(null);
|
|
183
186
|
const noteStoreRef = useRef(null);
|
|
187
|
+
const [noteStoreReady, setNoteStoreReady] = useState(false);
|
|
184
188
|
const accountAdapterRef = useRef(null);
|
|
189
|
+
const [initNonce, setInitNonce] = useState(0);
|
|
185
190
|
useEffect(() => {
|
|
186
191
|
loadSDK().then(() => setCryptoReady(true));
|
|
187
192
|
}, []);
|
|
@@ -194,6 +199,7 @@ function UPPAccountProvider({
|
|
|
194
199
|
setStarkMasterKeys(null);
|
|
195
200
|
setNotes([]);
|
|
196
201
|
noteStoreRef.current = null;
|
|
202
|
+
setNoteStoreReady(false);
|
|
197
203
|
accountAdapterRef.current = null;
|
|
198
204
|
return;
|
|
199
205
|
}
|
|
@@ -241,6 +247,7 @@ function UPPAccountProvider({
|
|
|
241
247
|
const noteStorage = createIndexedDBAdapter(storagePrefix);
|
|
242
248
|
const store = new NoteStore(noteStorage, "notes");
|
|
243
249
|
noteStoreRef.current = store;
|
|
250
|
+
setNoteStoreReady(true);
|
|
244
251
|
noteStoreUnsub = store.onChange(() => {
|
|
245
252
|
if (!cancelled) setNotes([...store.getNotes()]);
|
|
246
253
|
});
|
|
@@ -280,7 +287,7 @@ function UPPAccountProvider({
|
|
|
280
287
|
cancelled = true;
|
|
281
288
|
if (noteStoreUnsub) noteStoreUnsub();
|
|
282
289
|
};
|
|
283
|
-
}, [ethAddress, cryptoReady, chainId, publicClientProp]);
|
|
290
|
+
}, [ethAddress, cryptoReady, chainId, publicClientProp, initNonce]);
|
|
284
291
|
const setupAccount = useCallback(
|
|
285
292
|
async (signature) => {
|
|
286
293
|
if (!ethAddress || !cryptoReady) {
|
|
@@ -298,6 +305,7 @@ function UPPAccountProvider({
|
|
|
298
305
|
if (adapter) {
|
|
299
306
|
await adapter.save(keys, starkKeys);
|
|
300
307
|
}
|
|
308
|
+
setInitNonce((n) => n + 1);
|
|
301
309
|
} finally {
|
|
302
310
|
setIsLoading(false);
|
|
303
311
|
}
|
|
@@ -335,8 +343,8 @@ function UPPAccountProvider({
|
|
|
335
343
|
const logout = useCallback(() => {
|
|
336
344
|
noteStoreRef.current?.clear().catch(console.error);
|
|
337
345
|
noteStoreRef.current = null;
|
|
346
|
+
setNoteStoreReady(false);
|
|
338
347
|
accountAdapterRef.current?.clear().catch(console.error);
|
|
339
|
-
accountAdapterRef.current = null;
|
|
340
348
|
if (masterKeys) {
|
|
341
349
|
const ownerHashHex2 = toHex(masterKeys.ownerHash, { size: 32 });
|
|
342
350
|
const notesKey = getNotesStorageKey(chainId, ownerHashHex2.slice(0, 12));
|
|
@@ -409,7 +417,7 @@ function UPPAccountProvider({
|
|
|
409
417
|
);
|
|
410
418
|
const syncEngineRef = useRef(null);
|
|
411
419
|
useEffect(() => {
|
|
412
|
-
if (!masterKeys || !cryptoReady || !publicClientProp || !indexerConfig?.contractAddress) {
|
|
420
|
+
if (!masterKeys || !cryptoReady || !publicClientProp || !indexerConfig?.contractAddress || !noteStoreReady) {
|
|
413
421
|
syncEngineRef.current = null;
|
|
414
422
|
return;
|
|
415
423
|
}
|
|
@@ -433,7 +441,7 @@ function UPPAccountProvider({
|
|
|
433
441
|
return () => {
|
|
434
442
|
cancelled = true;
|
|
435
443
|
};
|
|
436
|
-
}, [masterKeys, cryptoReady, publicClientProp, indexerConfig?.contractAddress, indexerConfig?.swapModuleAddress, indexerConfig?.fromBlock]);
|
|
444
|
+
}, [masterKeys, cryptoReady, publicClientProp, noteStoreReady, indexerConfig?.contractAddress, indexerConfig?.swapModuleAddress, indexerConfig?.fromBlock]);
|
|
437
445
|
const syncNotes = useCallback(
|
|
438
446
|
async (_contractAddress, _client) => {
|
|
439
447
|
const engine = syncEngineRef.current;
|
|
@@ -1146,18 +1154,6 @@ function useUPPCrypto() {
|
|
|
1146
1154
|
getSubOrder
|
|
1147
1155
|
};
|
|
1148
1156
|
}
|
|
1149
|
-
function packNoteData(note) {
|
|
1150
|
-
return encodePacked(
|
|
1151
|
-
["uint64", "uint256", "bytes"],
|
|
1152
|
-
[note.searchTag, note.ownerHash, note.encryptedNote]
|
|
1153
|
-
);
|
|
1154
|
-
}
|
|
1155
|
-
function padToDepth(arr, padValue, depth) {
|
|
1156
|
-
if (arr.length >= depth) return arr.slice(0, depth);
|
|
1157
|
-
return [...arr, ...Array(depth - arr.length).fill(padValue)];
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
// src/react/use-shield.ts
|
|
1161
1157
|
function useShield(config) {
|
|
1162
1158
|
const { createNoteForSelf, isSetup, masterKeys } = useUPPAccount();
|
|
1163
1159
|
const [isPending, setIsPending] = useState(false);
|
|
@@ -1266,7 +1262,7 @@ function usePoolTransfer(config) {
|
|
|
1266
1262
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1267
1263
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1268
1264
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1269
|
-
import('../transfer-
|
|
1265
|
+
import('../transfer-27GZNGCI.js'),
|
|
1270
1266
|
import('../proof-YMXBL4D5.js'),
|
|
1271
1267
|
import('../asp-72WUGTQE.js')
|
|
1272
1268
|
]);
|
|
@@ -1352,9 +1348,6 @@ function usePoolTransfer(config) {
|
|
|
1352
1348
|
reset
|
|
1353
1349
|
};
|
|
1354
1350
|
}
|
|
1355
|
-
init_poseidon();
|
|
1356
|
-
var STATE_TREE_DEPTH = 32;
|
|
1357
|
-
var ASP_TREE_DEPTH2 = 20;
|
|
1358
1351
|
function useWithdraw(config) {
|
|
1359
1352
|
const {
|
|
1360
1353
|
isSetup,
|
|
@@ -1384,6 +1377,8 @@ function useWithdraw(config) {
|
|
|
1384
1377
|
recipient,
|
|
1385
1378
|
aspId = 0n,
|
|
1386
1379
|
aspRoot = 0n,
|
|
1380
|
+
aspPathElements,
|
|
1381
|
+
aspPathIndices,
|
|
1387
1382
|
isRagequit = false
|
|
1388
1383
|
} = params;
|
|
1389
1384
|
const cfg = configRef.current;
|
|
@@ -1417,10 +1412,9 @@ function useWithdraw(config) {
|
|
|
1417
1412
|
const origin = BigInt(selectedNote.origin);
|
|
1418
1413
|
const token = BigInt(selectedNote.token);
|
|
1419
1414
|
setStage("creating_outputs");
|
|
1420
|
-
const [transferModule, proofModule
|
|
1421
|
-
import('../transfer-
|
|
1422
|
-
import('../proof-YMXBL4D5.js')
|
|
1423
|
-
import('../index.js')
|
|
1415
|
+
const [transferModule, proofModule] = await Promise.all([
|
|
1416
|
+
import('../transfer-27GZNGCI.js'),
|
|
1417
|
+
import('../proof-YMXBL4D5.js')
|
|
1424
1418
|
]);
|
|
1425
1419
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
1426
1420
|
const { formatPlonkProofForContract } = proofModule;
|
|
@@ -1438,50 +1432,18 @@ function useWithdraw(config) {
|
|
|
1438
1432
|
};
|
|
1439
1433
|
const [noteProof] = await getMerkleProofsForNotes([spendableNote], leaves, tree);
|
|
1440
1434
|
setStage("generating_proof");
|
|
1441
|
-
const
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
const
|
|
1453
|
-
if (localCommitment !== storedCommitment) {
|
|
1454
|
-
throw new Error(
|
|
1455
|
-
`Note commitment mismatch \u2014 this note was created with an outdated commitment formula. Clear your shielded account (localStorage) and re-shield tokens.`
|
|
1456
|
-
);
|
|
1457
|
-
}
|
|
1458
|
-
const nullifier = await sdk.poseidon([
|
|
1459
|
-
BigInt(selectedNote.ownerSecret),
|
|
1460
|
-
BigInt(actualLeafIndex),
|
|
1461
|
-
storedCommitment
|
|
1462
|
-
]);
|
|
1463
|
-
const circuitInputs = {
|
|
1464
|
-
// Public inputs
|
|
1465
|
-
stateRoot: stateRootBI.toString(),
|
|
1466
|
-
aspRoot: aspRoot.toString(),
|
|
1467
|
-
nullifier: nullifier.toString(),
|
|
1468
|
-
amount: selectedNote.amount.toString(),
|
|
1469
|
-
recipient: BigInt(recipient).toString(),
|
|
1470
|
-
token: BigInt(cfg.tokenAddress).toString(),
|
|
1471
|
-
isRagequit: isRagequit ? "1" : "0",
|
|
1472
|
-
// Private inputs - Input Note
|
|
1473
|
-
// IMPORTANT: Use actualLeafIndex from Merkle proof, not stored leafIndex
|
|
1474
|
-
inputAmount: selectedNote.amount.toString(),
|
|
1475
|
-
inputOneTimeSecret: BigInt(selectedNote.ownerSecret).toString(),
|
|
1476
|
-
inputBlinding: selectedNote.blinding.toString(),
|
|
1477
|
-
inputOrigin: origin.toString(),
|
|
1478
|
-
inputLeafIndex: actualLeafIndex.toString(),
|
|
1479
|
-
inputPathElements: padToDepth(merkleProof.pathElements.map(String), "0", STATE_TREE_DEPTH),
|
|
1480
|
-
inputPathIndices: padToDepth(merkleProof.pathIndices.map(String), "0", STATE_TREE_DEPTH),
|
|
1481
|
-
// ASP membership proof (zeros for ragequit)
|
|
1482
|
-
aspPathElements: Array(ASP_TREE_DEPTH2).fill("0"),
|
|
1483
|
-
aspPathIndices: Array(ASP_TREE_DEPTH2).fill("0")
|
|
1484
|
-
};
|
|
1435
|
+
const circuitInputs = await buildWithdrawCircuitInputs({
|
|
1436
|
+
selectedNote: spendableNote,
|
|
1437
|
+
merkleProof: noteProof.proof,
|
|
1438
|
+
recipient: BigInt(recipient),
|
|
1439
|
+
tokenAddress: BigInt(cfg.tokenAddress),
|
|
1440
|
+
aspRoot,
|
|
1441
|
+
aspPathElements,
|
|
1442
|
+
aspPathIndices,
|
|
1443
|
+
isRagequit
|
|
1444
|
+
});
|
|
1445
|
+
const stateRootBI = noteProof.proof.root;
|
|
1446
|
+
const nullifier = BigInt(circuitInputs.nullifier);
|
|
1485
1447
|
setProvingProgress(null);
|
|
1486
1448
|
const { proof } = await generateUPPProofAsync(
|
|
1487
1449
|
"withdraw",
|
|
@@ -1642,8 +1604,8 @@ function storePersonalASPId(chainId, address, aspId) {
|
|
|
1642
1604
|
storeASPId(chainId, address, aspId);
|
|
1643
1605
|
}
|
|
1644
1606
|
init_poseidon();
|
|
1645
|
-
var
|
|
1646
|
-
var
|
|
1607
|
+
var STATE_TREE_DEPTH = 32;
|
|
1608
|
+
var ASP_TREE_DEPTH2 = 20;
|
|
1647
1609
|
var SWAP_ORDERS_ABI = [{
|
|
1648
1610
|
type: "function",
|
|
1649
1611
|
name: "swapOrders",
|
|
@@ -1792,7 +1754,7 @@ function useSwap(config) {
|
|
|
1792
1754
|
}
|
|
1793
1755
|
setStage("creating_outputs");
|
|
1794
1756
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
1795
|
-
import('../transfer-
|
|
1757
|
+
import('../transfer-27GZNGCI.js'),
|
|
1796
1758
|
import('../proof-YMXBL4D5.js'),
|
|
1797
1759
|
import('../index.js'),
|
|
1798
1760
|
import('../asp-72WUGTQE.js')
|
|
@@ -1852,10 +1814,10 @@ function useSwap(config) {
|
|
|
1852
1814
|
inputBlinding: selectedNote.blinding.toString(),
|
|
1853
1815
|
inputOrigin: origin.toString(),
|
|
1854
1816
|
inputLeafIndex: actualLeafIndex.toString(),
|
|
1855
|
-
inputPathElements: padToDepth(merkleProof.pathElements.map(String), "0",
|
|
1856
|
-
inputPathIndices: padToDepth(merkleProof.pathIndices.map(String), "0",
|
|
1857
|
-
aspPathElements: padToDepth(aspProofData.aspPathElements.map(String), "0",
|
|
1858
|
-
aspPathIndices: padToDepth(aspProofData.aspPathIndices.map(String), "0",
|
|
1817
|
+
inputPathElements: padToDepth(merkleProof.pathElements.map(String), "0", STATE_TREE_DEPTH),
|
|
1818
|
+
inputPathIndices: padToDepth(merkleProof.pathIndices.map(String), "0", STATE_TREE_DEPTH),
|
|
1819
|
+
aspPathElements: padToDepth(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH2),
|
|
1820
|
+
aspPathIndices: padToDepth(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH2)
|
|
1859
1821
|
};
|
|
1860
1822
|
setProvingProgress(null);
|
|
1861
1823
|
const { proof } = await generateUPPProofAsync(
|
|
@@ -1940,7 +1902,7 @@ function useSwap(config) {
|
|
|
1940
1902
|
}
|
|
1941
1903
|
setStage("creating_outputs");
|
|
1942
1904
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
1943
|
-
import('../transfer-
|
|
1905
|
+
import('../transfer-27GZNGCI.js'),
|
|
1944
1906
|
import('../proof-YMXBL4D5.js'),
|
|
1945
1907
|
import('../index.js'),
|
|
1946
1908
|
import('../asp-72WUGTQE.js')
|
|
@@ -2006,10 +1968,10 @@ function useSwap(config) {
|
|
|
2006
1968
|
inputBlinding: selectedNote.blinding.toString(),
|
|
2007
1969
|
inputOrigin: origin.toString(),
|
|
2008
1970
|
inputLeafIndex: actualLeafIndex.toString(),
|
|
2009
|
-
inputPathElements: padToDepth(merkleProof.pathElements.map(String), "0",
|
|
2010
|
-
inputPathIndices: padToDepth(merkleProof.pathIndices.map(String), "0",
|
|
2011
|
-
aspPathElements: padToDepth(aspProofData.aspPathElements.map(String), "0",
|
|
2012
|
-
aspPathIndices: padToDepth(aspProofData.aspPathIndices.map(String), "0",
|
|
1971
|
+
inputPathElements: padToDepth(merkleProof.pathElements.map(String), "0", STATE_TREE_DEPTH),
|
|
1972
|
+
inputPathIndices: padToDepth(merkleProof.pathIndices.map(String), "0", STATE_TREE_DEPTH),
|
|
1973
|
+
aspPathElements: padToDepth(aspProofData.aspPathElements.map(String), "0", ASP_TREE_DEPTH2),
|
|
1974
|
+
aspPathIndices: padToDepth(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH2)
|
|
2013
1975
|
};
|
|
2014
1976
|
setProvingProgress(null);
|
|
2015
1977
|
const { proof } = await generateUPPProofAsync(
|
|
@@ -2165,7 +2127,7 @@ function useSwap(config) {
|
|
|
2165
2127
|
createNoteForSelf(changeAmount, origin, token)
|
|
2166
2128
|
]);
|
|
2167
2129
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2168
|
-
import('../transfer-
|
|
2130
|
+
import('../transfer-27GZNGCI.js'),
|
|
2169
2131
|
import('../proof-YMXBL4D5.js'),
|
|
2170
2132
|
import('../asp-72WUGTQE.js')
|
|
2171
2133
|
]);
|