@hinkal/common 0.0.113 → 0.0.115
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/assets/{snarkjsWorkerLauncher-fuD5h_j0.js → snarkjsWorkerLauncher-CaBCnle3.js} +283 -257
- package/assets/snarkjsWorkerLogic-BAbiO5gj.js +17935 -0
- package/assets/snarkjsWorkerLogic-wHJfYCfg.js +15636 -0
- package/assets/{utxoWorkerLogic-CtFLQiAX.js → utxoWorkerLogic-BGFm-Zl2.js} +2 -2
- package/assets/{zkProofWorkerLauncher-J3Ts5_Ba.js → zkProofWorkerLauncher-BteYxRBn.js} +1 -1
- package/assets/{zkProofWorkerLogic-CPNuu61R.js → zkProofWorkerLogic-DiLbAhAo.js} +8354 -8298
- package/common.mjs +644 -0
- package/common10.mjs +30 -0
- package/common100.mjs +156 -0
- package/common101.mjs +568 -0
- package/common102.mjs +1603 -0
- package/common103.mjs +1764 -0
- package/common104.mjs +2030 -0
- package/common105.mjs +701 -0
- package/common106.mjs +480 -0
- package/common107.mjs +2082 -0
- package/common108.mjs +39 -0
- package/common109.mjs +24 -0
- package/common11.mjs +30 -0
- package/common110.mjs +41 -0
- package/common111.mjs +206 -0
- package/common112.mjs +48 -0
- package/common113.mjs +39 -0
- package/common114.mjs +70 -0
- package/common115.mjs +67 -0
- package/common116.mjs +5 -0
- package/common117.mjs +61 -0
- package/common118.mjs +20 -0
- package/common119.mjs +7 -0
- package/common12.mjs +58 -0
- package/common120.mjs +22 -0
- package/common121.mjs +16 -0
- package/common122.mjs +57 -0
- package/common123.mjs +45 -0
- package/common124.mjs +57 -0
- package/common125.mjs +229 -0
- package/common126.mjs +203 -0
- package/common127.mjs +29 -0
- package/common128.mjs +38 -0
- package/common129.mjs +15 -0
- package/common13.mjs +156 -0
- package/common130.mjs +105 -0
- package/common131.mjs +4 -0
- package/common132.mjs +14 -0
- package/common133.mjs +7 -0
- package/common134.mjs +6 -0
- package/common135.mjs +8 -0
- package/common136.mjs +40 -0
- package/common137.mjs +41 -0
- package/common138.mjs +72 -0
- package/common139.mjs +107 -0
- package/common14.mjs +32 -0
- package/common140.mjs +9 -0
- package/common141.mjs +10 -0
- package/common142.mjs +97 -0
- package/common143.mjs +65 -0
- package/common144.mjs +61 -0
- package/common145.mjs +95 -0
- package/common146.mjs +129 -0
- package/common147.mjs +105 -0
- package/common148.mjs +96 -0
- package/common149.mjs +18 -0
- package/common15.mjs +16 -0
- package/common150.mjs +45 -0
- package/common151.mjs +41 -0
- package/common152.mjs +108 -0
- package/common153.mjs +40 -0
- package/common154.mjs +19 -0
- package/common155.mjs +24 -0
- package/common156.mjs +21 -0
- package/common157.mjs +22 -0
- package/common158.mjs +4 -0
- package/common159.mjs +4 -0
- package/common16.mjs +6 -0
- package/common160.mjs +15 -0
- package/common161.mjs +13 -0
- package/common162.mjs +4 -0
- package/common163.mjs +15 -0
- package/common164.mjs +36 -0
- package/common165.mjs +58 -0
- package/common166.mjs +27 -0
- package/common167.mjs +15 -0
- package/common168.mjs +25 -0
- package/common169.mjs +4 -0
- package/common17.mjs +6877 -0
- package/common170.mjs +85 -0
- package/common171.mjs +2251 -0
- package/common172.mjs +856 -0
- package/common173.mjs +973 -0
- package/common174.mjs +1255 -0
- package/common175.mjs +591 -0
- package/common176.mjs +1392 -0
- package/common177.mjs +463 -0
- package/common178.mjs +137 -0
- package/common179.mjs +2700 -0
- package/common18.mjs +7415 -0
- package/common180.mjs +946 -0
- package/common181.mjs +973 -0
- package/common182.mjs +1327 -0
- package/common183.mjs +591 -0
- package/common184.mjs +1455 -0
- package/common185.mjs +490 -0
- package/common186.mjs +137 -0
- package/common187.mjs +2768 -0
- package/common188.mjs +8 -0
- package/common189.mjs +14 -0
- package/common19.mjs +11427 -0
- package/common190.mjs +115623 -0
- package/common191.mjs +42 -0
- package/common192.mjs +1022 -0
- package/common193.mjs +1423 -0
- package/common194.mjs +208 -0
- package/common195.mjs +340 -0
- package/common196.mjs +674 -0
- package/common197.mjs +1002 -0
- package/common198.mjs +883 -0
- package/common199.mjs +262 -0
- package/common2.mjs +67 -0
- package/common20.mjs +7417 -0
- package/common200.mjs +264 -0
- package/common201.mjs +173 -0
- package/common202.mjs +999 -0
- package/common203.mjs +80 -0
- package/common204.mjs +56 -0
- package/common205.mjs +42 -0
- package/common206.mjs +14 -0
- package/common207.mjs +4 -0
- package/common208.mjs +62 -0
- package/common209.mjs +4 -0
- package/common21.mjs +7439 -0
- package/common210.mjs +4 -0
- package/common211.mjs +58 -0
- package/common212.mjs +40 -0
- package/common213.mjs +45 -0
- package/common214.mjs +36 -0
- package/common215.mjs +32 -0
- package/common216.mjs +44 -0
- package/common217.mjs +32 -0
- package/common218.mjs +38 -0
- package/common219.mjs +9 -0
- package/common22.mjs +7411 -0
- package/common220.mjs +32 -0
- package/common221.mjs +47 -0
- package/common222.mjs +14 -0
- package/common223.mjs +30 -0
- package/common224.mjs +91 -0
- package/common225.mjs +112 -0
- package/common226.mjs +96 -0
- package/common227.mjs +30 -0
- package/common228.mjs +138 -0
- package/common229.mjs +18 -0
- package/common23.mjs +8425 -0
- package/common230.mjs +42 -0
- package/common231.mjs +60 -0
- package/common232.mjs +48 -0
- package/common233.mjs +47 -0
- package/common234.mjs +44 -0
- package/common235.mjs +74 -0
- package/common236.mjs +4 -0
- package/common237.mjs +60 -0
- package/common238.mjs +4 -0
- package/common239.mjs +30 -0
- package/common24.mjs +9600 -0
- package/common240.mjs +4 -0
- package/common241.mjs +153 -0
- package/common242.mjs +31 -0
- package/common243.mjs +30 -0
- package/common244.mjs +68 -0
- package/common245.mjs +57 -0
- package/common246.mjs +97 -0
- package/common247.mjs +36 -0
- package/common248.mjs +43 -0
- package/common249.mjs +44 -0
- package/common25.mjs +13283 -0
- package/common250.mjs +59 -0
- package/common251.mjs +75 -0
- package/{snarkjsWorkerLogic-CVna_BW9.mjs → common252.mjs} +1 -1
- package/common253.mjs +66 -0
- package/common254.mjs +70 -0
- package/common255.mjs +211 -0
- package/common256.mjs +8 -0
- package/{workerProxy-BDj498Ht.mjs → common257.mjs} +1 -1
- package/common26.mjs +4329 -0
- package/common27.mjs +4329 -0
- package/common28.mjs +204 -0
- package/common29.mjs +57 -0
- package/common3.mjs +27 -0
- package/common30.mjs +276 -0
- package/common31.mjs +118 -0
- package/common32.mjs +157 -0
- package/common33.mjs +29 -0
- package/common34.mjs +26 -0
- package/common35.mjs +53 -0
- package/common36.mjs +55 -0
- package/common37.mjs +18 -0
- package/common38.mjs +636 -0
- package/common39.mjs +24 -0
- package/common4.mjs +37 -0
- package/common40.mjs +13 -0
- package/common41.mjs +27 -0
- package/common42.mjs +15 -0
- package/common43.mjs +24 -0
- package/common44.mjs +253 -0
- package/common45.mjs +26 -0
- package/common46.mjs +15 -0
- package/common47.mjs +9 -0
- package/common48.mjs +25 -0
- package/common49.mjs +40 -0
- package/common5.mjs +37 -0
- package/common50.mjs +41 -0
- package/common51.mjs +90 -0
- package/common52.mjs +10 -0
- package/common53.mjs +299 -0
- package/common54.mjs +101 -0
- package/common55.mjs +83 -0
- package/common56.mjs +112 -0
- package/common57.mjs +140 -0
- package/common58.mjs +95 -0
- package/common59.mjs +98 -0
- package/common6.mjs +32 -0
- package/common60.mjs +5 -0
- package/common61.mjs +91 -0
- package/common62.mjs +66 -0
- package/common63.mjs +49 -0
- package/common64.mjs +177 -0
- package/common65.mjs +8 -0
- package/common66.mjs +131 -0
- package/common67.mjs +132 -0
- package/common68.mjs +59 -0
- package/common69.mjs +35 -0
- package/common7.mjs +37 -0
- package/common70.mjs +118 -0
- package/common71.mjs +134 -0
- package/common72.mjs +33 -0
- package/common73.mjs +29 -0
- package/common74.mjs +218 -0
- package/common75.mjs +194 -0
- package/common76.mjs +62 -0
- package/common77.mjs +181 -0
- package/common78.mjs +83 -0
- package/common79.mjs +9 -0
- package/common8.mjs +38 -0
- package/common80.mjs +21 -0
- package/common81.mjs +184 -0
- package/common82.mjs +53 -0
- package/common83.mjs +35 -0
- package/common84.mjs +7 -0
- package/common85.mjs +4 -0
- package/common86.mjs +350 -0
- package/common87.mjs +570 -0
- package/common88.mjs +519 -0
- package/common89.mjs +1422 -0
- package/common9.mjs +41 -0
- package/common90.mjs +1136 -0
- package/common91.mjs +334 -0
- package/common92.mjs +291 -0
- package/common93.mjs +205 -0
- package/common94.mjs +201 -0
- package/common95.mjs +89 -0
- package/common96.mjs +721 -0
- package/common97.mjs +346 -0
- package/common98.mjs +542 -0
- package/common99.mjs +393 -0
- package/package.json +4 -4
- package/assets/snarkjsWorkerLogic-B6N4z_eM.js +0 -12136
- package/assets/snarkjsWorkerLogic-Fv0M38Mc.js +0 -12087
- package/index-DXElTGy9.mjs +0 -254449
- package/index.js +0 -457
- package/utxoWorkerLogic-B1Hh-bq4.mjs +0 -64
- package/zkProofWorkerLogic-D9rxuuiK.mjs +0 -60
package/common220.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import o from "axios";
|
|
2
|
+
import "./common28.mjs";
|
|
3
|
+
import "./common157.mjs";
|
|
4
|
+
import "./common164.mjs";
|
|
5
|
+
import "./common168.mjs";
|
|
6
|
+
import "ethers";
|
|
7
|
+
import "circomlibjs";
|
|
8
|
+
import "./common51.mjs";
|
|
9
|
+
import { getServerURL as t } from "./common2.mjs";
|
|
10
|
+
import "./common50.mjs";
|
|
11
|
+
import "./common139.mjs";
|
|
12
|
+
import "./common191.mjs";
|
|
13
|
+
import "./common117.mjs";
|
|
14
|
+
import "./common72.mjs";
|
|
15
|
+
import "./common121.mjs";
|
|
16
|
+
import "./common35.mjs";
|
|
17
|
+
import { API_CONFIG as p } from "./common32.mjs";
|
|
18
|
+
import "./common33.mjs";
|
|
19
|
+
import "./common129.mjs";
|
|
20
|
+
import "./common42.mjs";
|
|
21
|
+
import "./common31.mjs";
|
|
22
|
+
import "./common77.mjs";
|
|
23
|
+
import "libsodium-wrappers";
|
|
24
|
+
import "./common30.mjs";
|
|
25
|
+
import "./common36.mjs";
|
|
26
|
+
import "./common41.mjs";
|
|
27
|
+
async function G(r) {
|
|
28
|
+
return (await o.post(`${t(r)}${p.ROUTES.restoreSnapshots}`)).data;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
G as restoreSnapshots
|
|
32
|
+
};
|
package/common221.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import "./common28.mjs";
|
|
2
|
+
import "./common157.mjs";
|
|
3
|
+
import "./common164.mjs";
|
|
4
|
+
import "./common168.mjs";
|
|
5
|
+
import "ethers";
|
|
6
|
+
import "circomlibjs";
|
|
7
|
+
import "./common51.mjs";
|
|
8
|
+
import "axios";
|
|
9
|
+
import "./common50.mjs";
|
|
10
|
+
import "./common139.mjs";
|
|
11
|
+
import "./common191.mjs";
|
|
12
|
+
import "./common117.mjs";
|
|
13
|
+
import "./common72.mjs";
|
|
14
|
+
import "./common121.mjs";
|
|
15
|
+
import "./common129.mjs";
|
|
16
|
+
import "./common42.mjs";
|
|
17
|
+
import "./common31.mjs";
|
|
18
|
+
import "./common35.mjs";
|
|
19
|
+
import "./common33.mjs";
|
|
20
|
+
import "./common77.mjs";
|
|
21
|
+
import "libsodium-wrappers";
|
|
22
|
+
import "./common30.mjs";
|
|
23
|
+
import "./common36.mjs";
|
|
24
|
+
import "./common41.mjs";
|
|
25
|
+
import { API as i } from "./common12.mjs";
|
|
26
|
+
const q = (e) => ({
|
|
27
|
+
async getAccessToken() {
|
|
28
|
+
const r = e.getCurrentChainId();
|
|
29
|
+
return i.getZkMeAccessToken(r);
|
|
30
|
+
},
|
|
31
|
+
async getUserAccounts() {
|
|
32
|
+
return [await e.getEthereumAddress()];
|
|
33
|
+
},
|
|
34
|
+
async delegateTransaction(r) {
|
|
35
|
+
const t = await e.getProviderAdapter(), o = {
|
|
36
|
+
...r,
|
|
37
|
+
chainId: Number(r.chainId),
|
|
38
|
+
type: r.type ? r.type : void 0,
|
|
39
|
+
maxPriorityFeePerGas: r.maxPriorityFeePerGas ? r.maxPriorityFeePerGas : void 0,
|
|
40
|
+
maxFeePerGas: r.maxFeePerGas ? r.maxFeePerGas : void 0
|
|
41
|
+
};
|
|
42
|
+
return (await t.sendTransaction(o)).hash;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export {
|
|
46
|
+
q as getHinkalZkMeProvider
|
|
47
|
+
};
|
package/common222.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CustomJSONStringify as c } from "./common240.mjs";
|
|
2
|
+
const u = (o) => {
|
|
3
|
+
const t = /* @__PURE__ */ new Map();
|
|
4
|
+
return (...n) => {
|
|
5
|
+
const e = c(n);
|
|
6
|
+
if (t.has(e))
|
|
7
|
+
return t.get(e);
|
|
8
|
+
const r = o(...n);
|
|
9
|
+
return t.set(e, r), r;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
u as memoizeFunc
|
|
14
|
+
};
|
package/common223.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import t from "axios";
|
|
2
|
+
import "./common28.mjs";
|
|
3
|
+
import "./common157.mjs";
|
|
4
|
+
import "./common164.mjs";
|
|
5
|
+
import "./common168.mjs";
|
|
6
|
+
import "ethers";
|
|
7
|
+
import "circomlibjs";
|
|
8
|
+
import "./common51.mjs";
|
|
9
|
+
import { getServerURL as m } from "./common2.mjs";
|
|
10
|
+
import "./common50.mjs";
|
|
11
|
+
import "./common139.mjs";
|
|
12
|
+
import "./common191.mjs";
|
|
13
|
+
import "./common117.mjs";
|
|
14
|
+
import "./common72.mjs";
|
|
15
|
+
import "./common121.mjs";
|
|
16
|
+
import "./common35.mjs";
|
|
17
|
+
import { API_CONFIG as i } from "./common32.mjs";
|
|
18
|
+
import "./common33.mjs";
|
|
19
|
+
import "./common129.mjs";
|
|
20
|
+
import "./common42.mjs";
|
|
21
|
+
import "./common31.mjs";
|
|
22
|
+
import "./common77.mjs";
|
|
23
|
+
import "libsodium-wrappers";
|
|
24
|
+
import "./common30.mjs";
|
|
25
|
+
import "./common36.mjs";
|
|
26
|
+
import "./common41.mjs";
|
|
27
|
+
const b = (o, r) => t.post(`${m(r)}${i.ROUTES.monitor}`, { address: o });
|
|
28
|
+
export {
|
|
29
|
+
b as monitor
|
|
30
|
+
};
|
package/common224.mjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ethers as M } from "ethers";
|
|
2
|
+
import { networkRegistry as U } from "./common28.mjs";
|
|
3
|
+
import "./common157.mjs";
|
|
4
|
+
import { ExternalActionId as m } from "./common159.mjs";
|
|
5
|
+
import { LidoAction as s, LidoVariant as u } from "./common160.mjs";
|
|
6
|
+
import "./common164.mjs";
|
|
7
|
+
import "./common168.mjs";
|
|
8
|
+
import { transactionErrorCodes as N } from "./common81.mjs";
|
|
9
|
+
import "circomlibjs";
|
|
10
|
+
import "./common51.mjs";
|
|
11
|
+
import "axios";
|
|
12
|
+
import "./common50.mjs";
|
|
13
|
+
import { addPaddingToUtxos as D } from "./common139.mjs";
|
|
14
|
+
import { outputUtxoProcessing as P } from "./common123.mjs";
|
|
15
|
+
import { constructZkProof as H } from "./common146.mjs";
|
|
16
|
+
import { estimateGasRelayer as S } from "./common229.mjs";
|
|
17
|
+
import { transactCallRelayer as b } from "./common230.mjs";
|
|
18
|
+
import "./common117.mjs";
|
|
19
|
+
import "./common72.mjs";
|
|
20
|
+
import "./common121.mjs";
|
|
21
|
+
import "./common35.mjs";
|
|
22
|
+
import "./common33.mjs";
|
|
23
|
+
import { processAmountChanges as v } from "./common125.mjs";
|
|
24
|
+
import { getFlatFees as K } from "./common126.mjs";
|
|
25
|
+
import "./common129.mjs";
|
|
26
|
+
import "./common42.mjs";
|
|
27
|
+
import "./common31.mjs";
|
|
28
|
+
import "./common191.mjs";
|
|
29
|
+
import "./common77.mjs";
|
|
30
|
+
import "libsodium-wrappers";
|
|
31
|
+
import "./common30.mjs";
|
|
32
|
+
import "./common36.mjs";
|
|
33
|
+
import "./common41.mjs";
|
|
34
|
+
const _ = (t, i) => {
|
|
35
|
+
if (t === u.Ethereum)
|
|
36
|
+
return i === s.Stake ? m.LidoETH : m.LidoETHNFT;
|
|
37
|
+
if (t === u.Polygon)
|
|
38
|
+
return i === s.Stake ? m.LidoMATIC : m.LidoMATICNFT;
|
|
39
|
+
throw new Error("Invalid LidoVariant used");
|
|
40
|
+
}, $ = (t) => M.utils.defaultAbiCoder.encode(["uint8"], [Number(t)]), Ct = async (t, i, e, a, o, f, A = !1) => {
|
|
41
|
+
const p = [...await D(t, a, o, 6, f)], y = p[0].length, C = `${e === s.Stake ? "swapperM" : "swapperToken"}2x${y}x1`, n = _(i, e), { flatFees: x, feeUnit: L } = await K(
|
|
42
|
+
t.getCurrentChainId(),
|
|
43
|
+
a,
|
|
44
|
+
n,
|
|
45
|
+
o,
|
|
46
|
+
e
|
|
47
|
+
);
|
|
48
|
+
o = v({
|
|
49
|
+
erc20Addresses: a,
|
|
50
|
+
amountChanges: o,
|
|
51
|
+
flatFees: x,
|
|
52
|
+
feeUnit: L,
|
|
53
|
+
externalActionId: n,
|
|
54
|
+
action: e
|
|
55
|
+
});
|
|
56
|
+
const g = e === s.Request ? o.map(() => !1) : o.map((r) => r > 0n), l = [];
|
|
57
|
+
for (let r = 0; r < a.length; r += 1) {
|
|
58
|
+
const { outputUtxos: F } = P(
|
|
59
|
+
t.userKeys,
|
|
60
|
+
p[r],
|
|
61
|
+
o[r],
|
|
62
|
+
void 0,
|
|
63
|
+
f[r]
|
|
64
|
+
);
|
|
65
|
+
l.push(F);
|
|
66
|
+
}
|
|
67
|
+
if (!await t.getRandomRelay())
|
|
68
|
+
throw Error(N.RELAYER_NOT_AVAILABLE);
|
|
69
|
+
const { lidoExternalActionEthAddress: T, lidoExternalActionMaticAddress: I } = U[t.getCurrentChainId()].contractData, c = i === u.Ethereum ? T : I;
|
|
70
|
+
if (!c)
|
|
71
|
+
throw new Error("Can't find external action address");
|
|
72
|
+
const R = $(e), { zkCallData: E, circomData: d, dimData: w } = await H(
|
|
73
|
+
t.merkleTreeHinkal,
|
|
74
|
+
t.merkleTreeAccessToken,
|
|
75
|
+
p,
|
|
76
|
+
l,
|
|
77
|
+
t.userKeys,
|
|
78
|
+
C,
|
|
79
|
+
n,
|
|
80
|
+
c,
|
|
81
|
+
R,
|
|
82
|
+
await t.getRandomRelay(),
|
|
83
|
+
t.getCurrentChainId(),
|
|
84
|
+
g,
|
|
85
|
+
x
|
|
86
|
+
);
|
|
87
|
+
return console.log({ externalActionAddress: c, externalActionId: n, circomData: d }), A ? await S(t, E, w, d) : await b(t.getCurrentChainId(), E, w, d);
|
|
88
|
+
};
|
|
89
|
+
export {
|
|
90
|
+
Ct as hinkalActionLido
|
|
91
|
+
};
|
package/common225.mjs
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import "./common28.mjs";
|
|
2
|
+
import "./common157.mjs";
|
|
3
|
+
import { ContractType as u } from "./common158.mjs";
|
|
4
|
+
import { ExternalActionId as W } from "./common159.mjs";
|
|
5
|
+
import { VolatileAction as a } from "./common160.mjs";
|
|
6
|
+
import "./common164.mjs";
|
|
7
|
+
import "./common168.mjs";
|
|
8
|
+
import "ethers";
|
|
9
|
+
import { transactionErrorCodes as N } from "./common81.mjs";
|
|
10
|
+
import { zeroAddress as y } from "./common34.mjs";
|
|
11
|
+
import "circomlibjs";
|
|
12
|
+
import "./common51.mjs";
|
|
13
|
+
import "axios";
|
|
14
|
+
import "./common50.mjs";
|
|
15
|
+
import { addPaddingToUtxos as H } from "./common139.mjs";
|
|
16
|
+
import { outputUtxoProcessing as L } from "./common123.mjs";
|
|
17
|
+
import { constructZkProof as M } from "./common146.mjs";
|
|
18
|
+
import { estimateGasRelayer as P } from "./common229.mjs";
|
|
19
|
+
import { transactCallRelayer as b } from "./common230.mjs";
|
|
20
|
+
import { transactCallDirect as C } from "./common231.mjs";
|
|
21
|
+
import "./common117.mjs";
|
|
22
|
+
import { getERC20Token as z } from "./common118.mjs";
|
|
23
|
+
import "./common121.mjs";
|
|
24
|
+
import "./common35.mjs";
|
|
25
|
+
import "./common33.mjs";
|
|
26
|
+
import { getFlatFees as K } from "./common126.mjs";
|
|
27
|
+
import "./common129.mjs";
|
|
28
|
+
import "./common42.mjs";
|
|
29
|
+
import "./common31.mjs";
|
|
30
|
+
import "./common191.mjs";
|
|
31
|
+
import { VolatileHelper as D } from "./common77.mjs";
|
|
32
|
+
import "./common72.mjs";
|
|
33
|
+
import "libsodium-wrappers";
|
|
34
|
+
import "./common30.mjs";
|
|
35
|
+
import "./common36.mjs";
|
|
36
|
+
import "./common41.mjs";
|
|
37
|
+
const Rt = async (t, i, o, R, T) => {
|
|
38
|
+
const { action: r, isRelayerOff: n, recipientAddress: V, baseExternalActionId: I, baseExternalActionMetadata: F } = R, f = z(i[0], t.getCurrentChainId());
|
|
39
|
+
if (!f)
|
|
40
|
+
throw Error("Deposit Action: No Token Found");
|
|
41
|
+
const c = [...o], S = [...i];
|
|
42
|
+
let A = [], x = o.map(() => 0n);
|
|
43
|
+
({ erc20Addresses: i, amountChanges: o, onChainCreation: A } = await D.processVolatileData(
|
|
44
|
+
t.getCurrentChainId(),
|
|
45
|
+
r,
|
|
46
|
+
i,
|
|
47
|
+
o
|
|
48
|
+
)), console.log("pre-amounts", o);
|
|
49
|
+
const p = await D.getVolatileExternalData(
|
|
50
|
+
t,
|
|
51
|
+
r,
|
|
52
|
+
c,
|
|
53
|
+
V,
|
|
54
|
+
I,
|
|
55
|
+
F
|
|
56
|
+
);
|
|
57
|
+
if (!p)
|
|
58
|
+
throw Error("No External Action Data");
|
|
59
|
+
(r === a.Withdraw && !n || r === a.Swap) && ({ flatFees: x } = await K(
|
|
60
|
+
t.getCurrentChainId(),
|
|
61
|
+
S,
|
|
62
|
+
W.Volatile,
|
|
63
|
+
c,
|
|
64
|
+
r
|
|
65
|
+
), r === a.Swap && (o[1] = 0n), console.log("hinkalActionVolatile flatFees:", {
|
|
66
|
+
flatFees: x,
|
|
67
|
+
erc20Addresses: i,
|
|
68
|
+
amountChanges: o,
|
|
69
|
+
originalAmountChanges: c,
|
|
70
|
+
externalActionData: p
|
|
71
|
+
}));
|
|
72
|
+
const g = [...await H(t, i, o)], U = `swapperM${o.length.toString()}x${g[0].length}x1`, d = [];
|
|
73
|
+
for (let e = 0; e < i.length; e += 1) {
|
|
74
|
+
const { outputUtxos: w } = L(t.userKeys, g[e], o[e]);
|
|
75
|
+
d.push(w);
|
|
76
|
+
}
|
|
77
|
+
const E = r === a.Deposit || n ? y : await t.getRandomRelay();
|
|
78
|
+
if (!n && !E)
|
|
79
|
+
throw Error(N.RELAYER_NOT_AVAILABLE);
|
|
80
|
+
const { zkCallData: m, circomData: l, dimData: s } = await M(
|
|
81
|
+
t.merkleTreeHinkal,
|
|
82
|
+
t.merkleTreeAccessToken,
|
|
83
|
+
g,
|
|
84
|
+
d,
|
|
85
|
+
t.userKeys,
|
|
86
|
+
U,
|
|
87
|
+
p.externalActionId,
|
|
88
|
+
p.externalAddress,
|
|
89
|
+
p.externalActionMetadata,
|
|
90
|
+
n ? y : E,
|
|
91
|
+
t.getCurrentChainId(),
|
|
92
|
+
A,
|
|
93
|
+
x
|
|
94
|
+
);
|
|
95
|
+
if (console.log("after proof generation"), r === a.Deposit) {
|
|
96
|
+
const e = t.getContractWithSigner(u.VolatileVault), w = t.getContractWithSigner(u.HinkalWrapper);
|
|
97
|
+
return console.log("here", { contractToApprove: e }), await C(
|
|
98
|
+
t,
|
|
99
|
+
c[0],
|
|
100
|
+
f,
|
|
101
|
+
m,
|
|
102
|
+
l,
|
|
103
|
+
s,
|
|
104
|
+
e,
|
|
105
|
+
w
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
return r === a.Withdraw && n ? await C(t, o[0], f, m, l, s) : T ? await P(t, m, s, l) : await b(t.getCurrentChainId(), m, s, l);
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
Rt as hinkalActionVolatile
|
|
112
|
+
};
|
package/common226.mjs
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ethers as I } from "ethers";
|
|
2
|
+
import { defaultHookData as U } from "./common157.mjs";
|
|
3
|
+
import { ExternalActionId as h } from "./common159.mjs";
|
|
4
|
+
import { PendleLPAction as A } from "./common160.mjs";
|
|
5
|
+
import "./common164.mjs";
|
|
6
|
+
import "./common168.mjs";
|
|
7
|
+
import { networkRegistry as k } from "./common28.mjs";
|
|
8
|
+
import "./common33.mjs";
|
|
9
|
+
import "./common30.mjs";
|
|
10
|
+
import "./common31.mjs";
|
|
11
|
+
import "./common35.mjs";
|
|
12
|
+
import "./common36.mjs";
|
|
13
|
+
import "./common41.mjs";
|
|
14
|
+
import "./common42.mjs";
|
|
15
|
+
import { transactionErrorCodes as F } from "./common81.mjs";
|
|
16
|
+
import "circomlibjs";
|
|
17
|
+
import "./common51.mjs";
|
|
18
|
+
import "axios";
|
|
19
|
+
import "./common50.mjs";
|
|
20
|
+
import { addPaddingToUtxos as P } from "./common139.mjs";
|
|
21
|
+
import { outputUtxoProcessing as O } from "./common123.mjs";
|
|
22
|
+
import { constructZkProof as T } from "./common146.mjs";
|
|
23
|
+
import { estimateGasRelayer as b } from "./common229.mjs";
|
|
24
|
+
import { transactCallRelayer as S } from "./common230.mjs";
|
|
25
|
+
import "./common117.mjs";
|
|
26
|
+
import "./common72.mjs";
|
|
27
|
+
import "./common121.mjs";
|
|
28
|
+
import { processAmountChanges as v } from "./common125.mjs";
|
|
29
|
+
import { getFlatFees as z } from "./common126.mjs";
|
|
30
|
+
import "./common129.mjs";
|
|
31
|
+
import "./common191.mjs";
|
|
32
|
+
import "./common77.mjs";
|
|
33
|
+
import "libsodium-wrappers";
|
|
34
|
+
const G = (t, o) => {
|
|
35
|
+
if (t === A.AddOrRemoveLiquidity)
|
|
36
|
+
return o.length === 3 ? [!1, !0, !1] : [!1, !0, !1, !1];
|
|
37
|
+
if (t === A.Checkpoint)
|
|
38
|
+
return [!1, !0];
|
|
39
|
+
throw new Error("Unknown PendleLPAction not implemented");
|
|
40
|
+
}, H = (t, o) => {
|
|
41
|
+
const { pendleLPAction: r, lpAddress: e, evmData: a } = t;
|
|
42
|
+
return I.utils.defaultAbiCoder.encode(
|
|
43
|
+
["uint8", "address", "uint256", "uint256", "bytes"],
|
|
44
|
+
[r, e, o[0][0].amount, o[0][0].timeStamp, a]
|
|
45
|
+
);
|
|
46
|
+
}, Ct = async (t, o, r, e, a, g = !1) => {
|
|
47
|
+
const m = h.PendleLP, { pendleLPAction: s } = e, i = [...await P(t, o, r)], y = `swapperMO${r.length.toString()}x${i[0].length}x1`, { flatFees: c, feeUnit: C } = await z(
|
|
48
|
+
t.getCurrentChainId(),
|
|
49
|
+
o,
|
|
50
|
+
m,
|
|
51
|
+
r,
|
|
52
|
+
s,
|
|
53
|
+
a
|
|
54
|
+
);
|
|
55
|
+
console.log("hinkalActionPendle flatFees:", c), r = v({
|
|
56
|
+
erc20Addresses: o,
|
|
57
|
+
amountChanges: r,
|
|
58
|
+
flatFees: c,
|
|
59
|
+
feeUnit: C,
|
|
60
|
+
externalActionId: m,
|
|
61
|
+
action: s,
|
|
62
|
+
gasTokenAddress: a
|
|
63
|
+
});
|
|
64
|
+
const u = [];
|
|
65
|
+
for (let n = 0; n < o.length; n += 1) {
|
|
66
|
+
const { outputUtxos: R } = O(t.userKeys, i[n], r[n]);
|
|
67
|
+
u.push(R);
|
|
68
|
+
}
|
|
69
|
+
const x = G(s, o), { contractData: w } = k[t.getCurrentChainId()], E = w?.pendleLPExternalActionInstanceAddress, D = H(e, i), d = await t.getRandomRelay();
|
|
70
|
+
if (!d)
|
|
71
|
+
throw Error(F.RELAYER_NOT_AVAILABLE);
|
|
72
|
+
const L = { ...U }, { zkCallData: p, circomData: l, dimData: f } = await T(
|
|
73
|
+
t.merkleTreeHinkal,
|
|
74
|
+
t.merkleTreeAccessToken,
|
|
75
|
+
i,
|
|
76
|
+
u,
|
|
77
|
+
t.userKeys,
|
|
78
|
+
y,
|
|
79
|
+
m,
|
|
80
|
+
E,
|
|
81
|
+
D,
|
|
82
|
+
d,
|
|
83
|
+
t.getCurrentChainId(),
|
|
84
|
+
x,
|
|
85
|
+
c,
|
|
86
|
+
L
|
|
87
|
+
);
|
|
88
|
+
return console.log("hinkalActionPendle: zkCallData, dimData, circomData:", { zkCallData: p, dimData: f, circomData: l }), g ? await b(t, p, f, l) : await S(t.getCurrentChainId(), p, f, l);
|
|
89
|
+
}, xt = async (t, o, r) => {
|
|
90
|
+
const e = [...await P(t, [o], [-1n * r])];
|
|
91
|
+
return { amount: e[0][0].amount, timestamp: e[0][0].timeStamp };
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
Ct as hinkalActionPendleLP,
|
|
95
|
+
xt as hinkalGetPendleLPClaimableParams
|
|
96
|
+
};
|
package/common227.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import i from "axios";
|
|
2
|
+
import "./common28.mjs";
|
|
3
|
+
import "./common157.mjs";
|
|
4
|
+
import "./common164.mjs";
|
|
5
|
+
import "./common168.mjs";
|
|
6
|
+
import "ethers";
|
|
7
|
+
import "circomlibjs";
|
|
8
|
+
import "./common51.mjs";
|
|
9
|
+
import { getServerURL as m } from "./common2.mjs";
|
|
10
|
+
import "./common50.mjs";
|
|
11
|
+
import "./common139.mjs";
|
|
12
|
+
import "./common191.mjs";
|
|
13
|
+
import "./common117.mjs";
|
|
14
|
+
import "./common72.mjs";
|
|
15
|
+
import "./common121.mjs";
|
|
16
|
+
import "./common35.mjs";
|
|
17
|
+
import { API_CONFIG as p } from "./common32.mjs";
|
|
18
|
+
import "./common33.mjs";
|
|
19
|
+
import "./common129.mjs";
|
|
20
|
+
import "./common42.mjs";
|
|
21
|
+
import "./common31.mjs";
|
|
22
|
+
import "./common77.mjs";
|
|
23
|
+
import "libsodium-wrappers";
|
|
24
|
+
import "./common30.mjs";
|
|
25
|
+
import "./common36.mjs";
|
|
26
|
+
import "./common41.mjs";
|
|
27
|
+
const T = async (t, o, r) => (await i.get(`${m(t)}${p.ROUTES.connextReceiveFee(o, r)}`)).data;
|
|
28
|
+
export {
|
|
29
|
+
T as getConnextReceiveFee
|
|
30
|
+
};
|
package/common228.mjs
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import "./common28.mjs";
|
|
2
|
+
import "./common157.mjs";
|
|
3
|
+
import { ContractType as k } from "./common158.mjs";
|
|
4
|
+
import { ExternalActionId as h } from "./common159.mjs";
|
|
5
|
+
import "./common164.mjs";
|
|
6
|
+
import "./common168.mjs";
|
|
7
|
+
import { HinkalStakeMode as g } from "./common169.mjs";
|
|
8
|
+
import { randomBigInt as B } from "./common137.mjs";
|
|
9
|
+
import { Utxo as f } from "./common71.mjs";
|
|
10
|
+
import "axios";
|
|
11
|
+
import "ethers";
|
|
12
|
+
import { UserKeys as O } from "./common51.mjs";
|
|
13
|
+
import "./common50.mjs";
|
|
14
|
+
import { ownerPublicKey as b, zeroAddress as N } from "./common34.mjs";
|
|
15
|
+
import { addPaddingToUtxos as z } from "./common139.mjs";
|
|
16
|
+
import { outputUtxoProcessing as $ } from "./common123.mjs";
|
|
17
|
+
import { constructZkProof as j } from "./common146.mjs";
|
|
18
|
+
import "./common191.mjs";
|
|
19
|
+
import "./common117.mjs";
|
|
20
|
+
import { getERC20Token as Z, getHToken as q } from "./common118.mjs";
|
|
21
|
+
import "./common121.mjs";
|
|
22
|
+
import "./common35.mjs";
|
|
23
|
+
import "./common33.mjs";
|
|
24
|
+
import "./common129.mjs";
|
|
25
|
+
import { transactCallDirect as T } from "./common231.mjs";
|
|
26
|
+
import "circomlibjs";
|
|
27
|
+
import "./common42.mjs";
|
|
28
|
+
import "./common31.mjs";
|
|
29
|
+
import "./common77.mjs";
|
|
30
|
+
import "./common72.mjs";
|
|
31
|
+
import { encryptStake as w, createStakeCommitment as G, encodeHStakeMetadata as J } from "./common153.mjs";
|
|
32
|
+
import "./common30.mjs";
|
|
33
|
+
import "./common36.mjs";
|
|
34
|
+
import "./common41.mjs";
|
|
35
|
+
const It = async (t, y, e, a, s) => {
|
|
36
|
+
const A = await t.getEthereumAddress(), m = Z(y[0], t.getCurrentChainId());
|
|
37
|
+
if (!m)
|
|
38
|
+
throw Error("Deposit Action: No Token Found");
|
|
39
|
+
const c = a === g.Stake, n = a === g.Unstake, { symbol: U } = m;
|
|
40
|
+
console.log(`${a} token ${U} Start`);
|
|
41
|
+
const { erc20TokenAddress: E } = m, r = [
|
|
42
|
+
...await z(
|
|
43
|
+
t,
|
|
44
|
+
y,
|
|
45
|
+
e,
|
|
46
|
+
2,
|
|
47
|
+
void 0,
|
|
48
|
+
a !== g.Deposit
|
|
49
|
+
)
|
|
50
|
+
];
|
|
51
|
+
if (c || n) {
|
|
52
|
+
r[0][0] = f.createFrom(r[0][0], {
|
|
53
|
+
amount: e[0] * (c ? 1n : -1n),
|
|
54
|
+
isStakeOrUnstakeInput: !0
|
|
55
|
+
});
|
|
56
|
+
for (let o = 0; o < r.length; o += 1)
|
|
57
|
+
for (let i = 0; i < r[o].length; i += 1)
|
|
58
|
+
o === 0 && i === 0 || (r[o][i] = f.createFrom(r[o][i], { amount: 0n }));
|
|
59
|
+
}
|
|
60
|
+
const { outputUtxos: K } = $(t.userKeys, r[0], e[0]), p = [
|
|
61
|
+
K.map(
|
|
62
|
+
(o) => f.createFrom(o, {
|
|
63
|
+
isStake: c,
|
|
64
|
+
isUnstakeOutput: n
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
];
|
|
68
|
+
n && (p[0][0] = f.createFrom(p[0][0], {
|
|
69
|
+
amount: 0n,
|
|
70
|
+
isUnstakeOutput: n
|
|
71
|
+
}));
|
|
72
|
+
const H = [!1], d = B(30), I = O.getEncryptionKeyPair(t.userKeys.getShieldedPrivateKey()), P = w(d, s, b), D = w(d, s, I.publicKey), F = n ? 0n : G(
|
|
73
|
+
!0,
|
|
74
|
+
s,
|
|
75
|
+
d,
|
|
76
|
+
E,
|
|
77
|
+
e[0],
|
|
78
|
+
BigInt(p[0][0].timeStamp)
|
|
79
|
+
), W = J(
|
|
80
|
+
c ? 0 : 1,
|
|
81
|
+
F,
|
|
82
|
+
A,
|
|
83
|
+
P,
|
|
84
|
+
D
|
|
85
|
+
), C = t.getContractWithSigner(k.HinkalWrapper2), u = t.getContractWithSigner(k.HinkalStakeExternalAction);
|
|
86
|
+
console.log("external action address", u.address);
|
|
87
|
+
const { zkCallData: S, dimData: x, circomData: l } = await j(
|
|
88
|
+
t.merkleTreeHinkal,
|
|
89
|
+
t.merkleTreeAccessToken,
|
|
90
|
+
r,
|
|
91
|
+
p,
|
|
92
|
+
t.userKeys,
|
|
93
|
+
"swapperME1x2x1",
|
|
94
|
+
h.HinkalStake,
|
|
95
|
+
u.address,
|
|
96
|
+
W,
|
|
97
|
+
N,
|
|
98
|
+
t.getCurrentChainId(),
|
|
99
|
+
H,
|
|
100
|
+
void 0,
|
|
101
|
+
void 0,
|
|
102
|
+
{
|
|
103
|
+
stakedTokenRecipient: s,
|
|
104
|
+
stakeBlinding: d,
|
|
105
|
+
mode: a,
|
|
106
|
+
depositorAddress: A
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
if (console.log(l), n) {
|
|
110
|
+
const o = q(m, t.getCurrentChainId());
|
|
111
|
+
if (!o)
|
|
112
|
+
throw new Error("hToken not found");
|
|
113
|
+
const v = (await t.getContractWithFetcher(k.HToken, o.erc20TokenAddress).previewWithdraw(-e[0])).toBigInt();
|
|
114
|
+
return T(
|
|
115
|
+
t,
|
|
116
|
+
v,
|
|
117
|
+
o,
|
|
118
|
+
S,
|
|
119
|
+
l,
|
|
120
|
+
x,
|
|
121
|
+
u,
|
|
122
|
+
C
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return T(
|
|
126
|
+
t,
|
|
127
|
+
e[0],
|
|
128
|
+
m,
|
|
129
|
+
S,
|
|
130
|
+
l,
|
|
131
|
+
x,
|
|
132
|
+
u,
|
|
133
|
+
C
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
It as hinkalActionStake
|
|
138
|
+
};
|
package/common229.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "./common157.mjs";
|
|
2
|
+
import { ContractType as s } from "./common158.mjs";
|
|
3
|
+
import "./common164.mjs";
|
|
4
|
+
import "./common168.mjs";
|
|
5
|
+
const h = async (r, t, o, n) => {
|
|
6
|
+
const a = r.getContractWithFetcher(s.HinkalContract), e = n.externalActionId === 0n ? "transact" : "transactWithExternalAction";
|
|
7
|
+
return (await a.estimateGas[e](
|
|
8
|
+
t[0],
|
|
9
|
+
t[1],
|
|
10
|
+
t[2],
|
|
11
|
+
o,
|
|
12
|
+
n,
|
|
13
|
+
{ from: n.relay }
|
|
14
|
+
)).toBigInt();
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
h as estimateGasRelayer
|
|
18
|
+
};
|