@hinkal/common 0.1.33 → 0.1.34
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/constants/fees.constants.cjs +1 -1
- package/constants/fees.constants.mjs +22 -22
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.d.ts +1 -0
- package/data-structures/Hinkal/Hinkal.mjs +13 -10
- package/data-structures/Hinkal/IHinkal.d.ts +2 -1
- package/data-structures/Hinkal/hinkalActionBeefy.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionBeefy.mjs +18 -20
- package/data-structures/Hinkal/hinkalActionConvex.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionConvex.mjs +18 -21
- package/data-structures/Hinkal/hinkalActionLidoEth.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionLidoEth.mjs +31 -31
- package/data-structures/Hinkal/hinkalActionPendle.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionPendle.mjs +77 -80
- package/data-structures/Hinkal/hinkalActionPendleLP.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionPendleLP.mjs +34 -34
- package/data-structures/Hinkal/hinkalActionStake.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionStake.mjs +48 -52
- package/data-structures/Hinkal/hinkalActionVolatile.cjs +1 -1
- package/data-structures/Hinkal/hinkalActionVolatile.mjs +38 -44
- package/data-structures/Hinkal/hinkalDeposit.cjs +1 -1
- package/data-structures/Hinkal/hinkalDeposit.mjs +27 -28
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.cjs +1 -4
- package/data-structures/event-service/AbstractCommitmentsSnapshotService.mjs +11 -16
- package/data-structures/transactions-manager/TransactionsManager.cjs +1 -1
- package/data-structures/transactions-manager/TransactionsManager.mjs +66 -74
- package/data-structures/transactions-manager/history/getVolatileData.cjs +1 -1
- package/data-structures/transactions-manager/history/getVolatileData.mjs +13 -13
- package/data-structures/volatile-helper/VolatileHelper.cjs +1 -1
- package/data-structures/volatile-helper/VolatileHelper.mjs +60 -60
- package/functions/pre-transaction/getFlatFees.cjs +1 -1
- package/functions/pre-transaction/getFlatFees.mjs +42 -42
- package/functions/pre-transaction/process-gas-estimates.cjs +1 -1
- package/functions/pre-transaction/process-gas-estimates.mjs +17 -26
- package/functions/protocols/pendle.helpers.cjs +1 -1
- package/functions/protocols/pendle.helpers.mjs +27 -27
- package/functions/snarkjs/constructGeneralZkProof.cjs +1 -1
- package/functions/snarkjs/constructGeneralZkProof.mjs +35 -37
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +27 -30
- package/functions/web3/events/getShieldedBalance.cjs +2 -2
- package/functions/web3/events/getShieldedBalance.mjs +25 -25
- package/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/functions/web3/functionCalls/transactCallDirect.mjs +15 -15
- package/functions/web3/runContractFunction.cjs +1 -1
- package/functions/web3/runContractFunction.mjs +37 -37
- package/functions/web3/uniswapAPI.cjs +1 -1
- package/functions/web3/uniswapAPI.mjs +28 -28
- package/package.json +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLogic.mjs +16 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UserFriendlyErrorCodes as
|
|
1
|
+
import { UserFriendlyErrorCodes as g, transactionErrorCodes as T } from "../../error-handling/error-codes.constants.mjs";
|
|
2
2
|
import "ethers";
|
|
3
|
-
import { getErrorMessage as
|
|
3
|
+
import { getErrorMessage as p } from "../../error-handling/get-error.message.mjs";
|
|
4
4
|
import "axios";
|
|
5
5
|
import "../../constants/chains.constants.mjs";
|
|
6
6
|
import "../../constants/vite.constants.mjs";
|
|
@@ -9,70 +9,70 @@ import "../../types/transactions.types.mjs";
|
|
|
9
9
|
import "../../types/curve.types.mjs";
|
|
10
10
|
import "circomlibjs";
|
|
11
11
|
import "../../constants/reorg-depths.constants.mjs";
|
|
12
|
-
const
|
|
12
|
+
const w = 5e4, l = 1, P = 11, d = 15, m = async (o, e) => {
|
|
13
13
|
try {
|
|
14
|
-
const t = await
|
|
15
|
-
return
|
|
14
|
+
const t = await o.getFeeData(), a = e === 0 ? P : d;
|
|
15
|
+
return t.gasPrice?.mul(a).div(10) ?? void 0;
|
|
16
16
|
} catch (t) {
|
|
17
17
|
console.log("getGasPrice error: ", { err: t });
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
}, E = (
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
}, E = (o, e, t) => new Promise((a, s) => {
|
|
21
|
+
const i = setTimeout(() => {
|
|
22
|
+
s(new Error(T.TRANSACTION_TIMEOUT));
|
|
23
23
|
}, t);
|
|
24
|
-
|
|
25
|
-
clearTimeout(
|
|
26
|
-
}).catch((
|
|
27
|
-
clearTimeout(
|
|
24
|
+
o.wait(e).then((r) => {
|
|
25
|
+
clearTimeout(i), a(r);
|
|
26
|
+
}).catch((r) => {
|
|
27
|
+
clearTimeout(i), s(r);
|
|
28
28
|
});
|
|
29
29
|
}), u = async ({
|
|
30
|
-
contractFunction:
|
|
30
|
+
contractFunction: o,
|
|
31
31
|
args: e,
|
|
32
32
|
gasPrice: t,
|
|
33
|
-
gasLimit:
|
|
34
|
-
nonce:
|
|
35
|
-
confirmations:
|
|
36
|
-
waitTime:
|
|
33
|
+
gasLimit: a,
|
|
34
|
+
nonce: s,
|
|
35
|
+
confirmations: i,
|
|
36
|
+
waitTime: r
|
|
37
37
|
}) => {
|
|
38
|
-
const
|
|
38
|
+
const n = await o(...e, {
|
|
39
39
|
type: 0,
|
|
40
|
-
gasLimit:
|
|
40
|
+
gasLimit: a,
|
|
41
41
|
gasPrice: t,
|
|
42
|
-
nonce:
|
|
42
|
+
nonce: s
|
|
43
43
|
});
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
return await E(
|
|
45
|
+
n,
|
|
46
|
+
i ?? l,
|
|
47
|
+
r ?? w
|
|
48
48
|
);
|
|
49
49
|
}, N = async ({
|
|
50
|
-
provider:
|
|
50
|
+
provider: o,
|
|
51
51
|
contractFunction: e,
|
|
52
52
|
args: t,
|
|
53
|
-
gasLimit:
|
|
54
|
-
nonce:
|
|
55
|
-
confirmations:
|
|
53
|
+
gasLimit: a,
|
|
54
|
+
nonce: s,
|
|
55
|
+
confirmations: i
|
|
56
56
|
}) => {
|
|
57
57
|
try {
|
|
58
|
-
const
|
|
59
|
-
|
|
58
|
+
const r = await m(
|
|
59
|
+
o,
|
|
60
60
|
0
|
|
61
61
|
/* Initial */
|
|
62
62
|
);
|
|
63
|
-
return await u({ contractFunction: e, args: t, gasPrice:
|
|
64
|
-
} catch (
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
63
|
+
return await u({ contractFunction: e, args: t, gasPrice: r, gasLimit: a, nonce: s, confirmations: i });
|
|
64
|
+
} catch (r) {
|
|
65
|
+
const n = p(r);
|
|
66
|
+
if (n === g.MAX_FEE_GAS_ERROR || n === T.TRANSACTION_TIMEOUT) {
|
|
67
67
|
console.log("Timeout Hit: Increase gas");
|
|
68
68
|
const c = await m(
|
|
69
|
-
|
|
69
|
+
o,
|
|
70
70
|
1
|
|
71
71
|
/* Secondary */
|
|
72
72
|
);
|
|
73
|
-
return await u({ contractFunction: e, args: t, gasPrice: c, gasLimit:
|
|
73
|
+
return await u({ contractFunction: e, args: t, gasPrice: c, gasLimit: a, nonce: s, confirmations: i });
|
|
74
74
|
}
|
|
75
|
-
throw
|
|
75
|
+
throw r;
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("ethers"),d=require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");const C=require("../../constants/protocol.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const l=require("../../error-handling/error-codes.constants.cjs"),y=require("./etherFunctions.cjs");require("axios");require("../../types/circom-data.types.cjs");const u=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("circomlibjs");const h=require("../../error-handling/logError.cjs"),w=async(t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("ethers"),d=require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");const C=require("../../constants/protocol.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const l=require("../../error-handling/error-codes.constants.cjs"),y=require("./etherFunctions.cjs");require("axios");require("../../types/circom-data.types.cjs");const u=require("../../types/ethereum-network.types.cjs");require("../../types/transactions.types.cjs");require("../../types/curve.types.cjs");require("circomlibjs");const h=require("../../error-handling/logError.cjs"),w=async(t,s,r,o)=>{const c=(await Promise.all([100,500,3e3,1e4].map(async e=>({poolAddress:await s.getPool(r,o,e),fee:e})))).filter(({poolAddress:e})=>e!==C.zeroAddress),n=await Promise.all(c.map(async e=>({poolAddress:e.poolAddress,fee:e.fee,token1Balance:(await t.balanceOf(e.poolAddress)).toBigInt()}))),i=n.map(e=>e.token1Balance).reduce((e,p)=>p>=e?p:e,0n);if(i===0n)throw new Error(l.transactionErrorCodes.UNISWAP_NOT_ENOUGH_LIQUIDITY);return n.find(e=>e.token1Balance===i)},g=async(t,s,r,o,c)=>{try{if(!d.networkRegistry[t.getCurrentChainId()].quoterV2Address)throw Error("No Quoter Contract Provided");return(await t.getContractWithFetcher(u.ContractType.UniswapV3QuoterContract,d.networkRegistry[t.getCurrentChainId()].quoterV2Address).callStatic.quoteExactInputSingle({tokenIn:s.wrappedErc20TokenAddress??s.erc20TokenAddress,tokenOut:r.wrappedErc20TokenAddress??r.erc20TokenAddress,fee:o,amountIn:c,sqrtPriceLimitX96:0})).amountOut.toBigInt()}catch(n){throw h.logError(n),n}},A=async(t,s,r)=>{try{const o=t.getCurrentChainId(),c=t.getContractWithFetcher(u.ContractType.UniswapV3FactoryContract,d.networkRegistry[o].uniswapV3FactoryAddress),n=t.getContractWithFetcher(u.ContractType.ERC20Contract,r.wrappedErc20TokenAddress??r.erc20TokenAddress),{fee:a}=await w(n,c,s.wrappedErc20TokenAddress??s.erc20TokenAddress,r.wrappedErc20TokenAddress??r.erc20TokenAddress);return a}catch(o){throw console.log("Error in getUniswapFee",o),o}},P=async(t,s,r,o)=>{try{const c=await A(t,r,o),n=q.utils.defaultAbiCoder.encode(["uint24"],[c]),a=y.getAmountInWei(r,s);return{tokenPrice:await g(t,r,o,c,a),poolFee:n}}catch{throw Error(l.transactionErrorCodes.NO_UNISWAP_PRICE)}};exports.getUniswapFee=A;exports.getUniswapPrice=P;exports.getUniswapPriceHelper=g;exports.searchPoolAndFee=w;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { utils as
|
|
1
|
+
import { utils as w } from "ethers";
|
|
2
2
|
import { networkRegistry as d } from "../../constants/chains.constants.mjs";
|
|
3
3
|
import "../../constants/vite.constants.mjs";
|
|
4
4
|
import "../../constants/contracts.constants.mjs";
|
|
5
5
|
import "../../constants/kyc.constants.mjs";
|
|
6
|
-
import { zeroAddress as
|
|
6
|
+
import { zeroAddress as A } from "../../constants/protocol.constants.mjs";
|
|
7
7
|
import "../../constants/coingecko.constants.mjs";
|
|
8
8
|
import "../../constants/axelar.constants.mjs";
|
|
9
9
|
import "../../constants/rewards.constants.mjs";
|
|
10
10
|
import "../../constants/reorg-depths.constants.mjs";
|
|
11
11
|
import { transactionErrorCodes as u } from "../../error-handling/error-codes.constants.mjs";
|
|
12
|
-
import { getAmountInWei as
|
|
12
|
+
import { getAmountInWei as l } from "./etherFunctions.mjs";
|
|
13
13
|
import "axios";
|
|
14
14
|
import "../../types/circom-data.types.mjs";
|
|
15
15
|
import { ContractType as p } from "../../types/ethereum-network.types.mjs";
|
|
@@ -17,23 +17,23 @@ import "../../types/transactions.types.mjs";
|
|
|
17
17
|
import "../../types/curve.types.mjs";
|
|
18
18
|
import "circomlibjs";
|
|
19
19
|
import { logError as C } from "../../error-handling/logError.mjs";
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const f = async (e, s, t, o) => {
|
|
21
|
+
const c = (await Promise.all(
|
|
22
22
|
[100, 500, 3e3, 1e4].map(async (r) => ({
|
|
23
|
-
poolAddress: await
|
|
23
|
+
poolAddress: await s.getPool(t, o, r),
|
|
24
24
|
fee: r
|
|
25
25
|
}))
|
|
26
|
-
)).filter(({ poolAddress: r }) => r !==
|
|
27
|
-
|
|
26
|
+
)).filter(({ poolAddress: r }) => r !== A), n = await Promise.all(
|
|
27
|
+
c.map(async (r) => ({
|
|
28
28
|
poolAddress: r.poolAddress,
|
|
29
29
|
fee: r.fee,
|
|
30
30
|
token1Balance: (await e.balanceOf(r.poolAddress)).toBigInt()
|
|
31
31
|
}))
|
|
32
|
-
), i =
|
|
32
|
+
), i = n.map((r) => r.token1Balance).reduce((r, m) => m >= r ? m : r, 0n);
|
|
33
33
|
if (i === 0n)
|
|
34
34
|
throw new Error(u.UNISWAP_NOT_ENOUGH_LIQUIDITY);
|
|
35
|
-
return
|
|
36
|
-
},
|
|
35
|
+
return n.find((r) => r.token1Balance === i);
|
|
36
|
+
}, g = async (e, s, t, o, c) => {
|
|
37
37
|
try {
|
|
38
38
|
if (!d[e.getCurrentChainId()].quoterV2Address)
|
|
39
39
|
throw Error("No Quoter Contract Provided");
|
|
@@ -41,44 +41,44 @@ const g = async (e, c, t, o) => {
|
|
|
41
41
|
p.UniswapV3QuoterContract,
|
|
42
42
|
d[e.getCurrentChainId()].quoterV2Address
|
|
43
43
|
).callStatic.quoteExactInputSingle({
|
|
44
|
-
tokenIn:
|
|
44
|
+
tokenIn: s.wrappedErc20TokenAddress ?? s.erc20TokenAddress,
|
|
45
45
|
tokenOut: t.wrappedErc20TokenAddress ?? t.erc20TokenAddress,
|
|
46
46
|
fee: o,
|
|
47
|
-
amountIn:
|
|
47
|
+
amountIn: c,
|
|
48
48
|
sqrtPriceLimitX96: 0
|
|
49
49
|
})).amountOut.toBigInt();
|
|
50
|
-
} catch (
|
|
51
|
-
throw C(
|
|
50
|
+
} catch (n) {
|
|
51
|
+
throw C(n), n;
|
|
52
52
|
}
|
|
53
|
-
}, I = async (e,
|
|
53
|
+
}, I = async (e, s, t) => {
|
|
54
54
|
try {
|
|
55
|
-
const o = e.getCurrentChainId(),
|
|
55
|
+
const o = e.getCurrentChainId(), c = e.getContractWithFetcher(
|
|
56
56
|
p.UniswapV3FactoryContract,
|
|
57
57
|
d[o].uniswapV3FactoryAddress
|
|
58
|
-
),
|
|
58
|
+
), n = e.getContractWithFetcher(
|
|
59
59
|
p.ERC20Contract,
|
|
60
60
|
t.wrappedErc20TokenAddress ?? t.erc20TokenAddress
|
|
61
|
-
), { fee: a } = await
|
|
62
|
-
s,
|
|
61
|
+
), { fee: a } = await f(
|
|
63
62
|
n,
|
|
64
|
-
c
|
|
63
|
+
c,
|
|
64
|
+
s.wrappedErc20TokenAddress ?? s.erc20TokenAddress,
|
|
65
65
|
t.wrappedErc20TokenAddress ?? t.erc20TokenAddress
|
|
66
66
|
);
|
|
67
67
|
return a;
|
|
68
68
|
} catch (o) {
|
|
69
69
|
throw console.log("Error in getUniswapFee", o), o;
|
|
70
70
|
}
|
|
71
|
-
}, L = async (e,
|
|
71
|
+
}, L = async (e, s, t, o) => {
|
|
72
72
|
try {
|
|
73
|
-
const
|
|
74
|
-
return { tokenPrice: await
|
|
75
|
-
} catch
|
|
76
|
-
throw
|
|
73
|
+
const c = await I(e, t, o), n = w.defaultAbiCoder.encode(["uint24"], [c]), a = l(t, s);
|
|
74
|
+
return { tokenPrice: await g(e, t, o, c, a), poolFee: n };
|
|
75
|
+
} catch {
|
|
76
|
+
throw Error(u.NO_UNISWAP_PRICE);
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
export {
|
|
80
80
|
I as getUniswapFee,
|
|
81
81
|
L as getUniswapPrice,
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
g as getUniswapPriceHelper,
|
|
83
|
+
f as searchPoolAndFee
|
|
84
84
|
};
|
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-D2n9Ry7V.js").href:new URL("../../assets/snarkjsWorkerLauncher-D2n9Ry7V.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 P=require("../workerProxy.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("../workerProxy.cjs"),n=require("../../constants/vite.constants.cjs"),w=require("snarkjs");function $(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,s.get?s:{enumerable:!0,get:()=>t[e]})}}return i.default=t,Object.freeze(i)}const h=$(w),c=new P.WorkerProxy,p=async t=>{const{input:i,wasmFilePath:e,zKeyFilePath:s,chainId:f}=t.payload.data,{hostLocation:{origin:l},constants:{isDevelopment:g,chains:{chainIds:b}}}=t.metadata;let o=e,r=s;const u=o.startsWith("https://");if(n.isNode&&!u){n.isWebpack?(o=`libs/hardhat/test/circuits/${e}`,r=`libs/hardhat/test/circuits/${s}`):!n.isWebpack&&g&&(o=`test/circuits/${e}`,r=`test/circuits/${s}`);const a=require("path");o=a.resolve(o),r=a.resolve(r)}n.isNode&&u?process.browser=!0:f===b.localhost&&!n.isNode&&(o=`${l}/${e}`,r=`${l}/${s}`);try{const{proof:a,publicSignals:d}=await h.groth16.fullProve(i,o,r),k=await h.groth16.exportSolidityCallData(a,d),y=JSON.parse(`[${k}]`);c.postMessageToMainThread({zkCallData:y,proof:a,publicSignals:d})}catch(a){console.log(a)}};c.attachWorkerSideOnMessage(p);exports.default=c;exports.onWorkerMessage=p;
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import { WorkerProxy as w } from "../workerProxy.mjs";
|
|
2
|
-
import { isNode as
|
|
2
|
+
import { isNode as i, isWebpack as h } from "../../constants/vite.constants.mjs";
|
|
3
3
|
import * as p from "snarkjs";
|
|
4
|
-
const
|
|
5
|
-
const { input:
|
|
6
|
-
hostLocation: { origin:
|
|
4
|
+
const u = new w(), y = async (r) => {
|
|
5
|
+
const { input: d, wasmFilePath: e, zKeyFilePath: o, chainId: f } = r.payload.data, {
|
|
6
|
+
hostLocation: { origin: l },
|
|
7
7
|
constants: {
|
|
8
8
|
isDevelopment: m,
|
|
9
|
-
chains: { chainIds:
|
|
9
|
+
chains: { chainIds: $ }
|
|
10
10
|
}
|
|
11
|
-
} =
|
|
12
|
-
let t =
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
|
|
11
|
+
} = r.metadata;
|
|
12
|
+
let t = e, a = o;
|
|
13
|
+
const c = t.startsWith("https://");
|
|
14
|
+
if (i && !c) {
|
|
15
|
+
h ? (t = `libs/hardhat/test/circuits/${e}`, a = `libs/hardhat/test/circuits/${o}`) : !h && m && (t = `test/circuits/${e}`, a = `test/circuits/${o}`);
|
|
16
16
|
const s = require("path");
|
|
17
|
-
t = s.resolve(t),
|
|
17
|
+
t = s.resolve(t), a = s.resolve(a);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
i && c ? process.browser = !0 : f === $.localhost && !i && (t = `${l}/${e}`, a = `${l}/${o}`);
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
f.postMessageToMainThread({ zkCallData: k, proof: s, publicSignals: h });
|
|
21
|
+
const { proof: s, publicSignals: n } = await p.groth16.fullProve(d, t, a), g = await p.groth16.exportSolidityCallData(s, n), k = JSON.parse(`[${g}]`);
|
|
22
|
+
u.postMessageToMainThread({ zkCallData: k, proof: s, publicSignals: n });
|
|
24
23
|
} catch (s) {
|
|
25
24
|
console.log(s);
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
|
-
|
|
27
|
+
u.attachWorkerSideOnMessage(y);
|
|
29
28
|
export {
|
|
30
|
-
|
|
29
|
+
u as default,
|
|
31
30
|
y as onWorkerMessage
|
|
32
31
|
};
|