@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
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
const
|
|
4
|
-
const t =
|
|
1
|
+
import { B as U } from "./zkProofWorkerLauncher-B54jpyIs.js";
|
|
2
|
+
import { U as l, i as T, h as I, j as f, k as y, l as m, m as h, p as S } from "./zkProofWorkerLogic-g413cUJh.js";
|
|
3
|
+
const g = (e) => {
|
|
4
|
+
const t = T.decode(
|
|
5
5
|
["uint256", "address", "tuple(uint256, uint256, uint256, uint256)", "uint256", "uint256"],
|
|
6
6
|
e
|
|
7
|
-
), o = t[0].toBigInt(), r = t[1], s = t[2][0].toBigInt(), n = t[2][1].toHexString(), a = t[2][2].toBigInt(),
|
|
7
|
+
), o = t[0].toBigInt(), r = t[1], s = t[2][0].toBigInt(), n = t[2][1].toHexString(), a = t[2][2].toBigInt(), i = t[2][3].toBigInt(), c = t[3].toString(), p = t[4].toNumber();
|
|
8
8
|
return {
|
|
9
9
|
amount: o,
|
|
10
10
|
erc20TokenAddress: r,
|
|
11
11
|
randomization: s,
|
|
12
12
|
stealthAddress: n,
|
|
13
13
|
H0: a,
|
|
14
|
-
H1:
|
|
15
|
-
timeStamp:
|
|
16
|
-
tokenId:
|
|
14
|
+
H1: i,
|
|
15
|
+
timeStamp: c,
|
|
16
|
+
tokenId: p
|
|
17
17
|
};
|
|
18
|
-
},
|
|
19
|
-
const { amount: o, erc20TokenAddress: r, timeStamp: s, tokenId: n, randomization: a } =
|
|
18
|
+
}, _ = (e, t) => {
|
|
19
|
+
const { amount: o, erc20TokenAddress: r, timeStamp: s, tokenId: n, randomization: a } = g(e);
|
|
20
20
|
return {
|
|
21
21
|
amount: o,
|
|
22
22
|
erc20TokenAddress: r,
|
|
@@ -25,72 +25,72 @@ const U = (e) => {
|
|
|
25
25
|
randomization: a,
|
|
26
26
|
shieldedPrivateKey: t
|
|
27
27
|
};
|
|
28
|
-
},
|
|
29
|
-
const { randomization: o, H0: r, H1: s } =
|
|
28
|
+
}, x = (e, t) => {
|
|
29
|
+
const { randomization: o, H0: r, H1: s } = g(e), n = l.checkSignature(o, r, s, t);
|
|
30
30
|
if (!n)
|
|
31
31
|
throw new Error("UTXO doesn't belong to user");
|
|
32
32
|
return n;
|
|
33
33
|
};
|
|
34
34
|
var d = /* @__PURE__ */ ((e) => (e[e.BATCH_FILTER_UTXOS_WITH_NULLIFIER = 0] = "BATCH_FILTER_UTXOS_WITH_NULLIFIER", e[e.BUILD_UTXOS = 1] = "BUILD_UTXOS", e[e.DECIPHER_OUTPUTS = 2] = "DECIPHER_OUTPUTS", e))(d || {});
|
|
35
|
-
const u = new
|
|
35
|
+
const u = new I(), E = async ({ data: e }) => {
|
|
36
36
|
const { utxos: t, nullifiers: o } = e, r = t.filter((s) => {
|
|
37
37
|
const n = new f(s);
|
|
38
38
|
return !o.has(n.getNullifier());
|
|
39
39
|
});
|
|
40
40
|
u.postMessageToMainThread(r);
|
|
41
|
-
},
|
|
41
|
+
}, v = async ({ data: e }) => {
|
|
42
42
|
const t = new l(e.signature), o = t.getShieldedPrivateKey(), r = e.encryptedOutputs.map((s) => {
|
|
43
43
|
try {
|
|
44
|
-
return s.isPositive ?
|
|
44
|
+
return s.isPositive ? y(U.from(s.value.slice(2), "hex"), t) : _(s.value, o);
|
|
45
45
|
} catch {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
}).filter((s) => s !== void 0);
|
|
49
49
|
u.postMessageToMainThread(r);
|
|
50
|
-
},
|
|
50
|
+
}, P = async ({ data: e }) => {
|
|
51
51
|
const t = new l(e.signature), o = [], { encryptedOutputs: r } = e;
|
|
52
52
|
let { lastOutput: s } = e;
|
|
53
53
|
for (let n = 0; n < r.length; n += 1) {
|
|
54
54
|
const a = r[n];
|
|
55
55
|
if (s = a.value, a.isPositive)
|
|
56
56
|
try {
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
57
|
+
const i = m(U.from(s.slice(2), "hex"), t);
|
|
58
|
+
if (!i.erc20TokenAddress || !i.amount || !i.stealthAddress)
|
|
59
59
|
throw Error("bruh");
|
|
60
|
-
o.map((
|
|
60
|
+
o.map((c) => c.value).includes(a.value) || o.push(a);
|
|
61
61
|
} catch {
|
|
62
62
|
h("Utxo not decrypted");
|
|
63
63
|
}
|
|
64
64
|
else
|
|
65
65
|
try {
|
|
66
|
-
|
|
66
|
+
x(s, t.getShieldedPrivateKey()) && (o.map((c) => c.value).includes(a.value) || o.push(a));
|
|
67
67
|
} catch {
|
|
68
68
|
h("Utxo not decoded");
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
u.postMessageToMainThread({ additionalEncryptedOutputs: o, lastOutput: s });
|
|
72
|
-
},
|
|
73
|
-
await
|
|
72
|
+
}, B = async (e) => {
|
|
73
|
+
await S();
|
|
74
74
|
const { type: t } = e.payload;
|
|
75
75
|
switch (t) {
|
|
76
76
|
case d.BATCH_FILTER_UTXOS_WITH_NULLIFIER:
|
|
77
|
-
|
|
77
|
+
E(e.payload);
|
|
78
78
|
return;
|
|
79
79
|
case d.BUILD_UTXOS:
|
|
80
|
-
|
|
80
|
+
v(e.payload);
|
|
81
81
|
return;
|
|
82
82
|
case d.DECIPHER_OUTPUTS:
|
|
83
|
-
|
|
83
|
+
P(e.payload);
|
|
84
84
|
return;
|
|
85
85
|
default:
|
|
86
86
|
throw Error(`Unknown worker message type ${t}`);
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
u.attachWorkerSideOnMessage(
|
|
89
|
+
u.attachWorkerSideOnMessage(B);
|
|
90
90
|
export {
|
|
91
91
|
u as default,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
v as handleBuildUtxosMessage,
|
|
93
|
+
P as handleDecipherMessage,
|
|
94
|
+
E as handleFilterUtxosWithNullifier,
|
|
95
|
+
B as onWorkerMessage
|
|
96
96
|
};
|