h_test_1 0.0.25 → 0.0.27

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../functions/web3/etherFunctions.cjs"),s=require("../../crypto/poseidon.cjs"),l=require("./MerkleTree.cjs"),g=(n,o,r,t)=>{if(console.log("getPatchedAccessTokenMerkleTree a1",{merkleTreeAccessToken:n,accessKey:o,patchAccessTokenMerkleTree:r,kycRequired:t}),!t||r){const e=l.MerkleTree.create(s.poseidonFunction,0n);return console.log("getPatchedAccessTokenMerkleTree a2",{tree:e}),e.insert(BigInt(o),e.getStartIndex()),t||(e.insert(c.randomBigInt(31),e.getStartIndex()+1n),console.log("getPatchedAccessTokenMerkleTree a3",{tree:e})),console.log("getPatchedAccessTokenMerkleTree a4",{tree:e}),e}return n};exports.getPatchedAccessTokenMerkleTree=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../functions/web3/etherFunctions.cjs"),c=require("../../crypto/poseidon.cjs"),i=require("./MerkleTree.cjs"),u=(r,n,o,t)=>{if(!t||o){const e=i.MerkleTree.create(c.poseidonFunction,0n);return e.insert(BigInt(n),e.getStartIndex()),t||e.insert(s.randomBigInt(31),e.getStartIndex()+1n),e}return r};exports.getPatchedAccessTokenMerkleTree=u;
@@ -1,18 +1,13 @@
1
- import { randomBigInt as c } from "../../functions/web3/etherFunctions.mjs";
2
- import { poseidonFunction as g } from "../../crypto/poseidon.mjs";
1
+ import { randomBigInt as i } from "../../functions/web3/etherFunctions.mjs";
2
+ import { poseidonFunction as m } from "../../crypto/poseidon.mjs";
3
3
  import { MerkleTree as s } from "./MerkleTree.mjs";
