@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.
Files changed (270) hide show
  1. package/assets/{snarkjsWorkerLauncher-fuD5h_j0.js → snarkjsWorkerLauncher-CaBCnle3.js} +283 -257
  2. package/assets/snarkjsWorkerLogic-BAbiO5gj.js +17935 -0
  3. package/assets/snarkjsWorkerLogic-wHJfYCfg.js +15636 -0
  4. package/assets/{utxoWorkerLogic-CtFLQiAX.js → utxoWorkerLogic-BGFm-Zl2.js} +2 -2
  5. package/assets/{zkProofWorkerLauncher-J3Ts5_Ba.js → zkProofWorkerLauncher-BteYxRBn.js} +1 -1
  6. package/assets/{zkProofWorkerLogic-CPNuu61R.js → zkProofWorkerLogic-DiLbAhAo.js} +8354 -8298
  7. package/common.mjs +644 -0
  8. package/common10.mjs +30 -0
  9. package/common100.mjs +156 -0
  10. package/common101.mjs +568 -0
  11. package/common102.mjs +1603 -0
  12. package/common103.mjs +1764 -0
  13. package/common104.mjs +2030 -0
  14. package/common105.mjs +701 -0
  15. package/common106.mjs +480 -0
  16. package/common107.mjs +2082 -0
  17. package/common108.mjs +39 -0
  18. package/common109.mjs +24 -0
  19. package/common11.mjs +30 -0
  20. package/common110.mjs +41 -0
  21. package/common111.mjs +206 -0
  22. package/common112.mjs +48 -0
  23. package/common113.mjs +39 -0
  24. package/common114.mjs +70 -0
  25. package/common115.mjs +67 -0
  26. package/common116.mjs +5 -0
  27. package/common117.mjs +61 -0
  28. package/common118.mjs +20 -0
  29. package/common119.mjs +7 -0
  30. package/common12.mjs +58 -0
  31. package/common120.mjs +22 -0
  32. package/common121.mjs +16 -0
  33. package/common122.mjs +57 -0
  34. package/common123.mjs +45 -0
  35. package/common124.mjs +57 -0
  36. package/common125.mjs +229 -0
  37. package/common126.mjs +203 -0
  38. package/common127.mjs +29 -0
  39. package/common128.mjs +38 -0
  40. package/common129.mjs +15 -0
  41. package/common13.mjs +156 -0
  42. package/common130.mjs +105 -0
  43. package/common131.mjs +4 -0
  44. package/common132.mjs +14 -0
  45. package/common133.mjs +7 -0
  46. package/common134.mjs +6 -0
  47. package/common135.mjs +8 -0
  48. package/common136.mjs +40 -0
  49. package/common137.mjs +41 -0
  50. package/common138.mjs +72 -0
  51. package/common139.mjs +107 -0
  52. package/common14.mjs +32 -0
  53. package/common140.mjs +9 -0
  54. package/common141.mjs +10 -0
  55. package/common142.mjs +97 -0
  56. package/common143.mjs +65 -0
  57. package/common144.mjs +61 -0
  58. package/common145.mjs +95 -0
  59. package/common146.mjs +129 -0
  60. package/common147.mjs +105 -0
  61. package/common148.mjs +96 -0
  62. package/common149.mjs +18 -0
  63. package/common15.mjs +16 -0
  64. package/common150.mjs +45 -0
  65. package/common151.mjs +41 -0
  66. package/common152.mjs +108 -0
  67. package/common153.mjs +40 -0
  68. package/common154.mjs +19 -0
  69. package/common155.mjs +24 -0
  70. package/common156.mjs +21 -0
  71. package/common157.mjs +22 -0
  72. package/common158.mjs +4 -0
  73. package/common159.mjs +4 -0
  74. package/common16.mjs +6 -0
  75. package/common160.mjs +15 -0
  76. package/common161.mjs +13 -0
  77. package/common162.mjs +4 -0
  78. package/common163.mjs +15 -0
  79. package/common164.mjs +36 -0
  80. package/common165.mjs +58 -0
  81. package/common166.mjs +27 -0
  82. package/common167.mjs +15 -0
  83. package/common168.mjs +25 -0
  84. package/common169.mjs +4 -0
  85. package/common17.mjs +6877 -0
  86. package/common170.mjs +85 -0
  87. package/common171.mjs +2251 -0
  88. package/common172.mjs +856 -0
  89. package/common173.mjs +973 -0
  90. package/common174.mjs +1255 -0
  91. package/common175.mjs +591 -0
  92. package/common176.mjs +1392 -0
  93. package/common177.mjs +463 -0
  94. package/common178.mjs +137 -0
  95. package/common179.mjs +2700 -0
  96. package/common18.mjs +7415 -0
  97. package/common180.mjs +946 -0
  98. package/common181.mjs +973 -0
  99. package/common182.mjs +1327 -0
  100. package/common183.mjs +591 -0
  101. package/common184.mjs +1455 -0
  102. package/common185.mjs +490 -0
  103. package/common186.mjs +137 -0
  104. package/common187.mjs +2768 -0
  105. package/common188.mjs +8 -0
  106. package/common189.mjs +14 -0
  107. package/common19.mjs +11427 -0
  108. package/common190.mjs +115623 -0
  109. package/common191.mjs +42 -0
  110. package/common192.mjs +1022 -0
  111. package/common193.mjs +1423 -0
  112. package/common194.mjs +208 -0
  113. package/common195.mjs +340 -0
  114. package/common196.mjs +674 -0
  115. package/common197.mjs +1002 -0
  116. package/common198.mjs +883 -0
  117. package/common199.mjs +262 -0
  118. package/common2.mjs +67 -0
  119. package/common20.mjs +7417 -0
  120. package/common200.mjs +264 -0
  121. package/common201.mjs +173 -0
  122. package/common202.mjs +999 -0
  123. package/common203.mjs +80 -0
  124. package/common204.mjs +56 -0
  125. package/common205.mjs +42 -0
  126. package/common206.mjs +14 -0
  127. package/common207.mjs +4 -0
  128. package/common208.mjs +62 -0
  129. package/common209.mjs +4 -0
  130. package/common21.mjs +7439 -0
  131. package/common210.mjs +4 -0
  132. package/common211.mjs +58 -0
  133. package/common212.mjs +40 -0
  134. package/common213.mjs +45 -0
  135. package/common214.mjs +36 -0
  136. package/common215.mjs +32 -0
  137. package/common216.mjs +44 -0
  138. package/common217.mjs +32 -0
  139. package/common218.mjs +38 -0
  140. package/common219.mjs +9 -0
  141. package/common22.mjs +7411 -0
  142. package/common220.mjs +32 -0
  143. package/common221.mjs +47 -0
  144. package/common222.mjs +14 -0
  145. package/common223.mjs +30 -0
  146. package/common224.mjs +91 -0
  147. package/common225.mjs +112 -0
  148. package/common226.mjs +96 -0
  149. package/common227.mjs +30 -0
  150. package/common228.mjs +138 -0
  151. package/common229.mjs +18 -0
  152. package/common23.mjs +8425 -0
  153. package/common230.mjs +42 -0
  154. package/common231.mjs +60 -0
  155. package/common232.mjs +48 -0
  156. package/common233.mjs +47 -0
  157. package/common234.mjs +44 -0
  158. package/common235.mjs +74 -0
  159. package/common236.mjs +4 -0
  160. package/common237.mjs +60 -0
  161. package/common238.mjs +4 -0
  162. package/common239.mjs +30 -0
  163. package/common24.mjs +9600 -0
  164. package/common240.mjs +4 -0
  165. package/common241.mjs +153 -0
  166. package/common242.mjs +31 -0
  167. package/common243.mjs +30 -0
  168. package/common244.mjs +68 -0
  169. package/common245.mjs +57 -0
  170. package/common246.mjs +97 -0
  171. package/common247.mjs +36 -0
  172. package/common248.mjs +43 -0
  173. package/common249.mjs +44 -0
  174. package/common25.mjs +13283 -0
  175. package/common250.mjs +59 -0
  176. package/common251.mjs +75 -0
  177. package/{snarkjsWorkerLogic-CVna_BW9.mjs → common252.mjs} +1 -1
  178. package/common253.mjs +66 -0
  179. package/common254.mjs +70 -0
  180. package/common255.mjs +211 -0
  181. package/common256.mjs +8 -0
  182. package/{workerProxy-BDj498Ht.mjs → common257.mjs} +1 -1
  183. package/common26.mjs +4329 -0
  184. package/common27.mjs +4329 -0
  185. package/common28.mjs +204 -0
  186. package/common29.mjs +57 -0
  187. package/common3.mjs +27 -0
  188. package/common30.mjs +276 -0
  189. package/common31.mjs +118 -0
  190. package/common32.mjs +157 -0
  191. package/common33.mjs +29 -0
  192. package/common34.mjs +26 -0
  193. package/common35.mjs +53 -0
  194. package/common36.mjs +55 -0
  195. package/common37.mjs +18 -0
  196. package/common38.mjs +636 -0
  197. package/common39.mjs +24 -0
  198. package/common4.mjs +37 -0
  199. package/common40.mjs +13 -0
  200. package/common41.mjs +27 -0
  201. package/common42.mjs +15 -0
  202. package/common43.mjs +24 -0
  203. package/common44.mjs +253 -0
  204. package/common45.mjs +26 -0
  205. package/common46.mjs +15 -0
  206. package/common47.mjs +9 -0
  207. package/common48.mjs +25 -0
  208. package/common49.mjs +40 -0
  209. package/common5.mjs +37 -0
  210. package/common50.mjs +41 -0
  211. package/common51.mjs +90 -0
  212. package/common52.mjs +10 -0
  213. package/common53.mjs +299 -0
  214. package/common54.mjs +101 -0
  215. package/common55.mjs +83 -0
  216. package/common56.mjs +112 -0
  217. package/common57.mjs +140 -0
  218. package/common58.mjs +95 -0
  219. package/common59.mjs +98 -0
  220. package/common6.mjs +32 -0
  221. package/common60.mjs +5 -0
  222. package/common61.mjs +91 -0
  223. package/common62.mjs +66 -0
  224. package/common63.mjs +49 -0
  225. package/common64.mjs +177 -0
  226. package/common65.mjs +8 -0
  227. package/common66.mjs +131 -0
  228. package/common67.mjs +132 -0
  229. package/common68.mjs +59 -0
  230. package/common69.mjs +35 -0
  231. package/common7.mjs +37 -0
  232. package/common70.mjs +118 -0
  233. package/common71.mjs +134 -0
  234. package/common72.mjs +33 -0
  235. package/common73.mjs +29 -0
  236. package/common74.mjs +218 -0
  237. package/common75.mjs +194 -0
  238. package/common76.mjs +62 -0
  239. package/common77.mjs +181 -0
  240. package/common78.mjs +83 -0
  241. package/common79.mjs +9 -0
  242. package/common8.mjs +38 -0
  243. package/common80.mjs +21 -0
  244. package/common81.mjs +184 -0
  245. package/common82.mjs +53 -0
  246. package/common83.mjs +35 -0
  247. package/common84.mjs +7 -0
  248. package/common85.mjs +4 -0
  249. package/common86.mjs +350 -0
  250. package/common87.mjs +570 -0
  251. package/common88.mjs +519 -0
  252. package/common89.mjs +1422 -0
  253. package/common9.mjs +41 -0
  254. package/common90.mjs +1136 -0
  255. package/common91.mjs +334 -0
  256. package/common92.mjs +291 -0
  257. package/common93.mjs +205 -0
  258. package/common94.mjs +201 -0
  259. package/common95.mjs +89 -0
  260. package/common96.mjs +721 -0
  261. package/common97.mjs +346 -0
  262. package/common98.mjs +542 -0
  263. package/common99.mjs +393 -0
  264. package/package.json +4 -4
  265. package/assets/snarkjsWorkerLogic-B6N4z_eM.js +0 -12136
  266. package/assets/snarkjsWorkerLogic-Fv0M38Mc.js +0 -12087
  267. package/index-DXElTGy9.mjs +0 -254449
  268. package/index.js +0 -457
  269. package/utxoWorkerLogic-B1Hh-bq4.mjs +0 -64
  270. package/zkProofWorkerLogic-D9rxuuiK.mjs +0 -60
