@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/common57.mjs ADDED
@@ -0,0 +1,140 @@
1
+ import { networkRegistry as W } from "./common28.mjs";
2
+ import { defaultHookData as H } from "./common157.mjs";
3
+ import { ContractType as A } from "./common158.mjs";
4
+ import { ExternalActionId as O } from "./common159.mjs";
5
+ import { PendleAction as o } from "./common160.mjs";
6
+ import "./common164.mjs";
7
+ import "./common168.mjs";
8
+ import { utils as U } from "ethers";
9
+ import { transactionErrorCodes as b } from "./common81.mjs";
10
+ import { zeroAddress as R } from "./common34.mjs";
11
+ import "circomlibjs";
12
+ import "./common51.mjs";
13
+ import "axios";
14
+ import "./common50.mjs";
15
+ import { addPaddingToUtxos as z } from "./common139.mjs";
16
+ import { outputUtxoProcessing as L } from "./common123.mjs";
17
+ import { constructZkProof as N } from "./common146.mjs";
18
+ import { estimateGasRelayer as $ } from "./common229.mjs";
19
+ import { transactCallRelayer as v } from "./common230.mjs";
20
+ import { transactCallDirect as D } from "./common231.mjs";
21
+ import "./common117.mjs";
22
+ import { getERC20Token as E } from "./common118.mjs";
23
+ import "./common121.mjs";
24
+ import "./common35.mjs";
25
+ import "./common33.mjs";
26
+ import { processAmountChanges as G } from "./common125.mjs";
27
+ import { getFlatFees as K } from "./common126.mjs";
28
+ import "./common129.mjs";
29
+ import "./common42.mjs";
30
+ import "./common31.mjs";
31
+ import "./common191.mjs";
32
+ import "./common77.mjs";
33
+ import "./common72.mjs";
34
+ import "libsodium-wrappers";
35
+ import "./common30.mjs";
36
+ import "./common36.mjs";
37
+ import "./common41.mjs";
38
+ const _ = (t) => {
39
+ let r = [];
40
+ return t === o.Deposit ? r = [!1, !0] : t === o.Withdraw ? r = [!1, !0] : t === o.SwapFromYt ? r = [!1, !0, !0] : t === o.SwapToYt ? r = [!1, !1, !0] : t === o.SwapPt ? r = [!1, !0] : t === o.Mint ? r = [!1, !0, !1, !0] : t === o.Redeem ? r = [!1, !1, !0, !0] : t === o.Checkpoint && (r = [!1, !0]), r;
41
+ }, B = (t, r) => {
42
+ const { pendleAction: i, ytAddress: n, userAddress: l, evmData: d } = t, a = d ?? "0x00", s = l ?? R;
43
+ if ([
44
+ o.Deposit,
45
+ o.Withdraw,
46
+ o.SwapFromYt,
47
+ o.SwapToYt,
48
+ o.SwapPt,
49
+ o.Mint,
50
+ o.Redeem,
51
+ o.Checkpoint
52
+ ].includes(t.pendleAction))
53
+ return U.defaultAbiCoder.encode(
54
+ ["uint8", "address", "uint256", "uint256", "address", "bool", "bytes"],
55
+ [
56
+ i,
57
+ n,
58
+ r[0][0].amount,
59
+ r[0][0].timeStamp,
60
+ s,
61
+ !0,
62
+ a
63
+ ]
64
+ );
65
+ throw new Error("Not implemented");
66
+ }, Ft = async (t, r, i, n, l, d = !1) => {
67
+ const a = O.Pendle, { pendleAction: s } = n, c = [...await z(t, r, i)], C = `swapperMO${i.length.toString()}x${c[0].length}x1`;
68
+ console.log({ inputUtxosArray: c, circuitName: C, pendleMetadata: n });
69
+ const { flatFees: w, feeUnit: T } = await K(
70
+ t.getCurrentChainId(),
71
+ r,
72
+ a,
73
+ i,
74
+ s,
75
+ l
76
+ );
77
+ console.log("hinkalActionPendle flatFees:", w), i = G({
78
+ erc20Addresses: r,
79
+ amountChanges: i,
80
+ flatFees: w,
81
+ feeUnit: T,
82
+ externalActionId: a,
83
+ action: s,
84
+ gasTokenAddress: l
85
+ });
86
+ const g = [];
87
+ for (let e = 0; e < r.length; e += 1) {
88
+ const { outputUtxos: u } = L(t.userKeys, c[e], i[e]);
89
+ g.push(u);
90
+ }
91
+ const P = _(s), { contractData: S } = W[t.getCurrentChainId()], I = S?.pendleExternalActionInstanceAddress, h = B(n, c), x = s === o.Deposit || n.isRelayerOff ? R : await t.getRandomRelay();
92
+ if (!x)
93
+ throw Error(b.RELAYER_NOT_AVAILABLE);
94
+ const Y = `0x0${s.toString(16)}`, k = { ...H, preHookMetadata: Y }, { zkCallData: m, circomData: p, dimData: f } = await N(
95
+ t.merkleTreeHinkal,
96
+ t.merkleTreeAccessToken,
97
+ c,
98
+ g,
99
+ t.userKeys,
100
+ C,
101
+ a,
102
+ I,
103
+ h,
104
+ x,
105
+ t.getCurrentChainId(),
106
+ P,
107
+ w,
108
+ k
109
+ );
110
+ if (console.log("hinkalActionPendle: zkCallData, dimData, circomData:", { zkCallData: m, dimData: f, circomData: p }), d)
111
+ return await $(t, m, f, p);
112
+ const y = t.getCurrentChainId();
113
+ if (s === o.Deposit) {
114
+ console.log("inside pendle deposit");
115
+ const e = E(n.ytAddress, y);
116
+ if (!e)
117
+ throw Error("Yt Token not found");
118
+ const u = t.getContractWithSigner(A.PendleGeneralExternalAction), F = t.getContractWithSigner(A.HinkalWrapper);
119
+ return await D(
120
+ t,
121
+ i[0],
122
+ e,
123
+ m,
124
+ p,
125
+ f,
126
+ u,
127
+ F
128
+ );
129
+ }
130
+ if (s === o.Withdraw && n.isRelayerOff) {
131
+ const e = E(n.ytAddress, y);
132
+ if (!e)
133
+ throw Error("Yt Token not found");
134
+ return await D(t, i[0], e, m, p, f);
135
+ }
136
+ return await v(t.getCurrentChainId(), m, f, p);
137
+ };
138
+ export {
139
+ Ft as hinkalActionPendle
140
+ };
package/common58.mjs ADDED
@@ -0,0 +1,95 @@
1
+ import "./common28.mjs";
2
+ import "./common157.mjs";
3
+ import "./common164.mjs";
4
+ import "./common168.mjs";
5
+ import "ethers";
6
+ import { transactionErrorCodes as P } from "./common81.mjs";
7
+ import { Utxo as A } from "./common71.mjs";
8
+ import "axios";
9
+ import "./common51.mjs";
10
+ import "./common50.mjs";
11
+ import { zeroAddress as f } from "./common34.mjs";
12
+ import { addPaddingToUtxos as U } from "./common139.mjs";
13
+ import { outputUtxoProcessing as z } from "./common123.mjs";
14
+ import { constructZkProof as T } from "./common146.mjs";
15
+ import "./common191.mjs";
16
+ import "./common117.mjs";
17
+ import { getERC20Token as C } from "./common118.mjs";
18
+ import "./common121.mjs";
19
+ import "./common35.mjs";
20
+ import "./common33.mjs";
21
+ import "./common129.mjs";
22
+ import { transactCallDirect as D } from "./common231.mjs";
23
+ import "circomlibjs";
24
+ import "./common42.mjs";
25
+ import "./common31.mjs";
26
+ import "./common77.mjs";
27
+ import "./common72.mjs";
28
+ import "libsodium-wrappers";
29
+ import "./common30.mjs";
30
+ import "./common36.mjs";
31
+ import "./common41.mjs";
32
+ const mt = async (t, i, r) => {
33
+ const s = C(i[0], t.getCurrentChainId());
34
+ if (!s)
35
+ throw Error("Deposit Action: No Token Found");
36
+ const a = r[0], o = {
37
+ externalActionId: 0n,
38
+ externalAddress: await t.getEthereumAddress(),
39
+ externalActionMetadata: "0x00"
40
+ }, e = [...await U(t, i, r)], p = `swapperM${r.length.toString()}x${e[0].length}x1`, m = [];
41
+ for (let n = 0; n < i.length; n += 1) {
42
+ const { outputUtxos: x } = z(t.userKeys, e[n], r[n]);
43
+ m.push(x);
44
+ }
45
+ const { zkCallData: d, circomData: u, dimData: l } = await T(
46
+ t.merkleTreeHinkal,
47
+ t.merkleTreeAccessToken,
48
+ e,
49
+ m,
50
+ t.userKeys,
51
+ p,
52
+ o.externalActionId,
53
+ o.externalAddress,
54
+ o.externalActionMetadata,
55
+ f,
56
+ t.getCurrentChainId()
57
+ );
58
+ return console.log("after proof generation"), await D(t, a, s, d, u, l);
59
+ }, ct = async (t, i, r, s) => {
60
+ console.log({ recipinetInfo: s });
61
+ const [a, o, e] = s.split(","), p = !a || !o || !e, m = o?.substring(0, 2) !== "0x" || e?.substring(0, 2) !== "0x", d = e?.length !== 66 || o?.length > 66 || o?.length < 64, u = s?.includes('"');
62
+ if (p || m || d || u)
63
+ throw Error(P.RECIPIENT_FORMAT_INCORRECT);
64
+ const l = [BigInt(a)], y = [o], n = i.map((c) => [
65
+ new A({ amount: 0n, erc20TokenAddress: c, shieldedPrivateKey: t.userKeys.getShieldedPrivateKey() }),
66
+ new A({ amount: 0n, erc20TokenAddress: c, shieldedPrivateKey: t.userKeys.getShieldedPrivateKey() })
67
+ ]), x = `swapperM${r.length.toString()}x${n[0].length}x1`, E = i.map((c, g) => [
68
+ new A({
69
+ amount: r[g],
70
+ erc20TokenAddress: c,
71
+ randomization: l[g],
72
+ stealthAddress: y[g],
73
+ encryptionKey: e
74
+ })
75
+ ]), { zkCallData: K, circomData: h, dimData: I } = await T(
76
+ t.merkleTreeHinkal,
77
+ t.merkleTreeAccessToken,
78
+ n,
79
+ E,
80
+ t.userKeys,
81
+ x,
82
+ 0n,
83
+ await t.getEthereumAddress(),
84
+ "0x00",
85
+ f,
86
+ t.getCurrentChainId()
87
+ ), w = C(i[0], t.getCurrentChainId());
88
+ if (!w)
89
+ throw Error("Withdraw Action: No Token Found");
90
+ return await D(t, r[0], w, K, h, I);
91
+ };
92
+ export {
93
+ mt as hinkalDeposit,
94
+ ct as hinkalDepositForOther
95
+ };
package/common59.mjs ADDED
@@ -0,0 +1,98 @@
1
+ import { networkRegistry as R } from "./common28.mjs";
2
+ import "./common157.mjs";
3
+ import { ExternalActionId as n } from "./common159.mjs";
4
+ import "./common164.mjs";
5
+ import "./common168.mjs";
6
+ import "ethers";
7
+ import { transactionErrorCodes as I } from "./common81.mjs";
8
+ import "circomlibjs";
9
+ import "./common51.mjs";
10
+ import "axios";
11
+ import "./common50.mjs";
12
+ import { addPaddingToUtxos as U } from "./common139.mjs";
13
+ import { outputUtxoProcessing as D } from "./common123.mjs";
14
+ import { constructZkProof as T } from "./common146.mjs";
15
+ import { estimateGasRelayer as b } from "./common229.mjs";
16
+ import { transactCallRelayer as F } from "./common230.mjs";
17
+ import "./common117.mjs";
18
+ import "./common72.mjs";
19
+ import "./common121.mjs";
20
+ import "./common35.mjs";
21
+ import "./common33.mjs";
22
+ import { processAmountChanges as L } from "./common125.mjs";
23
+ import { getFlatFees as M } from "./common126.mjs";
24
+ import "./common129.mjs";
25
+ import "./common42.mjs";
26
+ import "./common31.mjs";
27
+ import "./common191.mjs";
28
+ import "./common77.mjs";
29
+ import "libsodium-wrappers";
30
+ import "./common30.mjs";
31
+ import "./common36.mjs";
32
+ import "./common41.mjs";
33
+ const N = (t, o) => {
34
+ const { contractData: r } = R[t.getCurrentChainId()];
35
+ let e;
36
+ switch (o) {
37
+ case n.Uniswap:
38
+ e = r?.uniswapExternalActionAddress;
39
+ break;
40
+ case n.Odos:
41
+ e = r?.odosExternalActionInstanceAddress;
42
+ break;
43
+ case n.OneInch:
44
+ e = r?.oneInchExternalActionInstanceAddress;
45
+ break;
46
+ default:
47
+ e = r?.uniswapExternalActionAddress;
48
+ break;
49
+ }
50
+ if (!e)
51
+ throw new Error("No external Address set during swap");
52
+ return e;
53
+ }, dt = async (t, o, r, e, u, A = !1, x = !1) => {
54
+ const { flatFees: p, feeUnit: w } = await M(
55
+ t.getCurrentChainId(),
56
+ o,
57
+ e,
58
+ r
59
+ );
60
+ r = L({ erc20Addresses: o, amountChanges: r, flatFees: p, feeUnit: w, externalActionId: e });
61
+ const E = N(t, e), s = {
62
+ externalActionId: e,
63
+ externalAddress: E,
64
+ externalActionMetadata: u
65
+ }, i = [...await U(t, o, r)], g = `swapperM${r.length.toString()}x${i[0].length}x1`, y = [!1, !0], m = [];
66
+ for (let a = 0; a < o.length; a += 1) {
67
+ const { outputUtxos: C } = D(t.userKeys, i[a], r[a]);
68
+ m.push(C);
69
+ }
70
+ const c = await t.getRandomRelay();
71
+ if (!c)
72
+ throw Error(I.RELAYER_NOT_AVAILABLE);
73
+ const { zkCallData: d, circomData: l, dimData: f } = await T(
74
+ t.merkleTreeHinkal,
75
+ t.merkleTreeAccessToken,
76
+ i,
77
+ m,
78
+ t.userKeys,
79
+ g,
80
+ s.externalActionId,
81
+ s.externalAddress,
82
+ s.externalActionMetadata,
83
+ c,
84
+ t.getCurrentChainId(),
85
+ y,
86
+ p
87
+ );
88
+ return A ? await b(t, d, f, l) : await F(
89
+ t.getCurrentChainId(),
90
+ d,
91
+ f,
92
+ l,
93
+ x
94
+ );
95
+ };
96
+ export {
97
+ dt as hinkalSwap
98
+ };
package/common6.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 "./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 { getRelayerURL as i } from "./common14.mjs";
17
+ import { RELAYER_CONFIG as m } 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 P(r, t) {
28
+ return (await o.post(`${i(r)}${m.TRANSACT}`, t)).data;
29
+ }
30
+ export {
31
+ P as callRelayerTransactAPI
32
+ };
package/common60.mjs ADDED
@@ -0,0 +1,5 @@
1
+ const n = async () => {
2
+ };
3
+ export {
4
+ n as hinkalTransfer
5
+ };
package/common61.mjs ADDED
@@ -0,0 +1,91 @@
1
+ import "./common28.mjs";
2
+ import "./common157.mjs";
3
+ import { ExternalActionId as l } from "./common159.mjs";
4
+ import "./common164.mjs";
5
+ import "./common168.mjs";
6
+ import "ethers";
7
+ import { transactionErrorCodes as T } from "./common81.mjs";
8
+ import { zeroAddress as I } from "./common34.mjs";
9
+ import "circomlibjs";
10
+ import "./common51.mjs";
11
+ import "axios";
12
+ import "./common50.mjs";
13
+ import { addPaddingToUtxos as y } from "./common139.mjs";
14
+ import { outputUtxoProcessing as D } from "./common123.mjs";
15
+ import { constructZkProof as U } from "./common146.mjs";
16
+ import { estimateGasRelayer as F } from "./common229.mjs";
17
+ import { transactCallRelayer as N } from "./common230.mjs";
18
+ import { transactCallDirect as R } from "./common231.mjs";
19
+ import "./common117.mjs";
20
+ import { getERC20Token as L } from "./common118.mjs";
21
+ import "./common121.mjs";
22
+ import "./common35.mjs";
23
+ import "./common33.mjs";
24
+ import { processAmountChanges as M } from "./common125.mjs";
25
+ import { getFlatFees as P } from "./common126.mjs";
26
+ import "./common129.mjs";
27
+ import "./common42.mjs";
28
+ import "./common31.mjs";
29
+ import "./common191.mjs";
30
+ import "./common77.mjs";
31
+ import "./common72.mjs";
32
+ import "libsodium-wrappers";
33
+ import "./common30.mjs";
34
+ import "./common36.mjs";
35
+ import "./common41.mjs";
36
+ const lt = async (t, i, r, u, e, A = !1) => {
37
+ const { flatFees: x, feeUnit: w } = await P(
38
+ t.getCurrentChainId(),
39
+ i,
40
+ l.Transact,
41
+ r
42
+ );
43
+ e || M({
44
+ erc20Addresses: i,
45
+ amountChanges: r,
46
+ flatFees: x,
47
+ feeUnit: w,
48
+ externalActionId: l.Transact
49
+ });
50
+ const a = L(i[0], t.getCurrentChainId());
51
+ if (!a)
52
+ throw Error("Deposit Action: No Token Found");
53
+ const n = {
54
+ externalActionId: 0n,
55
+ externalAddress: u,
56
+ externalActionMetadata: "0x00"
57
+ }, m = [...await y(t, i, r)], g = `swapperM${r.length.toString()}x${m[0].length}x1`, C = [!1], d = [];
58
+ for (let o = 0; o < i.length; o += 1) {
59
+ const { outputUtxos: E } = D(t.userKeys, m[o], r[o]);
60
+ d.push(E);
61
+ }
62
+ const f = await t.getRandomRelay();
63
+ if (!e && !f)
64
+ throw Error(T.RELAYER_NOT_AVAILABLE);
65
+ const { zkCallData: p, circomData: c, dimData: s } = await U(
66
+ t.merkleTreeHinkal,
67
+ t.merkleTreeAccessToken,
68
+ m,
69
+ d,
70
+ t.userKeys,
71
+ g,
72
+ n.externalActionId,
73
+ n.externalAddress,
74
+ n.externalActionMetadata,
75
+ e ? I : f,
76
+ t.getCurrentChainId(),
77
+ C,
78
+ x
79
+ );
80
+ if (A)
81
+ return await F(t, p, s, c);
82
+ if (e) {
83
+ if (!a)
84
+ throw Error("Withdraw Action: No Token Found");
85
+ return await R(t, r[0], a, p, c, s);
86
+ }
87
+ return await N(t.getCurrentChainId(), p, s, c);
88
+ };
89
+ export {
90
+ lt as hinkalWithdraw
91
+ };
package/common62.mjs ADDED
@@ -0,0 +1,66 @@
1
+ import { networkRegistry as A } from "./common28.mjs";
2
+ import "./common157.mjs";
3
+ import { ExternalActionId as g } from "./common159.mjs";
4
+ import "./common164.mjs";
5
+ import "./common168.mjs";
6
+ import "ethers";
7
+ import { transactionErrorCodes as w } from "./common81.mjs";
8
+ import "circomlibjs";
9
+ import "./common51.mjs";
10
+ import "axios";
11
+ import "./common50.mjs";
12
+ import { addPaddingToUtxos as R } from "./common139.mjs";
13
+ import { outputUtxoProcessing as U } from "./common123.mjs";
14
+ import "./common191.mjs";
15
+ import "./common117.mjs";
16
+ import "./common72.mjs";
17
+ import "./common121.mjs";
18
+ import "./common35.mjs";
19
+ import "./common33.mjs";
20
+ import { processAmountChanges as C } from "./common125.mjs";
21
+ import "./common129.mjs";
22
+ import { estimateGasRelayer as I } from "./common229.mjs";
23
+ import { transactCallRelayer as P } from "./common230.mjs";
24
+ import "./common42.mjs";
25
+ import "./common31.mjs";
26
+ import "./common77.mjs";
27
+ import { constructEmporiumProof as T } from "./common147.mjs";
28
+ import "libsodium-wrappers";
29
+ import "./common30.mjs";
30
+ import "./common36.mjs";
31
+ import "./common41.mjs";
32
+ const pt = async (t, i, o, u, d = [], l, E = !1) => {
33
+ const e = i.map((r) => 0n);
34
+ o = C({ erc20Addresses: i, amountChanges: o, flatFees: e, feeUnit: void 0, externalActionId: g.Emporium });
35
+ const m = [...await R(t, i, o)], p = [];
36
+ for (let r = 0; r < i.length; r += 1) {
37
+ const { outputUtxos: y } = U(t.userKeys, m[r], o[r]);
38
+ p.push(y);
39
+ }
40
+ const a = await t.getRandomRelay();
41
+ if (!a)
42
+ throw Error(w.RELAYER_NOT_AVAILABLE);
43
+ const { contractData: x } = A[t.getCurrentChainId()], s = x.emporiumAddress;
44
+ if (!s)
45
+ throw Error("No Emporium Address Provided");
46
+ const { zkCallData: n, circomData: c, dimData: f } = await T(
47
+ t.merkleTreeHinkal,
48
+ t.merkleTreeAccessToken,
49
+ m,
50
+ p,
51
+ t.userKeys,
52
+ o.length,
53
+ m[0].length,
54
+ s,
55
+ d,
56
+ a,
57
+ t.getCurrentChainId(),
58
+ u,
59
+ e,
60
+ l
61
+ );
62
+ return E ? await I(t, n, f, c) : await P(t.getCurrentChainId(), n, f, c);
63
+ };
64
+ export {
65
+ pt as hinkalPrivateWallet
66
+ };
package/common63.mjs ADDED
@@ -0,0 +1,49 @@
1
+ import { networkRegistry as i } from "./common28.mjs";
2
+ import "./common157.mjs";
3
+ import { ContractType as r } from "./common158.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 "./common72.mjs";
15
+ import "./common121.mjs";
16
+ import "./common35.mjs";
17
+ import "./common33.mjs";
18
+ import "./common129.mjs";
19
+ import { ClientAccessTokenSnapshotService as m } from "./common232.mjs";
20
+ import { ClientCommitmentsSnapshotService as n } from "./common233.mjs";
21
+ import { ClientNullifierSnapshotService as c } from "./common234.mjs";
22
+ import "./common31.mjs";
23
+ import "./common77.mjs";
24
+ import "./common42.mjs";
25
+ import { balanceChangedHandler as o } from "./common141.mjs";
26
+ import "libsodium-wrappers";
27
+ import "./common30.mjs";
28
+ import "./common36.mjs";
29
+ import "./common41.mjs";
30
+ const j = async (e) => {
31
+ const { maxPageSize: t } = i[e.getCurrentChainId()];
32
+ e.commitmentsSnapshotService?.intervalClear(), e.commitmentsSnapshotService = new n(
33
+ e.getContractWithFetcher(r.HinkalContract),
34
+ t
35
+ ), e.nullifierSnapshotService?.intervalClear(), e.nullifierSnapshotService = new c(
36
+ e.getContractWithFetcher(r.HinkalContract),
37
+ t
38
+ ), e.accessTokenSnapshotService?.intervalClear(), e.accessTokenSnapshotService = new m(
39
+ e.getContractWithFetcher(r.CrossChainAccessTokenContract),
40
+ t
41
+ ), await Promise.all([
42
+ e.commitmentsSnapshotService.init(),
43
+ e.nullifierSnapshotService.init(),
44
+ e.accessTokenSnapshotService.init()
45
+ ]), e.merkleTreeHinkal = e.commitmentsSnapshotService.merkleTree, e.merkleTreeAccessToken = e.accessTokenSnapshotService.merkleTree, e.nullifiers = e.nullifierSnapshotService.nullifiers, e.encryptedOutputs = e.commitmentsSnapshotService.encryptedOutputs, e.commitmentsSnapshotService.onNewEvent = o, e.nullifierSnapshotService.onNewEvent = o;
46
+ };
47
+ export {
48
+ j as resetMerkleTrees
49
+ };