h_test_1 0.0.25 → 0.0.26
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/package.json +3 -3
- package/webworker/viteWorkerURL.constant.cjs +3 -3
- package/webworker/viteWorkerURL.constant.mjs +3 -3
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLogic.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLogic.mjs +23 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "h_test_1",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"homepage": "hinkal.io",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hinkal Protocol"
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"types": "./index.d.ts",
|
|
52
52
|
"scripts": {
|
|
53
|
-
"prebuild": "nx prebuild:workers",
|
|
54
|
-
"build": "nx build",
|
|
53
|
+
"prebuild": "npx nx prebuild:workers",
|
|
54
|
+
"build": "npx nx build",
|
|
55
55
|
"lint": "nx lint",
|
|
56
56
|
"test": "nx test"
|
|
57
57
|
},
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
var e = /* @__PURE__ */ ((r) => (r.ZKProof = "ZKProof", r.SnarkJS = "SnarkJS", r.UTXO = "UTXO", r))(e || {});
|
|
15
15
|
|
|
16
16
|
const n = async () => ({
|
|
17
|
-
[e.ZKProof]: await getWorkerURL(domain + '/0.2.
|
|
18
|
-
[e.SnarkJS]: await getWorkerURL(domain + '/0.2.
|
|
19
|
-
[e.UTXO]: await getWorkerURL(domain + '/0.2.
|
|
17
|
+
[e.ZKProof]: await getWorkerURL(domain + '/0.2.20/' + 'zkProofWorkerLauncher.js'),
|
|
18
|
+
[e.SnarkJS]: await getWorkerURL(domain + '/0.2.20/' + 'snarkjsWorkerLauncher.js'),
|
|
19
|
+
[e.UTXO]: await getWorkerURL(domain + '/0.2.20/' + 'utxoWorkerLauncher.js'),
|
|
20
20
|
});
|
|
21
21
|
exports.getWorkerViteURL = n;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
var e = /* @__PURE__ */ ((r) => (r.ZKProof = "ZKProof", r.SnarkJS = "SnarkJS", r.UTXO = "UTXO", r))(e || {});
|
|
15
15
|
|
|
16
16
|
const n = async () => ({
|
|
17
|
-
[e.ZKProof]: await getWorkerURL(domain + '/0.2.
|
|
18
|
-
[e.SnarkJS]: await getWorkerURL(domain + '/0.2.
|
|
19
|
-
[e.UTXO]: await getWorkerURL(domain + '/0.2.
|
|
17
|
+
[e.ZKProof]: await getWorkerURL(domain + '/0.2.20/' + 'zkProofWorkerLauncher.js'),
|
|
18
|
+
[e.SnarkJS]: await getWorkerURL(domain + '/0.2.20/' + 'snarkjsWorkerLauncher.js'),
|
|
19
|
+
[e.UTXO]: await getWorkerURL(domain + '/0.2.20/' + 'utxoWorkerLauncher.js'),
|
|
20
20
|
});
|
|
21
21
|
export { n as getWorkerViteURL };
|
|
@@ -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-2cfKnA2L.js").href:new URL("../../assets/zkProofWorkerLauncher-2cfKnA2L.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 A=require("../../crypto/preProcessing.cjs"),S=require("../../data-structures/utxo/Utxo.cjs"),m=require("../../functions/snarkjs/common.snarkjs.cjs"),C=require("../workerProxy.cjs"),d=require("./zkProofWorker.types.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("../../crypto/preProcessing.cjs"),S=require("../../data-structures/utxo/Utxo.cjs"),m=require("../../functions/snarkjs/common.snarkjs.cjs"),C=require("../workerProxy.cjs"),d=require("./zkProofWorker.types.cjs"),u=require("../../functions/utils/merkleTree.utils.cjs"),t=new C.WorkerProxy,p=r=>{const{inputUtxosSerialized:e,merkleTreeSerialized:a}=r.data,c=u.contructMerkleTreeFromSerialized(a),i=e.map(o=>o.map(l=>new S.Utxo(l))),{inCommitmentSiblings:n,inCommitmentSiblingSides:s}=m.calcCommitmentsSiblingAndSides(i,c);t.postMessageToMainThread({inCommitmentSiblings:n,inCommitmentSiblingSides:s})},T=r=>{const{accessKey:e,merkleTreeAccessTokenSerialized:a}=r.data,c=u.contructMerkleTreeFromSerialized(a),{accessTokenSiblings:i,accessTokenSiblingSides:n}=m.calcAccessTokenSiblingsAndSides(e,c);t.postMessageToMainThread({accessTokenSiblings:i,accessTokenSiblingSides:n})},k=r=>{const{inputUtxosSerialized:e,onChainCreation:a,proverVersion:c}=r.data,i=e.map(s=>s.map(o=>new S.Utxo(o)));let n=[];c==="v1x0"?n=i.map((s,o)=>s.map(l=>a[o]?"0":l.getNullifier())):n=i.map(s=>s.map(o=>o.amount===0n?"0":o.getNullifier())),t.postMessageToMainThread(n)},g=async r=>{try{await A.preProcessing();const{type:e}=r.payload;switch(e){case d.ZKProofWorkerActionType.CALC_COMMITMENTS_SIBLING_AND_SIDES:p(r.payload);return;case d.ZKProofWorkerActionType.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES:T(r.payload);return;case d.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS:k(r.payload);return;default:throw Error(`Unknown worker message type ${e}`)}}catch(e){console.error(e),t.postErrorToMainThread(e)}};t.attachWorkerSideOnMessage(g);exports.default=t;exports.handleBuildInNullifiers=k;exports.handleCalcAccessTokenSiblingAndSides=T;exports.handleCalcCommitmentsSiblingAndSides=p;exports.onWorkerMessage=g;
|
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
import { preProcessing as S } from "../../crypto/preProcessing.mjs";
|
|
2
|
-
import { Utxo as
|
|
3
|
-
import { calcCommitmentsSiblingAndSides as
|
|
4
|
-
import { WorkerProxy as
|
|
2
|
+
import { Utxo as p } from "../../data-structures/utxo/Utxo.mjs";
|
|
3
|
+
import { calcCommitmentsSiblingAndSides as T, calcAccessTokenSiblingsAndSides as g } from "../../functions/snarkjs/common.snarkjs.mjs";
|
|
4
|
+
import { WorkerProxy as k } from "../workerProxy.mjs";
|
|
5
5
|
import { ZKProofWorkerActionType as m } from "./zkProofWorker.types.mjs";
|
|
6
|
-
import { contructMerkleTreeFromSerialized as
|
|
7
|
-
const c = new
|
|
8
|
-
const { inputUtxosSerialized: e, merkleTreeSerialized: t } = o.data, a =
|
|
9
|
-
(
|
|
10
|
-
), { inCommitmentSiblings:
|
|
11
|
-
c.postMessageToMainThread({ inCommitmentSiblings:
|
|
6
|
+
import { contructMerkleTreeFromSerialized as d } from "../../functions/utils/merkleTree.utils.mjs";
|
|
7
|
+
const c = new k(), u = (o) => {
|
|
8
|
+
const { inputUtxosSerialized: e, merkleTreeSerialized: t } = o.data, a = d(t), i = e.map(
|
|
9
|
+
(r) => r.map((l) => new p(l))
|
|
10
|
+
), { inCommitmentSiblings: n, inCommitmentSiblingSides: s } = T(i, a);
|
|
11
|
+
c.postMessageToMainThread({ inCommitmentSiblings: n, inCommitmentSiblingSides: s });
|
|
12
12
|
}, C = (o) => {
|
|
13
|
-
const { accessKey: e, merkleTreeAccessTokenSerialized: t } = o.data;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
console.log("worker code a3", { accessTokenSiblings: s, accessTokenSiblingSides: r }), c.postMessageToMainThread({ accessTokenSiblings: s, accessTokenSiblingSides: r });
|
|
19
|
-
}, M = (o) => {
|
|
20
|
-
const { inputUtxosSerialized: e, onChainCreation: t, proverVersion: a } = o.data, s = e.map(
|
|
21
|
-
(i) => i.map((n) => new d(n))
|
|
13
|
+
const { accessKey: e, merkleTreeAccessTokenSerialized: t } = o.data, a = d(t), { accessTokenSiblings: i, accessTokenSiblingSides: n } = g(e, a);
|
|
14
|
+
c.postMessageToMainThread({ accessTokenSiblings: i, accessTokenSiblingSides: n });
|
|
15
|
+
}, f = (o) => {
|
|
16
|
+
const { inputUtxosSerialized: e, onChainCreation: t, proverVersion: a } = o.data, i = e.map(
|
|
17
|
+
(s) => s.map((r) => new p(r))
|
|
22
18
|
);
|
|
23
|
-
let
|
|
24
|
-
a === "v1x0" ?
|
|
25
|
-
(
|
|
26
|
-
) :
|
|
27
|
-
},
|
|
28
|
-
console.log("worker code onWorkerMessage", { data: o });
|
|
19
|
+
let n = [];
|
|
20
|
+
a === "v1x0" ? n = i.map(
|
|
21
|
+
(s, r) => s.map((l) => t[r] ? "0" : l.getNullifier())
|
|
22
|
+
) : n = i.map((s) => s.map((r) => r.amount === 0n ? "0" : r.getNullifier())), c.postMessageToMainThread(n);
|
|
23
|
+
}, A = async (o) => {
|
|
29
24
|
try {
|
|
30
25
|
await S();
|
|
31
26
|
const { type: e } = o.payload;
|
|
@@ -37,7 +32,7 @@ const c = new T(), u = (o) => {
|
|
|
37
32
|
C(o.payload);
|
|
38
33
|
return;
|
|
39
34
|
case m.BUILD_IN_NULLIFIERS:
|
|
40
|
-
|
|
35
|
+
f(o.payload);
|
|
41
36
|
return;
|
|
42
37
|
default:
|
|
43
38
|
throw Error(`Unknown worker message type ${e}`);
|
|
@@ -46,11 +41,11 @@ const c = new T(), u = (o) => {
|
|
|
46
41
|
console.error(e), c.postErrorToMainThread(e);
|
|
47
42
|
}
|
|
48
43
|
};
|
|
49
|
-
c.attachWorkerSideOnMessage(
|
|
44
|
+
c.attachWorkerSideOnMessage(A);
|
|
50
45
|
export {
|
|
51
46
|
c as default,
|
|
52
|
-
|
|
47
|
+
f as handleBuildInNullifiers,
|
|
53
48
|
C as handleCalcAccessTokenSiblingAndSides,
|
|
54
49
|
u as handleCalcCommitmentsSiblingAndSides,
|
|
55
|
-
|
|
50
|
+
A as onWorkerMessage
|
|
56
51
|
};
|