@permissionless-technologies/upp-sdk 0.3.1 → 0.3.3
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-4EDTZQ44.js → chunk-A4NHQ3ZY.js} +2 -2
- package/dist/{chunk-4EDTZQ44.js.map → chunk-A4NHQ3ZY.js.map} +1 -1
- package/dist/{chunk-4EMXHMJ5.cjs → chunk-DDO3H7SO.cjs} +2 -2
- package/dist/{chunk-4EMXHMJ5.cjs.map → chunk-DDO3H7SO.cjs.map} +1 -1
- package/dist/{chunk-IYOR5TCO.cjs → chunk-KXPZUBPI.cjs} +19 -6
- package/dist/chunk-KXPZUBPI.cjs.map +1 -0
- package/dist/{chunk-GS4UCMW4.js → chunk-OD2SDC4L.js} +3 -3
- package/dist/{chunk-GS4UCMW4.js.map → chunk-OD2SDC4L.js.map} +1 -1
- package/dist/{chunk-7F75NGNB.js → chunk-QKI4QWLT.js} +19 -6
- package/dist/chunk-QKI4QWLT.js.map +1 -0
- package/dist/{chunk-52PPS4AT.cjs → chunk-SJDPDHSD.cjs} +4 -4
- package/dist/{chunk-52PPS4AT.cjs.map → chunk-SJDPDHSD.cjs.map} +1 -1
- package/dist/{chunk-56LZ2RV6.js → chunk-SZ2ATSYI.js} +3 -3
- package/dist/{chunk-56LZ2RV6.js.map → chunk-SZ2ATSYI.js.map} +1 -1
- package/dist/{chunk-4MOXKZSE.cjs → chunk-YCUDP7Q4.cjs} +3 -3
- package/dist/{chunk-4MOXKZSE.cjs.map → chunk-YCUDP7Q4.cjs.map} +1 -1
- package/dist/core/index.cjs +55 -55
- package/dist/core/index.js +3 -3
- package/dist/index.cjs +63 -63
- package/dist/index.js +4 -4
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.js +1 -1
- package/dist/react/index.cjs +24 -17
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +14 -7
- package/dist/react/index.js.map +1 -1
- package/dist/{transfer-4GJJTWMH.js → transfer-3QFLYTOI.js} +3 -3
- package/dist/{transfer-4GJJTWMH.js.map → transfer-3QFLYTOI.js.map} +1 -1
- package/dist/{transfer-CLBDOA63.cjs → transfer-USRM46JZ.cjs} +9 -9
- package/dist/{transfer-CLBDOA63.cjs.map → transfer-USRM46JZ.cjs.map} +1 -1
- package/package.json +1 -1
- package/src/deployments/31337.json +1 -1
- package/dist/chunk-7F75NGNB.js.map +0 -1
- package/dist/chunk-IYOR5TCO.cjs.map +0 -1
package/dist/indexer/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDDO3H7SO_cjs = require('../chunk-DDO3H7SO.cjs');
|
|
4
4
|
var chunkERQE57IA_cjs = require('../chunk-ERQE57IA.cjs');
|
|
5
5
|
require('../chunk-G7VZBCD6.cjs');
|
|
6
6
|
|
|
@@ -8,23 +8,23 @@ require('../chunk-G7VZBCD6.cjs');
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "computeSearchTag", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkDDO3H7SO_cjs.computeSearchTag; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "makeRpcIndexer", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkDDO3H7SO_cjs.makeRpcIndexer; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "matchesSearchTag", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkDDO3H7SO_cjs.matchesSearchTag; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "tryDecryptNote", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkDDO3H7SO_cjs.tryDecryptNote; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "unpackNoteData", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkDDO3H7SO_cjs.unpackNoteData; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "createAutoAdapter", {
|
|
30
30
|
enumerable: true,
|
package/dist/indexer/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { computeSearchTag, makeRpcIndexer, matchesSearchTag, tryDecryptNote, unpackNoteData } from '../chunk-
|
|
1
|
+
export { computeSearchTag, makeRpcIndexer, matchesSearchTag, tryDecryptNote, unpackNoteData } from '../chunk-A4NHQ3ZY.js';
|
|
2
2
|
export { createAutoAdapter, createIndexedDBAdapter, createLocalStorageAdapter, createMemoryAdapter, indexedDBAdapter, localStorageAdapter, memoryAdapter } from '../chunk-XV72HNHN.js';
|
|
3
3
|
import '../chunk-Z6ZWNWWR.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkKXPZUBPI_cjs = require('../chunk-KXPZUBPI.cjs');
|
|
4
4
|
var chunkNDM5EJEV_cjs = require('../chunk-NDM5EJEV.cjs');
|
|
5
5
|
var chunkERQE57IA_cjs = require('../chunk-ERQE57IA.cjs');
|
|
6
6
|
require('../chunk-3HQ7A6ZM.cjs');
|
|
@@ -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 chunkKXPZUBPI_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 chunkKXPZUBPI_cjs.NoteStore(noteStorage, "notes");
|
|
152
152
|
noteStoreRef.current = store;
|
|
153
153
|
noteStoreUnsub = store.onChange(() => {
|
|
154
154
|
if (!cancelled) setNotes([...store.getNotes()]);
|
|
@@ -372,8 +372,9 @@ function UPPAccountProvider({
|
|
|
372
372
|
false,
|
|
373
373
|
["decrypt"]
|
|
374
374
|
);
|
|
375
|
+
const currentStore = noteStoreRef.current;
|
|
375
376
|
const existingCommitments = new Set(
|
|
376
|
-
notes.map((n) => n.commitment.toLowerCase())
|
|
377
|
+
(currentStore ? currentStore.getNotes() : notes).map((n) => n.commitment.toLowerCase())
|
|
377
378
|
);
|
|
378
379
|
const candidates = [];
|
|
379
380
|
console.log("[syncNotes] Scanning contract:", contractAddress, "\u2014 existing:", existingCommitments.size, "notes");
|
|
@@ -697,11 +698,17 @@ function UPPAccountProvider({
|
|
|
697
698
|
}
|
|
698
699
|
};
|
|
699
700
|
}, [liveSyncInterval]);
|
|
701
|
+
react.useEffect(() => {
|
|
702
|
+
const contractAddr = indexerConfig?.contractAddress;
|
|
703
|
+
if (!masterKeys || !publicClientProp || !contractAddr) return;
|
|
704
|
+
startLiveSync(contractAddr, publicClientProp);
|
|
705
|
+
return () => stopLiveSync();
|
|
706
|
+
}, [masterKeys, publicClientProp, indexerConfig?.contractAddress]);
|
|
700
707
|
const ownerHashHex = masterKeys ? viem.toHex(masterKeys.ownerHash, { size: 32 }) : null;
|
|
701
708
|
const stealthAddress = react.useMemo(() => {
|
|
702
709
|
if (!masterKeys) return null;
|
|
703
710
|
try {
|
|
704
|
-
const { encodeStealthAddress } = (
|
|
711
|
+
const { encodeStealthAddress } = (chunkKXPZUBPI_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkKXPZUBPI_cjs.stealth_exports));
|
|
705
712
|
return encodeStealthAddress(masterKeys.ownerHash, masterKeys.viewingHash);
|
|
706
713
|
} catch {
|
|
707
714
|
return null;
|
|
@@ -710,7 +717,7 @@ function UPPAccountProvider({
|
|
|
710
717
|
const starkStealthAddress = react.useMemo(() => {
|
|
711
718
|
if (!starkMasterKeys) return null;
|
|
712
719
|
try {
|
|
713
|
-
const { encodeStarkStealthAddress } = (
|
|
720
|
+
const { encodeStarkStealthAddress } = (chunkKXPZUBPI_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkKXPZUBPI_cjs.stealth_exports));
|
|
714
721
|
return encodeStarkStealthAddress(starkMasterKeys.starkOwnerHash, starkMasterKeys.starkViewingHash);
|
|
715
722
|
} catch {
|
|
716
723
|
return null;
|
|
@@ -1561,7 +1568,7 @@ function usePoolTransfer(config) {
|
|
|
1561
1568
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1562
1569
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1563
1570
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1564
|
-
import('../transfer-
|
|
1571
|
+
import('../transfer-USRM46JZ.cjs'),
|
|
1565
1572
|
import('../proof-5OECB3RQ.cjs'),
|
|
1566
1573
|
import('../asp-TXSAFFD3.cjs')
|
|
1567
1574
|
]);
|
|
@@ -1720,7 +1727,7 @@ function useWithdraw(config) {
|
|
|
1720
1727
|
const token = BigInt(selectedNote.token);
|
|
1721
1728
|
setStage("creating_outputs");
|
|
1722
1729
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1723
|
-
import('../transfer-
|
|
1730
|
+
import('../transfer-USRM46JZ.cjs'),
|
|
1724
1731
|
import('../proof-5OECB3RQ.cjs'),
|
|
1725
1732
|
import('../index.cjs')
|
|
1726
1733
|
]);
|
|
@@ -1983,7 +1990,7 @@ function useSwapOrderBook(config) {
|
|
|
1983
1990
|
try {
|
|
1984
1991
|
const logs = await config.publicClient.getLogs({
|
|
1985
1992
|
address: config.poolAddress,
|
|
1986
|
-
event:
|
|
1993
|
+
event: chunkKXPZUBPI_cjs.SWAP_ORDER_PLACED_EVENT,
|
|
1987
1994
|
fromBlock: config.fromBlock ?? 0n,
|
|
1988
1995
|
toBlock: "latest"
|
|
1989
1996
|
});
|
|
@@ -1999,10 +2006,10 @@ function useSwapOrderBook(config) {
|
|
|
1999
2006
|
blockNumber: log.blockNumber ?? 0n
|
|
2000
2007
|
}));
|
|
2001
2008
|
if (config.sellToken && config.buyToken) {
|
|
2002
|
-
parsedOrders =
|
|
2009
|
+
parsedOrders = chunkKXPZUBPI_cjs.filterOrdersByTokenPair(parsedOrders, config.sellToken, config.buyToken);
|
|
2003
2010
|
}
|
|
2004
2011
|
if (config.acceptableAspIds && config.acceptableAspIds.length > 0) {
|
|
2005
|
-
parsedOrders =
|
|
2012
|
+
parsedOrders = chunkKXPZUBPI_cjs.filterOrdersByASP(parsedOrders, config.acceptableAspIds);
|
|
2006
2013
|
}
|
|
2007
2014
|
const enriched = [];
|
|
2008
2015
|
for (const order of parsedOrders) {
|
|
@@ -2099,7 +2106,7 @@ function useSwap(config) {
|
|
|
2099
2106
|
}
|
|
2100
2107
|
setStage("creating_outputs");
|
|
2101
2108
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2102
|
-
import('../transfer-
|
|
2109
|
+
import('../transfer-USRM46JZ.cjs'),
|
|
2103
2110
|
import('../proof-5OECB3RQ.cjs'),
|
|
2104
2111
|
import('../index.cjs'),
|
|
2105
2112
|
import('../asp-TXSAFFD3.cjs')
|
|
@@ -2181,8 +2188,8 @@ function useSwap(config) {
|
|
|
2181
2188
|
formattedProof.c[0],
|
|
2182
2189
|
formattedProof.c[1]
|
|
2183
2190
|
];
|
|
2184
|
-
const cancelSecret =
|
|
2185
|
-
const cancelKeyHash =
|
|
2191
|
+
const cancelSecret = chunkKXPZUBPI_cjs.generateCancelSecret();
|
|
2192
|
+
const cancelKeyHash = chunkKXPZUBPI_cjs.computeCancelKeyHash(cancelSecret);
|
|
2186
2193
|
const currentBlock = await cfg.publicClient.getBlockNumber();
|
|
2187
2194
|
const expiry = currentBlock + expiryBlocks;
|
|
2188
2195
|
return {
|
|
@@ -2230,7 +2237,7 @@ function useSwap(config) {
|
|
|
2230
2237
|
noteOverride
|
|
2231
2238
|
} = params;
|
|
2232
2239
|
const cfg = configRef.current;
|
|
2233
|
-
const giveAmount =
|
|
2240
|
+
const giveAmount = chunkKXPZUBPI_cjs.computeGiveAmount(takeAmount, rate);
|
|
2234
2241
|
setStage("selecting_notes");
|
|
2235
2242
|
let selectedNote;
|
|
2236
2243
|
if (noteOverride) {
|
|
@@ -2251,7 +2258,7 @@ function useSwap(config) {
|
|
|
2251
2258
|
}
|
|
2252
2259
|
setStage("creating_outputs");
|
|
2253
2260
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2254
|
-
import('../transfer-
|
|
2261
|
+
import('../transfer-USRM46JZ.cjs'),
|
|
2255
2262
|
import('../proof-5OECB3RQ.cjs'),
|
|
2256
2263
|
import('../index.cjs'),
|
|
2257
2264
|
import('../asp-TXSAFFD3.cjs')
|
|
@@ -2481,7 +2488,7 @@ function useSwap(config) {
|
|
|
2481
2488
|
createNoteForSelf(changeAmount, origin, token)
|
|
2482
2489
|
]);
|
|
2483
2490
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2484
|
-
import('../transfer-
|
|
2491
|
+
import('../transfer-USRM46JZ.cjs'),
|
|
2485
2492
|
import('../proof-5OECB3RQ.cjs'),
|
|
2486
2493
|
import('../asp-TXSAFFD3.cjs')
|
|
2487
2494
|
]);
|