package/common127.mjs ADDED
@@ -0,0 +1,29 @@
1
+ import { networkRegistry as i, chainIdsByType as o } from "./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 "./common35.mjs";
16
+ import "./common33.mjs";
17
+ import "./common129.mjs";
18
+ import "./common42.mjs";
19
+ import "./common31.mjs";
20
+ import "./common77.mjs";
21
+ import "libsodium-wrappers";
22
+ import "./common30.mjs";
23
+ import "./common36.mjs";
24
+ import "./common41.mjs";
25
+ const B = (t) => i[t], R = (t) => Object.keys(o)[Object.values(o).findIndex((r) => r.includes(t.chainId))];
26
+ export {
27
+ B as getNetworkObject,
28
+ R as getNetworkType
29
+ };
package/common128.mjs ADDED
@@ -0,0 +1,38 @@
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 "./common35.mjs";
16
+ import "./common33.mjs";
17
+ import "./common129.mjs";
18
+ import "./common42.mjs";
19
+ import "./common31.mjs";
20
+ import "./common77.mjs";
21
+ import "libsodium-wrappers";
22
+ import "./common30.mjs";
23
+ import { AxelarRegistry as p } from "./common36.mjs";
24
+ import "./common41.mjs";
25
+ const z = (i) => {
26
+ const r = p.find((m) => m.chainId === i.chainId);
27
+ if (!r)
28
+ return;
29
+ const { sourceChain: t, sourceAddress: o } = r;
30
+ return {
31
+ destinationChain: t,
32
+ destinationAddress: o,
33
+ messageFee: i.gasFeeInWei ?? 0n
34
+ };
35
+ };
36
+ export {
37
+ z as getAxelarMigrationInfo
38
+ };
package/common129.mjs ADDED
@@ -0,0 +1,15 @@
1
+ import { UAParser as s } from "ua-parser-js";
2
+ const a = new s(), n = ["17"], u = () => {
3
+ const { name: e, version: r } = a.getBrowser(), t = r?.substring(0, 2);
4
+ return !(e === "Safari" && t && !n.includes(t));
5
+ }, o = {
6
+ mpcVault: "MPCVault - Multisig Wallet",
7
+ utila: "UtilaWallet"
8
+ }, i = (e) => {
9
+ const r = e?.session?.peer?.metadata?.name;
10
+ return !Object.values(o).includes(r);
11
+ };
12
+ export {
13
+ u as browserSupported,
14
+ i as walletSupported
15
+ };
package/common13.mjs ADDED
@@ -0,0 +1,156 @@
1
+ import p from "axios";
2
+ import { ethers as A } from "ethers";
3
+ import "./common157.mjs";
4
+ import "./common164.mjs";
5
+ import { curveNetworkNames as f, curvePools as w } from "./common168.mjs";
6
+ import { getCrvCvxWithChainId as C } from "./common38.mjs";
7
+ import { getERC20Registry as l } from "./common170.mjs";
8
+ import { getNonLocalhostChainId as u } from "./common28.mjs";
9
+ import { zeroAddress as m } from "./common34.mjs";
10
+ import { logError as D } from "./common84.mjs";
11
+ import { lowerCaseIncludes as k, caseInsensitiveEqual as h } from "./common134.mjs";
12
+ const T = /* @__PURE__ */ new Set(), L = {}, y = (e, o) => {
13
+ const n = l(e), a = n.find((t) => t.erc20TokenAddress.toLocaleLowerCase() === o.toLocaleLowerCase());
14
+ return a ? a ? a.symbol : o : n[0].symbol;
15
+ }, P = (e, o) => {
16
+ const n = l(e), a = n.find((t) => t.erc20TokenAddress.toLocaleLowerCase() === o.toLocaleLowerCase());
17
+ return a ? a.logoURI ? a.logoURI : "" : n[0].logoURI ? n[0].logoURI : "";
18
+ };
19
+ async function b(e) {
20
+ const o = u(e), n = f[o];
21
+ return p.get(`https://api.curve.fi/api/getSubgraphData/${n}`, { timeout: 7e3 }).then((a) => a.data ? a.data.data.poolList.map((t) => ({
22
+ address: t.address,
23
+ volumeUSD: t.volumeUSD,
24
+ dailyApy: t.latestDailyApy,
25
+ weeklyApy: t.latestWeeklyApy
26
+ })) : []).catch(() => []);
27
+ }
28
+ async function U(e, o) {
29
+ const n = u(e), a = f[n];
30
+ return a ? p.get(`https://api.curve.fi/api/getPools/${a}/${o}`).then((t) => t.data?.data.poolData.map((s) => {
31
+ const { usdTotal: i } = s, d = Number(A.utils.formatEther(s.totalSupply || "0")), c = d > 0 ? Number(i) / d : 0;
32
+ return {
33
+ id: s.id,
34
+ name: s.name,
35
+ address: s.address,
36
+ lpToken: y(e, s.lpTokenAddress || ""),
37
+ lpTokenAddress: s.lpTokenAddress,
38
+ coins: s.underlyingCoins ? s.underlyingCoins : s.coins,
39
+ tokensForDeposit: s.coins,
40
+ coinAddresses: (s.coinsAddresses || []).filter((r) => r !== m).map((r) => y(e, r)),
41
+ coinLogos: (s.coinsAddresses || []).filter((r) => r !== m).map((r) => P(e, r)),
42
+ gaugeAddress: s.gaugeAddress ? s.gaugeAddress : void 0,
43
+ gaugeCrvApy: s.gaugeCrvApy && s.gaugeCrvApy[0] && s.gaugeCrvApy[0] !== 0 ? { base: s.gaugeCrvApy[0], boosted: s.gaugeCrvApy[1] } : void 0,
44
+ gaugeRewards: s.gaugeRewards,
45
+ usdTotal: i,
46
+ totalSupply: d,
47
+ lpPrice: c,
48
+ liquidityUtilization: void 0
49
+ };
50
+ })) : [];
51
+ }
52
+ async function N(e) {
53
+ let o = [];
54
+ return await Promise.all(
55
+ w.map(async (n) => {
56
+ const a = await U(e, n);
57
+ return o = o.concat(a), a;
58
+ })
59
+ ), Promise.all(o);
60
+ }
61
+ async function v(e) {
62
+ const o = await b(e), n = await N(e), a = [];
63
+ for (const t of n) {
64
+ if (a.map((d) => d.address).includes(t.address))
65
+ continue;
66
+ const s = t.lpTokenAddress.toLowerCase();
67
+ T.add(s.toLowerCase()), L[s] = t.address.toLowerCase();
68
+ const i = {
69
+ id: t.id,
70
+ name: t.name,
71
+ address: t.address,
72
+ lpToken: s,
73
+ lpTokenAddress: s,
74
+ coins: t.coins,
75
+ coinNames: t.coinAddresses.join(" "),
76
+ coinAddresses: t.coinAddresses,
77
+ coinLogos: t.coinLogos,
78
+ tokensForDeposit: t.tokensForDeposit,
79
+ gaugeAddress: t.gaugeAddress,
80
+ usdTotal: t.usdTotal,
81
+ totalSupply: t.totalSupply,
82
+ lpPrice: t.lpPrice,
83
+ tvl: Math.round(t.usdTotal),
84
+ gaugeRewards: t.gaugeRewards,
85
+ gaugeCrvApy: t.gaugeCrvApy ? {
86
+ base: Math.round(t.gaugeCrvApy.base * 100) / 100,
87
+ boosted: Math.round(t.gaugeCrvApy.boosted * 100) / 100
88
+ } : void 0,
89
+ liquidityUtilization: 0,
90
+ volumeUSD: 0,
91
+ dailyApy: 0,
92
+ weeklyApy: 0
93
+ };
94
+ for (const d of o)
95
+ if (h(t.address, d.address)) {
96
+ i.liquidityUtilization = d.volumeUSD / t.usdTotal, i.volumeUSD = Math.round(d.volumeUSD), i.dailyApy = Math.round(d.dailyApy * 100) / 100, i.weeklyApy = Math.round(d.weeklyApy * 100) / 100;
97
+ break;
98
+ }
99
+ a.push(i);
100
+ }
101
+ return a;
102
+ }
103
+ const j = async (e) => {
104
+ const o = u(e), n = await v(o), a = C(o).map((s) => s.lpToken.toLowerCase());
105
+ return n.filter((s) => k(a, s.lpTokenAddress));
106
+ }, G = async (e) => {
107
+ const o = u(e), n = await v(o), t = l(e).map((i) => i.erc20TokenAddress.toLowerCase());
108
+ return n.filter((i) => k(t, i.lpTokenAddress));
109
+ };
110
+ async function $(e, o) {
111
+ let n = 0;
112
+ for (let r = 0; r < e.tokensForDeposit.length; r += 1)
113
+ e.tokensForDeposit[r].usdTotal = Number(
114
+ A.utils.formatUnits(
115
+ BigInt(e.tokensForDeposit[r].poolBalance),
116
+ Number(e.tokensForDeposit[r].decimals)
117
+ )
118
+ ) * e.tokensForDeposit[r].usdPrice, n += e.tokensForDeposit[r].usdTotal || 0, e.tokensForDeposit[r].symbol.startsWith("am") && (e.tokensForDeposit[r].symbol = e.tokensForDeposit[r].symbol.slice(2));
119
+ for (let r = 0; r < e.tokensForDeposit.length; r += 1)
120
+ e.tokensForDeposit[r].weighting = (e.tokensForDeposit[r].usdTotal || 0) / n;
121
+ const a = await o.functions.fee();
122
+ let t, s, i, d = !1;
123
+ try {
124
+ const r = (await o.functions.future_A_time())[0].toNumber(), g = new Date(r * 1e3);
125
+ s = g.toLocaleString(), i = (await o.functions.future_A())[0].toNumber() / 100, d = !!r && g >= /* @__PURE__ */ new Date(), t = (await o.functions.initial_A())[0].toNumber() / 100;
126
+ } catch {
127
+ D("A ramp up not found");
128
+ }
129
+ return {
130
+ poolAddress: o.address,
131
+ lpToken: e.lpTokenAddress,
132
+ gaugeAddress: e.gaugeAddress,
133
+ gaugeCrvApy: e.gaugeCrvApy,
134
+ currencyReserves: e.coins,
135
+ liquidityUtilization: e.liquidityUtilization,
136
+ volumeUSD: e.volumeUSD,
137
+ dailyApy: e.dailyApy,
138
+ weeklyApy: e.weeklyApy,
139
+ gaugeRewards: e?.gaugeRewards,
140
+ A: (await o.functions.A())[0].toNumber(),
141
+ initialA: t,
142
+ futureTime: s,
143
+ futureA: i,
144
+ hasRampUp: d,
145
+ fee: a[0].toNumber() / 1e8,
146
+ daoFee: a[0].toNumber() / 2e8,
147
+ virtualPrice: Number((await o.functions.get_virtual_price())[0].toBigInt() / 100000000000000n) / 1e4
148
+ };
149
+ }
150
+ export {
151
+ j as getCurvePools,
152
+ G as getCurvePoolsforPriceFetching,
153
+ $ as getExtendedPoolInfo,
154
+ T as lpTokens,
155
+ L as lpTokensToBasePool
156
+ };
package/common130.mjs ADDED
@@ -0,0 +1,105 @@
1
+ import { BigNumber as m } from "ethers";
2
+ import "./common28.mjs";
3
+ import "./common157.mjs";
4
+ import "./common164.mjs";
5
+ import "./common168.mjs";
6
+ import "circomlibjs";
7
+ import "./common51.mjs";
8
+ import "axios";
9
+ import { abiDecodeUtxo as g } from "./common49.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 "./common33.mjs";
18
+ import "./common129.mjs";
19
+ import "./common42.mjs";
20
+ import "./common31.mjs";
21
+ import "./common77.mjs";
22
+ import "libsodium-wrappers";
23
+ import { getHinkalParameters as x } from "./common30.mjs";
24
+ import "./common36.mjs";
25
+ import "./common41.mjs";
26
+ const G = (e, r) => {
27
+ const n = e.parseTransaction({ data: r }), { circomData: t } = n.args, {
28
+ extraRandomization: o,
29
+ stealthAddress: i,
30
+ H0: u,
31
+ H1: s
32
+ } = t.stealthAddressStructure;
33
+ return {
34
+ erc20TokenAddresses: t.erc20TokenAddresses,
35
+ amountChanges: t.amountChanges,
36
+ flatFees: t.flatFees,
37
+ externalActionId: t.externalActionId,
38
+ externalActionMetadata: t.externalActionMetadata,
39
+ encryptedOutputs: t.encryptedOutputs.map((d) => d[0]),
40
+ hookData: t.hookData,
41
+ stealthAddressStructure: {
42
+ extraRandomization: o.toBigInt(),
43
+ stealthAddress: i.toBigInt(),
44
+ H0: u.toBigInt(),
45
+ H1: s.toBigInt()
46
+ }
47
+ };
48
+ }, J = (e, r) => {
49
+ const { transactMethodId: n, transactWithExternalActionMethodId: t, NewCommitment: o, NewCommitmentTopic: i, hinkalInterface: u } = x(e), s = [];
50
+ for (let a = 0; a < r.length; a += 1) {
51
+ s.push(r[a]), s[a].utxosArray = [];
52
+ const { methodId: d } = s[a];
53
+ s[a].logs.forEach((c, S) => {
54
+ if (d !== n && d !== t || c.topics[0] !== i)
55
+ return;
56
+ const p = u.decodeEventLog(o, c.data);
57
+ if (p.index.toBigInt() < 0n) {
58
+ const { amount: l, erc20TokenAddress: h, timeStamp: A, tokenId: I } = g(p.encryptedOutput);
59
+ s[a].utxosArray?.push({ amount: l, erc20TokenAddress: h, timeStamp: A, tokenId: I });
60
+ }
61
+ });
62
+ }
63
+ return s;
64
+ }, K = (e) => ({
65
+ ...e,
66
+ utxosArray: e.utxosArray?.map((r) => ({ ...r, amount: BigInt(r.amount) })),
67
+ decodedInput: {
68
+ ...e.decodedInput,
69
+ amountChanges: e.decodedInput.amountChanges.map(m.from),
70
+ flatFees: e.decodedInput.flatFees.map(m.from),
71
+ externalActionId: m.from(e.decodedInput.externalActionId),
72
+ stealthAddressStructure: {
73
+ ...e.decodedInput.stealthAddressStructure,
74
+ extraRandomization: BigInt(e.decodedInput.stealthAddressStructure.extraRandomization),
75
+ stealthAddress: BigInt(e.decodedInput.stealthAddressStructure.stealthAddress),
76
+ H0: BigInt(e.decodedInput.stealthAddressStructure.H0),
77
+ H1: BigInt(e.decodedInput.stealthAddressStructure.H1)
78
+ }
79
+ }
80
+ }), Q = (e) => e.map((n) => {
81
+ const { decodedInput: t } = n;
82
+ return {
83
+ ...n,
84
+ input: "",
85
+ decodedInput: {
86
+ ...t,
87
+ amountChanges: t.amountChanges.map((o) => o.toString()),
88
+ flatFees: t.flatFees.map((o) => o.toString()),
89
+ externalActionId: t.externalActionId.toString(),
90
+ stealthAddressStructure: {
91
+ ...t.stealthAddressStructure,
92
+ extraRandomization: String(t.stealthAddressStructure.extraRandomization),
93
+ stealthAddress: String(t.stealthAddressStructure.stealthAddress),
94
+ H0: String(t.stealthAddressStructure.H0),
95
+ H1: String(t.stealthAddressStructure.H1)
96
+ }
97
+ }
98
+ };
99
+ });
100
+ export {
101
+ G as decodeTxInput,
102
+ J as decodeTxLogs,
103
+ K as deserializeDecodedTxs,
104
+ Q as serializeDecodedTxs
105
+ };
package/common131.mjs ADDED
@@ -0,0 +1,4 @@
1
+ const o = () => window.location.reload();
2
+ export {
3
+ o as reloadPage
4
+ };
package/common132.mjs ADDED
@@ -0,0 +1,14 @@
1
+ function e(t) {
2
+ return t?.toLowerCase().split(" ").map((r) => r.charAt(0).toUpperCase() + r.substring(1)).join(" ");
3
+ }
4
+ function n(t) {
5
+ return t.charAt(0).toUpperCase() + t.slice(1);
6
+ }
7
+ function i(t) {
8
+ return !t || t === null || Array.isArray(t) && t.length === 0 ? !0 : Object.keys(t).length === 0 && t.constructor === Object;
9
+ }
10
+ export {
11
+ n as capitalizeFirstLetter,
12
+ i as isNullOrEmpty,
13
+ e as toTitleCase
14
+ };
package/common133.mjs ADDED
@@ -0,0 +1,7 @@
1
+ const t = (e) => {
2
+ const n = /^[a-zA-Z0-9_]{5,24}$/;
3
+ return e.length > 0 && n.test(e);
4
+ };
5
+ export {
6
+ t as isNicknameValid
7
+ };
package/common134.mjs ADDED
@@ -0,0 +1,6 @@
1
+ const o = (e, s) => !e || !s ? !1 : e.toLowerCase() === s.toLowerCase(), r = (e, s) => e.some((t) => o(t, s)), a = (e, s) => e.some((t) => t.toLowerCase().startsWith(s.toLowerCase()));
2
+ export {
3
+ o as caseInsensitiveEqual,
4
+ r as lowerCaseIncludes,
5
+ a as lowerCaseStartsWith
6
+ };
package/common135.mjs ADDED
@@ -0,0 +1,8 @@
1
+ const i = (e = 1e3) => new Promise((t) => {
2
+ setTimeout(() => {
3
+ t(void 0);
4
+ }, e);
5
+ });
6
+ export {
7
+ i as waitLittle
8
+ };
package/common136.mjs ADDED
@@ -0,0 +1,40 @@
1
+ import { getERC20Registry as p } from "./common170.mjs";
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 "axios";
10
+ import "./common50.mjs";
11
+ import "./common139.mjs";
12
+ import "./common191.mjs";
13
+ import "./common117.mjs";
14
+ import { customTokenRegistry as s } from "./common72.mjs";
15
+ import "./common121.mjs";
16
+ import "./common35.mjs";
17
+ import "./common33.mjs";
18
+ import "./common129.mjs";
19
+ import "./common42.mjs";
20
+ import "./common31.mjs";
21
+ import { VolatileHelper as e } from "./common77.mjs";
22
+ import "libsodium-wrappers";
23
+ import "./common30.mjs";
24
+ import "./common36.mjs";
25
+ import "./common41.mjs";
26
+ const m = { chains: [] }, v = async (r) => {
27
+ let o = [...p(r), ...s.getCustomTokens(r)];
28
+ m.chains.includes(r) || (o = await Promise.all(
29
+ o.map(async (t) => {
30
+ if (t.isVolatile) {
31
+ const i = await e.getShareTokenAddress(r, t.erc20TokenAddress);
32
+ i && (t.sharedAddress = i);
33
+ }
34
+ return t;
35
+ })
36
+ ), m.chains.push(r));
37
+ };
38
+ export {
39
+ v as patchRegistry
40
+ };
package/common137.mjs ADDED
@@ -0,0 +1,41 @@
1
+ import { ethers as i, BigNumber as a } from "ethers";
2
+ import { transactionErrorCodes as c } from "./common81.mjs";
3
+ const h = (t) => i.utils.parseEther(t).toBigInt(), P = (t) => i.BigNumber.from(i.utils.randomBytes(t)).toBigInt(), f = (t, n) => i.utils.formatUnits(n, t.decimals), m = (t, n) => {
4
+ const r = 10 ** (18 - t.decimals);
5
+ try {
6
+ return i.utils.parseUnits(n).div(a.from(r.toString())).toBigInt();
7
+ } catch {
8
+ throw new Error(c.DECIMALS_LIMIT);
9
+ }
10
+ }, g = (t) => {
11
+ const n = t.toFixed(30), [r, e] = n.split("."), s = e ? e.length : 0, o = `${r}${e || ""}`;
12
+ return [BigInt(o), s];
13
+ }, v = (t, n) => {
14
+ try {
15
+ return m(t, n);
16
+ } catch {
17
+ return BigInt(0);
18
+ }
19
+ }, u = (t, n, r) => {
20
+ const e = i.utils.formatUnits(t, n.decimals), s = BigInt(10 ** (18 - r));
21
+ try {
22
+ const o = i.utils.parseUnits(e).div(a.from(s.toString())).toBigInt();
23
+ return i.utils.formatUnits(o, r);
24
+ } catch {
25
+ throw new Error(c.DECIMALS_LIMIT);
26
+ }
27
+ }, D = (t, n, r, e) => {
28
+ const [s, o] = g(r);
29
+ return { totalValueDollarsBigInt: n * s / BigInt(10 ** (t.decimals - e)) / BigInt(10 ** o), precision: e };
30
+ }, E = (t, n) => !t || !n ? "0" : u(n ?? 0n, t, t.decimals).toString() ?? "0";
31
+ export {
32
+ D as calculateDollarValue,
33
+ h as ethToWei,
34
+ f as getAmountInToken,
35
+ m as getAmountInWei,
36
+ v as getAmountInWeiOrZero,
37
+ u as getAmountWithPrecision,
38
+ E as getAmountWithPrecisionOrZero,
39
+ P as randomBigInt,
40
+ g as toBigIntWithDecimals
41
+ };
package/common138.mjs ADDED
@@ -0,0 +1,72 @@
1
+ import { Utxo as C } from "./common71.mjs";
2
+ import "./common157.mjs";
3
+ import { ContractType as m } from "./common158.mjs";
4
+ import "./common164.mjs";
5
+ import "./common168.mjs";
6
+ import { getHinkalCache as O, setHinkalCache as P } from "./common115.mjs";
7
+ const b = async (e, r, u, n, i = 0) => (await e.utxoUtils.buildBatchProcess(r, u)).reduce((s, t) => n && i !== 0 ? t.erc20TokenAddress.toLowerCase() === n.toLowerCase() && t.tokenId === i ? [...s, t] : s : n ? t.erc20TokenAddress.toLowerCase() === n.toLowerCase() ? [...s, t] : s : [...s, t], []), I = async (e, r, u, n, i, a, s, t = 0) => {
8
+ const o = await e.utxoUtils.batchFilterUtxosWithNullifier(r, u);
9
+ if (s) {
10
+ for (o.sort((l, c) => l.amount <= c.amount ? 1 : -1); o.length < n || o.length > n && o.length < 6; )
11
+ o.push(new C({ amount: 0n, erc20TokenAddress: s, shieldedPrivateKey: a, tokenId: t }));
12
+ if (i)
13
+ for (; o.length > 6; )
14
+ o.splice(o.length - 1);
15
+ }
16
+ return {
17
+ inputUtxos: o
18
+ };
19
+ }, B = async ({
20
+ hinkal: e,
21
+ erc20TokenAddress: r = void 0,
22
+ minInput: u = 2,
23
+ sliceIfMore6: n = !0,
24
+ tokenId: i = 0
25
+ }) => {
26
+ if (!e.getCurrentChainId || !e.getSelectedNetwork())
27
+ return { inputUtxos: [] };
28
+ const { encryptedOutputs: a, nullifiers: s, userKeys: t } = e, o = Array.from(a), l = e.getCurrentChainId(), c = e.getContract(m.HinkalContract).address, y = t.getShieldedPublicKey(), U = t.getShieldedPrivateKey();
29
+ let p = [], f = [], { encryptedOutputs: g, lastOutput: d } = O(
30
+ l,
31
+ y,
32
+ c
33
+ ), h = o.findIndex((x) => x.value === d);
34
+ if (h > -1 || g.length === 0) {
35
+ h += 1;
36
+ const x = o.slice(h);
37
+ ({ lastOutput: d, additionalEncryptedOutputs: f } = await e.utxoUtils.batchProcess(
38
+ x,
39
+ d,
40
+ t
41
+ )), p = [...g, ...f], P(
42
+ {
43
+ lastOutput: d,
44
+ encryptedOutputs: p
45
+ },
46
+ l,
47
+ y,
48
+ c
49
+ );
50
+ }
51
+ const w = await b(
52
+ e,
53
+ p,
54
+ t,
55
+ r,
56
+ i
57
+ );
58
+ return await I(
59
+ e,
60
+ w,
61
+ s,
62
+ u,
63
+ n,
64
+ U,
65
+ r,
66
+ i
67
+ );
68
+ };
69
+ export {
70
+ B as getInputUtxoAndBalance,
71
+ b as getInputUtxosFromEncryptedOutputs
72
+ };
package/common139.mjs ADDED
@@ -0,0 +1,107 @@
1
+ import { Mutex as A } from "async-mutex";
2
+ import { getERC20Registry as w } from "./common170.mjs";
3
+ import { Utxo as k } from "./common71.mjs";
4
+ import { customTokenRegistry as I } from "./common72.mjs";
5
+ import { getInputUtxoAndBalance as T } from "./common138.mjs";
6
+ import { getAmountWithPrecision as U } from "./common137.mjs";
7
+ import { ErrorWithAmount as P } from "./common219.mjs";
8
+ import "axios";
9
+ import "./common28.mjs";
10
+ import "./common157.mjs";
11
+ import "./common164.mjs";
12
+ import "./common168.mjs";
13
+ import "ethers";
14
+ import "./common191.mjs";
15
+ import "./common51.mjs";
16
+ import "./common50.mjs";
17
+ import "./common117.mjs";
18
+ import "./common35.mjs";
19
+ import "./common33.mjs";
20
+ import { caseInsensitiveEqual as h } from "./common134.mjs";
21
+ import "libsodium-wrappers";
22
+ import "circomlibjs";
23
+ import "./common42.mjs";
24
+ import "./common31.mjs";
25
+ import { VolatileHelper as b } from "./common77.mjs";
26
+ import "./common30.mjs";
27
+ import "./common36.mjs";
28
+ import "./common41.mjs";
29
+ import { getERC20Token as x } from "./common118.mjs";
30
+ import "./common121.mjs";
31
+ import "./common129.mjs";
32
+ import { patchRegistry as S } from "./common136.mjs";
33
+ const C = new A(), at = async (a) => {
34
+ const s = await C.acquire(), { inputUtxos: m } = await T({ hinkal: a, sliceIfMore6: !1 }), r = a.getCurrentChainId(), l = [...w(r), ...I.getCustomTokens(r)];
35
+ await S(r);
36
+ const f = l.map((t) => ({
37
+ token: t,
38
+ balance: m.reduce((e, n) => {
39
+ const o = t.isVolatile ? t.sharedAddress : t.erc20TokenAddress;
40
+ return h(o, n.erc20TokenAddress) ? e + n.amount : e;
41
+ }, 0n),
42
+ timestamp: m.filter(
43
+ (e) => h(e.erc20TokenAddress, t.erc20TokenAddress)
44
+ )[0]?.timeStamp,
45
+ nfts: m.filter(
46
+ (e) => h(e.erc20TokenAddress, t.erc20TokenAddress) && e.tokenId !== 0
47
+ ).map((e) => ({ tokenId: e.tokenId, timestamp: e.timeStamp }))
48
+ })), u = await Promise.all(
49
+ f.map(async (t) => {
50
+ if (!t.token.isVolatile)
51
+ return t;
52
+ t.token?.sharedAddress || console.log("VolatileToken must have a corresponding sharedAddress");
53
+ let e = 0n;
54
+ return t.balance > 0n && (e = await b.getVolatileTokenBalance(
55
+ r,
56
+ t.token.sharedAddress,
57
+ t.balance
58
+ )), {
59
+ ...t,
60
+ balance: BigInt(e)
61
+ };
62
+ })
63
+ );
64
+ return s(), u;
65
+ }, mt = async (a, s, m, r = 6, l = s.map(() => 0), f = !1) => {
66
+ const { userKeys: u } = a, t = [], e = [];
67
+ let n = 0;
68
+ for (let o = 0; o < s.length; o += 1)
69
+ if (f === !1) {
70
+ const { inputUtxos: i } = await T({
71
+ hinkal: a,
72
+ erc20TokenAddress: s[o],
73
+ tokenId: l[o],
74
+ sliceIfMore6: !1
75
+ });
76
+ n = Math.max(i.length, n), e.push(i);
77
+ } else
78
+ e.push([]);
79
+ return console.log({ maxUtxoNum: n }), n === 2 ? e : (e.forEach((o, i) => {
80
+ if (o.length > r) {
81
+ const d = o.slice(0, r), p = d.reduce((c, g) => c + g.amount, 0n);
82
+ if (m[i] < 0n && p < -m[i]) {
83
+ const c = x(s[i], a.getCurrentChainId()), g = Number(U(p, c, 2)), y = `Unfortunately your transaction did not go through due to UTXOs limitations.
84
+ Please try again with ${c.symbol}`;
85
+ throw new P(g, y);
86
+ }
87
+ t.push(d);
88
+ } else if (o.length <= r) {
89
+ const d = [...o];
90
+ let p = r - o.length;
91
+ for (; p > 0; )
92
+ p -= 1, d.push(
93
+ new k({
94
+ amount: 0n,
95
+ erc20TokenAddress: s[i],
96
+ shieldedPrivateKey: u.getShieldedPrivateKey(),
97
+ tokenId: l[i]
98
+ })
99
+ );
100
+ t.push(d);
101
+ }
102
+ }), t);
103
+ };
104
+ export {
105
+ mt as addPaddingToUtxos,
106
+ at as getShieldedBalance
107
+ };