@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.
@@ -1,11 +0,0 @@
1
- import { W as r } from "./zkProofWorkerLogic-BwAAGTST.js";
2
- import "./zkProofWorkerLauncher-D1ef-Gxp.js";
3
- var o = self.location.href, e = "/assets/snarkjsWorkerLauncher-CaBCnle3.js", a = "/assets/utxoWorkerLauncher-TRT6Cdzd.js";
4
- const t = {
5
- [r.ZKProof]: o,
6
- [r.SnarkJS]: e,
7
- [r.UTXO]: a
8
- };
9
- export {
10
- t as workerViteURL
11
- };
@@ -1,64 +0,0 @@
1
- import { U as p, g as h, h as y, i as f, j as U, l as d, k as g, d as x, m as u } from "./index-DVX9ShLf.js";
2
- import { W as T } from "./workerProxy-BDj498Ht.js";
3
- const i = new T(), v = async ({ data: e }) => {
4
- const { utxos: s, nullifiers: r } = e, o = s.filter((t) => {
5
- const c = new p(t);
6
- return !r.has(c.getNullifier());
7
- });
8
- i.postMessageToMainThread(o);
9
- }, k = async ({ data: e }) => {
10
- const s = new h(e.signature), r = s.getShieldedPrivateKey(), o = e.encryptedOutputs.map((t) => {
11
- try {
12
- return t.isPositive ? y(Buffer.from(t.value.slice(2), "hex"), s) : f(t.value, r);
13
- } catch {
14
- return;
15
- }
16
- }).filter((t) => t !== void 0);
17
- i.postMessageToMainThread(o);
18
- }, m = async ({ data: e }) => {
19
- const s = new h(e.signature), r = [], { encryptedOutputs: o } = e;
20
- let { lastOutput: t } = e;
21
- for (let c = 0; c < o.length; c += 1) {
22
- const a = o[c];
23
- if (t = a.value, a.isPositive)
24
- try {
25
- const n = U(Buffer.from(t.slice(2), "hex"), s);
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
- g(t, s.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: t });
40
- }, w = async (e) => {
41
- await x();
42
- const { type: s } = e.payload;
43
- switch (s) {
44
- case u.BATCH_FILTER_UTXOS_WITH_NULLIFIER:
45
- v(e.payload);
46
- return;
47
- case u.BUILD_UTXOS:
48
- k(e.payload);
49
- return;
50
- case u.DECIPHER_OUTPUTS:
51
- m(e.payload);
52
- return;
53
- default:
54
- throw Error(`Unknown worker message type ${s}`);
55
- }
56
- };
57
- i.attachWorkerSideOnMessage(w);
58
- export {
59
- i as default,
60
- k as handleBuildUtxosMessage,
61
- m as handleDecipherMessage,
62
- v as handleFilterUtxosWithNullifier,
63
- w as onWorkerMessage
64
- };
@@ -1,9 +0,0 @@
1
- import { W as r } from "./index-DVX9ShLf.js";
2
- const o = "/assets/zkProofWorkerLauncher-D1ef-Gxp.js", s = "/assets/snarkjsWorkerLauncher-CaBCnle3.js", e = "/assets/utxoWorkerLauncher-TRT6Cdzd.js", k = {
3
- [r.ZKProof]: o,
4
- [r.SnarkJS]: s,
5
- [r.UTXO]: e
6
- };
7
- export {
8
- k as workerViteURL
9
- };