@permissionless-technologies/upp-sdk 0.4.10 → 0.4.12
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-L3PVYAH2.js → chunk-JD3KMRWN.js} +3 -3
- package/dist/{chunk-L3PVYAH2.js.map → chunk-JD3KMRWN.js.map} +1 -1
- package/dist/{chunk-43GNVMVL.cjs → chunk-ONNWKSAZ.cjs} +3 -3
- package/dist/{chunk-43GNVMVL.cjs.map → chunk-ONNWKSAZ.cjs.map} +1 -1
- package/dist/{chunk-IWNEKLAA.cjs → chunk-OPBS3OMJ.cjs} +2 -2
- package/dist/{chunk-IWNEKLAA.cjs.map → chunk-OPBS3OMJ.cjs.map} +1 -1
- package/dist/{chunk-R75NKNDC.js → chunk-S2OM2NHS.js} +2 -2
- package/dist/{chunk-R75NKNDC.js.map → chunk-S2OM2NHS.js.map} +1 -1
- package/dist/core/index.cjs +13 -13
- package/dist/core/index.js +3 -3
- package/dist/{index-Mm_cz6Ie.d.cts → index-CKCDqv2e.d.cts} +40 -0
- package/dist/{index-Cxm5E-J5.d.ts → index-DLczKlnM.d.ts} +40 -0
- package/dist/index.cjs +225 -177
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +53 -5
- package/dist/index.js.map +1 -1
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.d.cts +2 -2
- package/dist/indexer/index.d.ts +2 -2
- package/dist/indexer/index.js +1 -1
- package/dist/react/index.cjs +113 -6
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +113 -6
- package/dist/react/index.js.map +1 -1
- package/dist/{transfer-ZDJPVUL2.cjs → transfer-DZFXSJAU.cjs} +10 -10
- package/dist/{transfer-ZDJPVUL2.cjs.map → transfer-DZFXSJAU.cjs.map} +1 -1
- package/dist/{transfer-WYG6422Y.js → transfer-Y5QKVEYS.js} +4 -4
- package/dist/{transfer-WYG6422Y.js.map → transfer-Y5QKVEYS.js.map} +1 -1
- package/package.json +1 -1
- package/src/contracts/interfaces/IUniversalPrivatePool.sol +11 -3
package/dist/react/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StorableAccountAdapter, init_stealth, stealth_exports, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, NoteStore } from '../chunk-RNUG3EFC.js';
|
|
2
2
|
import { computeSingleOriginASPRoot } from '../chunk-6IEYWJVS.js';
|
|
3
3
|
export { ASP_TREE_DEPTH, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof } from '../chunk-6IEYWJVS.js';
|
|
4
|
-
import { createAutoAdapter } from '../chunk-XV72HNHN.js';
|
|
5
4
|
import '../chunk-UQIM2KT3.js';
|
|
5
|
+
import { createAutoAdapter } from '../chunk-XV72HNHN.js';
|
|
6
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';
|
|
@@ -187,6 +187,7 @@ function UPPAccountProvider({
|
|
|
187
187
|
return () => {
|
|
188
188
|
cancelled = true;
|
|
189
189
|
if (noteStoreUnsub) noteStoreUnsub();
|
|
190
|
+
syncPromiseRef.current = null;
|
|
190
191
|
};
|
|
191
192
|
}, [ethAddress, cryptoReady, chainId, publicClientProp]);
|
|
192
193
|
const persistNotes = useCallback(
|
|
@@ -473,6 +474,112 @@ function UPPAccountProvider({
|
|
|
473
474
|
} catch (e) {
|
|
474
475
|
console.warn("[syncNotes] Failed to scan Transferred events:", e);
|
|
475
476
|
}
|
|
477
|
+
try {
|
|
478
|
+
const filledLogs = await client.getLogs({
|
|
479
|
+
address: contractAddress,
|
|
480
|
+
event: {
|
|
481
|
+
type: "event",
|
|
482
|
+
name: "SwapOrderFilled",
|
|
483
|
+
inputs: [
|
|
484
|
+
{ name: "orderId", type: "bytes32", indexed: true },
|
|
485
|
+
{ name: "fillerNullifier", type: "bytes32", indexed: true },
|
|
486
|
+
{ name: "fillerOutputCommitment", type: "bytes32", indexed: true },
|
|
487
|
+
{ name: "takeAmount", type: "uint256", indexed: false },
|
|
488
|
+
{ name: "giveAmount", type: "uint256", indexed: false },
|
|
489
|
+
{ name: "fillerAspId", type: "uint256", indexed: false },
|
|
490
|
+
{ name: "encryptedFillerNote", type: "bytes", indexed: false }
|
|
491
|
+
]
|
|
492
|
+
},
|
|
493
|
+
fromBlock: 0n,
|
|
494
|
+
toBlock: "latest"
|
|
495
|
+
});
|
|
496
|
+
for (const log of filledLogs) {
|
|
497
|
+
const c = log.args.fillerOutputCommitment;
|
|
498
|
+
if (!existingCommitments.has(c.toLowerCase())) {
|
|
499
|
+
candidates.push({
|
|
500
|
+
commitment: c,
|
|
501
|
+
leafIndex: commitmentLeafMap.get(c.toLowerCase()) ?? -1,
|
|
502
|
+
packedData: log.args.encryptedFillerNote,
|
|
503
|
+
txHash: log.transactionHash
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
} catch (e) {
|
|
508
|
+
console.warn("[syncNotes] Failed to scan SwapOrderFilled events:", e);
|
|
509
|
+
}
|
|
510
|
+
try {
|
|
511
|
+
const claimedLogs = await client.getLogs({
|
|
512
|
+
address: contractAddress,
|
|
513
|
+
event: {
|
|
514
|
+
type: "event",
|
|
515
|
+
name: "SwapOrderClaimed",
|
|
516
|
+
inputs: [
|
|
517
|
+
{ name: "orderId", type: "bytes32", indexed: true },
|
|
518
|
+
{ name: "accumulatedBuyAmount", type: "uint256", indexed: false },
|
|
519
|
+
{ name: "refundedSellAmount", type: "uint256", indexed: false },
|
|
520
|
+
{ name: "buyOutputCommitment", type: "bytes32", indexed: false },
|
|
521
|
+
{ name: "encryptedBuyNote", type: "bytes", indexed: false },
|
|
522
|
+
{ name: "refundCommitment", type: "bytes32", indexed: false },
|
|
523
|
+
{ name: "encryptedRefundNote", type: "bytes", indexed: false }
|
|
524
|
+
]
|
|
525
|
+
},
|
|
526
|
+
fromBlock: 0n,
|
|
527
|
+
toBlock: "latest"
|
|
528
|
+
});
|
|
529
|
+
for (const log of claimedLogs) {
|
|
530
|
+
const buyC = log.args.buyOutputCommitment;
|
|
531
|
+
const refundC = log.args.refundCommitment;
|
|
532
|
+
const txHash = log.transactionHash;
|
|
533
|
+
if (buyC && !existingCommitments.has(buyC.toLowerCase())) {
|
|
534
|
+
candidates.push({
|
|
535
|
+
commitment: buyC,
|
|
536
|
+
leafIndex: commitmentLeafMap.get(buyC.toLowerCase()) ?? -1,
|
|
537
|
+
packedData: log.args.encryptedBuyNote,
|
|
538
|
+
txHash
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
if (refundC && !existingCommitments.has(refundC.toLowerCase())) {
|
|
542
|
+
candidates.push({
|
|
543
|
+
commitment: refundC,
|
|
544
|
+
leafIndex: commitmentLeafMap.get(refundC.toLowerCase()) ?? -1,
|
|
545
|
+
packedData: log.args.encryptedRefundNote,
|
|
546
|
+
txHash
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
} catch (e) {
|
|
551
|
+
console.warn("[syncNotes] Failed to scan SwapOrderClaimed events:", e);
|
|
552
|
+
}
|
|
553
|
+
try {
|
|
554
|
+
const cancelledLogs = await client.getLogs({
|
|
555
|
+
address: contractAddress,
|
|
556
|
+
event: {
|
|
557
|
+
type: "event",
|
|
558
|
+
name: "SwapOrderCancelled",
|
|
559
|
+
inputs: [
|
|
560
|
+
{ name: "orderId", type: "bytes32", indexed: true },
|
|
561
|
+
{ name: "refundedSellAmount", type: "uint256", indexed: false },
|
|
562
|
+
{ name: "refundCommitment", type: "bytes32", indexed: false },
|
|
563
|
+
{ name: "encryptedRefundNote", type: "bytes", indexed: false }
|
|
564
|
+
]
|
|
565
|
+
},
|
|
566
|
+
fromBlock: 0n,
|
|
567
|
+
toBlock: "latest"
|
|
568
|
+
});
|
|
569
|
+
for (const log of cancelledLogs) {
|
|
570
|
+
const c = log.args.refundCommitment;
|
|
571
|
+
if (c && !existingCommitments.has(c.toLowerCase())) {
|
|
572
|
+
candidates.push({
|
|
573
|
+
commitment: c,
|
|
574
|
+
leafIndex: commitmentLeafMap.get(c.toLowerCase()) ?? -1,
|
|
575
|
+
packedData: log.args.encryptedRefundNote,
|
|
576
|
+
txHash: log.transactionHash
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
} catch (e) {
|
|
581
|
+
console.warn("[syncNotes] Failed to scan SwapOrderCancelled events:", e);
|
|
582
|
+
}
|
|
476
583
|
let discovered = 0;
|
|
477
584
|
let skippedEmpty = 0, skippedOwner = 0;
|
|
478
585
|
for (const candidate of candidates) {
|
|
@@ -1597,7 +1704,7 @@ function usePoolTransfer(config) {
|
|
|
1597
1704
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1598
1705
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1599
1706
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1600
|
-
import('../transfer-
|
|
1707
|
+
import('../transfer-Y5QKVEYS.js'),
|
|
1601
1708
|
import('../proof-XQG5DN5N.js'),
|
|
1602
1709
|
import('../asp-72WUGTQE.js')
|
|
1603
1710
|
]);
|
|
@@ -1746,7 +1853,7 @@ function useWithdraw(config) {
|
|
|
1746
1853
|
const token = BigInt(selectedNote.token);
|
|
1747
1854
|
setStage("creating_outputs");
|
|
1748
1855
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1749
|
-
import('../transfer-
|
|
1856
|
+
import('../transfer-Y5QKVEYS.js'),
|
|
1750
1857
|
import('../proof-XQG5DN5N.js'),
|
|
1751
1858
|
import('../index.js')
|
|
1752
1859
|
]);
|
|
@@ -2115,7 +2222,7 @@ function useSwap(config) {
|
|
|
2115
2222
|
}
|
|
2116
2223
|
setStage("creating_outputs");
|
|
2117
2224
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2118
|
-
import('../transfer-
|
|
2225
|
+
import('../transfer-Y5QKVEYS.js'),
|
|
2119
2226
|
import('../proof-XQG5DN5N.js'),
|
|
2120
2227
|
import('../index.js'),
|
|
2121
2228
|
import('../asp-72WUGTQE.js')
|
|
@@ -2256,7 +2363,7 @@ function useSwap(config) {
|
|
|
2256
2363
|
}
|
|
2257
2364
|
setStage("creating_outputs");
|
|
2258
2365
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2259
|
-
import('../transfer-
|
|
2366
|
+
import('../transfer-Y5QKVEYS.js'),
|
|
2260
2367
|
import('../proof-XQG5DN5N.js'),
|
|
2261
2368
|
import('../index.js'),
|
|
2262
2369
|
import('../asp-72WUGTQE.js')
|
|
@@ -2475,7 +2582,7 @@ function useSwap(config) {
|
|
|
2475
2582
|
createNoteForSelf(changeAmount, origin, token)
|
|
2476
2583
|
]);
|
|
2477
2584
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2478
|
-
import('../transfer-
|
|
2585
|
+
import('../transfer-Y5QKVEYS.js'),
|
|
2479
2586
|
import('../proof-XQG5DN5N.js'),
|
|
2480
2587
|
import('../asp-72WUGTQE.js')
|
|
2481
2588
|
]);
|