@hinkal/common 0.1.20 → 0.1.25
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/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/data-structures/crypto-keys/encryptDecryptUtxo.mjs +32 -31
- package/data-structures/transactions-manager/TransactionsManager.cjs +1 -1
- package/data-structures/transactions-manager/TransactionsManager.mjs +7 -6
- package/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/functions/snarkjs/common.snarkjs.mjs +23 -22
- package/functions/staking/index.cjs +1 -1
- package/functions/staking/index.mjs +19 -18
- package/index.cjs +1 -1
- package/index.mjs +639 -641
- package/package.json +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +2 -2
- package/webworker/utxoWorker/utxoWorkerLogic.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLogic.mjs +27 -26
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/addGlobals.cjs +0 -1
- package/addGlobals.d.ts +0 -1
- package/addGlobals.mjs +0 -9
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/snarkjsWorkerLauncher-
|
|
1
|
+
"use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/snarkjsWorkerLauncher-DCEHNhzP.js").href:new URL("../../assets/snarkjsWorkerLauncher-DCEHNhzP.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/utxoWorkerLauncher-
|
|
1
|
+
"use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/utxoWorkerLauncher-varBpMvo.js").href:new URL("../../assets/utxoWorkerLauncher-varBpMvo.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("../../crypto/preProcessing.cjs"),d=require("../../data-structures/crypto-keys/keys.cjs"),k=require("../../data-structures/utxo/Utxo.cjs"),y=require("../../data-structures/crypto-keys/encryptDecryptUtxo.cjs"),h=require("../../data-structures/crypto-keys/decodeUTXO.cjs"),M=require("../workerProxy.cjs"),l=require("./utxoWorker.types.cjs");var p={};const i=new M.WorkerProxy,U=async({data:e})=>{const{utxos:t,nullifiers:s}=e,o=t.filter(r=>{const c=new k.Utxo(r);return!s.has(c.getNullifier())});i.postMessageToMainThread(o)},x=async({data:e})=>{const t=new d.UserKeys(e.signature),s=t.getShieldedPrivateKey(),o=e.encryptedOutputs.map((r,c)=>{try{return r.isPositive?y.decryptUtxoConstructorArgs(p.from(r.value.slice(2),"hex"),t):h.decodeUtxoConstructorArgs(r.value,s)}catch{return}}).filter(r=>r!==void 0);i.postMessageToMainThread(o)},g=async({data:e})=>{const t=new d.UserKeys(e.signature),s=[],{encryptedOutputs:o}=e;let{lastOutput:r}=e;const c=t.getShieldedPrivateKey();for(let u=0;u<o.length;u+=1){const a=o[u];if(r=a.value,a.isPositive)try{const n=y.decryptUtxo(p.from(r.slice(2),"hex"),t);if(!n.erc20TokenAddress||!n.amount||!n.stealthAddress)throw Error("bruh");s.push(a)}catch{}else try{h.checkUtxoSignature(r,c)&&s.push(a)}catch{}}i.postMessageToMainThread({additionalEncryptedOutputs:s,lastOutput:r})},f=async e=>{await T.preProcessing();const{type:t}=e.payload;switch(t){case l.UtxoWorkerActionType.BATCH_FILTER_UTXOS_WITH_NULLIFIER:U(e.payload);return;case l.UtxoWorkerActionType.BUILD_UTXOS:x(e.payload);return;case l.UtxoWorkerActionType.DECIPHER_OUTPUTS:g(e.payload);return;default:throw Error(`Unknown worker message type ${t}`)}};i.attachWorkerSideOnMessage(f);exports.default=i;exports.handleBuildUtxosMessage=x;exports.handleDecipherMessage=g;exports.handleFilterUtxosWithNullifier=U;exports.onWorkerMessage=f;
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import { preProcessing as
|
|
2
|
-
import { UserKeys as
|
|
3
|
-
import { Utxo as
|
|
4
|
-
import { decryptUtxoConstructorArgs as
|
|
5
|
-
import { decodeUtxoConstructorArgs as
|
|
6
|
-
import { WorkerProxy as
|
|
7
|
-
import { UtxoWorkerActionType as
|
|
8
|
-
|
|
1
|
+
import { preProcessing as h } from "../../crypto/preProcessing.mjs";
|
|
2
|
+
import { UserKeys as u } from "../../data-structures/crypto-keys/keys.mjs";
|
|
3
|
+
import { Utxo as y } from "../../data-structures/utxo/Utxo.mjs";
|
|
4
|
+
import { decryptUtxoConstructorArgs as f, decryptUtxo as m } from "../../data-structures/crypto-keys/encryptDecryptUtxo.mjs";
|
|
5
|
+
import { decodeUtxoConstructorArgs as g, checkUtxoSignature as x } from "../../data-structures/crypto-keys/decodeUTXO.mjs";
|
|
6
|
+
import { WorkerProxy as U } from "../workerProxy.mjs";
|
|
7
|
+
import { UtxoWorkerActionType as l } from "./utxoWorker.types.mjs";
|
|
8
|
+
var p = {};
|
|
9
|
+
const a = new U(), T = async ({ data: e }) => {
|
|
9
10
|
const { utxos: t, nullifiers: o } = e, s = t.filter((r) => {
|
|
10
|
-
const i = new
|
|
11
|
+
const i = new y(r);
|
|
11
12
|
return !o.has(i.getNullifier());
|
|
12
13
|
});
|
|
13
14
|
a.postMessageToMainThread(s);
|
|
14
|
-
},
|
|
15
|
-
const t = new
|
|
15
|
+
}, v = async ({ data: e }) => {
|
|
16
|
+
const t = new u(e.signature), o = t.getShieldedPrivateKey(), s = e.encryptedOutputs.map((r, i) => {
|
|
16
17
|
try {
|
|
17
|
-
return r.isPositive ?
|
|
18
|
+
return r.isPositive ? f(p.from(r.value.slice(2), "hex"), t) : g(r.value, o);
|
|
18
19
|
} catch {
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
22
|
}).filter((r) => r !== void 0);
|
|
22
23
|
a.postMessageToMainThread(s);
|
|
23
24
|
}, k = async ({ data: e }) => {
|
|
24
|
-
const t = new
|
|
25
|
+
const t = new u(e.signature), o = [], { encryptedOutputs: s } = e;
|
|
25
26
|
let { lastOutput: r } = e;
|
|
26
27
|
const i = t.getShieldedPrivateKey();
|
|
27
28
|
for (let d = 0; d < s.length; d += 1) {
|
|
28
29
|
const c = s[d];
|
|
29
30
|
if (r = c.value, c.isPositive)
|
|
30
31
|
try {
|
|
31
|
-
const n =
|
|
32
|
+
const n = m(p.from(r.slice(2), "hex"), t);
|
|
32
33
|
if (!n.erc20TokenAddress || !n.amount || !n.stealthAddress)
|
|
33
34
|
throw Error("bruh");
|
|
34
35
|
o.push(c);
|
|
@@ -36,33 +37,33 @@ const a = new x(), U = async ({ data: e }) => {
|
|
|
36
37
|
}
|
|
37
38
|
else
|
|
38
39
|
try {
|
|
39
|
-
|
|
40
|
+
x(r, i) && o.push(c);
|
|
40
41
|
} catch {
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
a.postMessageToMainThread({ additionalEncryptedOutputs: o, lastOutput: r });
|
|
44
|
-
},
|
|
45
|
-
await
|
|
45
|
+
}, w = async (e) => {
|
|
46
|
+
await h();
|
|
46
47
|
const { type: t } = e.payload;
|
|
47
48
|
switch (t) {
|
|
48
|
-
case
|
|
49
|
-
U(e.payload);
|
|
50
|
-
return;
|
|
51
|
-
case u.BUILD_UTXOS:
|
|
49
|
+
case l.BATCH_FILTER_UTXOS_WITH_NULLIFIER:
|
|
52
50
|
T(e.payload);
|
|
53
51
|
return;
|
|
54
|
-
case
|
|
52
|
+
case l.BUILD_UTXOS:
|
|
53
|
+
v(e.payload);
|
|
54
|
+
return;
|
|
55
|
+
case l.DECIPHER_OUTPUTS:
|
|
55
56
|
k(e.payload);
|
|
56
57
|
return;
|
|
57
58
|
default:
|
|
58
59
|
throw Error(`Unknown worker message type ${t}`);
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
|
-
a.attachWorkerSideOnMessage(
|
|
62
|
+
a.attachWorkerSideOnMessage(w);
|
|
62
63
|
export {
|
|
63
64
|
a as default,
|
|
64
|
-
|
|
65
|
+
v as handleBuildUtxosMessage,
|
|
65
66
|
k as handleDecipherMessage,
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
T as handleFilterUtxosWithNullifier,
|
|
68
|
+
w as onWorkerMessage
|
|
68
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/zkProofWorkerLauncher-
|
|
1
|
+
"use strict";const e=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../assets/zkProofWorkerLauncher-Cb3LgXnS.js").href:new URL("../../assets/zkProofWorkerLauncher-Cb3LgXnS.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
|
package/addGlobals.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("buffer"),d=require("process");let e=!1;const r=()=>{e||(typeof window<"u"&&(window.global=window,window.Buffer=o.Buffer,window.process=d),e=!0)};exports.addGlobals=r;
|
package/addGlobals.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const addGlobals: () => void;
|
package/addGlobals.mjs
DELETED