@unlink-xyz/core 0.1.3-canary.caa4485 → 0.1.3-canary.df80fa1
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/circuits.json +6 -54
- package/dist/clients/broadcaster.d.ts +1 -1
- package/dist/clients/broadcaster.d.ts.map +1 -1
- package/dist/clients/http.d.ts.map +1 -1
- package/dist/clients/http.js +7 -13
- package/dist/clients/indexer.d.ts +0 -5
- package/dist/clients/indexer.d.ts.map +1 -1
- package/dist/clients/indexer.js +0 -19
- package/dist/prover/registry.d.ts +2 -2
- package/dist/prover/registry.d.ts.map +1 -1
- package/dist/prover/registry.js +13 -61
- package/dist/state/store/ciphertext-store.d.ts +0 -4
- package/dist/state/store/ciphertext-store.d.ts.map +1 -1
- package/dist/state/store/ciphertext-store.js +0 -12
- package/dist/state/store/job-store.d.ts.map +1 -1
- package/dist/state/store/job-store.js +25 -46
- package/dist/state/store/jobs.d.ts +8 -33
- package/dist/state/store/jobs.d.ts.map +1 -1
- package/dist/state/store/note-store.d.ts +2 -6
- package/dist/state/store/note-store.d.ts.map +1 -1
- package/dist/state/store/note-store.js +4 -22
- package/dist/state/store/store.d.ts +1 -3
- package/dist/state/store/store.d.ts.map +1 -1
- package/dist/transactions/deposit.d.ts +3 -5
- package/dist/transactions/deposit.d.ts.map +1 -1
- package/dist/transactions/deposit.js +77 -172
- package/dist/transactions/index.d.ts +4 -5
- package/dist/transactions/index.d.ts.map +1 -1
- package/dist/transactions/index.js +3 -4
- package/dist/transactions/note-selection.d.ts.map +1 -1
- package/dist/transactions/note-selection.js +2 -7
- package/dist/transactions/note-sync.d.ts.map +1 -1
- package/dist/transactions/note-sync.js +10 -11
- package/dist/transactions/transact.d.ts +2 -3
- package/dist/transactions/transact.d.ts.map +1 -1
- package/dist/transactions/transact.js +103 -164
- package/dist/transactions/transaction-planner.d.ts.map +1 -1
- package/dist/transactions/transaction-planner.js +3 -4
- package/dist/transactions/types/deposit.d.ts +10 -27
- package/dist/transactions/types/deposit.d.ts.map +1 -1
- package/dist/transactions/types/options.d.ts +0 -2
- package/dist/transactions/types/options.d.ts.map +1 -1
- package/dist/transactions/types/state-stores.d.ts +2 -4
- package/dist/transactions/types/state-stores.d.ts.map +1 -1
- package/dist/transactions/types/transact.d.ts +16 -31
- package/dist/transactions/types/transact.d.ts.map +1 -1
- package/dist/transactions/withdrawal-planner.d.ts +28 -25
- package/dist/transactions/withdrawal-planner.d.ts.map +1 -1
- package/dist/transactions/withdrawal-planner.js +44 -73
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/crypto.d.ts +3 -9
- package/dist/utils/crypto.d.ts.map +1 -1
- package/dist/utils/crypto.js +5 -11
- package/dist/utils/polling.d.ts +0 -5
- package/dist/utils/polling.d.ts.map +1 -1
- package/dist/utils/polling.js +0 -5
- package/dist/vitest.config.d.ts.map +1 -1
- package/dist/vitest.config.js +7 -2
- package/package.json +4 -13
- package/dist/browser/index.js +0 -117833
- package/dist/browser/index.js.map +0 -1
- package/dist/transactions/transfer-planner.d.ts +0 -36
- package/dist/transactions/transfer-planner.d.ts.map +0 -1
- package/dist/transactions/transfer-planner.js +0 -85
- package/dist/tsup.browser.config.d.ts +0 -7
- package/dist/tsup.browser.config.d.ts.map +0 -1
- package/dist/tsup.browser.config.js +0 -34
package/dist/circuits.json
CHANGED
|
@@ -1,74 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
"joinsplit_1x1_16": {
|
|
3
|
-
"file": "joinsplit",
|
|
4
|
-
"template": "JoinSplit",
|
|
5
|
-
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
6
|
-
"params": [1, 1, 16]
|
|
7
|
-
},
|
|
8
|
-
"joinsplit_1x2_16": {
|
|
9
|
-
"file": "joinsplit",
|
|
10
|
-
"template": "JoinSplit",
|
|
11
|
-
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
12
|
-
"params": [1, 2, 16]
|
|
13
|
-
},
|
|
14
|
-
"joinsplit_2x1_16": {
|
|
15
|
-
"file": "joinsplit",
|
|
16
|
-
"template": "JoinSplit",
|
|
17
|
-
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
18
|
-
"params": [2, 1, 16]
|
|
19
|
-
},
|
|
20
|
-
"joinsplit_2x2_16": {
|
|
21
|
-
"file": "joinsplit",
|
|
22
|
-
"template": "JoinSplit",
|
|
23
|
-
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
24
|
-
"params": [2, 2, 16]
|
|
25
|
-
},
|
|
26
|
-
"joinsplit_2x3_16": {
|
|
27
|
-
"file": "joinsplit",
|
|
28
|
-
"template": "JoinSplit",
|
|
29
|
-
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
30
|
-
"params": [2, 3, 16]
|
|
31
|
-
},
|
|
32
|
-
"joinsplit_3x1_16": {
|
|
33
|
-
"file": "joinsplit",
|
|
34
|
-
"template": "JoinSplit",
|
|
35
|
-
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
36
|
-
"params": [3, 1, 16]
|
|
37
|
-
},
|
|
38
|
-
"joinsplit_3x2_16": {
|
|
39
|
-
"file": "joinsplit",
|
|
40
|
-
"template": "JoinSplit",
|
|
41
|
-
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
42
|
-
"params": [3, 2, 16]
|
|
43
|
-
},
|
|
44
2
|
"joinsplit_3x3_16": {
|
|
45
3
|
"file": "joinsplit",
|
|
46
4
|
"template": "JoinSplit",
|
|
47
5
|
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
48
6
|
"params": [3, 3, 16]
|
|
49
7
|
},
|
|
50
|
-
"
|
|
51
|
-
"file": "joinsplit",
|
|
52
|
-
"template": "JoinSplit",
|
|
53
|
-
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
54
|
-
"params": [4, 1, 16]
|
|
55
|
-
},
|
|
56
|
-
"joinsplit_4x2_16": {
|
|
8
|
+
"joinsplit_2x3_16": {
|
|
57
9
|
"file": "joinsplit",
|
|
58
10
|
"template": "JoinSplit",
|
|
59
11
|
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
60
|
-
"params": [
|
|
12
|
+
"params": [2, 3, 16]
|
|
61
13
|
},
|
|
62
|
-
"
|
|
14
|
+
"joinsplit_1x2_16": {
|
|
63
15
|
"file": "joinsplit",
|
|
64
16
|
"template": "JoinSplit",
|
|
65
17
|
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
66
|
-
"params": [
|
|
18
|
+
"params": [1, 2, 16]
|
|
67
19
|
},
|
|
68
|
-
"
|
|
20
|
+
"joinsplit_1x1_16": {
|
|
69
21
|
"file": "joinsplit",
|
|
70
22
|
"template": "JoinSplit",
|
|
71
23
|
"pubs": ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
72
|
-
"params": [
|
|
24
|
+
"params": [1, 1, 16]
|
|
73
25
|
}
|
|
74
26
|
}
|
|
@@ -14,7 +14,7 @@ export type SubmitRelayResponse = {
|
|
|
14
14
|
accepted: boolean;
|
|
15
15
|
message?: string | null;
|
|
16
16
|
};
|
|
17
|
-
export type RelayState = "pending" | "broadcasting" | "
|
|
17
|
+
export type RelayState = "pending" | "broadcasting" | "succeeded" | "failed" | "dead";
|
|
18
18
|
export type RelayStatusResponse = {
|
|
19
19
|
id: string;
|
|
20
20
|
state: RelayState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broadcaster.d.ts","sourceRoot":"","sources":["../../clients/broadcaster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EA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AM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAK3D;AAWD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,YAAY,GACjB,cAAc,CA+ChB"}
|
package/dist/clients/http.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ky, { TimeoutError } from "ky";
|
|
1
|
+
import ky, { HTTPError, TimeoutError } from "ky";
|
|
2
2
|
/**
|
|
3
3
|
* Resolve fetch implementation from options or global.
|
|
4
4
|
* @param providedFetch - Optional fetch implementation
|
|
@@ -36,15 +36,11 @@ export function createJsonHttpClient(baseUrl, deps) {
|
|
|
36
36
|
const api = ky.create({
|
|
37
37
|
prefixUrl: baseUrl.replace(/\/+$/, ""),
|
|
38
38
|
fetch: fetchImpl,
|
|
39
|
-
// Disable ky's automatic error throwing to prevent browser DevTools
|
|
40
|
-
// from logging expected 404s as network errors
|
|
41
|
-
throwHttpErrors: false,
|
|
42
39
|
});
|
|
43
40
|
return {
|
|
44
41
|
async request(opts) {
|
|
45
|
-
let res;
|
|
46
42
|
try {
|
|
47
|
-
res =
|
|
43
|
+
const res = api(opts.path.replace(/^\//, ""), {
|
|
48
44
|
method: opts.method,
|
|
49
45
|
searchParams: opts.query,
|
|
50
46
|
json: opts.json,
|
|
@@ -52,20 +48,18 @@ export function createJsonHttpClient(baseUrl, deps) {
|
|
|
52
48
|
headers: opts.headers,
|
|
53
49
|
signal: opts.signal,
|
|
54
50
|
});
|
|
51
|
+
return await res.json();
|
|
55
52
|
}
|
|
56
53
|
catch (err) {
|
|
57
|
-
|
|
54
|
+
if (err instanceof HTTPError) {
|
|
55
|
+
const body = await readErrorBodySafe(err.response);
|
|
56
|
+
throw new HttpError(`HTTP ${err.response.status} ${err.response.statusText}`.trim(), err.response.status, body);
|
|
57
|
+
}
|
|
58
58
|
if (err instanceof TimeoutError) {
|
|
59
59
|
throw new HttpError("HTTP timeout", 408, null);
|
|
60
60
|
}
|
|
61
61
|
throw new HttpError(err instanceof Error ? err.message : "Network error", 0, null);
|
|
62
62
|
}
|
|
63
|
-
// HTTP status errors handled outside try-catch - no redundant catch/rethrow
|
|
64
|
-
if (!res.ok) {
|
|
65
|
-
const body = await readErrorBodySafe(res);
|
|
66
|
-
throw new HttpError(`HTTP ${res.status} ${res.statusText}`.trim(), res.status, body);
|
|
67
|
-
}
|
|
68
|
-
return (await res.json());
|
|
69
63
|
},
|
|
70
64
|
};
|
|
71
65
|
}
|
|
@@ -38,11 +38,6 @@ type IndexerClientDeps = {
|
|
|
38
38
|
export declare function createIndexerClient(baseUrl: string, deps: IndexerClientDeps): {
|
|
39
39
|
fetchCommitmentBatch(params: FetchCommitmentsParams): Promise<CommitmentBatchResponse>;
|
|
40
40
|
getCommitment(params: GetCommitmentParams): Promise<CommitmentRecord>;
|
|
41
|
-
/**
|
|
42
|
-
* Like getCommitment but returns null on 404 instead of throwing.
|
|
43
|
-
* Used for polling pending deposits without generating console errors.
|
|
44
|
-
*/
|
|
45
|
-
tryGetCommitment(params: GetCommitmentParams): Promise<CommitmentRecord | null>;
|
|
46
41
|
getNullifier(params: GetNullifierParams): Promise<IndexerNullifierRecord | null>;
|
|
47
42
|
getNullifierCount(chainId: number): Promise<number>;
|
|
48
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../clients/indexer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAe3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,E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"}
|
package/dist/clients/indexer.js
CHANGED
|
@@ -42,25 +42,6 @@ export function createIndexerClient(baseUrl, deps) {
|
|
|
42
42
|
});
|
|
43
43
|
return normalizeRecord(raw);
|
|
44
44
|
},
|
|
45
|
-
/**
|
|
46
|
-
* Like getCommitment but returns null on 404 instead of throwing.
|
|
47
|
-
* Used for polling pending deposits without generating console errors.
|
|
48
|
-
*/
|
|
49
|
-
async tryGetCommitment(params) {
|
|
50
|
-
try {
|
|
51
|
-
const raw = await http.request({
|
|
52
|
-
method: "GET",
|
|
53
|
-
path: `/chains/${params.chainId}/commitments/${params.commitment}`,
|
|
54
|
-
});
|
|
55
|
-
return normalizeRecord(raw);
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
if (isNotFoundError(err)) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
throw err;
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
45
|
async getNullifier(params) {
|
|
65
46
|
try {
|
|
66
47
|
const raw = await http.request({
|
|
@@ -12,10 +12,10 @@ export interface CircuitConfig {
|
|
|
12
12
|
/** Merkle tree depth */
|
|
13
13
|
readonly depth: number;
|
|
14
14
|
}
|
|
15
|
-
export type CircuitKey = "
|
|
15
|
+
export type CircuitKey = "3x3" | "2x3" | "1x2" | "1x1";
|
|
16
16
|
/**
|
|
17
17
|
* Registry of available circuits
|
|
18
|
-
* Auto-generated from zk/circuits.json
|
|
18
|
+
* Auto-generated from zk/circom/circuits.json
|
|
19
19
|
*/
|
|
20
20
|
export declare const CIRCUIT_REGISTRY: Record<CircuitKey, CircuitConfig>;
|
|
21
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../prover/registry.ts"],"names":[],"mappings":"AAKA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wBAAwB;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../prover/registry.ts"],"names":[],"mappings":"AAKA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wBAAwB;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAyBrD,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAoC,UAAU,EAAE,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,aAAa,GAAG,SAAS,CAG3B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3E"}
|
package/dist/prover/registry.js
CHANGED
|
@@ -1,84 +1,36 @@
|
|
|
1
1
|
// AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
|
|
2
2
|
// Generated by scripts/generate-registry.ts
|
|
3
|
-
// Source: zk/circuits.json
|
|
4
|
-
// Generated at: 2026-01-
|
|
3
|
+
// Source: zk/circom/circuits.json
|
|
4
|
+
// Generated at: 2026-01-13T11:31:30.333Z
|
|
5
5
|
/**
|
|
6
6
|
* Registry of available circuits
|
|
7
|
-
* Auto-generated from zk/circuits.json
|
|
7
|
+
* Auto-generated from zk/circom/circuits.json
|
|
8
8
|
*/
|
|
9
9
|
export const CIRCUIT_REGISTRY = {
|
|
10
|
-
"1x1": {
|
|
11
|
-
name: "joinsplit_1x1_16",
|
|
12
|
-
inputs: 1,
|
|
13
|
-
outputs: 1,
|
|
14
|
-
depth: 16,
|
|
15
|
-
},
|
|
16
|
-
"1x2": {
|
|
17
|
-
name: "joinsplit_1x2_16",
|
|
18
|
-
inputs: 1,
|
|
19
|
-
outputs: 2,
|
|
20
|
-
depth: 16,
|
|
21
|
-
},
|
|
22
|
-
"2x1": {
|
|
23
|
-
name: "joinsplit_2x1_16",
|
|
24
|
-
inputs: 2,
|
|
25
|
-
outputs: 1,
|
|
26
|
-
depth: 16,
|
|
27
|
-
},
|
|
28
|
-
"2x2": {
|
|
29
|
-
name: "joinsplit_2x2_16",
|
|
30
|
-
inputs: 2,
|
|
31
|
-
outputs: 2,
|
|
32
|
-
depth: 16,
|
|
33
|
-
},
|
|
34
|
-
"2x3": {
|
|
35
|
-
name: "joinsplit_2x3_16",
|
|
36
|
-
inputs: 2,
|
|
37
|
-
outputs: 3,
|
|
38
|
-
depth: 16,
|
|
39
|
-
},
|
|
40
|
-
"3x1": {
|
|
41
|
-
name: "joinsplit_3x1_16",
|
|
42
|
-
inputs: 3,
|
|
43
|
-
outputs: 1,
|
|
44
|
-
depth: 16,
|
|
45
|
-
},
|
|
46
|
-
"3x2": {
|
|
47
|
-
name: "joinsplit_3x2_16",
|
|
48
|
-
inputs: 3,
|
|
49
|
-
outputs: 2,
|
|
50
|
-
depth: 16,
|
|
51
|
-
},
|
|
52
10
|
"3x3": {
|
|
53
11
|
name: "joinsplit_3x3_16",
|
|
54
12
|
inputs: 3,
|
|
55
13
|
outputs: 3,
|
|
56
14
|
depth: 16,
|
|
57
15
|
},
|
|
58
|
-
"
|
|
59
|
-
name: "
|
|
60
|
-
inputs:
|
|
61
|
-
outputs:
|
|
16
|
+
"2x3": {
|
|
17
|
+
name: "joinsplit_2x3_16",
|
|
18
|
+
inputs: 2,
|
|
19
|
+
outputs: 3,
|
|
62
20
|
depth: 16,
|
|
63
21
|
},
|
|
64
|
-
"
|
|
65
|
-
name: "
|
|
66
|
-
inputs:
|
|
22
|
+
"1x2": {
|
|
23
|
+
name: "joinsplit_1x2_16",
|
|
24
|
+
inputs: 1,
|
|
67
25
|
outputs: 2,
|
|
68
26
|
depth: 16,
|
|
69
27
|
},
|
|
70
|
-
"
|
|
71
|
-
name: "
|
|
72
|
-
inputs:
|
|
28
|
+
"1x1": {
|
|
29
|
+
name: "joinsplit_1x1_16",
|
|
30
|
+
inputs: 1,
|
|
73
31
|
outputs: 1,
|
|
74
32
|
depth: 16,
|
|
75
33
|
},
|
|
76
|
-
"5x2": {
|
|
77
|
-
name: "joinsplit_5x2_16",
|
|
78
|
-
inputs: 5,
|
|
79
|
-
outputs: 2,
|
|
80
|
-
depth: 16,
|
|
81
|
-
},
|
|
82
34
|
};
|
|
83
35
|
/**
|
|
84
36
|
* Get list of all supported circuit keys
|
|
@@ -8,9 +8,5 @@ export declare function createCiphertextStore(storage: Storage): {
|
|
|
8
8
|
* Retrieve encrypted note payloads; returns null when the ciphertext is missing.
|
|
9
9
|
*/
|
|
10
10
|
getCiphertext(chainId: number, index: number): Promise<Uint8Array<ArrayBuffer> | null>;
|
|
11
|
-
/**
|
|
12
|
-
* Remove all cached ciphertexts for a chain.
|
|
13
|
-
*/
|
|
14
|
-
clearCiphertexts(chainId: number): Promise<void>;
|
|
15
11
|
};
|
|
16
12
|
//# sourceMappingURL=ciphertext-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciphertext-store.d.ts","sourceRoot":"","sources":["../../../state/store/ciphertext-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO;IAElD;;OAEG;2BAC0B,MAAM,SAAS,MAAM,WAAW,UAAU;IAQvE;;OAEG;2BAC0B,MAAM,SAAS,MAAM;
|
|
1
|
+
{"version":3,"file":"ciphertext-store.d.ts","sourceRoot":"","sources":["../../../state/store/ciphertext-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO;IAElD;;OAEG;2BAC0B,MAAM,SAAS,MAAM,WAAW,UAAU;IAQvE;;OAEG;2BAC0B,MAAM,SAAS,MAAM;EAOrD"}
|
|
@@ -21,17 +21,5 @@ export function createCiphertextStore(storage) {
|
|
|
21
21
|
const data = await storage.get(keys.ciphertext(chainId, index));
|
|
22
22
|
return data ? new Uint8Array(data) : null;
|
|
23
23
|
},
|
|
24
|
-
/**
|
|
25
|
-
* Remove all cached ciphertexts for a chain.
|
|
26
|
-
*/
|
|
27
|
-
async clearCiphertexts(chainId) {
|
|
28
|
-
ensureChainId(chainId);
|
|
29
|
-
const prefix = `ciphertexts:${chainId}:`;
|
|
30
|
-
const entries = await storage.iter({ prefix });
|
|
31
|
-
if (entries.length === 0)
|
|
32
|
-
return;
|
|
33
|
-
const deletions = entries.map(({ key }) => ({ del: key }));
|
|
34
|
-
await storage.batch(deletions);
|
|
35
|
-
},
|
|
36
24
|
};
|
|
37
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-store.d.ts","sourceRoot":"","sources":["../../../state/store/job-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAQ9C,OAAO,KAAK,EAEV,OAAO,EACP,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"job-store.d.ts","sourceRoot":"","sources":["../../../state/store/job-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAQ9C,OAAO,KAAK,EAEV,OAAO,EACP,SAAS,EACT,SAAS,EAGV,MAAM,kBAAkB,CAAC;AAiH1B,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO;gBAEzB,SAAS;oBASL,MAAM;sBAKlB;QACN,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;KACxB;uBAesB,MAAM;EAIlC"}
|
|
@@ -34,61 +34,40 @@ function normalizeTimestamps(job) {
|
|
|
34
34
|
timeoutMs,
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
+
function validateTransactContext(context) {
|
|
38
|
+
ensurePositiveInt("context index", context.index);
|
|
39
|
+
if (!context.nullifier) {
|
|
40
|
+
throw new Error("context nullifier is required");
|
|
41
|
+
}
|
|
42
|
+
const { witness } = context;
|
|
43
|
+
if (!witness) {
|
|
44
|
+
throw new Error("context witness is required");
|
|
45
|
+
}
|
|
46
|
+
ensurePositiveInt("witness leafIndex", witness.leafIndex);
|
|
47
|
+
if (!Array.isArray(witness.pathElements) ||
|
|
48
|
+
!Array.isArray(witness.pathIndices)) {
|
|
49
|
+
throw new Error("witness pathElements and pathIndices are required");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
37
52
|
function validatePoolTransactionRecord(job) {
|
|
38
53
|
ensureAddress("pool address", job.poolAddress);
|
|
39
54
|
if (!job.calldata) {
|
|
40
55
|
throw new Error("calldata is required for pool transaction record");
|
|
41
56
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const tx = job.transactions[i];
|
|
47
|
-
ensureAddress(`transaction token at ${i}`, tx.token);
|
|
48
|
-
if (!Array.isArray(tx.nullifiers) || !tx.nullifiers.length) {
|
|
49
|
-
throw new Error(`nullifiers array is required at index ${i}`);
|
|
50
|
-
}
|
|
51
|
-
// predictedCommitments can be empty for withdrawals with no change
|
|
52
|
-
if (!Array.isArray(tx.predictedCommitments)) {
|
|
53
|
-
throw new Error(`predicted commitments array is required at index ${i}`);
|
|
54
|
-
}
|
|
55
|
-
// Only require non-empty commitments if there's no withdrawal
|
|
56
|
-
if (!tx.predictedCommitments.length && !tx.withdrawal) {
|
|
57
|
-
throw new Error(`predicted commitments are required at index ${i}`);
|
|
57
|
+
job.contexts.forEach(validateTransactContext);
|
|
58
|
+
job.predictedOutputs.forEach((output) => {
|
|
59
|
+
if (!output.hex) {
|
|
60
|
+
throw new Error("predicted output hex is required");
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (!c.hex) {
|
|
62
|
-
throw new Error(`predicted commitment hex is required at index ${i}.${j}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (tx.withdrawal) {
|
|
66
|
-
if (!tx.withdrawal.amount) {
|
|
67
|
-
throw new Error(`withdrawal amount is required at index ${i}`);
|
|
68
|
-
}
|
|
69
|
-
if (!tx.withdrawal.recipient) {
|
|
70
|
-
throw new Error(`withdrawal recipient is required at index ${i}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
62
|
+
ensurePositiveInt("predicted output index", output.index);
|
|
63
|
+
});
|
|
74
64
|
}
|
|
75
65
|
function validateDepositRecord(job) {
|
|
76
|
-
if (!
|
|
77
|
-
|
|
78
|
-
throw new Error("predicted commitments array is required for deposit");
|
|
66
|
+
if (!job.predictedCommitment?.hex) {
|
|
67
|
+
throw new Error("predicted commitment hex is required");
|
|
79
68
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (!c.hex) {
|
|
83
|
-
throw new Error(`predicted commitment hex is required at index ${i}`);
|
|
84
|
-
}
|
|
85
|
-
ensureAddress(`predicted commitment token at ${i}`, c.token);
|
|
86
|
-
if (!c.amount) {
|
|
87
|
-
throw new Error(`predicted commitment amount is required at index ${i}`);
|
|
88
|
-
}
|
|
89
|
-
if (c.index !== undefined) {
|
|
90
|
-
ensurePositiveInt(`predicted commitment index at ${i}`, c.index);
|
|
91
|
-
}
|
|
69
|
+
if (job.predictedCommitment.index !== undefined) {
|
|
70
|
+
ensurePositiveInt("predicted commitment index", job.predictedCommitment.index);
|
|
92
71
|
}
|
|
93
72
|
}
|
|
94
73
|
function validateJob(job) {
|
|
@@ -25,23 +25,13 @@ export type JobRecordBase = {
|
|
|
25
25
|
}>;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
/**
|
|
29
|
-
* Predicted commitment info for deposits.
|
|
30
|
-
*/
|
|
31
|
-
export type PredictedCommitment = {
|
|
32
|
-
hex: string;
|
|
33
|
-
token: string;
|
|
34
|
-
amount: string;
|
|
35
|
-
index?: number;
|
|
36
|
-
root?: string;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Record for tracking deposits
|
|
40
|
-
*/
|
|
41
28
|
export type DepositRecord = JobRecordBase & {
|
|
42
29
|
kind: "deposit";
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
predictedCommitment: {
|
|
31
|
+
hex: string;
|
|
32
|
+
index?: number;
|
|
33
|
+
root?: string;
|
|
34
|
+
};
|
|
45
35
|
};
|
|
46
36
|
export type TransactContext = {
|
|
47
37
|
index: number;
|
|
@@ -60,28 +50,13 @@ export type TransactOutput = {
|
|
|
60
50
|
index: number;
|
|
61
51
|
root?: string;
|
|
62
52
|
};
|
|
63
|
-
/**
|
|
64
|
-
* Individual transaction info within a transact job.
|
|
65
|
-
*/
|
|
66
|
-
export type TransactJobTransaction = {
|
|
67
|
-
token: string;
|
|
68
|
-
nullifiers: string[];
|
|
69
|
-
predictedCommitments: Array<{
|
|
70
|
-
hex: string;
|
|
71
|
-
index?: number;
|
|
72
|
-
}>;
|
|
73
|
-
/** For withdrawals: amount and recipient */
|
|
74
|
-
withdrawal?: {
|
|
75
|
-
amount: string;
|
|
76
|
-
recipient: string;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
53
|
/** Fields shared by transfer and withdraw records */
|
|
80
54
|
type PoolTransactionFields = {
|
|
81
55
|
poolAddress: string;
|
|
82
56
|
calldata: string;
|
|
83
|
-
|
|
84
|
-
|
|
57
|
+
contexts: TransactContext[];
|
|
58
|
+
predictedOutputs: TransactOutput[];
|
|
59
|
+
expectedRoot?: string;
|
|
85
60
|
};
|
|
86
61
|
export type TransferRecord = JobRecordBase & PoolTransactionFields & {
|
|
87
62
|
kind: "transfer";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../state/store/jobs.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,WAAW,GACX,cAAc,GACd,WAAW,GACX,QAAQ,GACR,MAAM,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE;QACf,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;QAC/D,OAAO,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAClD,CAAC;CACH,CAAC;AAEF
|
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M,CAAC;IAElB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;QACzB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qDAAqD;AACrD,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,aAAa,GACxC,qBAAqB,GAAG;IACtB,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG,aAAa,GACxC,qBAAqB,GAAG;IACtB,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEJ,mEAAmE;AACnE,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG,cAAc,CAAC;AAEpE,+BAA+B;AAC/B,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,CAAC;AAExE,eAAO,MAAM,sBAAsB,QAAgB,CAAC"}
|
|
@@ -23,16 +23,12 @@ export declare function createNoteStore(storage: Storage): {
|
|
|
23
23
|
includeSpent?: boolean;
|
|
24
24
|
}): Promise<NoteRecord[]>;
|
|
25
25
|
/**
|
|
26
|
-
* Mark a cached note as spent by setting its timestamp and
|
|
26
|
+
* Mark a cached note as spent by setting its timestamp and re-indexing metadata.
|
|
27
27
|
*/
|
|
28
|
-
markNoteSpent(chainId: number, index: number, spentAt?: number
|
|
28
|
+
markNoteSpent(chainId: number, index: number, spentAt?: number): Promise<NoteRecord>;
|
|
29
29
|
/**
|
|
30
30
|
* Drop the spent marker from a cached note, returning it to the unspent index.
|
|
31
31
|
*/
|
|
32
32
|
markNoteUnspent(chainId: number, index: number): Promise<NoteRecord>;
|
|
33
|
-
/**
|
|
34
|
-
* Remove all cached notes and their unspent indices for a chain.
|
|
35
|
-
*/
|
|
36
|
-
clearNotes(chainId: number): Promise<void>;
|
|
37
33
|
};
|
|
38
34
|
//# sourceMappingURL=note-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note-store.d.ts","sourceRoot":"","sources":["../../../state/store/note-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAevD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElE,eAAO,MAAM,UAAU,+BAA0B,CAAC;AAElD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IA2D5C;;;;;OAKG;kBACiB,UAAU;IAW9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;IAI5C;;OAEG;wBAEQ;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB;IAkBH;;OAEG;
|
|
1
|
+
{"version":3,"file":"note-store.d.ts","sourceRoot":"","sources":["../../../state/store/note-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAevD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElE,eAAO,MAAM,UAAU,+BAA0B,CAAC;AAElD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IA2D5C;;;;;OAKG;kBACiB,UAAU;IAW9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;IAI5C;;OAEG;wBAEQ;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB;IAkBH;;OAEG;2BAC0B,MAAM,SAAS,MAAM;IAalD;;OAEG;6BAC4B,MAAM,SAAS,MAAM;EAgBvD"}
|
|
@@ -93,18 +93,17 @@ export function createNoteStore(storage) {
|
|
|
93
93
|
return filtered;
|
|
94
94
|
},
|
|
95
95
|
/**
|
|
96
|
-
* Mark a cached note as spent by setting its timestamp and
|
|
96
|
+
* Mark a cached note as spent by setting its timestamp and re-indexing metadata.
|
|
97
97
|
*/
|
|
98
|
-
async markNoteSpent(chainId, index, spentAt = Date.now()
|
|
98
|
+
async markNoteSpent(chainId, index, spentAt = Date.now()) {
|
|
99
99
|
const existing = await store.getNote(chainId, index);
|
|
100
100
|
if (!existing) {
|
|
101
101
|
throw new CoreError("note not found");
|
|
102
102
|
}
|
|
103
|
-
if (existing.spentAt === spentAt
|
|
104
|
-
existing.spentTxHash === spentTxHash) {
|
|
103
|
+
if (existing.spentAt === spentAt) {
|
|
105
104
|
return existing;
|
|
106
105
|
}
|
|
107
|
-
const updated = { ...existing, spentAt
|
|
106
|
+
const updated = { ...existing, spentAt };
|
|
108
107
|
await persistNote(updated);
|
|
109
108
|
return updated;
|
|
110
109
|
},
|
|
@@ -124,23 +123,6 @@ export function createNoteStore(storage) {
|
|
|
124
123
|
await persistNote(updated);
|
|
125
124
|
return updated;
|
|
126
125
|
},
|
|
127
|
-
/**
|
|
128
|
-
* Remove all cached notes and their unspent indices for a chain.
|
|
129
|
-
*/
|
|
130
|
-
async clearNotes(chainId) {
|
|
131
|
-
const notePrefix = `notes:${chainId}:`;
|
|
132
|
-
const noteEntries = await storage.iter({ prefix: notePrefix });
|
|
133
|
-
// Also clear unspent indices for this chain (all mpks)
|
|
134
|
-
const unspentPrefix = `idx:notes:unspent:${chainId}:`;
|
|
135
|
-
const unspentEntries = await storage.iter({ prefix: unspentPrefix });
|
|
136
|
-
if (noteEntries.length === 0 && unspentEntries.length === 0)
|
|
137
|
-
return;
|
|
138
|
-
const deletions = [
|
|
139
|
-
...noteEntries.map(({ key }) => ({ del: key })),
|
|
140
|
-
...unspentEntries.map(({ key }) => ({ del: key })),
|
|
141
|
-
];
|
|
142
|
-
await storage.batch(deletions);
|
|
143
|
-
},
|
|
144
126
|
};
|
|
145
127
|
return store;
|
|
146
128
|
}
|
|
@@ -11,9 +11,8 @@ export interface StateStore {
|
|
|
11
11
|
token?: string;
|
|
12
12
|
includeSpent?: boolean;
|
|
13
13
|
}): Promise<NoteRecord[]>;
|
|
14
|
-
markNoteSpent(chainId: number, index: number, spentAt?: number
|
|
14
|
+
markNoteSpent(chainId: number, index: number, spentAt?: number): Promise<NoteRecord>;
|
|
15
15
|
markNoteUnspent(chainId: number, index: number): Promise<NoteRecord>;
|
|
16
|
-
clearNotes(chainId: number): Promise<void>;
|
|
17
16
|
putNullifier(nullifier: NullifierRecord): Promise<void>;
|
|
18
17
|
getNullifier(chainId: number, value: string): Promise<NullifierRecord | null>;
|
|
19
18
|
countNullifiers(chainId: number): Promise<number>;
|
|
@@ -24,7 +23,6 @@ export interface StateStore {
|
|
|
24
23
|
getRoot(chainId: number, value: string): Promise<RootRecord | null>;
|
|
25
24
|
putCiphertext(chainId: number, index: number, payload: Uint8Array): Promise<void>;
|
|
26
25
|
getCiphertext(chainId: number, index: number): Promise<Uint8Array | null>;
|
|
27
|
-
clearCiphertexts(chainId: number): Promise<void>;
|
|
28
26
|
putJob(job: JobRecord): Promise<void>;
|
|
29
27
|
getJob(relayId: string): Promise<JobRecord | null>;
|
|
30
28
|
listJobs(filter?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../state/store/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI/D,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,UAAU;IAEzB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACpE,SAAS,CAAC,OAAO,CAAC,EAAE;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1B,aAAa,CACX,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../state/store/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI/D,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,cAAc,CAAC;AAGt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