@hinkal/common 0.0.17 → 0.0.20
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/assets/{snarkjsWorkerLauncher-CaBCnle3.js → snarkjsWorkerLauncher-Cxayz-rO.js} +395 -392
- package/assets/snarkjsWorkerLogic-C0jhwQeU.js +37319 -0
- package/assets/{snarkjsWorkerLogic-PT_bvjbJ.js → snarkjsWorkerLogic-scy9tbGQ.js} +864 -817
- package/assets/{utxoWorkerLauncher-TRT6Cdzd.js → utxoWorkerLauncher-949gA7j-.js} +395 -394
- package/assets/{utxoWorkerLogic-CaRjg9tk.js → utxoWorkerLogic-CWVrduGP.js} +30 -30
- package/assets/{utxoWorkerLogic-CWrzh8Rb.js → utxoWorkerLogic-CyWO48JX.js} +36352 -20473
- package/assets/viteWorkerURL.constant-D9TTkFfm.js +11 -0
- package/assets/{zkProofWorkerLauncher-D1ef-Gxp.js → zkProofWorkerLauncher-B54jpyIs.js} +395 -395
- package/assets/{zkProofWorkerLogic-BwAAGTST.js → zkProofWorkerLogic-g413cUJh.js} +78787 -66386
- package/{index-DVX9ShLf.js → index-CRZ_sTGy.js} +116241 -103711
- package/index.js +57 -57
- package/package.json +1 -1
- package/{snarkjsWorkerLogic-D0EKr8Rb.js → snarkjsWorkerLogic-CJ6jLJrl.js} +863 -815
- package/utxoWorkerLogic-CxyTY-Iw.js +64 -0
- package/viteWorkerURL.constant-gZWY_Fas.js +9 -0
- package/{workerProxy-BDj498Ht.js → workerProxy-DTKGeJe4.js} +4 -3
- package/{zkProofWorkerLogic-BWuMfo-V.js → zkProofWorkerLogic-B9OTFcZv.js} +11 -11
- package/assets/snarkjsWorkerLogic-BAbiO5gj.js +0 -17935
- package/assets/viteWorkerURL.constant-C7fE1hzc.js +0 -11
- package/utxoWorkerLogic-Ck4p7ORl.js +0 -64
- package/viteWorkerURL.constant-Zrb20DQB.js +0 -9
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { U as y, l as h, m as f, B as p, n as U, o as g, q as d, s as x, k as T, t as u } from "./index-CRZ_sTGy.js";
|
|
2
|
+
import { W as v } from "./workerProxy-DTKGeJe4.js";
|
|
3
|
+
const i = new v(), k = async ({ data: e }) => {
|
|
4
|
+
const { utxos: t, nullifiers: r } = e, o = t.filter((s) => {
|
|
5
|
+
const c = new y(s);
|
|
6
|
+
return !r.has(c.getNullifier());
|
|
7
|
+
});
|
|
8
|
+
i.postMessageToMainThread(o);
|
|
9
|
+
}, m = async ({ data: e }) => {
|
|
10
|
+
const t = new h(e.signature), r = t.getShieldedPrivateKey(), o = e.encryptedOutputs.map((s) => {
|
|
11
|
+
try {
|
|
12
|
+
return s.isPositive ? f(p.from(s.value.slice(2), "hex"), t) : U(s.value, r);
|
|
13
|
+
} catch {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}).filter((s) => s !== void 0);
|
|
17
|
+
i.postMessageToMainThread(o);
|
|
18
|
+
}, w = async ({ data: e }) => {
|
|
19
|
+
const t = new h(e.signature), r = [], { encryptedOutputs: o } = e;
|
|
20
|
+
let { lastOutput: s } = e;
|
|
21
|
+
for (let c = 0; c < o.length; c += 1) {
|
|
22
|
+
const a = o[c];
|
|
23
|
+
if (s = a.value, a.isPositive)
|
|
24
|
+
try {
|
|
25
|
+
const n = g(p.from(s.slice(2), "hex"), t);
|
|
26
|
+
if (!n.erc20TokenAddress || !n.amount || !n.stealthAddress)
|
|
27
|
+
throw Error("bruh");
|
|
28
|
+
r.map((l) => l.value).includes(a.value) || r.push(a);
|
|
29
|
+
} catch {
|
|
30
|
+
d("Utxo not decrypted");
|
|
31
|
+
}
|
|
32
|
+
else
|
|
33
|
+
try {
|
|
34
|
+
x(s, t.getShieldedPrivateKey()) && (r.map((l) => l.value).includes(a.value) || r.push(a));
|
|
35
|
+
} catch {
|
|
36
|
+
d("Utxo not decoded");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
i.postMessageToMainThread({ additionalEncryptedOutputs: r, lastOutput: s });
|
|
40
|
+
}, M = async (e) => {
|
|
41
|
+
await T();
|
|
42
|
+
const { type: t } = e.payload;
|
|
43
|
+
switch (t) {
|
|
44
|
+
case u.BATCH_FILTER_UTXOS_WITH_NULLIFIER:
|
|
45
|
+
k(e.payload);
|
|
46
|
+
return;
|
|
47
|
+
case u.BUILD_UTXOS:
|
|
48
|
+
m(e.payload);
|
|
49
|
+
return;
|
|
50
|
+
case u.DECIPHER_OUTPUTS:
|
|
51
|
+
w(e.payload);
|
|
52
|
+
return;
|
|
53
|
+
default:
|
|
54
|
+
throw Error(`Unknown worker message type ${t}`);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
i.attachWorkerSideOnMessage(M);
|
|
58
|
+
export {
|
|
59
|
+
i as default,
|
|
60
|
+
m as handleBuildUtxosMessage,
|
|
61
|
+
w as handleDecipherMessage,
|
|
62
|
+
k as handleFilterUtxosWithNullifier,
|
|
63
|
+
M as onWorkerMessage
|
|
64
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { W as r } from "./index-CRZ_sTGy.js";
|
|
2
|
+
const o = "" + new URL("assets/zkProofWorkerLauncher-B54jpyIs.js", import.meta.url).href, e = "" + new URL("assets/snarkjsWorkerLauncher-Cxayz-rO.js", import.meta.url).href, s = "" + new URL("assets/utxoWorkerLauncher-949gA7j-.js", import.meta.url).href, a = {
|
|
3
|
+
[r.ZKProof]: o,
|
|
4
|
+
[r.SnarkJS]: e,
|
|
5
|
+
[r.UTXO]: s
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
a as workerViteURL
|
|
9
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { p as s } from "./index-CRZ_sTGy.js";
|
|
2
|
+
class r {
|
|
2
3
|
isNode = !1;
|
|
3
4
|
/**
|
|
4
5
|
* This allow browser or main thread to listen for worker response message
|
|
@@ -18,7 +19,7 @@ class i {
|
|
|
18
19
|
return this._eventEmitter = new e(), this._eventEmitter;
|
|
19
20
|
}
|
|
20
21
|
constructor() {
|
|
21
|
-
this.isNode = typeof
|
|
22
|
+
this.isNode = typeof s < "u" && s.versions != null && s.versions.node != null;
|
|
22
23
|
}
|
|
23
24
|
terminate() {
|
|
24
25
|
}
|
|
@@ -50,5 +51,5 @@ class i {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
+
r as W
|
|
54
55
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { M as p,
|
|
2
|
-
import { W as M } from "./workerProxy-
|
|
3
|
-
const d = new M(),
|
|
1
|
+
import { M as p, h as g, U as T, i as k, j as u, k as I, Z as m, l as C } from "./index-CRZ_sTGy.js";
|
|
2
|
+
import { W as M } from "./workerProxy-DTKGeJe4.js";
|
|
3
|
+
const d = new M(), h = (e) => {
|
|
4
4
|
const { inputUtxosSerialized: s, merkleTreeSerialized: n } = e.data, l = n.tree, a = new Map(
|
|
5
5
|
Object.entries(l).map(([r, c]) => [BigInt(r), BigInt(c)])
|
|
6
6
|
), t = p.createWithData(
|
|
@@ -12,9 +12,9 @@ const d = new M(), A = (e) => {
|
|
|
12
12
|
0n
|
|
13
13
|
), i = s.map(
|
|
14
14
|
(r) => r.map((c) => new T(c))
|
|
15
|
-
), { inCommitmentSiblings: o, inCommitmentSiblingSides: S } =
|
|
15
|
+
), { inCommitmentSiblings: o, inCommitmentSiblingSides: S } = k(i, t);
|
|
16
16
|
d.postMessageToMainThread({ inCommitmentSiblings: o, inCommitmentSiblingSides: S });
|
|
17
|
-
},
|
|
17
|
+
}, A = (e) => {
|
|
18
18
|
const { userSignature: s, merkleTreeAccessTokenSerialized: n } = e.data, l = new C(s), a = n.tree, t = new Map(
|
|
19
19
|
Object.entries(a).map(([r, c]) => [BigInt(r), BigInt(c)])
|
|
20
20
|
), i = p.createWithData(
|
|
@@ -24,7 +24,7 @@ const d = new M(), A = (e) => {
|
|
|
24
24
|
g,
|
|
25
25
|
25n,
|
|
26
26
|
0n
|
|
27
|
-
), { accessTokenSiblings: o, accessTokenSiblingSides: S } =
|
|
27
|
+
), { accessTokenSiblings: o, accessTokenSiblingSides: S } = u(l, i);
|
|
28
28
|
d.postMessageToMainThread({ accessTokenSiblings: o, accessTokenSiblingSides: S });
|
|
29
29
|
}, w = (e) => {
|
|
30
30
|
const { inputUtxosSerialized: s, onChainCreation: n } = e.data, a = s.map(
|
|
@@ -34,14 +34,14 @@ const d = new M(), A = (e) => {
|
|
|
34
34
|
);
|
|
35
35
|
d.postMessageToMainThread(a);
|
|
36
36
|
}, y = async (e) => {
|
|
37
|
-
await
|
|
37
|
+
await I();
|
|
38
38
|
const { type: s } = e.payload;
|
|
39
39
|
switch (s) {
|
|
40
40
|
case m.CALC_COMMITMENTS_SIBLING_AND_SIDES:
|
|
41
|
-
|
|
41
|
+
h(e.payload);
|
|
42
42
|
return;
|
|
43
43
|
case m.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES:
|
|
44
|
-
|
|
44
|
+
A(e.payload);
|
|
45
45
|
return;
|
|
46
46
|
case m.BUILD_IN_NULLIFIERS:
|
|
47
47
|
w(e.payload);
|
|
@@ -54,7 +54,7 @@ d.attachWorkerSideOnMessage(y);
|
|
|
54
54
|
export {
|
|
55
55
|
d as default,
|
|
56
56
|
w as handleBuildInNullifiers,
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
A as handleCalcAccessTokenSiblingAndSides,
|
|
58
|
+
h as handleCalcCommitmentsSiblingAndSides,
|
|
59
59
|
y as onWorkerMessage
|
|
60
60
|
};
|