@permissionless-technologies/upp-sdk 0.4.21 → 0.4.23
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/README.md +37 -3
- package/dist/chunk-2BSIUEPO.js +343 -0
- package/dist/chunk-2BSIUEPO.js.map +1 -0
- package/dist/{chunk-YHBUCKVS.cjs → chunk-5MK5R7M7.cjs} +24 -24
- package/dist/{chunk-YHBUCKVS.cjs.map → chunk-5MK5R7M7.cjs.map} +1 -1
- package/dist/{chunk-V6MW5VOF.cjs → chunk-632LPXPX.cjs} +4 -4
- package/dist/{chunk-V6MW5VOF.cjs.map → chunk-632LPXPX.cjs.map} +1 -1
- package/dist/{chunk-RYEYGGE7.cjs → chunk-IX7HV5TE.cjs} +18 -5
- package/dist/chunk-IX7HV5TE.cjs.map +1 -0
- package/dist/{chunk-5H27F6W6.cjs → chunk-IYRCJAME.cjs} +13 -9
- package/dist/chunk-IYRCJAME.cjs.map +1 -0
- package/dist/{chunk-KRLRJ3HN.js → chunk-KR4GB6VC.js} +18 -5
- package/dist/chunk-KR4GB6VC.js.map +1 -0
- package/dist/{chunk-C7DUABSG.js → chunk-Q6BLTPWV.js} +13 -9
- package/dist/chunk-Q6BLTPWV.js.map +1 -0
- package/dist/{chunk-ND56VNCF.js → chunk-R4O6FOIN.js} +2 -2
- package/dist/{chunk-ND56VNCF.js.map → chunk-R4O6FOIN.js.map} +1 -1
- package/dist/{chunk-OLJFKARA.js → chunk-TVF6FYTQ.js} +16 -16
- package/dist/{chunk-OLJFKARA.js.map → chunk-TVF6FYTQ.js.map} +1 -1
- package/dist/{chunk-7VPW5T5R.js → chunk-UMWY4ICQ.js} +3 -3
- package/dist/{chunk-7VPW5T5R.js.map → chunk-UMWY4ICQ.js.map} +1 -1
- package/dist/{chunk-PZAV2S5E.cjs → chunk-UWW4GFZ3.cjs} +2 -2
- package/dist/{chunk-PZAV2S5E.cjs.map → chunk-UWW4GFZ3.cjs.map} +1 -1
- package/dist/chunk-VVW5VVY3.cjs +347 -0
- package/dist/chunk-VVW5VVY3.cjs.map +1 -0
- package/dist/core/index.cjs +85 -72
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +6 -5
- package/dist/core/proof-worker-entry.cjs +8 -8
- package/dist/core/proof-worker-entry.cjs.map +1 -1
- package/dist/core/proof-worker-entry.js +8 -8
- package/dist/core/proof-worker-entry.js.map +1 -1
- package/dist/{index-PgqOAfcc.d.cts → index-AooYZ0kF.d.cts} +1 -1
- package/dist/{index-DsXMd8zh.d.ts → index-CpfUNGm9.d.ts} +1 -1
- package/dist/{index-DmowSsZb.d.ts → index-De5B4r0l.d.ts} +9 -3
- package/dist/{index-DcfqeWvk.d.cts → index-hNuffoCo.d.cts} +9 -3
- package/dist/index.cjs +231 -218
- 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 +8 -7
- 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/{proof-VINVGL4F.cjs → proof-X3MVQFFZ.cjs} +14 -13
- package/dist/{proof-VINVGL4F.cjs.map → proof-X3MVQFFZ.cjs.map} +1 -1
- package/dist/{proof-XQG5DN5N.js → proof-YMXBL4D5.js} +4 -3
- package/dist/{proof-XQG5DN5N.js.map → proof-YMXBL4D5.js.map} +1 -1
- package/dist/react/index.cjs +123 -39
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +44 -6
- package/dist/react/index.d.ts +44 -6
- package/dist/react/index.js +90 -18
- package/dist/react/index.js.map +1 -1
- package/dist/{transfer-Cqg235q6.d.ts → transfer-BGzySIhC.d.ts} +124 -5
- package/dist/{transfer-B4q3ZTJK.d.cts → transfer-BhB-UuBP.d.cts} +124 -5
- package/dist/{transfer-7IFAXV5K.cjs → transfer-M3PKP4PY.cjs} +12 -11
- package/dist/{transfer-7IFAXV5K.cjs.map → transfer-M3PKP4PY.cjs.map} +1 -1
- package/dist/{transfer-FWCRUWWM.js → transfer-RA7R3KQY.js} +6 -5
- package/dist/{transfer-FWCRUWWM.js.map → transfer-RA7R3KQY.js.map} +1 -1
- package/package.json +2 -2
- package/src/deployments/11155111.json +12 -12
- package/dist/chunk-5H27F6W6.cjs.map +0 -1
- package/dist/chunk-C7DUABSG.js.map +0 -1
- package/dist/chunk-KRLRJ3HN.js.map +0 -1
- package/dist/chunk-RYEYGGE7.cjs.map +0 -1
package/dist/indexer/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUWW4GFZ3_cjs = require('../chunk-UWW4GFZ3.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 chunkUWW4GFZ3_cjs.computeSearchTag; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "makeRpcIndexer", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkUWW4GFZ3_cjs.makeRpcIndexer; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "matchesSearchTag", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkUWW4GFZ3_cjs.matchesSearchTag; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "tryDecryptNote", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkUWW4GFZ3_cjs.tryDecryptNote; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "unpackNoteData", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkUWW4GFZ3_cjs.unpackNoteData; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "createAutoAdapter", {
|
|
30
30
|
enumerable: true,
|
package/dist/indexer/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-AooYZ0kF.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-AooYZ0kF.cjs';
|
|
3
|
+
import { _ as ___index_js } from '../index-hNuffoCo.cjs';
|
|
4
|
+
export { m as makeRpcIndexer } from '../index-hNuffoCo.cjs';
|
|
5
5
|
import { Hex } from 'viem';
|
|
6
6
|
import { P as Point } from '../merkle-mteVOlDf.cjs';
|
|
7
|
-
import '../transfer-
|
|
7
|
+
import '../transfer-BhB-UuBP.cjs';
|
|
8
8
|
import '../keccak-m31-B_AqBbRF.cjs';
|
|
9
9
|
import '@permissionless-technologies/upc-sdk';
|
|
10
10
|
import 'react/jsx-runtime';
|
package/dist/indexer/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-CpfUNGm9.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-CpfUNGm9.js';
|
|
3
|
+
import { _ as ___index_js } from '../index-De5B4r0l.js';
|
|
4
|
+
export { m as makeRpcIndexer } from '../index-De5B4r0l.js';
|
|
5
5
|
import { Hex } from 'viem';
|
|
6
6
|
import { P as Point } from '../merkle-mteVOlDf.js';
|
|
7
|
-
import '../transfer-
|
|
7
|
+
import '../transfer-BGzySIhC.js';
|
|
8
8
|
import '../keccak-m31-B_AqBbRF.js';
|
|
9
9
|
import '@permissionless-technologies/upc-sdk';
|
|
10
10
|
import 'react/jsx-runtime';
|
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-R4O6FOIN.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
|
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIX7HV5TE_cjs = require('./chunk-IX7HV5TE.cjs');
|
|
4
|
+
require('./chunk-VVW5VVY3.cjs');
|
|
4
5
|
require('./chunk-G7VZBCD6.cjs');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
Object.defineProperty(exports, "ASP_TREE_DEPTH", {
|
|
9
10
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkIX7HV5TE_cjs.ASP_TREE_DEPTH; }
|
|
11
12
|
});
|
|
12
13
|
Object.defineProperty(exports, "STATE_TREE_DEPTH", {
|
|
13
14
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkIX7HV5TE_cjs.STATE_TREE_DEPTH; }
|
|
15
16
|
});
|
|
16
17
|
Object.defineProperty(exports, "formatPlonkProofForContract", {
|
|
17
18
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkIX7HV5TE_cjs.formatPlonkProofForContract; }
|
|
19
20
|
});
|
|
20
21
|
Object.defineProperty(exports, "formatProofForContract", {
|
|
21
22
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkIX7HV5TE_cjs.formatProofForContract; }
|
|
23
24
|
});
|
|
24
25
|
Object.defineProperty(exports, "generateProof", {
|
|
25
26
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkIX7HV5TE_cjs.generateProof; }
|
|
27
28
|
});
|
|
28
29
|
Object.defineProperty(exports, "generateStealthProof", {
|
|
29
30
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkIX7HV5TE_cjs.generateStealthProof; }
|
|
31
32
|
});
|
|
32
33
|
Object.defineProperty(exports, "generateUPPProof", {
|
|
33
34
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkIX7HV5TE_cjs.generateUPPProof; }
|
|
35
36
|
});
|
|
36
37
|
Object.defineProperty(exports, "getStealthCircuitArtifacts", {
|
|
37
38
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkIX7HV5TE_cjs.getStealthCircuitArtifacts; }
|
|
39
40
|
});
|
|
40
41
|
Object.defineProperty(exports, "getUPPCircuitArtifacts", {
|
|
41
42
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkIX7HV5TE_cjs.getUPPCircuitArtifacts; }
|
|
43
44
|
});
|
|
44
45
|
Object.defineProperty(exports, "verifyProof", {
|
|
45
46
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkIX7HV5TE_cjs.verifyProof; }
|
|
47
48
|
});
|
|
48
|
-
//# sourceMappingURL=proof-
|
|
49
|
-
//# sourceMappingURL=proof-
|
|
49
|
+
//# sourceMappingURL=proof-X3MVQFFZ.cjs.map
|
|
50
|
+
//# sourceMappingURL=proof-X3MVQFFZ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"proof-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"proof-X3MVQFFZ.cjs"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { ASP_TREE_DEPTH, STATE_TREE_DEPTH, formatPlonkProofForContract, formatProofForContract, generateProof, generateStealthProof, generateUPPProof, getStealthCircuitArtifacts, getUPPCircuitArtifacts, verifyProof } from './chunk-
|
|
1
|
+
export { ASP_TREE_DEPTH, STATE_TREE_DEPTH, formatPlonkProofForContract, formatProofForContract, generateProof, generateStealthProof, generateUPPProof, getStealthCircuitArtifacts, getUPPCircuitArtifacts, verifyProof } from './chunk-KR4GB6VC.js';
|
|
2
|
+
import './chunk-2BSIUEPO.js';
|
|
2
3
|
import './chunk-Z6ZWNWWR.js';
|
|
3
|
-
//# sourceMappingURL=proof-
|
|
4
|
-
//# sourceMappingURL=proof-
|
|
4
|
+
//# sourceMappingURL=proof-YMXBL4D5.js.map
|
|
5
|
+
//# sourceMappingURL=proof-YMXBL4D5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"proof-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"proof-YMXBL4D5.js"}
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIYRCJAME_cjs = require('../chunk-IYRCJAME.cjs');
|
|
4
4
|
var chunkXVIICZKW_cjs = require('../chunk-XVIICZKW.cjs');
|
|
5
|
+
var chunkVVW5VVY3_cjs = require('../chunk-VVW5VVY3.cjs');
|
|
5
6
|
var chunkERQE57IA_cjs = require('../chunk-ERQE57IA.cjs');
|
|
6
7
|
require('../chunk-UFEDJJSH.cjs');
|
|
7
8
|
var chunkHEHXSV47_cjs = require('../chunk-HEHXSV47.cjs');
|
|
@@ -107,7 +108,7 @@ function UPPAccountProvider({
|
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
110
|
const accountStorage = chunkERQE57IA_cjs.createAutoAdapter(`upp_account`);
|
|
110
|
-
const adapter = new
|
|
111
|
+
const adapter = new chunkIYRCJAME_cjs.StorableAccountAdapter(accountStorage, ethAddress);
|
|
111
112
|
accountAdapterRef.current = adapter;
|
|
112
113
|
const legacyKey = getStorageKey(ethAddress);
|
|
113
114
|
const legacySaved = typeof window !== "undefined" ? localStorage.getItem(legacyKey) : null;
|
|
@@ -148,7 +149,7 @@ function UPPAccountProvider({
|
|
|
148
149
|
const ownerHashHex2 = viem.toHex(account.keys.ownerHash, { size: 32 });
|
|
149
150
|
const storagePrefix = `upp_${chainId}_${ownerHashHex2.slice(0, 12)}`;
|
|
150
151
|
const noteStorage = chunkERQE57IA_cjs.createAutoAdapter(storagePrefix);
|
|
151
|
-
const store = new
|
|
152
|
+
const store = new chunkIYRCJAME_cjs.NoteStore(noteStorage, "notes");
|
|
152
153
|
noteStoreRef.current = store;
|
|
153
154
|
noteStoreUnsub = store.onChange(() => {
|
|
154
155
|
if (!cancelled) setNotes([...store.getNotes()]);
|
|
@@ -853,7 +854,7 @@ function UPPAccountProvider({
|
|
|
853
854
|
const stealthAddress = react.useMemo(() => {
|
|
854
855
|
if (!masterKeys) return null;
|
|
855
856
|
try {
|
|
856
|
-
const { encodeStealthAddress } = (
|
|
857
|
+
const { encodeStealthAddress } = (chunkIYRCJAME_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkIYRCJAME_cjs.stealth_exports));
|
|
857
858
|
return encodeStealthAddress(masterKeys.ownerHash, masterKeys.viewingHash);
|
|
858
859
|
} catch {
|
|
859
860
|
return null;
|
|
@@ -862,7 +863,7 @@ function UPPAccountProvider({
|
|
|
862
863
|
const starkStealthAddress = react.useMemo(() => {
|
|
863
864
|
if (!starkMasterKeys) return null;
|
|
864
865
|
try {
|
|
865
|
-
const { encodeStarkStealthAddress } = (
|
|
866
|
+
const { encodeStarkStealthAddress } = (chunkIYRCJAME_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkIYRCJAME_cjs.stealth_exports));
|
|
866
867
|
return encodeStarkStealthAddress(starkMasterKeys.starkOwnerHash, starkMasterKeys.starkViewingHash);
|
|
867
868
|
} catch {
|
|
868
869
|
return null;
|
|
@@ -1710,8 +1711,8 @@ function usePoolTransfer(config) {
|
|
|
1710
1711
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1711
1712
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1712
1713
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1713
|
-
import('../transfer-
|
|
1714
|
-
import('../proof-
|
|
1714
|
+
import('../transfer-M3PKP4PY.cjs'),
|
|
1715
|
+
import('../proof-X3MVQFFZ.cjs'),
|
|
1715
1716
|
import('../asp-CUE3NMBN.cjs')
|
|
1716
1717
|
]);
|
|
1717
1718
|
const {
|
|
@@ -1749,12 +1750,13 @@ function usePoolTransfer(config) {
|
|
|
1749
1750
|
changeNoteWithAmount
|
|
1750
1751
|
);
|
|
1751
1752
|
setProvingProgress(null);
|
|
1752
|
-
const { proof } = await
|
|
1753
|
+
const { proof } = await chunkIYRCJAME_cjs.generateUPPProofAsync(
|
|
1753
1754
|
"transfer",
|
|
1754
1755
|
circuitInputs,
|
|
1755
|
-
cfg.circuitBaseUrl
|
|
1756
|
+
cfg.circuitBaseUrl,
|
|
1756
1757
|
{
|
|
1757
1758
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
1759
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
1758
1760
|
worker: cfg.proofWorker
|
|
1759
1761
|
}
|
|
1760
1762
|
);
|
|
@@ -1867,8 +1869,8 @@ function useWithdraw(config) {
|
|
|
1867
1869
|
const token = BigInt(selectedNote.token);
|
|
1868
1870
|
setStage("creating_outputs");
|
|
1869
1871
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1870
|
-
import('../transfer-
|
|
1871
|
-
import('../proof-
|
|
1872
|
+
import('../transfer-M3PKP4PY.cjs'),
|
|
1873
|
+
import('../proof-X3MVQFFZ.cjs'),
|
|
1872
1874
|
import('../index.cjs')
|
|
1873
1875
|
]);
|
|
1874
1876
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
@@ -1932,12 +1934,13 @@ function useWithdraw(config) {
|
|
|
1932
1934
|
aspPathIndices: Array(ASP_TREE_DEPTH2).fill("0")
|
|
1933
1935
|
};
|
|
1934
1936
|
setProvingProgress(null);
|
|
1935
|
-
const { proof } = await
|
|
1937
|
+
const { proof } = await chunkIYRCJAME_cjs.generateUPPProofAsync(
|
|
1936
1938
|
"withdraw",
|
|
1937
1939
|
circuitInputs,
|
|
1938
|
-
cfg.circuitBaseUrl
|
|
1940
|
+
cfg.circuitBaseUrl,
|
|
1939
1941
|
{
|
|
1940
1942
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
1943
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
1941
1944
|
worker: cfg.proofWorker
|
|
1942
1945
|
}
|
|
1943
1946
|
);
|
|
@@ -2127,7 +2130,7 @@ function useSwapOrderBook(config) {
|
|
|
2127
2130
|
try {
|
|
2128
2131
|
const logs = await config.publicClient.getLogs({
|
|
2129
2132
|
address: config.poolAddress,
|
|
2130
|
-
event:
|
|
2133
|
+
event: chunkIYRCJAME_cjs.SWAP_ORDER_PLACED_EVENT,
|
|
2131
2134
|
fromBlock: config.fromBlock ?? 0n,
|
|
2132
2135
|
toBlock: "latest"
|
|
2133
2136
|
});
|
|
@@ -2143,10 +2146,10 @@ function useSwapOrderBook(config) {
|
|
|
2143
2146
|
blockNumber: log.blockNumber ?? 0n
|
|
2144
2147
|
}));
|
|
2145
2148
|
if (config.sellToken && config.buyToken) {
|
|
2146
|
-
parsedOrders =
|
|
2149
|
+
parsedOrders = chunkIYRCJAME_cjs.filterOrdersByTokenPair(parsedOrders, config.sellToken, config.buyToken);
|
|
2147
2150
|
}
|
|
2148
2151
|
if (config.acceptableAspIds && config.acceptableAspIds.length > 0) {
|
|
2149
|
-
parsedOrders =
|
|
2152
|
+
parsedOrders = chunkIYRCJAME_cjs.filterOrdersByASP(parsedOrders, config.acceptableAspIds);
|
|
2150
2153
|
}
|
|
2151
2154
|
const enriched = [];
|
|
2152
2155
|
for (const order of parsedOrders) {
|
|
@@ -2244,8 +2247,8 @@ function useSwap(config) {
|
|
|
2244
2247
|
}
|
|
2245
2248
|
setStage("creating_outputs");
|
|
2246
2249
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2247
|
-
import('../transfer-
|
|
2248
|
-
import('../proof-
|
|
2250
|
+
import('../transfer-M3PKP4PY.cjs'),
|
|
2251
|
+
import('../proof-X3MVQFFZ.cjs'),
|
|
2249
2252
|
import('../index.cjs'),
|
|
2250
2253
|
import('../asp-CUE3NMBN.cjs')
|
|
2251
2254
|
]);
|
|
@@ -2310,18 +2313,19 @@ function useSwap(config) {
|
|
|
2310
2313
|
aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
|
|
2311
2314
|
};
|
|
2312
2315
|
setProvingProgress(null);
|
|
2313
|
-
const { proof } = await
|
|
2316
|
+
const { proof } = await chunkIYRCJAME_cjs.generateUPPProofAsync(
|
|
2314
2317
|
"withdraw",
|
|
2315
2318
|
circuitInputs,
|
|
2316
|
-
cfg.circuitBaseUrl
|
|
2319
|
+
cfg.circuitBaseUrl,
|
|
2317
2320
|
{
|
|
2318
2321
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
2322
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
2319
2323
|
worker: cfg.proofWorker
|
|
2320
2324
|
}
|
|
2321
2325
|
);
|
|
2322
2326
|
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2323
|
-
const cancelSecret =
|
|
2324
|
-
const cancelKeyHash =
|
|
2327
|
+
const cancelSecret = chunkIYRCJAME_cjs.generateCancelSecret();
|
|
2328
|
+
const cancelKeyHash = chunkIYRCJAME_cjs.computeCancelKeyHash(cancelSecret);
|
|
2325
2329
|
const currentBlock = await cfg.publicClient.getBlockNumber();
|
|
2326
2330
|
const expiry = currentBlock + expiryBlocks;
|
|
2327
2331
|
return {
|
|
@@ -2370,7 +2374,7 @@ function useSwap(config) {
|
|
|
2370
2374
|
noteOverride
|
|
2371
2375
|
} = params;
|
|
2372
2376
|
const cfg = configRef.current;
|
|
2373
|
-
const giveAmount =
|
|
2377
|
+
const giveAmount = chunkIYRCJAME_cjs.computeGiveAmount(takeAmount, rate);
|
|
2374
2378
|
setStage("selecting_notes");
|
|
2375
2379
|
let selectedNote;
|
|
2376
2380
|
if (noteOverride) {
|
|
@@ -2391,8 +2395,8 @@ function useSwap(config) {
|
|
|
2391
2395
|
}
|
|
2392
2396
|
setStage("creating_outputs");
|
|
2393
2397
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2394
|
-
import('../transfer-
|
|
2395
|
-
import('../proof-
|
|
2398
|
+
import('../transfer-M3PKP4PY.cjs'),
|
|
2399
|
+
import('../proof-X3MVQFFZ.cjs'),
|
|
2396
2400
|
import('../index.cjs'),
|
|
2397
2401
|
import('../asp-CUE3NMBN.cjs')
|
|
2398
2402
|
]);
|
|
@@ -2463,12 +2467,13 @@ function useSwap(config) {
|
|
|
2463
2467
|
aspPathIndices: padToDepth2(aspProofData.aspPathIndices.map(String), "0", ASP_TREE_DEPTH3)
|
|
2464
2468
|
};
|
|
2465
2469
|
setProvingProgress(null);
|
|
2466
|
-
const { proof } = await
|
|
2470
|
+
const { proof } = await chunkIYRCJAME_cjs.generateUPPProofAsync(
|
|
2467
2471
|
"withdraw",
|
|
2468
2472
|
circuitInputs,
|
|
2469
|
-
cfg.circuitBaseUrl
|
|
2473
|
+
cfg.circuitBaseUrl,
|
|
2470
2474
|
{
|
|
2471
2475
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
2476
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
2472
2477
|
worker: cfg.proofWorker
|
|
2473
2478
|
}
|
|
2474
2479
|
);
|
|
@@ -2628,8 +2633,8 @@ function useSwap(config) {
|
|
|
2628
2633
|
createNoteForSelf(changeAmount, origin, token)
|
|
2629
2634
|
]);
|
|
2630
2635
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2631
|
-
import('../transfer-
|
|
2632
|
-
import('../proof-
|
|
2636
|
+
import('../transfer-M3PKP4PY.cjs'),
|
|
2637
|
+
import('../proof-X3MVQFFZ.cjs'),
|
|
2633
2638
|
import('../asp-CUE3NMBN.cjs')
|
|
2634
2639
|
]);
|
|
2635
2640
|
const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
|
|
@@ -2659,12 +2664,13 @@ function useSwap(config) {
|
|
|
2659
2664
|
changeNoteWithAmount
|
|
2660
2665
|
);
|
|
2661
2666
|
setProvingProgress(null);
|
|
2662
|
-
const { proof } = await
|
|
2667
|
+
const { proof } = await chunkIYRCJAME_cjs.generateUPPProofAsync(
|
|
2663
2668
|
"transfer",
|
|
2664
2669
|
circuitInputs,
|
|
2665
|
-
cfg.circuitBaseUrl
|
|
2670
|
+
cfg.circuitBaseUrl,
|
|
2666
2671
|
{
|
|
2667
2672
|
onProgress: (s, msg) => setProvingProgress({ stage: s, message: msg }),
|
|
2673
|
+
onDownloadProgress: cfg.onDownloadProgress,
|
|
2668
2674
|
worker: cfg.proofWorker
|
|
2669
2675
|
}
|
|
2670
2676
|
);
|
|
@@ -2749,7 +2755,7 @@ function useProofWorker(worker) {
|
|
|
2749
2755
|
setManager(null);
|
|
2750
2756
|
return;
|
|
2751
2757
|
}
|
|
2752
|
-
const m = new
|
|
2758
|
+
const m = new chunkIYRCJAME_cjs.ProofWorkerManager(worker);
|
|
2753
2759
|
setManager(m);
|
|
2754
2760
|
return () => {
|
|
2755
2761
|
m.terminate();
|
|
@@ -2758,6 +2764,71 @@ function useProofWorker(worker) {
|
|
|
2758
2764
|
}, [worker]);
|
|
2759
2765
|
return manager;
|
|
2760
2766
|
}
|
|
2767
|
+
function useCircuitCache(baseUrl) {
|
|
2768
|
+
const [status, setStatus] = react.useState(/* @__PURE__ */ new Map());
|
|
2769
|
+
const [downloadProgress, setDownloadProgress] = react.useState(null);
|
|
2770
|
+
const [isDownloading, setIsDownloading] = react.useState(false);
|
|
2771
|
+
const cacheRef = react.useRef(null);
|
|
2772
|
+
if (!cacheRef.current) {
|
|
2773
|
+
cacheRef.current = chunkVVW5VVY3_cjs.CircuitArtifactCache.shared();
|
|
2774
|
+
}
|
|
2775
|
+
const cache = cacheRef.current;
|
|
2776
|
+
const refresh = react.useCallback(async () => {
|
|
2777
|
+
const s = await cache.getStatus();
|
|
2778
|
+
setStatus(s);
|
|
2779
|
+
}, [cache]);
|
|
2780
|
+
react.useEffect(() => {
|
|
2781
|
+
refresh();
|
|
2782
|
+
}, [refresh]);
|
|
2783
|
+
const isCached = react.useCallback(
|
|
2784
|
+
(circuit) => {
|
|
2785
|
+
return status.get(circuit)?.cached ?? false;
|
|
2786
|
+
},
|
|
2787
|
+
[status]
|
|
2788
|
+
);
|
|
2789
|
+
const preload = react.useCallback(
|
|
2790
|
+
async (circuit) => {
|
|
2791
|
+
setIsDownloading(true);
|
|
2792
|
+
setDownloadProgress(null);
|
|
2793
|
+
try {
|
|
2794
|
+
await cache.preload(circuit, baseUrl, (p) => {
|
|
2795
|
+
setDownloadProgress(p);
|
|
2796
|
+
});
|
|
2797
|
+
await refresh();
|
|
2798
|
+
} finally {
|
|
2799
|
+
setIsDownloading(false);
|
|
2800
|
+
setDownloadProgress(null);
|
|
2801
|
+
}
|
|
2802
|
+
},
|
|
2803
|
+
[cache, baseUrl, refresh]
|
|
2804
|
+
);
|
|
2805
|
+
const evict = react.useCallback(
|
|
2806
|
+
async (circuit) => {
|
|
2807
|
+
await cache.evict(circuit);
|
|
2808
|
+
await refresh();
|
|
2809
|
+
},
|
|
2810
|
+
[cache, refresh]
|
|
2811
|
+
);
|
|
2812
|
+
const evictAll = react.useCallback(async () => {
|
|
2813
|
+
await cache.evictAll();
|
|
2814
|
+
await refresh();
|
|
2815
|
+
}, [cache, refresh]);
|
|
2816
|
+
const requestPersistence = react.useCallback(async () => {
|
|
2817
|
+
return cache.requestPersistence();
|
|
2818
|
+
}, [cache]);
|
|
2819
|
+
return {
|
|
2820
|
+
isCached,
|
|
2821
|
+
preload,
|
|
2822
|
+
downloadProgress,
|
|
2823
|
+
isDownloading,
|
|
2824
|
+
evict,
|
|
2825
|
+
evictAll,
|
|
2826
|
+
status,
|
|
2827
|
+
refresh,
|
|
2828
|
+
requestPersistence,
|
|
2829
|
+
version: chunkVVW5VVY3_cjs.CIRCUIT_VERSION
|
|
2830
|
+
};
|
|
2831
|
+
}
|
|
2761
2832
|
function usePrivateBalance(config) {
|
|
2762
2833
|
const { unspentNotes, syncNotes, isSyncing: isNoteSyncing } = useUPPAccount();
|
|
2763
2834
|
const { poolAddress, publicClient, walletAddress, tokenList, autoSync = true, fromBlock = 0n } = config;
|
|
@@ -2772,7 +2843,7 @@ function usePrivateBalance(config) {
|
|
|
2772
2843
|
try {
|
|
2773
2844
|
const placedLogs = await publicClient.getLogs({
|
|
2774
2845
|
address: poolAddress,
|
|
2775
|
-
event:
|
|
2846
|
+
event: chunkIYRCJAME_cjs.SWAP_ORDER_PLACED_EVENT,
|
|
2776
2847
|
fromBlock,
|
|
2777
2848
|
toBlock: "latest"
|
|
2778
2849
|
});
|
|
@@ -2780,7 +2851,7 @@ function usePrivateBalance(config) {
|
|
|
2780
2851
|
for (const log of placedLogs) {
|
|
2781
2852
|
const args = log.args;
|
|
2782
2853
|
const orderId = args.orderId;
|
|
2783
|
-
if (walletAddress && !
|
|
2854
|
+
if (walletAddress && !chunkIYRCJAME_cjs.getCancelSecret(orderId, walletAddress)) continue;
|
|
2784
2855
|
orders.set(orderId.toLowerCase(), {
|
|
2785
2856
|
sellToken: args.sellToken,
|
|
2786
2857
|
sellAmount: BigInt(args.sellAmount),
|
|
@@ -2789,7 +2860,7 @@ function usePrivateBalance(config) {
|
|
|
2789
2860
|
}
|
|
2790
2861
|
const filledLogs = await publicClient.getLogs({
|
|
2791
2862
|
address: poolAddress,
|
|
2792
|
-
event:
|
|
2863
|
+
event: chunkIYRCJAME_cjs.SWAP_ORDER_FILLED_EVENT,
|
|
2793
2864
|
fromBlock,
|
|
2794
2865
|
toBlock: "latest"
|
|
2795
2866
|
});
|
|
@@ -2808,7 +2879,7 @@ function usePrivateBalance(config) {
|
|
|
2808
2879
|
}
|
|
2809
2880
|
const claimedLogs = await publicClient.getLogs({
|
|
2810
2881
|
address: poolAddress,
|
|
2811
|
-
event:
|
|
2882
|
+
event: chunkIYRCJAME_cjs.SWAP_ORDER_CLAIMED_EVENT,
|
|
2812
2883
|
fromBlock,
|
|
2813
2884
|
toBlock: "latest"
|
|
2814
2885
|
});
|
|
@@ -2817,7 +2888,7 @@ function usePrivateBalance(config) {
|
|
|
2817
2888
|
}
|
|
2818
2889
|
const cancelledLogs = await publicClient.getLogs({
|
|
2819
2890
|
address: poolAddress,
|
|
2820
|
-
event:
|
|
2891
|
+
event: chunkIYRCJAME_cjs.SWAP_ORDER_CANCELLED_EVENT,
|
|
2821
2892
|
fromBlock,
|
|
2822
2893
|
toBlock: "latest"
|
|
2823
2894
|
});
|
|
@@ -2909,11 +2980,11 @@ function usePrivateBalance(config) {
|
|
|
2909
2980
|
|
|
2910
2981
|
Object.defineProperty(exports, "ProofWorkerManager", {
|
|
2911
2982
|
enumerable: true,
|
|
2912
|
-
get: function () { return
|
|
2983
|
+
get: function () { return chunkIYRCJAME_cjs.ProofWorkerManager; }
|
|
2913
2984
|
});
|
|
2914
2985
|
Object.defineProperty(exports, "generateUPPProofAsync", {
|
|
2915
2986
|
enumerable: true,
|
|
2916
|
-
get: function () { return
|
|
2987
|
+
get: function () { return chunkIYRCJAME_cjs.generateUPPProofAsync; }
|
|
2917
2988
|
});
|
|
2918
2989
|
Object.defineProperty(exports, "ASP_TREE_DEPTH", {
|
|
2919
2990
|
enumerable: true,
|
|
@@ -2943,6 +3014,18 @@ Object.defineProperty(exports, "generateSingleOriginASPProof", {
|
|
|
2943
3014
|
enumerable: true,
|
|
2944
3015
|
get: function () { return chunkXVIICZKW_cjs.generateSingleOriginASPProof; }
|
|
2945
3016
|
});
|
|
3017
|
+
Object.defineProperty(exports, "CIRCUIT_CDN_BASE", {
|
|
3018
|
+
enumerable: true,
|
|
3019
|
+
get: function () { return chunkVVW5VVY3_cjs.CIRCUIT_CDN_BASE; }
|
|
3020
|
+
});
|
|
3021
|
+
Object.defineProperty(exports, "CIRCUIT_VERSION", {
|
|
3022
|
+
enumerable: true,
|
|
3023
|
+
get: function () { return chunkVVW5VVY3_cjs.CIRCUIT_VERSION; }
|
|
3024
|
+
});
|
|
3025
|
+
Object.defineProperty(exports, "CircuitArtifactCache", {
|
|
3026
|
+
enumerable: true,
|
|
3027
|
+
get: function () { return chunkVVW5VVY3_cjs.CircuitArtifactCache; }
|
|
3028
|
+
});
|
|
2946
3029
|
exports.UPPAccountProvider = UPPAccountProvider;
|
|
2947
3030
|
exports.UPPAvatar = UPPAvatar;
|
|
2948
3031
|
exports.UPPModal = UPPModal;
|
|
@@ -2950,6 +3033,7 @@ exports.UPPPrivateButton = UPPPrivateButton;
|
|
|
2950
3033
|
exports.generateAvatarData = generateAvatarData;
|
|
2951
3034
|
exports.renderAvatarSVG = renderAvatarSVG;
|
|
2952
3035
|
exports.storePersonalASPId = storePersonalASPId;
|
|
3036
|
+
exports.useCircuitCache = useCircuitCache;
|
|
2953
3037
|
exports.usePersonalASP = usePersonalASP;
|
|
2954
3038
|
exports.usePoolTransfer = usePoolTransfer;
|
|
2955
3039
|
exports.usePrivateBalance = usePrivateBalance;
|