@hinkal/common 0.0.21 → 0.0.22

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.
@@ -1192,8 +1192,9 @@ const It = /* @__PURE__ */ dt(mt), Ft = () => {
1192
1192
  };
1193
1193
  globalThis.process = It;
1194
1194
  globalThis.Buffer = gr;
1195
- const Tt = import("./snarkjsWorkerLogic-C0jhwQeU.js");
1195
+ const Tt = import("./utxoWorkerLogic-POijX68C.js");
1196
1196
  addEventListener("message", async (h) => {
1197
+ console.log("addEventListener in Utxo Launcher starts");
1197
1198
  const { onWorkerMessage: f } = await Tt;
1198
1199
  f(h.data);
1199
1200
  });
@@ -1,5 +1,5 @@
1
- import { B as U } from "./zkProofWorkerLauncher-CkAXJL76.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-DO1mhw9j.js";
1
+ import { B as U } from "./zkProofWorkerLauncher-BQqkxVGn.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 x } from "./zkProofWorkerLogic-z0yllRdM.js";
3
3
  const g = (e) => {
4
4
  const t = T.decode(
5
5
  ["uint256", "address", "tuple(uint256, uint256, uint256, uint256)", "uint256", "uint256"],
@@ -15,7 +15,7 @@ const g = (e) => {
15
15
  timeStamp: c,
16
16
  tokenId: p
17
17
  };
18
- }, _ = (e, t) => {
18
+ }, S = (e, t) => {
19
19
  const { amount: o, erc20TokenAddress: r, timeStamp: s, tokenId: n, randomization: a } = g(e);
20
20
  return {
21
21
  amount: o,
@@ -25,7 +25,7 @@ const g = (e) => {
25
25
  randomization: a,
26
26
  shieldedPrivateKey: t
27
27
  };
28
- }, x = (e, t) => {
28
+ }, _ = (e, t) => {
29
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");
@@ -41,7 +41,7 @@ const u = new I(), E = async ({ data: e }) => {
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 ? y(U.from(s.value.slice(2), "hex"), t) : _(s.value, o);
44
+ return s.isPositive ? y(U.from(s.value.slice(2), "hex"), t) : S(s.value, o);
45
45
  } catch {
46
46
  return;
47
47
  }
@@ -63,14 +63,14 @@ const u = new I(), E = async ({ data: e }) => {
63
63
  }
64
64
  else
65
65
  try {
66
- x(s, t.getShieldedPrivateKey()) && (o.map((c) => c.value).includes(a.value) || o.push(a));
66
+ _(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
72
  }, B = async (e) => {
73
- console.log("onWorkerMessage starts"), await S();
73
+ console.log("onWorkerMessage Utxo starts"), await x();
74
74
  const { type: t } = e.payload;
75
75
  switch (t) {
76
76
  case d.BATCH_FILTER_UTXOS_WITH_NULLIFIER:
@@ -1,4 +1,4 @@
1
- import { d as dist, p as process$1, B as Buffer } from "./utxoWorkerLauncher-BEUpD_S3.js";
1
+ import { d as dist, p as process$1, B as Buffer } from "./utxoWorkerLauncher-DD2MTdrZ.js";
2
2
  const hexLen = [0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4];
3
3
  function fromString(_, c) {
4
4
  if (!c || c == 10)
@@ -67767,7 +67767,7 @@ const workerProxy = new WorkerProxy(), handleFilterUtxosWithNullifier = async ({
67767
67767
  }
67768
67768
  workerProxy.postMessageToMainThread({ additionalEncryptedOutputs: h, lastOutput: B });
67769
67769
  }, onWorkerMessage = async (_) => {
67770
- console.log("onWorkerMessage starts"), await preProcessing();
67770
+ console.log("onWorkerMessage Utxo starts"), await preProcessing();
67771
67771
  const { type: c } = _.payload;
67772
67772
  switch (c) {
67773
67773
  case UtxoWorkerActionType.BATCH_FILTER_UTXOS_WITH_NULLIFIER:
@@ -0,0 +1,11 @@
1
+ import { W as r } from "./zkProofWorkerLogic-z0yllRdM.js";
2
+ import "./zkProofWorkerLauncher-BQqkxVGn.js";
3
+ var o = self.location.href, e = "" + new URL("snarkjsWorkerLauncher-B7O1JJ13.js", import.meta.url).href, a = "" + new URL("utxoWorkerLauncher-DD2MTdrZ.js", import.meta.url).href;
4
+ const n = {
5
+ [r.ZKProof]: o,
6
+ [r.SnarkJS]: e,
7
+ [r.UTXO]: a
8
+ };
9
+ export {
10
+ n as workerViteURL
11
+ };
@@ -64,12 +64,12 @@ or.read = function(h, f, p, x, w) {
64
64
  return (C ? -1 : 1) * l * Math.pow(2, s - x);
65
65
  };
66
66
  or.write = function(h, f, p, x, w, s) {
67
- var l, I, B, A = s * 8 - w - 1, o = (1 << A) - 1, U = o >> 1, k = w === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, C = x ? 0 : s - 1, P = x ? 1 : -1, J = f < 0 || f === 0 && 1 / f < 0 ? 1 : 0;
68
- for (f = Math.abs(f), isNaN(f) || f === 1 / 0 ? (I = isNaN(f) ? 1 : 0, l = o) : (l = Math.floor(Math.log(f) / Math.LN2), f * (B = Math.pow(2, -l)) < 1 && (l--, B *= 2), l + U >= 1 ? f += k / B : f += k * Math.pow(2, 1 - U), f * B >= 2 && (l++, B /= 2), l + U >= o ? (I = 0, l = o) : l + U >= 1 ? (I = (f * B - 1) * Math.pow(2, w), l = l + U) : (I = f * Math.pow(2, U - 1) * Math.pow(2, w), l = 0)); w >= 8; h[p + C] = I & 255, C += P, I /= 256, w -= 8)
67
+ var l, I, B, A = s * 8 - w - 1, o = (1 << A) - 1, U = o >> 1, k = w === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, C = x ? 0 : s - 1, $ = x ? 1 : -1, J = f < 0 || f === 0 && 1 / f < 0 ? 1 : 0;
68
+ for (f = Math.abs(f), isNaN(f) || f === 1 / 0 ? (I = isNaN(f) ? 1 : 0, l = o) : (l = Math.floor(Math.log(f) / Math.LN2), f * (B = Math.pow(2, -l)) < 1 && (l--, B *= 2), l + U >= 1 ? f += k / B : f += k * Math.pow(2, 1 - U), f * B >= 2 && (l++, B /= 2), l + U >= o ? (I = 0, l = o) : l + U >= 1 ? (I = (f * B - 1) * Math.pow(2, w), l = l + U) : (I = f * Math.pow(2, U - 1) * Math.pow(2, w), l = 0)); w >= 8; h[p + C] = I & 255, C += $, I /= 256, w -= 8)
69
69
  ;
70
- for (l = l << w | I, A += w; A > 0; h[p + C] = l & 255, C += P, l /= 256, A -= 8)
70
+ for (l = l << w | I, A += w; A > 0; h[p + C] = l & 255, C += $, l /= 256, A -= 8)
71
71
  ;
72
- h[p + C - P] |= J * 128;
72
+ h[p + C - $] |= J * 128;
73
73
  };
74
74
  /*!
75
75
  * The buffer module from node.js, for the browser.
@@ -121,7 +121,7 @@ or.write = function(h, f, p, x, w, s) {
121
121
  throw new TypeError(
122
122
  'The "string" argument must be of type string. Received type number'
123
123
  );
124
- return P(e);
124
+ return $(e);
125
125
  }
126
126
  return U(e, r, t);
127
127
  }
@@ -168,13 +168,13 @@ or.write = function(h, f, p, x, w, s) {
168
168
  o.alloc = function(e, r, t) {
169
169
  return C(e, r, t);
170
170
  };
171
- function P(e) {
171
+ function $(e) {
172
172
  return k(e), A(e < 0 ? 0 : Z(e) | 0);
173
173
  }
174
174
  o.allocUnsafe = function(e) {
175
- return P(e);
175
+ return $(e);
176
176
  }, o.allocUnsafeSlow = function(e) {
177
- return P(e);
177
+ return $(e);
178
178
  };
179
179
  function J(e, r) {
180
180
  if ((typeof r != "string" || r === "") && (r = "utf8"), !o.isEncoding(r))
@@ -328,7 +328,7 @@ or.write = function(h, f, p, x, w, s) {
328
328
  for (e || (e = "utf8"); ; )
329
329
  switch (e) {
330
330
  case "hex":
331
- return Pr(this, r, t);
331
+ return $r(this, r, t);
332
332
  case "utf8":
333
333
  case "utf-8":
334
334
  return fr(this, r, t);
@@ -336,7 +336,7 @@ or.write = function(h, f, p, x, w, s) {
336
336
  return Dr(this, r, t);
337
337
  case "latin1":
338
338
  case "binary":
339
- return $r(this, r, t);
339
+ return Pr(this, r, t);
340
340
  case "base64":
341
341
  return kr(this, r, t);
342
342
  case "ucs2":
@@ -590,14 +590,14 @@ or.write = function(h, f, p, x, w, s) {
590
590
  n += String.fromCharCode(e[i] & 127);
591
591
  return n;
592
592
  }
593
- function $r(e, r, t) {
593
+ function Pr(e, r, t) {
594
594
  let n = "";
595
595
  t = Math.min(e.length, t);
596
596
  for (let i = r; i < t; ++i)
597
597
  n += String.fromCharCode(e[i]);
598
598
  return n;
599
599
  }
600
- function Pr(e, r, t) {
600
+ function $r(e, r, t) {
601
601
  const n = e.length;
602
602
  (!r || r < 0) && (r = 0), (!t || t < 0 || t > n) && (t = n);
603
603
  let i = "";
@@ -646,13 +646,13 @@ or.write = function(h, f, p, x, w, s) {
646
646
  return r = r >>> 0, t || T(r, 4, this.length), (this[r] | this[r + 1] << 8 | this[r + 2] << 16) + this[r + 3] * 16777216;
647
647
  }, o.prototype.readUint32BE = o.prototype.readUInt32BE = function(r, t) {
648
648
  return r = r >>> 0, t || T(r, 4, this.length), this[r] * 16777216 + (this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3]);
649
- }, o.prototype.readBigUInt64LE = $(function(r) {
649
+ }, o.prototype.readBigUInt64LE = P(function(r) {
650
650
  r = r >>> 0, Y(r, "offset");
651
651
  const t = this[r], n = this[r + 7];
652
652
  (t === void 0 || n === void 0) && X(r, this.length - 8);
653
653
  const i = t + this[++r] * 2 ** 8 + this[++r] * 2 ** 16 + this[++r] * 2 ** 24, u = this[++r] + this[++r] * 2 ** 8 + this[++r] * 2 ** 16 + n * 2 ** 24;
654
654
  return BigInt(i) + (BigInt(u) << BigInt(32));
655
- }), o.prototype.readBigUInt64BE = $(function(r) {
655
+ }), o.prototype.readBigUInt64BE = P(function(r) {
656
656
  r = r >>> 0, Y(r, "offset");
657
657
  const t = this[r], n = this[r + 7];
658
658
  (t === void 0 || n === void 0) && X(r, this.length - 8);
@@ -684,13 +684,13 @@ or.write = function(h, f, p, x, w, s) {
684
684
  return r = r >>> 0, t || T(r, 4, this.length), this[r] | this[r + 1] << 8 | this[r + 2] << 16 | this[r + 3] << 24;
685
685
  }, o.prototype.readInt32BE = function(r, t) {
686
686
  return r = r >>> 0, t || T(r, 4, this.length), this[r] << 24 | this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3];
687
- }, o.prototype.readBigInt64LE = $(function(r) {
687
+ }, o.prototype.readBigInt64LE = P(function(r) {
688
688
  r = r >>> 0, Y(r, "offset");
689
689
  const t = this[r], n = this[r + 7];
690
690
  (t === void 0 || n === void 0) && X(r, this.length - 8);
691
691
  const i = this[r + 4] + this[r + 5] * 2 ** 8 + this[r + 6] * 2 ** 16 + (n << 24);
692
692
  return (BigInt(i) << BigInt(32)) + BigInt(t + this[++r] * 2 ** 8 + this[++r] * 2 ** 16 + this[++r] * 2 ** 24);
693
- }), o.prototype.readBigInt64BE = $(function(r) {
693
+ }), o.prototype.readBigInt64BE = P(function(r) {
694
694
  r = r >>> 0, Y(r, "offset");
695
695
  const t = this[r], n = this[r + 7];
696
696
  (t === void 0 || n === void 0) && X(r, this.length - 8);
@@ -757,9 +757,9 @@ or.write = function(h, f, p, x, w, s) {
757
757
  let c = Number(r >> BigInt(32) & BigInt(4294967295));
758
758
  return e[t + 3] = c, c = c >> 8, e[t + 2] = c, c = c >> 8, e[t + 1] = c, c = c >> 8, e[t] = c, t + 8;
759
759
  }
760
- o.prototype.writeBigUInt64LE = $(function(r, t = 0) {
760
+ o.prototype.writeBigUInt64LE = P(function(r, t = 0) {
761
761
  return lr(this, r, t, BigInt(0), BigInt("0xffffffffffffffff"));
762
- }), o.prototype.writeBigUInt64BE = $(function(r, t = 0) {
762
+ }), o.prototype.writeBigUInt64BE = P(function(r, t = 0) {
763
763
  return pr(this, r, t, BigInt(0), BigInt("0xffffffffffffffff"));
764
764
  }), o.prototype.writeIntLE = function(r, t, n, i) {
765
765
  if (r = +r, t = t >>> 0, !i) {
@@ -789,9 +789,9 @@ or.write = function(h, f, p, x, w, s) {
789
789
  return r = +r, t = t >>> 0, n || R(this, r, t, 4, 2147483647, -2147483648), this[t] = r & 255, this[t + 1] = r >>> 8, this[t + 2] = r >>> 16, this[t + 3] = r >>> 24, t + 4;
790
790
  }, o.prototype.writeInt32BE = function(r, t, n) {
791
791
  return r = +r, t = t >>> 0, n || R(this, r, t, 4, 2147483647, -2147483648), r < 0 && (r = 4294967295 + r + 1), this[t] = r >>> 24, this[t + 1] = r >>> 16, this[t + 2] = r >>> 8, this[t + 3] = r & 255, t + 4;
792
- }, o.prototype.writeBigInt64LE = $(function(r, t = 0) {
792
+ }, o.prototype.writeBigInt64LE = P(function(r, t = 0) {
793
793
  return lr(this, r, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
794
- }), o.prototype.writeBigInt64BE = $(function(r, t = 0) {
794
+ }), o.prototype.writeBigInt64BE = P(function(r, t = 0) {
795
795
  return pr(this, r, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
796
796
  });
797
797
  function ar(e, r, t, n, i, u) {
@@ -1042,7 +1042,7 @@ or.write = function(h, f, p, x, w, s) {
1042
1042
  }
1043
1043
  return r;
1044
1044
  }();
1045
- function $(e) {
1045
+ function P(e) {
1046
1046
  return typeof BigInt > "u" ? zr : e;
1047
1047
  }
1048
1048
  function zr() {
@@ -1192,10 +1192,11 @@ const It = /* @__PURE__ */ dt(mt), Ft = () => {
1192
1192
  };
1193
1193
  globalThis.process = It;
1194
1194
  globalThis.Buffer = gr;
1195
- const Tt = import("./zkProofWorkerLogic-DO1mhw9j.js").then(function(h) {
1195
+ const Tt = import("./zkProofWorkerLogic-z0yllRdM.js").then(function(h) {
1196
1196
  return h.z;
1197
1197
  });
1198
1198
  addEventListener("message", async (h) => {
1199
+ console.log("addEventListener in zkProof Launcher starts");
1199
1200
  const { onWorkerMessage: f } = await Tt;
1200
1201
  f(h.data);
1201
1202
  });