4
- const d = (o, r, n, t) => {
5
- if (console.log("getPatchedAccessTokenMerkleTree a1", {
6
- merkleTreeAccessToken: o,
7
- accessKey: r,
8
- patchAccessTokenMerkleTree: n,
9
- kycRequired: t
10
- }), !t || n) {
11
- const e = s.create(g, 0n);
12
- return console.log("getPatchedAccessTokenMerkleTree a2", { tree: e }), e.insert(BigInt(r), e.getStartIndex()), t || (e.insert(c(31), e.getStartIndex() + 1n), console.log("getPatchedAccessTokenMerkleTree a3", { tree: e })), console.log("getPatchedAccessTokenMerkleTree a4", { tree: e }), e;
4
+ const g = (r, n, o, t) => {
5
+ if (!t || o) {
6
+ const e = s.create(m, 0n);
7
+ return e.insert(BigInt(n), e.getStartIndex()), t || e.insert(i(31), e.getStartIndex() + 1n), e;
13
8
  }
14
- return o;
9
+ return r;
15
10
  };
16
11
  export {
17
- d as getPatchedAccessTokenMerkleTree
12
+ g as getPatchedAccessTokenMerkleTree
18
13
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./getZKFiles.cjs"),k=require("../../webworker/performTaskWithWorker.cjs"),c=require("../../webworker/snarkjsWorker/snarkjsWorker.types.cjs"),y=require("../../webworker/worker.registry.cjs"),g=async(r,e,t,o)=>{const a=l.getWASMFile(r,t,e),s=l.getZKeyFile(r,t,e);console.log("hinkalDeposit k5 self proof",{input:o,wasmFilePath:a,zKeyFilePath:s});const{publicSignals:n,zkCallData:i}=await k.performTaskWithWorker({type:y.WorkerVariant.SnarkJS,payload:{type:c.SnarkJSWorkerActionType.FULL_PROVE,data:{input:o,chainId:e,wasmFilePath:a,zKeyFilePath:s}}});return{zkCallData:i,publicSignals:n}};exports.generateZkProofSelf=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./getZKFiles.cjs"),k=require("../../webworker/performTaskWithWorker.cjs"),c=require("../../webworker/snarkjsWorker/snarkjsWorker.types.cjs"),y=require("../../webworker/worker.registry.cjs"),S=async(r,e,t,a)=>{const s=o.getWASMFile(r,t,e),n=o.getZKeyFile(r,t,e),{publicSignals:i,zkCallData:l}=await k.performTaskWithWorker({type:y.WorkerVariant.SnarkJS,payload:{type:c.SnarkJSWorkerActionType.FULL_PROVE,data:{input:a,chainId:e,wasmFilePath:s,zKeyFilePath:n}}});return{zkCallData:l,publicSignals:i}};exports.generateZkProofSelf=S;
@@ -1,19 +1,17 @@
1
- import { getWASMFile as k, getZKeyFile as n } from "./getZKFiles.mjs";
2
- import { performTaskWithWorker as s } from "../../webworker/performTaskWithWorker.mjs";
3
- import { SnarkJSWorkerActionType as m } from "../../webworker/snarkjsWorker/snarkjsWorker.types.mjs";
4
- import { WorkerVariant as f } from "../../webworker/worker.registry.mjs";
5
- const F = async (t, o, r, e) => {
6
- const a = k(t, r, o), l = n(t, r, o);
7
- console.log("hinkalDeposit k5 self proof", { input: e, wasmFilePath: a, zKeyFilePath: l });
8
- const { publicSignals: p, zkCallData: i } = await s({
9
- type: f.SnarkJS,
1
+ import { getWASMFile as m, getZKeyFile as n } from "./getZKFiles.mjs";
2
+ import { performTaskWithWorker as k } from "../../webworker/performTaskWithWorker.mjs";
3
+ import { SnarkJSWorkerActionType as s } from "../../webworker/snarkjsWorker/snarkjsWorker.types.mjs";
4
+ import { WorkerVariant as y } from "../../webworker/worker.registry.mjs";
5
+ const W = async (o, t, r, a) => {
6
+ const e = m(o, r, t), l = n(o, r, t), { publicSignals: p, zkCallData: i } = await k({
7
+ type: y.SnarkJS,
10
8
  payload: {
11
- type: m.FULL_PROVE,
12
- data: { input: e, chainId: o, wasmFilePath: a, zKeyFilePath: l }
9
+ type: s.FULL_PROVE,
10
+ data: { input: a, chainId: t, wasmFilePath: e, zKeyFilePath: l }
13
11
  }
14
12
  });
15
13
  return { zkCallData: i, publicSignals: p };
16
14
  };
17
15
  export {
18
- F as generateZkProofSelf
16
+ W as generateZkProofSelf
19
17
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("../../data-structures/merkle-tree/MerkleTree.cjs"),A=require("../../data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.cjs"),S=require("../../webworker/performTaskWithWorker.cjs"),m=require("../../webworker/worker.registry.cjs"),h=require("../../webworker/zkProofWorker/zkProofWorker.types.cjs"),u=require("./fetchMerkleTreeSiblings.cjs"),H=require("../utils/amounts.utils.cjs"),N=require("../../crypto/poseidon.cjs"),C=require("../../constants/vite.constants.cjs"),R=require("./fetchOnChainRootHashes.cjs"),p=async(o,i)=>{const e=o.getRootHash();if(console.log("sss pre calculate access token siblings and root hash",{accessKey:i,rootHash:e,patchedMerkleTree:o,tjson:o.toJSON()}),e===void 0)throw new Error("Root hash not available from patched merkle tree");const s=await S.performTaskWithWorker({type:m.WorkerVariant.ZKProof,payload:{type:h.ZKProofWorkerActionType.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES,data:{accessKey:i,merkleTreeAccessTokenSerialized:o.toJSON()}}});return console.log({resultFromWorker:s}),{accessTokenSiblings:s.accessTokenSiblings,accessTokenSiblingSides:s.accessTokenSiblingSides,rootHashAccessToken:e}},_=async(o,i,e,s,t,n)=>{console.log("hinkalDeposit sa5");const a=e.getAccessKey();console.log("hinkalDeposit sa6",{accessKey:a});const r=A.getPatchedAccessTokenMerkleTree(i,a,t,n),k=o.getRootHash();if(k===void 0)throw new Error("Root hash not available from hinkal merkle tree");let l,c;return C.isNode?(l=await p(r,a),c=await S.performTaskWithWorker({type:m.WorkerVariant.ZKProof,payload:{type:h.ZKProofWorkerActionType.CALC_COMMITMENTS_SIBLING_AND_SIDES,data:{inputUtxosSerialized:s,merkleTreeSerialized:o.toJSON()}}})):[l,c]=await Promise.all([p(r,a),S.performTaskWithWorker({type:m.WorkerVariant.ZKProof,payload:{type:h.ZKProofWorkerActionType.CALC_COMMITMENTS_SIBLING_AND_SIDES,data:{inputUtxosSerialized:s,merkleTreeSerialized:o.toJSON()}}})]),{inCommitmentSiblings:c.inCommitmentSiblings,inCommitmentSiblingSides:c.inCommitmentSiblingSides,accessTokenSiblings:l.accessTokenSiblings,accessTokenSiblingSides:l.accessTokenSiblingSides,rootHashHinkal:k,rootHashAccessToken:l.rootHashAccessToken}},P=async(o,i,e,s,t)=>{console.log("hinkalDeposit sa3");const n=i.getAccessKey();console.log("hinkalDeposit sa4",{accessKey:n});const a=!t||s;if(console.log("ba4",{needsPatching:a}),a){console.log("ba5");const k=W.MerkleTree.create(N.poseidonFunction,0n);console.log("ba6",{emptyMerkleTreeAccessToken:k});const l=A.getPatchedAccessTokenMerkleTree(k,n,s,t);console.log("pre calculating access token siblings and root hash",{accessKey:n});const[c,g]=await Promise.all([p(l,n),u.fetchMerkleTreeSiblings(o,e,n)]);return console.log("post calculating access token siblings and root hash",{accessTokenResult:c,siblingsResponse:g}),{inCommitmentSiblings:g.inCommitmentSiblings,inCommitmentSiblingSides:g.inCommitmentSiblingSides,accessTokenSiblings:c.accessTokenSiblings,accessTokenSiblingSides:c.accessTokenSiblingSides,rootHashHinkal:H.toBigInt(g.rootHashHinkal),rootHashAccessToken:c.rootHashAccessToken}}console.log("kaksk",{chainId:o,inputUtxosSerialized:e,accessKey:n});const r=await u.fetchMerkleTreeSiblings(o,e,n);return{inCommitmentSiblings:r.inCommitmentSiblings,inCommitmentSiblingSides:r.inCommitmentSiblingSides,accessTokenSiblings:r.accessTokenSiblings,accessTokenSiblingSides:r.accessTokenSiblingSides,rootHashHinkal:H.toBigInt(r.rootHashHinkal),rootHashAccessToken:H.toBigInt(r.rootHashAccessToken)}},I=async(o,i,e)=>{if(!i||!e)return!1;try{const s=i.getRootHash(),t=e.getRootHash();if(!s||!t)return!1;const{hinkalRootHash:n,accessTokenRootHash:a}=await R.fetchOnChainRootHashes(o);return s===n&&t===a}catch{return!1}},y=async(o,i,e,s,t,n,a)=>{const r=await I(o,n,a);return console.log("hinkalDeposit sa2",{isLocalFresh:r}),r?_(n,a,i,e,s,t):P(o,i,e,s,t)},w=async(o,i,e,s,t,n,a,r,k)=>{if(C.isNode){const{inCommitmentSiblings:l,inCommitmentSiblingSides:c,accessTokenSiblings:g,accessTokenSiblingSides:T,rootHashHinkal:b,rootHashAccessToken:f}=await y(o,s,t,n,a,i,e),d=await S.performTaskWithWorker({type:m.WorkerVariant.ZKProof,payload:{type:h.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:t,onChainCreation:r,proverVersion:k}}});return{inCommitmentSiblings:l,inCommitmentSiblingSides:c,accessTokenSiblings:g,accessTokenSiblingSides:T,rootHashHinkal:b,rootHashAccessToken:f,inNullifiers:d}}else{const[{inCommitmentSiblings:l,inCommitmentSiblingSides:c,accessTokenSiblings:g,accessTokenSiblingSides:T,rootHashHinkal:b,rootHashAccessToken:f},d]=await Promise.all([y(o,s,t,n,a,i,e),S.performTaskWithWorker({type:m.WorkerVariant.ZKProof,payload:{type:h.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:t,onChainCreation:r,proverVersion:k}}})]);return{inCommitmentSiblings:l,inCommitmentSiblingSides:c,accessTokenSiblings:g,accessTokenSiblingSides:T,rootHashHinkal:b,rootHashAccessToken:f,inNullifiers:d}}};exports.getDataFromWorkers=w;exports.getMerkleTreeSiblingsAndRootHashes=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../data-structures/merkle-tree/MerkleTree.cjs"),C=require("../../data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.cjs"),m=require("../../webworker/performTaskWithWorker.cjs"),g=require("../../webworker/worker.registry.cjs"),T=require("../../webworker/zkProofWorker/zkProofWorker.types.cjs"),A=require("./fetchMerkleTreeSiblings.cjs"),H=require("../utils/amounts.utils.cjs"),P=require("../../crypto/poseidon.cjs"),W=require("../../constants/vite.constants.cjs"),_=require("./fetchOnChainRootHashes.cjs"),y=async(e,i)=>{const s=e.getRootHash();if(s===void 0)throw new Error("Root hash not available from patched merkle tree");const o=await m.performTaskWithWorker({type:g.WorkerVariant.ZKProof,payload:{type:T.ZKProofWorkerActionType.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES,data:{accessKey:i,merkleTreeAccessTokenSerialized:e.toJSON()}}});return{accessTokenSiblings:o.accessTokenSiblings,accessTokenSiblingSides:o.accessTokenSiblingSides,rootHashAccessToken:s}},N=async(e,i,s,o,t,n)=>{const a=s.getAccessKey(),r=C.getPatchedAccessTokenMerkleTree(i,a,t,n),S=e.getRootHash();if(S===void 0)throw new Error("Root hash not available from hinkal merkle tree");let l,c;return W.isNode?(l=await y(r,a),c=await m.performTaskWithWorker({type:g.WorkerVariant.ZKProof,payload:{type:T.ZKProofWorkerActionType.CALC_COMMITMENTS_SIBLING_AND_SIDES,data:{inputUtxosSerialized:o,merkleTreeSerialized:e.toJSON()}}})):[l,c]=await Promise.all([y(r,a),m.performTaskWithWorker({type:g.WorkerVariant.ZKProof,payload:{type:T.ZKProofWorkerActionType.CALC_COMMITMENTS_SIBLING_AND_SIDES,data:{inputUtxosSerialized:o,merkleTreeSerialized:e.toJSON()}}})]),{inCommitmentSiblings:c.inCommitmentSiblings,inCommitmentSiblingSides:c.inCommitmentSiblingSides,accessTokenSiblings:l.accessTokenSiblings,accessTokenSiblingSides:l.accessTokenSiblingSides,rootHashHinkal:S,rootHashAccessToken:l.rootHashAccessToken}},R=async(e,i,s,o,t)=>{const n=i.getAccessKey();if(!t||o){const S=u.MerkleTree.create(P.poseidonFunction,0n),l=C.getPatchedAccessTokenMerkleTree(S,n,o,t),[c,k]=await Promise.all([y(l,n),A.fetchMerkleTreeSiblings(e,s,n)]);return{inCommitmentSiblings:k.inCommitmentSiblings,inCommitmentSiblingSides:k.inCommitmentSiblingSides,accessTokenSiblings:c.accessTokenSiblings,accessTokenSiblingSides:c.accessTokenSiblingSides,rootHashHinkal:H.toBigInt(k.rootHashHinkal),rootHashAccessToken:c.rootHashAccessToken}}const r=await A.fetchMerkleTreeSiblings(e,s,n);return{inCommitmentSiblings:r.inCommitmentSiblings,inCommitmentSiblingSides:r.inCommitmentSiblingSides,accessTokenSiblings:r.accessTokenSiblings,accessTokenSiblingSides:r.accessTokenSiblingSides,rootHashHinkal:H.toBigInt(r.rootHashHinkal),rootHashAccessToken:H.toBigInt(r.rootHashAccessToken)}},I=async(e,i,s)=>{if(!i||!s)return!1;try{const o=i.getRootHash(),t=s.getRootHash();if(!o||!t)return!1;const{hinkalRootHash:n,accessTokenRootHash:a}=await _.fetchOnChainRootHashes(e);return o===n&&t===a}catch{return!1}},p=async(e,i,s,o,t,n,a)=>await I(e,n,a)?N(n,a,i,s,o,t):R(e,i,s,o,t),M=async(e,i,s,o,t,n,a,r,S)=>{if(W.isNode){const{inCommitmentSiblings:l,inCommitmentSiblingSides:c,accessTokenSiblings:k,accessTokenSiblingSides:h,rootHashHinkal:b,rootHashAccessToken:d}=await p(e,o,t,n,a,i,s),f=await m.performTaskWithWorker({type:g.WorkerVariant.ZKProof,payload:{type:T.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:t,onChainCreation:r,proverVersion:S}}});return{inCommitmentSiblings:l,inCommitmentSiblingSides:c,accessTokenSiblings:k,accessTokenSiblingSides:h,rootHashHinkal:b,rootHashAccessToken:d,inNullifiers:f}}else{const[{inCommitmentSiblings:l,inCommitmentSiblingSides:c,accessTokenSiblings:k,accessTokenSiblingSides:h,rootHashHinkal:b,rootHashAccessToken:d},f]=await Promise.all([p(e,o,t,n,a,i,s),m.performTaskWithWorker({type:g.WorkerVariant.ZKProof,payload:{type:T.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:t,onChainCreation:r,proverVersion:S}}})]);return{inCommitmentSiblings:l,inCommitmentSiblingSides:c,accessTokenSiblings:k,accessTokenSiblingSides:h,rootHashHinkal:b,rootHashAccessToken:d,inNullifiers:f}}};exports.getDataFromWorkers=M;exports.getMerkleTreeSiblingsAndRootHashes=p;
@@ -1,161 +1,141 @@
1
1
  import { MerkleTree as R } from "../../data-structures/merkle-tree/MerkleTree.mjs";
2
- import { getPatchedAccessTokenMerkleTree as N } from "../../data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.mjs";
2
+ import { getPatchedAccessTokenMerkleTree as A } from "../../data-structures/merkle-tree/getPatchedAccessTokenMerkleTree.mjs";
3
3
  import { performTaskWithWorker as g } from "../../webworker/performTaskWithWorker.mjs";
4
4
  import { WorkerVariant as k } from "../../webworker/worker.registry.mjs";
5
5
  import { ZKProofWorkerActionType as b } from "../../webworker/zkProofWorker/zkProofWorker.types.mjs";
6
6
  import { fetchMerkleTreeSiblings as C } from "./fetchMerkleTreeSiblings.mjs";
7
- import { toBigInt as p } from "../utils/amounts.utils.mjs";
8
- import { poseidonFunction as _ } from "../../crypto/poseidon.mjs";
9
- import { isNode as A } from "../../constants/vite.constants.mjs";
10
- import { fetchOnChainRootHashes as I } from "./fetchOnChainRootHashes.mjs";
11
- const d = async (o, i) => {
12
- const s = o.getRootHash();
13
- if (console.log("sss pre calculate access token siblings and root hash", {
14
- accessKey: i,
15
- rootHash: s,
16
- patchedMerkleTree: o,
17
- tjson: o.toJSON()
18
- }), s === void 0)
7
+ import { toBigInt as d } from "../utils/amounts.utils.mjs";
8
+ import { poseidonFunction as I } from "../../crypto/poseidon.mjs";
9
+ import { isNode as N } from "../../constants/vite.constants.mjs";
10
+ import { fetchOnChainRootHashes as _ } from "./fetchOnChainRootHashes.mjs";
11
+ const p = async (o, n) => {
12
+ const e = o.getRootHash();
13
+ if (e === void 0)
19
14
  throw new Error("Root hash not available from patched merkle tree");
20
- const e = await g({
15
+ const s = await g({
21
16
  type: k.ZKProof,
22
17
  payload: {
23
18
  type: b.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES,
24
19
  data: {
25
- accessKey: i,
20
+ accessKey: n,
26
21
  merkleTreeAccessTokenSerialized: o.toJSON()
27
22
  }
28
23
  }
29
24
  });
30
- return console.log({ resultFromWorker: e }), {
31
- accessTokenSiblings: e.accessTokenSiblings,
32
- accessTokenSiblingSides: e.accessTokenSiblingSides,
33
- rootHashAccessToken: s
25
+ return {
26
+ accessTokenSiblings: s.accessTokenSiblings,
27
+ accessTokenSiblingSides: s.accessTokenSiblingSides,
28
+ rootHashAccessToken: e
34
29
  };
35
- }, w = async (o, i, s, e, t, n) => {
36
- console.log("hinkalDeposit sa5");
37
- const a = s.getAccessKey();
38
- console.log("hinkalDeposit sa6", { accessKey: a });
39
- const c = N(
30
+ }, L = async (o, n, e, s, i, t) => {
31
+ const c = e.getAccessKey(), a = A(
32
+ n,
33
+ c,
40
34
  i,
41
- a,
42
- t,
43
- n
35
+ t
44
36
  ), m = o.getRootHash();
45
37
  if (m === void 0)
46
38
  throw new Error("Root hash not available from hinkal merkle tree");
47
- let r, l;
48
- return A ? (r = await d(c, a), l = await g({
39
+ let l, r;
40
+ return N ? (l = await p(a, c), r = await g({
49
41
  type: k.ZKProof,
50
42
  payload: {
51
43
  type: b.CALC_COMMITMENTS_SIBLING_AND_SIDES,
52
- data: { inputUtxosSerialized: e, merkleTreeSerialized: o.toJSON() }
44
+ data: { inputUtxosSerialized: s, merkleTreeSerialized: o.toJSON() }
53
45
  }
54
- })) : [r, l] = await Promise.all([
55
- d(c, a),
46
+ })) : [l, r] = await Promise.all([
47
+ p(a, c),
56
48
  g({
57
49
  type: k.ZKProof,
58
50
  payload: {
59
51
  type: b.CALC_COMMITMENTS_SIBLING_AND_SIDES,
60
- data: { inputUtxosSerialized: e, merkleTreeSerialized: o.toJSON() }
52
+ data: { inputUtxosSerialized: s, merkleTreeSerialized: o.toJSON() }
61
53
  }
62
54
  })
63
55
  ]), {
64
- inCommitmentSiblings: l.inCommitmentSiblings,
65
- inCommitmentSiblingSides: l.inCommitmentSiblingSides,
66
- accessTokenSiblings: r.accessTokenSiblings,
67
- accessTokenSiblingSides: r.accessTokenSiblingSides,
56
+ inCommitmentSiblings: r.inCommitmentSiblings,
57
+ inCommitmentSiblingSides: r.inCommitmentSiblingSides,
58
+ accessTokenSiblings: l.accessTokenSiblings,
59
+ accessTokenSiblingSides: l.accessTokenSiblingSides,
68
60
  rootHashHinkal: m,
69
- rootHashAccessToken: r.rootHashAccessToken
61
+ rootHashAccessToken: l.rootHashAccessToken
70
62
  };
71
- }, D = async (o, i, s, e, t) => {
72
- console.log("hinkalDeposit sa3");
73
- const n = i.getAccessKey();
74
- console.log("hinkalDeposit sa4", { accessKey: n });
75
- const a = !t || e;
76
- if (console.log("ba4", { needsPatching: a }), a) {
77
- console.log("ba5");
78
- const m = R.create(_, 0n);
79
- console.log("ba6", { emptyMerkleTreeAccessToken: m });
80
- const r = N(
63
+ }, w = async (o, n, e, s, i) => {
64
+ const t = n.getAccessKey();
65
+ if (!i || s) {
66
+ const m = R.create(I, 0n), l = A(
81
67
  m,
82
- n,
83
- e,
84
- t
85
- );
86
- console.log("pre calculating access token siblings and root hash", { accessKey: n });
87
- const [l, S] = await Promise.all([
88
- d(r, n),
89
- C(o, s, n)
68
+ t,
69
+ s,
70
+ i
71
+ ), [r, S] = await Promise.all([
72
+ p(l, t),
73
+ C(o, e, t)
90
74
  ]);
91
- return console.log("post calculating access token siblings and root hash", { accessTokenResult: l, siblingsResponse: S }), {
75
+ return {
92
76
  inCommitmentSiblings: S.inCommitmentSiblings,
93
77
  inCommitmentSiblingSides: S.inCommitmentSiblingSides,
94
- accessTokenSiblings: l.accessTokenSiblings,
95
- accessTokenSiblingSides: l.accessTokenSiblingSides,
96
- rootHashHinkal: p(S.rootHashHinkal),
97
- rootHashAccessToken: l.rootHashAccessToken
78
+ accessTokenSiblings: r.accessTokenSiblings,
79
+ accessTokenSiblingSides: r.accessTokenSiblingSides,
80
+ rootHashHinkal: d(S.rootHashHinkal),
81
+ rootHashAccessToken: r.rootHashAccessToken
98
82
  };
99
83
  }
100
- console.log("kaksk", { chainId: o, inputUtxosSerialized: s, accessKey: n });
101
- const c = await C(o, s, n);
84
+ const a = await C(o, e, t);
102
85
  return {
103
- inCommitmentSiblings: c.inCommitmentSiblings,
104
- inCommitmentSiblingSides: c.inCommitmentSiblingSides,
105
- accessTokenSiblings: c.accessTokenSiblings,
106
- accessTokenSiblingSides: c.accessTokenSiblingSides,
107
- rootHashHinkal: p(c.rootHashHinkal),
108
- rootHashAccessToken: p(c.rootHashAccessToken)
86
+ inCommitmentSiblings: a.inCommitmentSiblings,
87
+ inCommitmentSiblingSides: a.inCommitmentSiblingSides,
88
+ accessTokenSiblings: a.accessTokenSiblings,
89
+ accessTokenSiblingSides: a.accessTokenSiblingSides,
90
+ rootHashHinkal: d(a.rootHashHinkal),
91
+ rootHashAccessToken: d(a.rootHashAccessToken)
109
92
  };
110
- }, L = async (o, i, s) => {
111
- if (!i || !s)
93
+ }, P = async (o, n, e) => {
94
+ if (!n || !e)
112
95
  return !1;
113
96
  try {
114
- const e = i.getRootHash(), t = s.getRootHash();
115
- if (!e || !t)
97
+ const s = n.getRootHash(), i = e.getRootHash();
98
+ if (!s || !i)
116
99
  return !1;
117
- const { hinkalRootHash: n, accessTokenRootHash: a } = await I(o);
118
- return e === n && t === a;
100
+ const { hinkalRootHash: t, accessTokenRootHash: c } = await _(o);
101
+ return s === t && i === c;
119
102
  } catch {
120
103
  return !1;
121
104
  }
122
- }, y = async (o, i, s, e, t, n, a) => {
123
- const c = await L(o, n, a);
124
- return console.log("hinkalDeposit sa2", { isLocalFresh: c }), c ? w(
125
- n,
126
- a,
127
- i,
128
- s,
129
- e,
130
- t
131
- ) : D(o, i, s, e, t);
132
- }, J = async (o, i, s, e, t, n, a, c, m) => {
133
- if (A) {
105
+ }, y = async (o, n, e, s, i, t, c) => await P(o, t, c) ? L(
106
+ t,
107
+ c,
108
+ n,
109
+ e,
110
+ s,
111
+ i
112
+ ) : w(o, n, e, s, i), v = async (o, n, e, s, i, t, c, a, m) => {
113
+ if (N) {
134
114
  const {
135
- inCommitmentSiblings: r,
136
- inCommitmentSiblingSides: l,
115
+ inCommitmentSiblings: l,
116
+ inCommitmentSiblingSides: r,
137
117
  accessTokenSiblings: S,
138
118
  accessTokenSiblingSides: h,
139
119
  rootHashHinkal: T,
140
120
  rootHashAccessToken: f
141
121
  } = await y(
142
122
  o,
143
- e,
123
+ s,
124
+ i,
144
125
  t,
126
+ c,
145
127
  n,
146
- a,
147
- i,
148
- s
128
+ e
149
129
  ), H = await g({
150
130
  type: k.ZKProof,
151
131
  payload: {
152
132
  type: b.BUILD_IN_NULLIFIERS,
153
- data: { inputUtxosSerialized: t, onChainCreation: c, proverVersion: m }
133
+ data: { inputUtxosSerialized: i, onChainCreation: a, proverVersion: m }
154
134
  }
155
135
  });
156
136
  return {
157
- inCommitmentSiblings: r,
158
- inCommitmentSiblingSides: l,
137
+ inCommitmentSiblings: l,
138
+ inCommitmentSiblingSides: r,
159
139
  accessTokenSiblings: S,
160
140
  accessTokenSiblingSides: h,
161
141
  rootHashHinkal: T,
@@ -165,8 +145,8 @@ const d = async (o, i) => {
165
145
  } else {
166
146
  const [
167
147
  {
168
- inCommitmentSiblings: r,
169
- inCommitmentSiblingSides: l,
148
+ inCommitmentSiblings: l,
149
+ inCommitmentSiblingSides: r,
170
150
  accessTokenSiblings: S,
171
151
  accessTokenSiblingSides: h,
172
152
  rootHashHinkal: T,
@@ -176,24 +156,24 @@ const d = async (o, i) => {
176
156
  ] = await Promise.all([
177
157
  y(
178
158
  o,
179
- e,
159
+ s,
160
+ i,
180
161
  t,
162
+ c,
181
163
  n,
182
- a,
183
- i,
184
- s
164
+ e
185
165
  ),
186
166
  g({
187
167
  type: k.ZKProof,
188
168
  payload: {
189
169
  type: b.BUILD_IN_NULLIFIERS,
190
- data: { inputUtxosSerialized: t, onChainCreation: c, proverVersion: m }
170
+ data: { inputUtxosSerialized: i, onChainCreation: a, proverVersion: m }
191
171
  }
192
172
  })
193
173
  ]);
194
174
  return {
195
- inCommitmentSiblings: r,
196
- inCommitmentSiblingSides: l,
175
+ inCommitmentSiblings: l,
176
+ inCommitmentSiblingSides: r,
197
177
  accessTokenSiblings: S,
198
178
  accessTokenSiblingSides: h,
199
179
  rootHashHinkal: T,
@@ -203,6 +183,6 @@ const d = async (o, i) => {
203
183
  }
204
184
  };
205
185
  export {
206
- J as getDataFromWorkers,
186
+ v as getDataFromWorkers,
207
187
  y as getMerkleTreeSiblingsAndRootHashes
208
188
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h_test_1",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
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
  },
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("../constants/chains.constants.cjs"),h=require("../constants/vite.constants.cjs"),k=require("./workerFactory.cjs"),d=async r=>{const e=await k.WorkerFactory.getWebWorker(r.type);return console.log("performTaskWithWorker a1",{worker:e,workerData:r}),new Promise((s,a)=>{let t={};if(typeof window<"u"&&window.location){const{origin:o,protocol:i,host:c,port:l,hostname:m,href:p}=window.location;t={origin:o,protocol:i,host:c,port:l,hostname:m,href:p}}e.onmessage=o=>{console.log("performTaskWithWorker a3",{result:o}),s(o.data),e.terminate()},e.onerror=o=>{console.error("performTaskWithWorker a2",{err:o}),a(o),e.terminate()};const n={payload:r.payload,metadata:{hostLocation:t,constants:{chains:{chainIds:W.chainIds},isDevelopment:h.isDevelopment}}};console.log("performTaskWithWorker a4",{message:n}),e.postMessage(n)})};exports.performTaskWithWorker=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../constants/chains.constants.cjs"),h=require("../constants/vite.constants.cjs"),w=require("./workerFactory.cjs"),y=async t=>{const e=await w.WorkerFactory.getWebWorker(t.type);return new Promise((r,s)=>{let n={};if(typeof window<"u"&&window.location){const{origin:o,protocol:i,host:c,port:d,hostname:m,href:p}=window.location;n={origin:o,protocol:i,host:c,port:d,hostname:m,href:p}}e.onmessage=o=>{r(o.data),e.terminate()},e.onerror=o=>{s(o),e.terminate()};const a={payload:t.payload,metadata:{hostLocation:n,constants:{chains:{chainIds:l.chainIds},isDevelopment:h.isDevelopment}}};e.postMessage(a)})};exports.performTaskWithWorker=y;
@@ -1,41 +1,41 @@
1
- import { chainIds as W } from "../constants/chains.constants.mjs";
2
- import { isDevelopment as f } from "../constants/vite.constants.mjs";
1
+ import { chainIds as f } from "../constants/chains.constants.mjs";
2
+ import { isDevelopment as w } from "../constants/vite.constants.mjs";
3
3
  import { WorkerFactory as h } from "./workerFactory.mjs";
4
- const w = async (r) => {
5
- const e = await h.getWebWorker(r.type);
6
- return console.log("performTaskWithWorker a1", { worker: e, workerData: r }), new Promise((n, s) => {
7
- let t = {};
4
+ const W = async (e) => {
5
+ const o = await h.getWebWorker(e.type);
6
+ return new Promise((n, a) => {
7
+ let r = {};
8
8
  if (typeof window < "u" && window.location) {
9
- const { origin: o, protocol: i, host: m, port: c, hostname: p, href: l } = window.location;
10
- t = {
11
- origin: o,
9
+ const { origin: t, protocol: i, host: m, port: c, hostname: p, href: d } = window.location;
10
+ r = {
11
+ origin: t,
12
12
  protocol: i,
13
13
  host: m,
14
14
  port: c,
15
15
  hostname: p,
16
- href: l
16
+ href: d
17
17
  };
18
18
  }
19
- e.onmessage = (o) => {
20
- console.log("performTaskWithWorker a3", { result: o }), n(o.data), e.terminate();
21
- }, e.onerror = (o) => {
22
- console.error("performTaskWithWorker a2", { err: o }), s(o), e.terminate();
19
+ o.onmessage = (t) => {
20
+ n(t.data), o.terminate();
21
+ }, o.onerror = (t) => {
22
+ a(t), o.terminate();
23
23
  };
24
- const a = {
25
- payload: r.payload,
24
+ const s = {
25
+ payload: e.payload,
26
26
  metadata: {
27
- hostLocation: t,
27
+ hostLocation: r,
28
28
  constants: {
29
29
  chains: {
30
- chainIds: W
30
+ chainIds: f
31
31
  },
32
- isDevelopment: f
32
+ isDevelopment: w
33
33
  }
34
34
  }
35
35
  };
36
- console.log("performTaskWithWorker a4", { message: a }), e.postMessage(a);
36
+ o.postMessage(s);
37
37
  });
38
38
  };
39
39
  export {
40
- w as performTaskWithWorker
40
+ W as performTaskWithWorker
41
41
  };
@@ -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.19/' + 'zkProofWorkerLauncher.js'),
18
- [e.SnarkJS]: await getWorkerURL(domain + '/0.2.19/' + 'snarkjsWorkerLauncher.js'),
19
- [e.UTXO]: await getWorkerURL(domain + '/0.2.19/' + 'utxoWorkerLauncher.js'),
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.19/' + 'zkProofWorkerLauncher.js'),
18
- [e.SnarkJS]: await getWorkerURL(domain + '/0.2.19/' + 'snarkjsWorkerLauncher.js'),
19
- [e.UTXO]: await getWorkerURL(domain + '/0.2.19/' + 'utxoWorkerLauncher.js'),
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-DQUaX0hI.js").href:new URL("../../assets/zkProofWorkerLauncher-DQUaX0hI.js",document.currentScript&&document.currentScript.src||document.baseURI).href);module.exports=e;
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,4 +1,4 @@
1
- const r = "" + new URL("../../assets/zkProofWorkerLauncher-DQUaX0hI.js", import.meta.url).href;
1
+ const r = "" + new URL("../../assets/zkProofWorkerLauncher-2cfKnA2L.js", import.meta.url).href;
2
2
  export {
3
3
  r as default
4
4
  };
@@ -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"),k=require("../../functions/utils/merkleTree.utils.cjs"),c=new C.WorkerProxy,u=o=>{const{inputUtxosSerialized:e,merkleTreeSerialized:t}=o.data,a=k.contructMerkleTreeFromSerialized(t),s=e.map(n=>n.map(l=>new S.Utxo(l))),{inCommitmentSiblings:r,inCommitmentSiblingSides:i}=m.calcCommitmentsSiblingAndSides(s,a);c.postMessageToMainThread({inCommitmentSiblings:r,inCommitmentSiblingSides:i})},p=o=>{const{accessKey:e,merkleTreeAccessTokenSerialized:t}=o.data;console.log("worker code a1",{accessKey:e,merkleTreeAccessTokenSerialized:t});const a=k.contructMerkleTreeFromSerialized(t);console.log("worker code a2",{merkleTree:a});const{accessTokenSiblings:s,accessTokenSiblingSides:r}=m.calcAccessTokenSiblingsAndSides(e,a);console.log("worker code a3",{accessTokenSiblings:s,accessTokenSiblingSides:r}),c.postMessageToMainThread({accessTokenSiblings:s,accessTokenSiblingSides:r})},g=o=>{const{inputUtxosSerialized:e,onChainCreation:t,proverVersion:a}=o.data,s=e.map(i=>i.map(n=>new S.Utxo(n)));let r=[];a==="v1x0"?r=s.map((i,n)=>i.map(l=>t[n]?"0":l.getNullifier())):r=s.map(i=>i.map(n=>n.amount===0n?"0":n.getNullifier())),c.postMessageToMainThread(r)},T=async o=>{console.log("worker code onWorkerMessage",{data:o});try{await A.preProcessing();const{type:e}=o.payload;switch(e){case d.ZKProofWorkerActionType.CALC_COMMITMENTS_SIBLING_AND_SIDES:u(o.payload);return;case d.ZKProofWorkerActionType.CALC_ACCESS_TOKEN_SIBLING_AND_SIDES:p(o.payload);return;case d.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS:g(o.payload);return;default:throw Error(`Unknown worker message type ${e}`)}}catch(e){console.error(e),c.postErrorToMainThread(e)}};c.attachWorkerSideOnMessage(T);exports.default=c;exports.handleBuildInNullifiers=g;exports.handleCalcAccessTokenSiblingAndSides=p;exports.handleCalcCommitmentsSiblingAndSides=u;exports.onWorkerMessage=T;
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 d } from "../../data-structures/utxo/Utxo.mjs";
3
- import { calcCommitmentsSiblingAndSides as g, calcAccessTokenSiblingsAndSides as k } from "../../functions/snarkjs/common.snarkjs.mjs";
4
- import { WorkerProxy as T } from "../workerProxy.mjs";
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 p } from "../../functions/utils/merkleTree.utils.mjs";
7
- const c = new T(), u = (o) => {
8
- const { inputUtxosSerialized: e, merkleTreeSerialized: t } = o.data, a = p(t), s = e.map(
9
- (n) => n.map((l) => new d(l))
10
- ), { inCommitmentSiblings: r, inCommitmentSiblingSides: i } = g(s, a);
11
- c.postMessageToMainThread({ inCommitmentSiblings: r, inCommitmentSiblingSides: i });
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
- console.log("worker code a1", { accessKey: e, merkleTreeAccessTokenSerialized: t });
15
- const a = p(t);
16
- console.log("worker code a2", { merkleTree: a });
17
- const { accessTokenSiblings: s, accessTokenSiblingSides: r } = k(e, a);
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 r = [];
24
- a === "v1x0" ? r = s.map(
25
- (i, n) => i.map((l) => t[n] ? "0" : l.getNullifier())
26
- ) : r = s.map((i) => i.map((n) => n.amount === 0n ? "0" : n.getNullifier())), c.postMessageToMainThread(r);
27
- }, f = async (o) => {
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
- M(o.payload);
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(f);
44
+ c.attachWorkerSideOnMessage(A);
50
45
  export {
51
46
  c as default,
52
- M as handleBuildInNullifiers,
47
+ f as handleBuildInNullifiers,
53
48
  C as handleCalcAccessTokenSiblingAndSides,
54
49
  u as handleCalcCommitmentsSiblingAndSides,
55
- f as onWorkerMessage
50
+ A as onWorkerMessage
56
51
  };