@permissionless-technologies/upp-sdk 0.2.1 → 0.3.1
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-3YZSIYJC.cjs +154 -0
- package/dist/chunk-3YZSIYJC.cjs.map +1 -0
- package/dist/{chunk-64RTC5ML.js → chunk-4EDTZQ44.js} +2 -2
- package/dist/{chunk-64RTC5ML.js.map → chunk-4EDTZQ44.js.map} +1 -1
- package/dist/{chunk-43U5RGYE.cjs → chunk-4EMXHMJ5.cjs} +2 -2
- package/dist/{chunk-43U5RGYE.cjs.map → chunk-4EMXHMJ5.cjs.map} +1 -1
- package/dist/{chunk-46GGZ3TC.cjs → chunk-4MOXKZSE.cjs} +17 -17
- package/dist/{chunk-46GGZ3TC.cjs.map → chunk-4MOXKZSE.cjs.map} +1 -1
- package/dist/{chunk-C7QQOJ7T.cjs → chunk-52PPS4AT.cjs} +4 -22
- package/dist/chunk-52PPS4AT.cjs.map +1 -0
- package/dist/{chunk-CZ23JMAQ.js → chunk-56LZ2RV6.js} +17 -17
- package/dist/{chunk-CZ23JMAQ.js.map → chunk-56LZ2RV6.js.map} +1 -1
- package/dist/{chunk-NUIQHTSA.js → chunk-7F75NGNB.js} +76 -3
- package/dist/chunk-7F75NGNB.js.map +1 -0
- package/dist/{chunk-SGZZL5AC.js → chunk-GS4UCMW4.js} +4 -20
- package/dist/chunk-GS4UCMW4.js.map +1 -0
- package/dist/{chunk-GXZ3MTCQ.cjs → chunk-IYOR5TCO.cjs} +77 -2
- package/dist/chunk-IYOR5TCO.cjs.map +1 -0
- package/dist/{chunk-GQV47S3N.cjs → chunk-PTDVGWHU.cjs} +2 -2
- package/dist/{chunk-GQV47S3N.cjs.map → chunk-PTDVGWHU.cjs.map} +1 -1
- package/dist/{chunk-NCW4AE7L.js → chunk-UAVWYXDN.js} +2 -2
- package/dist/chunk-UAVWYXDN.js.map +1 -0
- package/dist/chunk-XBNYAAMU.js +140 -0
- package/dist/chunk-XBNYAAMU.js.map +1 -0
- package/dist/core/index.cjs +68 -62
- package/dist/core/index.d.cts +3 -2
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.js +6 -4
- package/dist/{index-BGvapsJy.d.cts → index-B45-okum.d.cts} +19 -3
- package/dist/{index-ChGaGPzP.d.ts → index-BIcvNMPt.d.ts} +19 -3
- package/dist/{index-BBzvvrhG.d.ts → index-DwAJBoU7.d.ts} +122 -96
- package/dist/{index-C-jSNw6j.d.cts → index-o-Ds3YAq.d.cts} +122 -96
- package/dist/index.cjs +229 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.d.cts +6 -5
- package/dist/indexer/index.d.ts +6 -5
- package/dist/indexer/index.js +1 -1
- package/dist/react/index.cjs +107 -102
- 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 +100 -95
- package/dist/react/index.js.map +1 -1
- package/dist/stark-BcTD1OaJ.d.cts +185 -0
- package/dist/stark-BcTD1OaJ.d.ts +185 -0
- package/dist/{transfer-4OF2JWXX.js → transfer-4GJJTWMH.js} +4 -4
- package/dist/{transfer-4OF2JWXX.js.map → transfer-4GJJTWMH.js.map} +1 -1
- package/dist/{transfer-DKZuJnRM.d.cts → transfer-BzyernBd.d.cts} +1 -3
- package/dist/{transfer-SA4NHNJ7.cjs → transfer-CLBDOA63.cjs} +10 -10
- package/dist/{transfer-SA4NHNJ7.cjs.map → transfer-CLBDOA63.cjs.map} +1 -1
- package/dist/{transfer-BlmbO-Rd.d.ts → transfer-sqS6mJko.d.ts} +1 -3
- package/dist/utils/index.cjs +54 -1
- package/dist/utils/index.d.cts +2 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -1
- package/package.json +2 -2
- package/src/deployments/11155111.json +13 -13
- package/src/deployments/31337.json +1 -1
- package/dist/chunk-C7QQOJ7T.cjs.map +0 -1
- package/dist/chunk-GXZ3MTCQ.cjs.map +0 -1
- package/dist/chunk-NCW4AE7L.js.map +0 -1
- package/dist/chunk-NUIQHTSA.js.map +0 -1
- package/dist/chunk-SGZZL5AC.js.map +0 -1
package/dist/indexer/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4EMXHMJ5_cjs = require('../chunk-4EMXHMJ5.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 chunk4EMXHMJ5_cjs.computeSearchTag; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "makeRpcIndexer", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunk4EMXHMJ5_cjs.makeRpcIndexer; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "matchesSearchTag", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunk4EMXHMJ5_cjs.matchesSearchTag; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "tryDecryptNote", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunk4EMXHMJ5_cjs.tryDecryptNote; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "unpackNoteData", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunk4EMXHMJ5_cjs.unpackNoteData; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "createAutoAdapter", {
|
|
30
30
|
enumerable: true,
|
package/dist/indexer/index.d.cts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { S as StorageAdapter } from '../index-
|
|
2
|
-
export { C as CommitmentInsertedArgs, a as IndexedNote, I as Indexer, f as IndexerState, L as LiveSyncConfig, b as NoteFilters, N as NoteStatus, j as NullifiedArgs, R as RpcIndexerConfig, h as SerializedNote, i as StealthTransactArgs, e as SyncConfig, d as SyncProgress, c as SyncResult, g as SyncState } from '../index-
|
|
3
|
-
import { _ as ___index_js } from '../index-
|
|
4
|
-
export { m as makeRpcIndexer } from '../index-
|
|
1
|
+
import { S as StorageAdapter } from '../index-o-Ds3YAq.cjs';
|
|
2
|
+
export { C as CommitmentInsertedArgs, a as IndexedNote, I as Indexer, f as IndexerState, L as LiveSyncConfig, b as NoteFilters, N as NoteStatus, j as NullifiedArgs, R as RpcIndexerConfig, h as SerializedNote, i as StealthTransactArgs, e as SyncConfig, d as SyncProgress, c as SyncResult, g as SyncState } from '../index-o-Ds3YAq.cjs';
|
|
3
|
+
import { _ as ___index_js } from '../index-B45-okum.cjs';
|
|
4
|
+
export { m as makeRpcIndexer } from '../index-B45-okum.cjs';
|
|
5
5
|
import { Hex } from 'viem';
|
|
6
6
|
import { P as Point } from '../merkle-mteVOlDf.cjs';
|
|
7
|
-
import '../transfer-
|
|
7
|
+
import '../transfer-BzyernBd.cjs';
|
|
8
8
|
import '../keccak-m31-B_AqBbRF.cjs';
|
|
9
9
|
import '@permissionless-technologies/upc-sdk';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import 'react';
|
|
12
12
|
import '../types-CJSbxv4q.cjs';
|
|
13
|
+
import '../stark-BcTD1OaJ.cjs';
|
|
13
14
|
import '../keys/index.cjs';
|
|
14
15
|
import '../utils/index.cjs';
|
|
15
16
|
|
package/dist/indexer/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { S as StorageAdapter } from '../index-
|
|
2
|
-
export { C as CommitmentInsertedArgs, a as IndexedNote, I as Indexer, f as IndexerState, L as LiveSyncConfig, b as NoteFilters, N as NoteStatus, j as NullifiedArgs, R as RpcIndexerConfig, h as SerializedNote, i as StealthTransactArgs, e as SyncConfig, d as SyncProgress, c as SyncResult, g as SyncState } from '../index-
|
|
3
|
-
import { _ as ___index_js } from '../index-
|
|
4
|
-
export { m as makeRpcIndexer } from '../index-
|
|
1
|
+
import { S as StorageAdapter } from '../index-DwAJBoU7.js';
|
|
2
|
+
export { C as CommitmentInsertedArgs, a as IndexedNote, I as Indexer, f as IndexerState, L as LiveSyncConfig, b as NoteFilters, N as NoteStatus, j as NullifiedArgs, R as RpcIndexerConfig, h as SerializedNote, i as StealthTransactArgs, e as SyncConfig, d as SyncProgress, c as SyncResult, g as SyncState } from '../index-DwAJBoU7.js';
|
|
3
|
+
import { _ as ___index_js } from '../index-BIcvNMPt.js';
|
|
4
|
+
export { m as makeRpcIndexer } from '../index-BIcvNMPt.js';
|
|
5
5
|
import { Hex } from 'viem';
|
|
6
6
|
import { P as Point } from '../merkle-mteVOlDf.js';
|
|
7
|
-
import '../transfer-
|
|
7
|
+
import '../transfer-sqS6mJko.js';
|
|
8
8
|
import '../keccak-m31-B_AqBbRF.js';
|
|
9
9
|
import '@permissionless-technologies/upc-sdk';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import 'react';
|
|
12
12
|
import '../types-mLybMxNR.js';
|
|
13
|
+
import '../stark-BcTD1OaJ.js';
|
|
13
14
|
import '../keys/index.js';
|
|
14
15
|
import '../utils/index.js';
|
|
15
16
|
|
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-4EDTZQ44.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 chunkIYOR5TCO_cjs = require('../chunk-IYOR5TCO.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');
|
|
@@ -90,98 +90,103 @@ function UPPAccountProvider({
|
|
|
90
90
|
const unwatchRef = react.useRef(null);
|
|
91
91
|
const syncPromiseRef = react.useRef(null);
|
|
92
92
|
const noteStoreRef = react.useRef(null);
|
|
93
|
+
const accountAdapterRef = react.useRef(null);
|
|
93
94
|
react.useEffect(() => {
|
|
94
95
|
loadSDK().then(() => setCryptoReady(true));
|
|
95
96
|
}, []);
|
|
96
97
|
react.useEffect(() => {
|
|
97
98
|
let noteStoreUnsub = null;
|
|
99
|
+
let cancelled = false;
|
|
98
100
|
if (typeof window === "undefined") return;
|
|
99
101
|
if (!ethAddress || !cryptoReady) {
|
|
100
102
|
setMasterKeys(null);
|
|
101
103
|
setStarkMasterKeys(null);
|
|
102
104
|
setNotes([]);
|
|
103
105
|
noteStoreRef.current = null;
|
|
106
|
+
accountAdapterRef.current = null;
|
|
104
107
|
return;
|
|
105
108
|
}
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
109
|
+
const accountStorage = chunkERQE57IA_cjs.createAutoAdapter(`upp_account`);
|
|
110
|
+
const adapter = new chunkIYOR5TCO_cjs.StorableAccountAdapter(accountStorage, ethAddress);
|
|
111
|
+
accountAdapterRef.current = adapter;
|
|
112
|
+
const legacyKey = getStorageKey(ethAddress);
|
|
113
|
+
const legacySaved = typeof window !== "undefined" ? localStorage.getItem(legacyKey) : null;
|
|
114
|
+
const init = async () => {
|
|
115
|
+
let account = await adapter.load();
|
|
116
|
+
if (!account && legacySaved) {
|
|
117
|
+
try {
|
|
118
|
+
const parsed = JSON.parse(legacySaved);
|
|
119
|
+
if (parsed.spendingSecret && parsed.starkSecret) {
|
|
120
|
+
const keys = {
|
|
121
|
+
spendingSecret: BigInt(parsed.spendingSecret),
|
|
122
|
+
ownerHash: BigInt(parsed.ownerHash),
|
|
123
|
+
viewingSecret: BigInt(parsed.viewingSecret),
|
|
124
|
+
viewingHash: BigInt(parsed.viewingHash)
|
|
125
|
+
};
|
|
126
|
+
const starkKeys = {
|
|
127
|
+
starkSecret: parsed.starkSecret.map((s) => BigInt(s)),
|
|
128
|
+
starkOwnerHash: parsed.starkOwnerHash.map((s) => BigInt(s)),
|
|
129
|
+
starkViewingSecret: parsed.starkViewingSecret.map((s) => BigInt(s)),
|
|
130
|
+
starkViewingHash: parsed.starkViewingHash.map((s) => BigInt(s))
|
|
131
|
+
};
|
|
132
|
+
await adapter.save(keys, starkKeys);
|
|
133
|
+
account = { keys, starkKeys };
|
|
134
|
+
console.log("[UPPAccount] Migrated account from legacy localStorage");
|
|
135
|
+
}
|
|
136
|
+
} catch {
|
|
133
137
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
138
|
+
}
|
|
139
|
+
if (cancelled) return;
|
|
140
|
+
if (!account) {
|
|
141
|
+
setMasterKeys(null);
|
|
142
|
+
setStarkMasterKeys(null);
|
|
143
|
+
setNotes([]);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
setMasterKeys(account.keys);
|
|
147
|
+
if (account.starkKeys) setStarkMasterKeys(account.starkKeys);
|
|
148
|
+
const ownerHashHex2 = viem.toHex(account.keys.ownerHash, { size: 32 });
|
|
149
|
+
const storagePrefix = `upp_${chainId}_${ownerHashHex2.slice(0, 12)}`;
|
|
150
|
+
const noteStorage = chunkERQE57IA_cjs.createAutoAdapter(storagePrefix);
|
|
151
|
+
const store = new chunkIYOR5TCO_cjs.NoteStore(noteStorage, "notes");
|
|
152
|
+
noteStoreRef.current = store;
|
|
153
|
+
noteStoreUnsub = store.onChange(() => {
|
|
154
|
+
if (!cancelled) setNotes([...store.getNotes()]);
|
|
155
|
+
});
|
|
156
|
+
await store.load();
|
|
157
|
+
if (store.getNotes().length === 0) {
|
|
158
|
+
const legacyNotesKey = getNotesStorageKey(chainId, ownerHashHex2.slice(0, 12));
|
|
159
|
+
const legacyNotes = typeof window !== "undefined" ? localStorage.getItem(legacyNotesKey) : null;
|
|
160
|
+
if (legacyNotes) {
|
|
161
|
+
try {
|
|
162
|
+
const parsed = JSON.parse(legacyNotes);
|
|
163
|
+
const migrated = parsed.map((n) => ({
|
|
164
|
+
...n,
|
|
165
|
+
amount: BigInt(n.amount),
|
|
166
|
+
blinding: BigInt(n.blinding),
|
|
167
|
+
origin: n.origin ?? "0x0000000000000000000000000000000000000000",
|
|
168
|
+
token: n.token ?? "0x0000000000000000000000000000000000000000",
|
|
169
|
+
proofSystem: n.proofSystem ?? "snark"
|
|
170
|
+
}));
|
|
171
|
+
store.addNotes(migrated);
|
|
172
|
+
await store.persist();
|
|
173
|
+
console.log(`[NoteStore] Migrated ${migrated.length} legacy notes`);
|
|
174
|
+
} catch {
|
|
163
175
|
}
|
|
164
|
-
setNotes([...store.getNotes()]);
|
|
165
|
-
});
|
|
166
|
-
if (publicClientProp) {
|
|
167
|
-
checkChainFingerprint(chainId, publicClientProp).then((valid) => {
|
|
168
|
-
if (!valid) {
|
|
169
|
-
console.log(`[UPPAccount] Chain ${chainId} was reset \u2014 clearing stale notes`);
|
|
170
|
-
store.clear();
|
|
171
|
-
const legacyKey = getNotesStorageKey(chainId, ownerHashHex2.slice(0, 12));
|
|
172
|
-
localStorage.removeItem(legacyKey);
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
176
|
}
|
|
176
|
-
} catch (e) {
|
|
177
|
-
console.error("Failed to load saved account:", e);
|
|
178
177
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
if (!cancelled) setNotes([...store.getNotes()]);
|
|
179
|
+
if (publicClientProp) {
|
|
180
|
+
const valid = await checkChainFingerprint(chainId, publicClientProp);
|
|
181
|
+
if (!valid && !cancelled) {
|
|
182
|
+
console.log(`[UPPAccount] Chain ${chainId} was reset \u2014 clearing stale notes`);
|
|
183
|
+
await store.clear();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
init().catch((e) => console.error("Failed to load account:", e));
|
|
184
188
|
return () => {
|
|
189
|
+
cancelled = true;
|
|
185
190
|
if (noteStoreUnsub) noteStoreUnsub();
|
|
186
191
|
};
|
|
187
192
|
}, [ethAddress, cryptoReady, chainId, publicClientProp]);
|
|
@@ -204,18 +209,10 @@ function UPPAccountProvider({
|
|
|
204
209
|
setMasterKeys(keys);
|
|
205
210
|
setStarkMasterKeys(starkKeys);
|
|
206
211
|
setNotes([]);
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
viewingSecret: viem.toHex(keys.viewingSecret, { size: 32 }),
|
|
212
|
-
viewingHash: viem.toHex(keys.viewingHash, { size: 32 }),
|
|
213
|
-
starkSecret: starkKeys.starkSecret.map((v) => v.toString()),
|
|
214
|
-
starkOwnerHash: starkKeys.starkOwnerHash.map((v) => v.toString()),
|
|
215
|
-
starkViewingSecret: starkKeys.starkViewingSecret.map((v) => v.toString()),
|
|
216
|
-
starkViewingHash: starkKeys.starkViewingHash.map((v) => v.toString())
|
|
217
|
-
};
|
|
218
|
-
localStorage.setItem(getStorageKey(ethAddress), JSON.stringify(serialized));
|
|
212
|
+
const adapter = accountAdapterRef.current;
|
|
213
|
+
if (adapter) {
|
|
214
|
+
await adapter.save(keys, starkKeys);
|
|
215
|
+
}
|
|
219
216
|
} finally {
|
|
220
217
|
setIsLoading(false);
|
|
221
218
|
}
|
|
@@ -253,13 +250,21 @@ function UPPAccountProvider({
|
|
|
253
250
|
const logout = react.useCallback(() => {
|
|
254
251
|
noteStoreRef.current?.clear().catch(console.error);
|
|
255
252
|
noteStoreRef.current = null;
|
|
253
|
+
accountAdapterRef.current?.clear().catch(console.error);
|
|
254
|
+
accountAdapterRef.current = null;
|
|
256
255
|
if (masterKeys) {
|
|
257
256
|
const ownerHashHex2 = viem.toHex(masterKeys.ownerHash, { size: 32 });
|
|
258
257
|
const notesKey = getNotesStorageKey(chainId, ownerHashHex2.slice(0, 12));
|
|
259
|
-
|
|
258
|
+
try {
|
|
259
|
+
localStorage.removeItem(notesKey);
|
|
260
|
+
} catch {
|
|
261
|
+
}
|
|
260
262
|
}
|
|
261
263
|
if (ethAddress) {
|
|
262
|
-
|
|
264
|
+
try {
|
|
265
|
+
localStorage.removeItem(getStorageKey(ethAddress));
|
|
266
|
+
} catch {
|
|
267
|
+
}
|
|
263
268
|
}
|
|
264
269
|
setMasterKeys(null);
|
|
265
270
|
setStarkMasterKeys(null);
|
|
@@ -696,7 +701,7 @@ function UPPAccountProvider({
|
|
|
696
701
|
const stealthAddress = react.useMemo(() => {
|
|
697
702
|
if (!masterKeys) return null;
|
|
698
703
|
try {
|
|
699
|
-
const { encodeStealthAddress } = (
|
|
704
|
+
const { encodeStealthAddress } = (chunkIYOR5TCO_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkIYOR5TCO_cjs.stealth_exports));
|
|
700
705
|
return encodeStealthAddress(masterKeys.ownerHash, masterKeys.viewingHash);
|
|
701
706
|
} catch {
|
|
702
707
|
return null;
|
|
@@ -705,7 +710,7 @@ function UPPAccountProvider({
|
|
|
705
710
|
const starkStealthAddress = react.useMemo(() => {
|
|
706
711
|
if (!starkMasterKeys) return null;
|
|
707
712
|
try {
|
|
708
|
-
const { encodeStarkStealthAddress } = (
|
|
713
|
+
const { encodeStarkStealthAddress } = (chunkIYOR5TCO_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkIYOR5TCO_cjs.stealth_exports));
|
|
709
714
|
return encodeStarkStealthAddress(starkMasterKeys.starkOwnerHash, starkMasterKeys.starkViewingHash);
|
|
710
715
|
} catch {
|
|
711
716
|
return null;
|
|
@@ -1556,7 +1561,7 @@ function usePoolTransfer(config) {
|
|
|
1556
1561
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1557
1562
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1558
1563
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1559
|
-
import('../transfer-
|
|
1564
|
+
import('../transfer-CLBDOA63.cjs'),
|
|
1560
1565
|
import('../proof-5OECB3RQ.cjs'),
|
|
1561
1566
|
import('../asp-TXSAFFD3.cjs')
|
|
1562
1567
|
]);
|
|
@@ -1715,7 +1720,7 @@ function useWithdraw(config) {
|
|
|
1715
1720
|
const token = BigInt(selectedNote.token);
|
|
1716
1721
|
setStage("creating_outputs");
|
|
1717
1722
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1718
|
-
import('../transfer-
|
|
1723
|
+
import('../transfer-CLBDOA63.cjs'),
|
|
1719
1724
|
import('../proof-5OECB3RQ.cjs'),
|
|
1720
1725
|
import('../index.cjs')
|
|
1721
1726
|
]);
|
|
@@ -1978,7 +1983,7 @@ function useSwapOrderBook(config) {
|
|
|
1978
1983
|
try {
|
|
1979
1984
|
const logs = await config.publicClient.getLogs({
|
|
1980
1985
|
address: config.poolAddress,
|
|
1981
|
-
event:
|
|
1986
|
+
event: chunkIYOR5TCO_cjs.SWAP_ORDER_PLACED_EVENT,
|
|
1982
1987
|
fromBlock: config.fromBlock ?? 0n,
|
|
1983
1988
|
toBlock: "latest"
|
|
1984
1989
|
});
|
|
@@ -1994,10 +1999,10 @@ function useSwapOrderBook(config) {
|
|
|
1994
1999
|
blockNumber: log.blockNumber ?? 0n
|
|
1995
2000
|
}));
|
|
1996
2001
|
if (config.sellToken && config.buyToken) {
|
|
1997
|
-
parsedOrders =
|
|
2002
|
+
parsedOrders = chunkIYOR5TCO_cjs.filterOrdersByTokenPair(parsedOrders, config.sellToken, config.buyToken);
|
|
1998
2003
|
}
|
|
1999
2004
|
if (config.acceptableAspIds && config.acceptableAspIds.length > 0) {
|
|
2000
|
-
parsedOrders =
|
|
2005
|
+
parsedOrders = chunkIYOR5TCO_cjs.filterOrdersByASP(parsedOrders, config.acceptableAspIds);
|
|
2001
2006
|
}
|
|
2002
2007
|
const enriched = [];
|
|
2003
2008
|
for (const order of parsedOrders) {
|
|
@@ -2094,7 +2099,7 @@ function useSwap(config) {
|
|
|
2094
2099
|
}
|
|
2095
2100
|
setStage("creating_outputs");
|
|
2096
2101
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2097
|
-
import('../transfer-
|
|
2102
|
+
import('../transfer-CLBDOA63.cjs'),
|
|
2098
2103
|
import('../proof-5OECB3RQ.cjs'),
|
|
2099
2104
|
import('../index.cjs'),
|
|
2100
2105
|
import('../asp-TXSAFFD3.cjs')
|
|
@@ -2176,8 +2181,8 @@ function useSwap(config) {
|
|
|
2176
2181
|
formattedProof.c[0],
|
|
2177
2182
|
formattedProof.c[1]
|
|
2178
2183
|
];
|
|
2179
|
-
const cancelSecret =
|
|
2180
|
-
const cancelKeyHash =
|
|
2184
|
+
const cancelSecret = chunkIYOR5TCO_cjs.generateCancelSecret();
|
|
2185
|
+
const cancelKeyHash = chunkIYOR5TCO_cjs.computeCancelKeyHash(cancelSecret);
|
|
2181
2186
|
const currentBlock = await cfg.publicClient.getBlockNumber();
|
|
2182
2187
|
const expiry = currentBlock + expiryBlocks;
|
|
2183
2188
|
return {
|
|
@@ -2225,7 +2230,7 @@ function useSwap(config) {
|
|
|
2225
2230
|
noteOverride
|
|
2226
2231
|
} = params;
|
|
2227
2232
|
const cfg = configRef.current;
|
|
2228
|
-
const giveAmount =
|
|
2233
|
+
const giveAmount = chunkIYOR5TCO_cjs.computeGiveAmount(takeAmount, rate);
|
|
2229
2234
|
setStage("selecting_notes");
|
|
2230
2235
|
let selectedNote;
|
|
2231
2236
|
if (noteOverride) {
|
|
@@ -2246,7 +2251,7 @@ function useSwap(config) {
|
|
|
2246
2251
|
}
|
|
2247
2252
|
setStage("creating_outputs");
|
|
2248
2253
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2249
|
-
import('../transfer-
|
|
2254
|
+
import('../transfer-CLBDOA63.cjs'),
|
|
2250
2255
|
import('../proof-5OECB3RQ.cjs'),
|
|
2251
2256
|
import('../index.cjs'),
|
|
2252
2257
|
import('../asp-TXSAFFD3.cjs')
|
|
@@ -2476,7 +2481,7 @@ function useSwap(config) {
|
|
|
2476
2481
|
createNoteForSelf(changeAmount, origin, token)
|
|
2477
2482
|
]);
|
|
2478
2483
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2479
|
-
import('../transfer-
|
|
2484
|
+
import('../transfer-CLBDOA63.cjs'),
|
|
2480
2485
|
import('../proof-5OECB3RQ.cjs'),
|
|
2481
2486
|
import('../asp-TXSAFFD3.cjs')
|
|
2482
2487
|
]);
|