@gardenfi/swap 0.0.2 → 0.1.0-beta.1

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 (380) hide show
  1. package/dist/index104.cjs +1 -1
  2. package/dist/index104.js +1 -1
  3. package/dist/index106.cjs +1 -1
  4. package/dist/index106.js +3 -3
  5. package/dist/index107.cjs +1 -1
  6. package/dist/index107.js +1 -1
  7. package/dist/index113.cjs +1 -1
  8. package/dist/index113.js +1 -1
  9. package/dist/index116.cjs +1 -1
  10. package/dist/index116.js +1 -1
  11. package/dist/index117.cjs +1 -1
  12. package/dist/index117.js +1 -1
  13. package/dist/index12.cjs +1 -1
  14. package/dist/index12.js +12 -12
  15. package/dist/index120.cjs +1 -1
  16. package/dist/index120.js +2 -2
  17. package/dist/index121.cjs +1 -1
  18. package/dist/index121.js +7 -7
  19. package/dist/index126.cjs +1 -1
  20. package/dist/index126.js +3 -3
  21. package/dist/index127.cjs +1 -1
  22. package/dist/index127.js +1 -1
  23. package/dist/index128.cjs +1 -1
  24. package/dist/index128.js +2 -2
  25. package/dist/index129.cjs +1 -1
  26. package/dist/index129.js +1 -1
  27. package/dist/index130.cjs +1 -1
  28. package/dist/index130.js +3 -3
  29. package/dist/index132.cjs +1 -1
  30. package/dist/index132.js +1 -1
  31. package/dist/index133.cjs +1 -1
  32. package/dist/index133.js +1 -1
  33. package/dist/index134.cjs +1 -1
  34. package/dist/index134.js +1 -1
  35. package/dist/index135.cjs +1 -1
  36. package/dist/index135.js +1 -1
  37. package/dist/index138.cjs +1 -1
  38. package/dist/index138.js +1 -1
  39. package/dist/index140.cjs +1 -1
  40. package/dist/index140.js +1 -1
  41. package/dist/index148.cjs +1 -1
  42. package/dist/index148.js +1 -1
  43. package/dist/index149.cjs +1 -1
  44. package/dist/index149.js +1 -1
  45. package/dist/index154.cjs +1 -1
  46. package/dist/index154.js +1 -1
  47. package/dist/index160.cjs +1 -1
  48. package/dist/index160.js +1 -1
  49. package/dist/index162.cjs +1 -1
  50. package/dist/index162.js +2 -2
  51. package/dist/index167.cjs +1 -1
  52. package/dist/index167.js +2 -2
  53. package/dist/index168.cjs +1 -1
  54. package/dist/index168.js +2 -2
  55. package/dist/index169.cjs +1 -1
  56. package/dist/index169.js +2 -2
  57. package/dist/index170.cjs +1 -1
  58. package/dist/index170.js +2 -2
  59. package/dist/index171.cjs +1 -1
  60. package/dist/index171.js +2 -2
  61. package/dist/index172.cjs +1 -1
  62. package/dist/index172.js +2 -2
  63. package/dist/index173.cjs +1 -1
  64. package/dist/index173.js +2 -2
  65. package/dist/index178.cjs +1 -1
  66. package/dist/index178.js +1 -1
  67. package/dist/index18.cjs +1 -1
  68. package/dist/index18.js +3 -3
  69. package/dist/index181.cjs +1 -1
  70. package/dist/index181.js +1 -1
  71. package/dist/index182.cjs +1 -1
  72. package/dist/index182.js +61 -42
  73. package/dist/index19.cjs +1 -1
  74. package/dist/index19.js +18 -18
  75. package/dist/index190.cjs +1 -1
  76. package/dist/index190.js +1 -1
  77. package/dist/index195.cjs +1 -1
  78. package/dist/index195.js +19 -19
  79. package/dist/index20.cjs +1 -1
  80. package/dist/index20.js +2 -2
  81. package/dist/index21.cjs +1 -1
  82. package/dist/index21.js +19 -19
  83. package/dist/index217.cjs +1 -1
  84. package/dist/index217.js +58 -49
  85. package/dist/index24.cjs +1 -1
  86. package/dist/index24.js +2 -2
  87. package/dist/index242.cjs +1 -1
  88. package/dist/index242.js +1 -1
  89. package/dist/index247.cjs +1 -1
  90. package/dist/index247.js +2 -2
  91. package/dist/index248.cjs +1 -1
  92. package/dist/index248.js +1 -1
  93. package/dist/index249.cjs +1 -1
  94. package/dist/index249.js +2 -2
  95. package/dist/index260.cjs +1 -1
  96. package/dist/index260.js +3 -3
  97. package/dist/index272.cjs +1 -1
  98. package/dist/index272.js +1 -1
  99. package/dist/index273.cjs +1 -1
  100. package/dist/index273.js +1 -1
  101. package/dist/index276.cjs +1 -1
  102. package/dist/index276.js +3 -3
  103. package/dist/index278.cjs +1 -1
  104. package/dist/index278.js +1 -1
  105. package/dist/index28.cjs +1 -1
  106. package/dist/index28.js +58 -58
  107. package/dist/index281.cjs +1 -1
  108. package/dist/index281.js +140 -54
  109. package/dist/index282.cjs +1 -1
  110. package/dist/index282.js +5 -120
  111. package/dist/index283.cjs +2 -1
  112. package/dist/index283.js +42 -5
  113. package/dist/index284.cjs +1 -1
  114. package/dist/index284.js +2 -8
  115. package/dist/index285.cjs +1 -1
  116. package/dist/index285.js +5 -4
  117. package/dist/index286.cjs +1 -1
  118. package/dist/index286.js +9 -162
  119. package/dist/index287.cjs +1 -1
  120. package/dist/index287.js +20 -5
  121. package/dist/index288.cjs +1 -2
  122. package/dist/index288.js +8 -41
  123. package/dist/index289.cjs +1 -1
  124. package/dist/index289.js +73 -2
  125. package/dist/index290.cjs +1 -1
  126. package/dist/index290.js +65 -5
  127. package/dist/index291.cjs +1 -1
  128. package/dist/index291.js +187 -9
  129. package/dist/index292.cjs +1 -1
  130. package/dist/index292.js +20 -17
  131. package/dist/index293.cjs +1 -1
  132. package/dist/index293.js +42 -8
  133. package/dist/index294.cjs +1 -1
  134. package/dist/index294.js +24 -71
  135. package/dist/index295.cjs +1 -1
  136. package/dist/index295.js +86 -61
  137. package/dist/index296.cjs +1 -1
  138. package/dist/index296.js +35 -183
  139. package/dist/index297.cjs +1 -1
  140. package/dist/index297.js +15 -21
  141. package/dist/index298.cjs +1 -1
  142. package/dist/index298.js +5 -34
  143. package/dist/index299.cjs +1 -1
  144. package/dist/index299.js +36 -24
  145. package/dist/index3.cjs +1 -1
  146. package/dist/index3.js +4 -12
  147. package/dist/index300.cjs +1 -1
  148. package/dist/index300.js +15 -90
  149. package/dist/index301.cjs +1 -1
  150. package/dist/index301.js +8 -40
  151. package/dist/index302.cjs +1 -1
  152. package/dist/index302.js +7 -16
  153. package/dist/index303.cjs +1 -1
  154. package/dist/index303.js +41 -12
  155. package/dist/index304.cjs +1 -1
  156. package/dist/index304.js +318 -35
  157. package/dist/index305.cjs +1 -1
  158. package/dist/index305.js +605 -15
  159. package/dist/index306.cjs +1 -1
  160. package/dist/index306.js +110 -9
  161. package/dist/index307.cjs +1 -1
  162. package/dist/index307.js +167 -42
  163. package/dist/index308.cjs +1 -1
  164. package/dist/index308.js +291 -310
  165. package/dist/index309.cjs +1 -1
  166. package/dist/index309.js +94 -606
  167. package/dist/index31.cjs +1 -1
  168. package/dist/index31.js +1 -1
  169. package/dist/index310.cjs +1 -1
  170. package/dist/index310.js +44 -97
  171. package/dist/index311.cjs +1 -1
  172. package/dist/index311.js +52 -166
  173. package/dist/index312.cjs +1 -1
  174. package/dist/index312.js +41 -298
  175. package/dist/index313.cjs +1 -1
  176. package/dist/index313.js +15 -93
  177. package/dist/index314.cjs +1 -1
  178. package/dist/index314.js +310 -49
  179. package/dist/index315.cjs +1 -1
  180. package/dist/index315.js +57 -51
  181. package/dist/index316.cjs +1 -1
  182. package/dist/index316.js +18 -43
  183. package/dist/index317.cjs +1 -1
  184. package/dist/index317.js +28 -14
  185. package/dist/index318.cjs +1 -1
  186. package/dist/index318.js +3 -317
  187. package/dist/index319.cjs +7 -1
  188. package/dist/index319.js +232 -54
  189. package/dist/index32.cjs +1 -1
  190. package/dist/index32.js +1 -1
  191. package/dist/index320.cjs +1 -1
  192. package/dist/index320.js +47 -19
  193. package/dist/index321.cjs +1 -1
  194. package/dist/index321.js +208 -25
  195. package/dist/index322.cjs +1 -1
  196. package/dist/index322.js +81 -3
  197. package/dist/index323.cjs +1 -7
  198. package/dist/index323.js +27 -235
  199. package/dist/index324.cjs +1 -1
  200. package/dist/index324.js +77 -48
  201. package/dist/index325.cjs +1 -1
  202. package/dist/index325.js +9 -212
  203. package/dist/index326.cjs +1 -1
  204. package/dist/index326.js +15 -80
  205. package/dist/index327.cjs +1 -1
  206. package/dist/index327.js +20 -27
  207. package/dist/index328.cjs +1 -1
  208. package/dist/index328.js +13 -76
  209. package/dist/index329.cjs +1 -1
  210. package/dist/index329.js +13 -7
  211. package/dist/index330.cjs +1 -1
  212. package/dist/index330.js +14 -11
  213. package/dist/index331.cjs +1 -1
  214. package/dist/index331.js +9 -13
  215. package/dist/index332.cjs +1 -1
  216. package/dist/index332.js +13 -10
  217. package/dist/index333.cjs +1 -1
  218. package/dist/index333.js +25 -9
  219. package/dist/index334.cjs +1 -1
  220. package/dist/index334.js +31 -16
  221. package/dist/index335.cjs +2 -1
  222. package/dist/index335.js +18 -22
  223. package/dist/index336.cjs +1 -1
  224. package/dist/index336.js +14 -13
  225. package/dist/index337.cjs +1 -1
  226. package/dist/index337.js +11 -14
  227. package/dist/index338.cjs +1 -1
  228. package/dist/index338.js +10 -7
  229. package/dist/index339.cjs +1 -1
  230. package/dist/index339.js +32 -14
  231. package/dist/index340.cjs +1 -1
  232. package/dist/index340.js +115 -25
  233. package/dist/index341.cjs +1 -1
  234. package/dist/index341.js +102 -30
  235. package/dist/index342.cjs +1 -2
  236. package/dist/index342.js +6 -18
  237. package/dist/index343.cjs +1 -1
  238. package/dist/index343.js +7 -15
  239. package/dist/index344.cjs +1 -1
  240. package/dist/index344.js +25 -32
  241. package/dist/index345.cjs +1 -1
  242. package/dist/index345.js +16 -115
  243. package/dist/index346.cjs +1 -1
  244. package/dist/index346.js +212 -101
  245. package/dist/index347.cjs +1 -1
  246. package/dist/index347.js +7 -6
  247. package/dist/index348.cjs +1 -1
  248. package/dist/index348.js +120 -7
  249. package/dist/index349.cjs +1 -1
  250. package/dist/index349.js +4 -26
  251. package/dist/index350.cjs +2 -1
  252. package/dist/index350.js +193 -16
  253. package/dist/index351.cjs +1 -1
  254. package/dist/index351.js +72 -209
  255. package/dist/index352.cjs +1 -2
  256. package/dist/index352.js +317 -167
  257. package/dist/index353.cjs +1 -1
  258. package/dist/index353.js +160 -16
  259. package/dist/index354.cjs +1 -1
  260. package/dist/index354.js +5 -15
  261. package/dist/index355.cjs +1 -1
  262. package/dist/index355.js +12 -7
  263. package/dist/index356.cjs +1 -1
  264. package/dist/index356.js +16 -52
  265. package/dist/index357.cjs +1 -1
  266. package/dist/index357.js +51 -20
  267. package/dist/index358.cjs +1 -1
  268. package/dist/index358.js +10 -2
  269. package/dist/index363.cjs +1 -1
  270. package/dist/index363.js +1 -1
  271. package/dist/index364.cjs +1 -1
  272. package/dist/index364.js +1 -1
  273. package/dist/index365.cjs +1 -1
  274. package/dist/index365.js +3 -275
  275. package/dist/index366.cjs +1 -1
  276. package/dist/index366.js +73 -170
  277. package/dist/index367.cjs +1 -1
  278. package/dist/index367.js +32 -10
  279. package/dist/index368.cjs +1 -1
  280. package/dist/index368.js +5 -107
  281. package/dist/index369.cjs +1 -1
  282. package/dist/index369.js +140 -5
  283. package/dist/index370.cjs +1 -1
  284. package/dist/index370.js +274 -72
  285. package/dist/index371.cjs +1 -1
  286. package/dist/index371.js +171 -10
  287. package/dist/index372.cjs +1 -1
  288. package/dist/index372.js +10 -32
  289. package/dist/index373.cjs +1 -1
  290. package/dist/index373.js +101 -134
  291. package/dist/index374.cjs +1 -1
  292. package/dist/index374.js +9 -3
  293. package/dist/index375.cjs +1 -1
  294. package/dist/index375.js +4 -4
  295. package/dist/index376.cjs +1 -1
  296. package/dist/index376.js +1 -1
  297. package/dist/index378.cjs +1 -1
  298. package/dist/index378.js +1 -1
  299. package/dist/index379.cjs +1 -1
  300. package/dist/index379.js +1 -1
  301. package/dist/index38.cjs +1 -1
  302. package/dist/index38.js +2 -2
  303. package/dist/index380.cjs +1 -1
  304. package/dist/index380.js +1 -1
  305. package/dist/index381.cjs +1 -1
  306. package/dist/index381.js +2 -344
  307. package/dist/index382.cjs +1 -1
  308. package/dist/index382.js +15 -154
  309. package/dist/index383.cjs +1 -1
  310. package/dist/index383.js +110 -3
  311. package/dist/index384.cjs +1 -1
  312. package/dist/index384.js +3 -63
  313. package/dist/index385.cjs +1 -1
  314. package/dist/index385.js +59 -106
  315. package/dist/index386.cjs +1 -1
  316. package/dist/index386.js +2 -2
  317. package/dist/index42.cjs +1 -1
  318. package/dist/index42.js +88 -12
  319. package/dist/index43.cjs +1 -1
  320. package/dist/index43.js +13 -58
  321. package/dist/index44.cjs +1 -1
  322. package/dist/index44.js +12 -522
  323. package/dist/index45.cjs +1 -1
  324. package/dist/index45.js +59 -30
  325. package/dist/index46.cjs +1 -1
  326. package/dist/index46.js +522 -26
  327. package/dist/index47.cjs +1 -1
  328. package/dist/index47.js +16 -12
  329. package/dist/index48.cjs +1 -1
  330. package/dist/index48.js +12 -35
  331. package/dist/index49.cjs +1 -1
  332. package/dist/index49.js +14 -16
  333. package/dist/index50.cjs +1 -1
  334. package/dist/index50.js +38 -17
  335. package/dist/index51.cjs +1 -1
  336. package/dist/index51.js +15 -18
  337. package/dist/index52.cjs +1 -1
  338. package/dist/index52.js +17 -19
  339. package/dist/index53.cjs +1 -1
  340. package/dist/index53.js +17 -42
  341. package/dist/index54.cjs +1 -1
  342. package/dist/index54.js +15 -39
  343. package/dist/index55.cjs +1 -1
  344. package/dist/index55.js +49 -29
  345. package/dist/index56.cjs +1 -1
  346. package/dist/index56.js +46 -29
  347. package/dist/index57.cjs +1 -1
  348. package/dist/index57.js +26 -20
  349. package/dist/index58.cjs +1 -1
  350. package/dist/index58.js +27 -18
  351. package/dist/index59.cjs +1 -1
  352. package/dist/index59.js +16 -14
  353. package/dist/index60.cjs +1 -1
  354. package/dist/index60.js +28 -15
  355. package/dist/index61.cjs +1 -1
  356. package/dist/index61.js +28 -14
  357. package/dist/index62.cjs +1 -1
  358. package/dist/index62.js +13 -86
  359. package/dist/index63.cjs +1 -1
  360. package/dist/index63.js +13 -13
  361. package/dist/index64.cjs +1 -1
  362. package/dist/index64.js +17 -32
  363. package/dist/index65.cjs +1 -1
  364. package/dist/index65.js +9 -14
  365. package/dist/index66.cjs +1 -1
  366. package/dist/index66.js +32 -17
  367. package/dist/index67.cjs +1 -1
  368. package/dist/index67.js +14 -9
  369. package/dist/index71.cjs +1 -1
  370. package/dist/index71.js +28 -19
  371. package/dist/index77.cjs +1 -1
  372. package/dist/index77.js +13 -13
  373. package/dist/index9.cjs +1 -1
  374. package/dist/index9.js +27 -19
  375. package/dist/index92.cjs +1 -1
  376. package/dist/index92.js +1 -1
  377. package/dist/src/lib/constants/wagmiConfig.d.ts +9 -9
  378. package/dist/src/lib/store/swapStore.d.ts +1 -1
  379. package/dist/src/lib/types/types.d.ts +0 -1
  380. package/package.json +6 -6
package/dist/index195.js CHANGED
@@ -3,8 +3,8 @@ import { isHex as d } from "./index100.js";
3
3
  import { isAddress as f } from "./index79.js";
4
4
  import { toEventSelector as g } from "./index219.js";
5
5
  import { toFunctionSelector as b } from "./index216.js";
6
- function x(s) {
7
- const { abi: o, args: n = [], name: e } = s, u = d(e, { strict: !1 }), i = o.filter((t) => u ? t.type === "function" ? b(t) === e : t.type === "event" ? g(t) === e : !1 : "name" in t && t.name === e);
6
+ function w(s) {
7
+ const { abi: o, args: e = [], name: n } = s, u = d(n, { strict: !1 }), i = o.filter((t) => u ? t.type === "function" ? b(t) === n : t.type === "event" ? g(t) === n : !1 : "name" in t && t.name === n);
8
8
  if (i.length === 0)
9
9
  return;
10
10
  if (i.length === 1)
@@ -13,19 +13,19 @@ function x(s) {
13
13
  for (const t of i) {
14
14
  if (!("inputs" in t))
15
15
  continue;
16
- if (!n || n.length === 0) {
16
+ if (!e || e.length === 0) {
17
17
  if (!t.inputs || t.inputs.length === 0)
18
18
  return t;
19
19
  continue;
20
20
  }
21
- if (!t.inputs || t.inputs.length === 0 || t.inputs.length !== n.length)
21
+ if (!t.inputs || t.inputs.length === 0 || t.inputs.length !== e.length)
22
22
  continue;
23
- if (n.every((c, m) => {
23
+ if (e.every((c, m) => {
24
24
  const l = "inputs" in t && t.inputs[m];
25
25
  return l ? p(c, l) : !1;
26
26
  })) {
27
27
  if (r && "inputs" in r && r.inputs) {
28
- const c = a(t.inputs, r.inputs, n);
28
+ const c = a(t.inputs, r.inputs, e);
29
29
  if (c)
30
30
  throw new y({
31
31
  abiItem: t,
@@ -41,36 +41,36 @@ function x(s) {
41
41
  return r || i[0];
42
42
  }
43
43
  function p(s, o) {
44
- const n = typeof s, e = o.type;
45
- switch (e) {
44
+ const e = typeof s, n = o.type;
45
+ switch (n) {
46
46
  case "address":
47
47
  return f(s, { strict: !1 });
48
48
  case "bool":
49
- return n === "boolean";
49
+ return e === "boolean";
50
50
  case "function":
51
- return n === "string";
51
+ return e === "string";
52
52
  case "string":
53
- return n === "string";
53
+ return e === "string";
54
54
  default:
55
- return e === "tuple" && "components" in o ? Object.values(o.components).every((u, i) => p(Object.values(s)[i], u)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(e) ? n === "number" || n === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(e) ? n === "string" || s instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(e) ? Array.isArray(s) && s.every((u) => p(u, {
55
+ return n === "tuple" && "components" in o ? Object.values(o.components).every((u, i) => e === "object" && p(Object.values(s)[i], u)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n) ? e === "number" || e === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n) ? e === "string" || s instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n) ? Array.isArray(s) && s.every((u) => p(u, {
56
56
  ...o,
57
57
  // Pop off `[]` or `[M]` from end of type
58
- type: e.replace(/(\[[0-9]{0,}\])$/, "")
58
+ type: n.replace(/(\[[0-9]{0,}\])$/, "")
59
59
  })) : !1;
60
60
  }
61
61
  }
62
- function a(s, o, n) {
63
- for (const e in s) {
64
- const u = s[e], i = o[e];
62
+ function a(s, o, e) {
63
+ for (const n in s) {
64
+ const u = s[n], i = o[n];
65
65
  if (u.type === "tuple" && i.type === "tuple" && "components" in u && "components" in i)
66
- return a(u.components, i.components, n[e]);
66
+ return a(u.components, i.components, e[n]);
67
67
  const r = [u.type, i.type];
68
- if (r.includes("address") && r.includes("bytes20") ? !0 : r.includes("address") && r.includes("string") ? f(n[e], { strict: !1 }) : r.includes("address") && r.includes("bytes") ? f(n[e], { strict: !1 }) : !1)
68
+ if (r.includes("address") && r.includes("bytes20") ? !0 : r.includes("address") && r.includes("string") ? f(e[n], { strict: !1 }) : r.includes("address") && r.includes("bytes") ? f(e[n], { strict: !1 }) : !1)
69
69
  return r;
70
70
  }
71
71
  }
72
72
  export {
73
- x as getAbiItem,
73
+ w as getAbiItem,
74
74
  a as getAmbiguousTypes,
75
75
  p as isArgOfType
76
76
  };
package/dist/index20.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@gardenfi/core"),d=require("./index42.cjs"),g=require("./index43.cjs"),b=async(s,r,c)=>{const n=p.evmToViemChainMap[s];if(!n)return null;const i=d.createPublicClient({chain:n,transport:g.http()});try{const e="0x000000000000000000000000000000000000dead",o=BigInt(Math.floor(Date.now()/1e3)+3600),u="0x"+"0".repeat(64),t=await i.estimateContractGas({address:c,account:r,abi:[{inputs:[{internalType:"address payable",name:"redeemer",type:"address"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"secretHash",type:"bytes32"}],name:"initiate",outputs:[],stateMutability:"payable",type:"function"}],functionName:"initiate",args:[e,o,1n,u],value:1n}),a=await i.getGasPrice(),l=t+t*40n/100n,m=a+a*50n/100n,y=l*m;return{gasLimit:t,gasPrice:a,gasCost:y}}catch(e){return console.error("Legacy gas estimate failed:",e),null}};exports.getLegacyGasEstimate=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@gardenfi/core"),d=require("./index44.cjs"),g=require("./index45.cjs"),b=async(s,r,c)=>{const n=p.evmToViemChainMap[s];if(!n)return null;const i=d.createPublicClient({chain:n,transport:g.http()});try{const e="0x000000000000000000000000000000000000dead",o=BigInt(Math.floor(Date.now()/1e3)+3600),u="0x"+"0".repeat(64),t=await i.estimateContractGas({address:c,account:r,abi:[{inputs:[{internalType:"address payable",name:"redeemer",type:"address"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"secretHash",type:"bytes32"}],name:"initiate",outputs:[],stateMutability:"payable",type:"function"}],functionName:"initiate",args:[e,o,1n,u],value:1n}),a=await i.getGasPrice(),l=t+t*40n/100n,m=a+a*50n/100n,y=l*m;return{gasLimit:t,gasPrice:a,gasCost:y}}catch(e){return console.error("Legacy gas estimate failed:",e),null}};exports.getLegacyGasEstimate=b;
package/dist/index20.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { evmToViemChainMap as y } from "@gardenfi/core";
2
- import { createPublicClient as d } from "./index42.js";
3
- import { http as f } from "./index43.js";
2
+ import { createPublicClient as d } from "./index44.js";
3
+ import { http as f } from "./index45.js";
4
4
  const C = async (r, s, o) => {
5
5
  const n = y[r];
6
6
  if (!n) return null;
package/dist/index21.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@gardenfi/core"),h=require("@gardenfi/orderbook"),f=require("@gardenfi/utils"),p=require("bignumber.js"),b=require("starknet"),y=require("@solana/web3.js"),w=require("./index60.cjs"),m=require("./index61.cjs"),S=require("./index34.cjs"),B=require("./index42.cjs"),T=require("./index43.cjs"),v=[{members:[{name:"low",offset:0,type:"felt"},{name:"high",offset:1,type:"felt"}],name:"Uint256",size:2,type:"struct"},{inputs:[{name:"account",type:"felt"}],name:"balanceOf",outputs:[{name:"balance",type:"Uint256"}],stateMutability:"view",type:"function"}],E=async(a,e,s)=>{var r,l,u;try{const o=s===f.Network.TESTNET?"https://api.devnet.solana.com":"https://solana-rpc.publicnode.com",n=new y.Connection(o),c=typeof a=="string"?new y.PublicKey(a):a;if(((r=e.token)==null?void 0:r.address)==="")return(await n.getBalance(c)).toString();let i;try{i=new y.PublicKey(((l=e.token)==null?void 0:l.address)||"")}catch(d){return console.error("Invalid token mint address",{address:(u=e.token)==null?void 0:u.address,error:d}),"0"}const t=await n.getTokenAccountsByOwner(c,{mint:i});return t.value.length===0?"0":(await n.getTokenAccountBalance(t.value[0].pubkey)).value.amount}catch(o){return console.error("Error fetching Solana token balance:",o),"0"}},C=async(a,e,s)=>{var r;if(!h.isStarknet(e.chain))return"0";try{const l=new b.RpcProvider({nodeUrl:k.STARKNET_CONFIG[s].nodeUrl}),o=await new b.Contract(v,((r=e.token)==null?void 0:r.address)||"",l).balanceOf(a);if(!o)return"0";const n=o.balance.low.toString(),c=o.balance.high.toString(),i=new p(n),t=new p(c),g=new p(2).pow(128);return i.plus(t.multipliedBy(g)).toString(10)}catch(l){return console.error("Error fetching Starknet balance:",l),"0"}},N=async(a,e)=>{var s;try{if(h.isBitcoin(e.chain)||!h.isEVM(e.chain)||!h.isEvmNativeToken(e.chain,((s=e.token)==null?void 0:s.address)||""))return 0;const r=k.evmToViemChainMap[e.chain];if(!r)return 0;const u=await B.createPublicClient({chain:r,transport:T.http()}).getBalance({address:a});return S.formatAmount(u,e.decimals,8)}catch(r){return console.error("Error fetching native balance:",r),0}},q=async(a,e,s)=>{var u,o;if(!h.isSui(e.chain))return"0";const r=w.getFullnodeUrl(s);async function l(n,c){const t=await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:n,params:c})})).json();if(t.error)throw new Error(t.error.message);return t.result}try{if(((u=e.token)==null?void 0:u.address)==="primary"||((o=e.token)==null?void 0:o.address)==="0x2::sui::SUI"){const c=await l("suix_getBalance",[a,"0x2::sui::SUI"]),i=new p(c.totalBalance??0),t=new p(await m.getSuiTotalGasFee(a,i.toString(10),s));return p.max(i.minus(5e6).minus(t),0).toString(10)}else{const n=await l("suix_getAllBalances",[a]),c=Array.isArray(n)?n.find(i=>{var t,g;return i.coinType===((t=e.token)==null?void 0:t.address)||i.coinType===((g=e.token)==null?void 0:g.address.replace(/^0x/,"0x"))}):void 0;return c?String(c.totalBalance??"0"):"0"}}catch(n){return console.error("Error fetching Sui token balance:",n),"0"}};exports.getNativeBalance=N;exports.getSolanaTokenBalance=E;exports.getStarknetTokenBalance=C;exports.getSuiTokenBalance=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@gardenfi/core"),d=require("@gardenfi/orderbook"),f=require("@gardenfi/utils"),g=require("bignumber.js"),y=require("starknet"),b=require("@solana/web3.js"),w=require("./index62.cjs"),m=require("./index63.cjs"),S=require("./index34.cjs"),B=require("./index44.cjs"),T=require("./index45.cjs"),v=[{members:[{name:"low",offset:0,type:"felt"},{name:"high",offset:1,type:"felt"}],name:"Uint256",size:2,type:"struct"},{inputs:[{name:"account",type:"felt"}],name:"balanceOf",outputs:[{name:"balance",type:"Uint256"}],stateMutability:"view",type:"function"}],E=async(a,e,s)=>{var r,l,u;try{const o=s===f.Network.TESTNET?"https://api.devnet.solana.com":"https://solana-rpc.publicnode.com",n=new b.Connection(o),c=typeof a=="string"?new b.PublicKey(a):a;if(((r=e.token)==null?void 0:r.address)==="")return(await n.getBalance(c)).toString();let i;try{i=new b.PublicKey(((l=e.token)==null?void 0:l.address)||"")}catch(h){return console.error("Invalid token mint address",{address:(u=e.token)==null?void 0:u.address,error:h}),"0"}const t=await n.getTokenAccountsByOwner(c,{mint:i});return t.value.length===0?"0":(await n.getTokenAccountBalance(t.value[0].pubkey)).value.amount}catch(o){return console.error("Error fetching Solana token balance:",o),"0"}},C=async(a,e,s)=>{var r;if(!d.isStarknet(e.chain))return"0";try{const l=new y.RpcProvider({nodeUrl:k.STARKNET_CONFIG[s].nodeUrl}),o=await new y.Contract({providerOrAccount:l,abi:v,address:(r=e.token)==null?void 0:r.address}).balanceOf(a);if(!o)return"0";const n=o.balance.low.toString(),c=o.balance.high.toString(),i=new g(n),t=new g(c),p=new g(2).pow(128);return i.plus(t.multipliedBy(p)).toString(10)}catch(l){return console.error("Error fetching Starknet balance:",l),"0"}},N=async(a,e)=>{var s;try{if(d.isBitcoin(e.chain)||!d.isEVM(e.chain)||!d.isEvmNativeToken(e.chain,((s=e.token)==null?void 0:s.address)||""))return 0;const r=k.evmToViemChainMap[e.chain];if(!r)return 0;const u=await B.createPublicClient({chain:r,transport:T.http()}).getBalance({address:a});return S.formatAmount(u,e.decimals,8)}catch(r){return console.error("Error fetching native balance:",r),0}},q=async(a,e,s)=>{var u,o;if(!d.isSui(e.chain))return"0";const r=w.getFullnodeUrl(s);async function l(n,c){const t=await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:n,params:c})})).json();if(t.error)throw new Error(t.error.message);return t.result}try{if(((u=e.token)==null?void 0:u.address)==="primary"||((o=e.token)==null?void 0:o.address)==="0x2::sui::SUI"){const c=await l("suix_getBalance",[a,"0x2::sui::SUI"]),i=new g(c.totalBalance??0),t=new g(await m.getSuiTotalGasFee(a,i.toString(10),s));return g.max(i.minus(5e6).minus(t),0).toString(10)}else{const n=await l("suix_getAllBalances",[a]),c=Array.isArray(n)?n.find(i=>{var t,p;return i.coinType===((t=e.token)==null?void 0:t.address)||i.coinType===((p=e.token)==null?void 0:p.address.replace(/^0x/,"0x"))}):void 0;return c?String(c.totalBalance??"0"):"0"}}catch(n){return console.error("Error fetching Sui token balance:",n),"0"}};exports.getNativeBalance=N;exports.getSolanaTokenBalance=E;exports.getStarknetTokenBalance=C;exports.getSuiTokenBalance=q;
package/dist/index21.js CHANGED
@@ -1,15 +1,15 @@
1
- import { STARKNET_CONFIG as d, evmToViemChainMap as g } from "@gardenfi/core";
1
+ import { STARKNET_CONFIG as h, evmToViemChainMap as g } from "@gardenfi/core";
2
2
  import { isSui as y, isStarknet as w, isBitcoin as b, isEVM as k, isEvmNativeToken as S } from "@gardenfi/orderbook";
3
3
  import { Network as B } from "@gardenfi/utils";
4
4
  import p from "bignumber.js";
5
5
  import { RpcProvider as T, Contract as E } from "starknet";
6
- import { Connection as v, PublicKey as h } from "@solana/web3.js";
7
- import { getFullnodeUrl as C } from "./index60.js";
8
- import { getSuiTotalGasFee as I } from "./index61.js";
9
- import { formatAmount as N } from "./index34.js";
10
- import { createPublicClient as U } from "./index42.js";
11
- import { http as _ } from "./index43.js";
12
- const A = [
6
+ import { Connection as v, PublicKey as d } from "@solana/web3.js";
7
+ import { getFullnodeUrl as C } from "./index62.js";
8
+ import { getSuiTotalGasFee as I } from "./index63.js";
9
+ import { formatAmount as A } from "./index34.js";
10
+ import { createPublicClient as N } from "./index44.js";
11
+ import { http as U } from "./index45.js";
12
+ const _ = [
13
13
  {
14
14
  members: [
15
15
  {
@@ -47,12 +47,12 @@ const A = [
47
47
  ], z = async (o, n, s) => {
48
48
  var r, l, u;
49
49
  try {
50
- const a = s === B.TESTNET ? "https://api.devnet.solana.com" : "https://solana-rpc.publicnode.com", t = new v(a), c = typeof o == "string" ? new h(o) : o;
50
+ const a = s === B.TESTNET ? "https://api.devnet.solana.com" : "https://solana-rpc.publicnode.com", t = new v(a), c = typeof o == "string" ? new d(o) : o;
51
51
  if (((r = n.token) == null ? void 0 : r.address) === "")
52
52
  return (await t.getBalance(c)).toString();
53
53
  let i;
54
54
  try {
55
- i = new h(((l = n.token) == null ? void 0 : l.address) || "");
55
+ i = new d(((l = n.token) == null ? void 0 : l.address) || "");
56
56
  } catch (f) {
57
57
  return console.error("Invalid token mint address", {
58
58
  address: (u = n.token) == null ? void 0 : u.address,
@@ -73,12 +73,12 @@ const A = [
73
73
  if (!w(n.chain)) return "0";
74
74
  try {
75
75
  const l = new T({
76
- nodeUrl: d[s].nodeUrl
77
- }), a = await new E(
78
- A,
79
- ((r = n.token) == null ? void 0 : r.address) || "",
80
- l
81
- ).balanceOf(o);
76
+ nodeUrl: h[s].nodeUrl
77
+ }), a = await new E({
78
+ providerOrAccount: l,
79
+ abi: _,
80
+ address: (r = n.token) == null ? void 0 : r.address
81
+ }).balanceOf(o);
82
82
  if (!a) return "0";
83
83
  const t = a.balance.low.toString(), c = a.balance.high.toString(), i = new p(t), e = new p(c), m = new p(2).pow(128);
84
84
  return i.plus(e.multipliedBy(m)).toString(10);
@@ -92,13 +92,13 @@ const A = [
92
92
  return 0;
93
93
  const r = g[n.chain];
94
94
  if (!r) return 0;
95
- const u = await U({
95
+ const u = await N({
96
96
  chain: r,
97
- transport: _()
97
+ transport: U()
98
98
  }).getBalance({
99
99
  address: o
100
100
  });
101
- return N(u, n.decimals, 8);
101
+ return A(u, n.decimals, 8);
102
102
  } catch (r) {
103
103
  return console.error("Error fetching native balance:", r), 0;
104
104
  }
package/dist/index217.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index187.cjs"),A=require("./index218.cjs"),D=require("./index87.cjs"),S=require("./index219.cjs"),b=require("./index210.cjs"),I=require("./index188.cjs"),p="/docs/contract/decodeEventLog";function q(n){const{abi:d,data:i,strict:v,topics:E}=n,m=v??!0,[f,...w]=E;if(!f)throw new a.AbiEventSignatureEmptyTopicsError({docsPath:p});const o=d.find(e=>e.type==="event"&&f===S.toEventSelector(I.formatAbiItem(e)));if(!(o&&"name"in o)||o.type!=="event")throw new a.AbiEventSignatureNotFoundError(f,{docsPath:p});const{name:y,inputs:r}=o,u=r==null?void 0:r.some(e=>!("name"in e&&e.name)),c=u?[]:{},g=r.map((e,t)=>[e,t]).filter(([e])=>"indexed"in e&&e.indexed);for(let e=0;e<g.length;e++){const[t,l]=g[e],h=w[e];if(!h)throw new a.DecodeLogTopicsMismatch({abiItem:o,param:t});c[u?l:t.name||l]=L({param:t,value:h})}const s=r.filter(e=>!("indexed"in e&&e.indexed));if(s.length>0){if(i&&i!=="0x")try{const e=b.decodeAbiParameters(s,i);if(e)if(u)for(let t=0;t<r.length;t++)c[t]=c[t]??e.shift();else for(let t=0;t<s.length;t++)c[s[t].name]=e[t]}catch(e){if(m)throw e instanceof a.AbiDecodingDataSizeTooSmallError||e instanceof A.PositionOutOfBoundsError?new a.DecodeLogDataMismatch({abiItem:o,data:i,params:s,size:D.size(i)}):e}else if(m)throw new a.DecodeLogDataMismatch({abiItem:o,data:"0x",params:s,size:0})}return{eventName:y,args:Object.values(c).length>0?c:void 0}}function L({param:n,value:d}){return n.type==="string"||n.type==="bytes"||n.type==="tuple"||n.type.match(/^(.*)\[(\d+)?\]$/)?d:(b.decodeAbiParameters([n],d)||[])[0]}exports.decodeEventLog=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index187.cjs"),D=require("./index218.cjs"),x=require("./index87.cjs"),S=require("./index219.cjs"),E=require("./index210.cjs"),T=require("./index188.cjs"),v="/docs/contract/decodeEventLog";function q(o){const{abi:u,data:c,strict:w,topics:y}=o,d=w??!0,[p,...I]=y;if(!p)throw new a.AbiEventSignatureEmptyTopicsError({docsPath:v});const i=u.find(e=>e.type==="event"&&p===S.toEventSelector(T.formatAbiItem(e)));if(!(i&&"name"in i)||i.type!=="event")throw new a.AbiEventSignatureNotFoundError(p,{docsPath:v});const{name:A,inputs:s}=i,m=s==null?void 0:s.some(e=>!("name"in e&&e.name)),r=m?[]:{},b=s.map((e,n)=>[e,n]).filter(([e])=>"indexed"in e&&e.indexed),h=[];for(let e=0;e<b.length;e++){const[n,t]=b[e],f=I[e];if(!f){if(d)throw new a.DecodeLogTopicsMismatch({abiItem:i,param:n});h.push([n,t]);continue}r[m?t:n.name||t]=L({param:n,value:f})}const g=s.filter(e=>!("indexed"in e&&e.indexed)),l=d?g:[...h.map(([e])=>e),...g];if(l.length>0){if(c&&c!=="0x")try{const e=E.decodeAbiParameters(l,c);if(e){let n=0;if(!d)for(const[t,f]of h)r[m?f:t.name||f]=e[n++];if(m)for(let t=0;t<s.length;t++)r[t]===void 0&&n<e.length&&(r[t]=e[n++]);else for(let t=0;t<g.length;t++)r[g[t].name]=e[n++]}}catch(e){if(d)throw e instanceof a.AbiDecodingDataSizeTooSmallError||e instanceof D.PositionOutOfBoundsError?new a.DecodeLogDataMismatch({abiItem:i,data:c,params:l,size:x.size(c)}):e}else if(d)throw new a.DecodeLogDataMismatch({abiItem:i,data:"0x",params:l,size:0})}return{eventName:A,args:Object.values(r).length>0?r:void 0}}function L({param:o,value:u}){return o.type==="string"||o.type==="bytes"||o.type==="tuple"||o.type.match(/^(.*)\[(\d+)?\]$/)?u:(E.decodeAbiParameters([o],u)||[])[0]}exports.decodeEventLog=q;
package/dist/index217.js CHANGED
@@ -1,67 +1,76 @@
1
- import { AbiEventSignatureEmptyTopicsError as A, AbiEventSignatureNotFoundError as x, DecodeLogTopicsMismatch as D, AbiDecodingDataSizeTooSmallError as I, DecodeLogDataMismatch as l } from "./index187.js";
2
- import { PositionOutOfBoundsError as S } from "./index218.js";
3
- import { size as T } from "./index87.js";
4
- import { toEventSelector as z } from "./index219.js";
5
- import { decodeAbiParameters as w } from "./index210.js";
6
- import { formatAbiItem as L } from "./index188.js";
7
- const u = "/docs/contract/decodeEventLog";
8
- function U(o) {
9
- const { abi: d, data: i, strict: E, topics: b } = o, m = E ?? !0, [a, ...v] = b;
10
- if (!a)
11
- throw new A({ docsPath: u });
12
- const n = d.find((e) => e.type === "event" && a === z(L(e)));
13
- if (!(n && "name" in n) || n.type !== "event")
14
- throw new x(a, { docsPath: u });
15
- const { name: y, inputs: r } = n, f = r == null ? void 0 : r.some((e) => !("name" in e && e.name)), c = f ? [] : {}, p = r.map((e, t) => [e, t]).filter(([e]) => "indexed" in e && e.indexed);
16
- for (let e = 0; e < p.length; e++) {
17
- const [t, g] = p[e], h = v[e];
18
- if (!h)
19
- throw new D({
20
- abiItem: n,
21
- param: t
22
- });
23
- c[f ? g : t.name || g] = O({
24
- param: t,
25
- value: h
1
+ import { AbiEventSignatureEmptyTopicsError as A, AbiEventSignatureNotFoundError as D, DecodeLogTopicsMismatch as T, AbiDecodingDataSizeTooSmallError as S, DecodeLogDataMismatch as w } from "./index187.js";
2
+ import { PositionOutOfBoundsError as z } from "./index218.js";
3
+ import { size as L } from "./index87.js";
4
+ import { toEventSelector as O } from "./index219.js";
5
+ import { decodeAbiParameters as I } from "./index210.js";
6
+ import { formatAbiItem as P } from "./index188.js";
7
+ const E = "/docs/contract/decodeEventLog";
8
+ function $(o) {
9
+ const { abi: f, data: s, strict: b, topics: v } = o, d = b ?? !0, [u, ...x] = v;
10
+ if (!u)
11
+ throw new A({ docsPath: E });
12
+ const i = f.find((e) => e.type === "event" && u === O(P(e)));
13
+ if (!(i && "name" in i) || i.type !== "event")
14
+ throw new D(u, { docsPath: E });
15
+ const { name: y, inputs: c } = i, m = c == null ? void 0 : c.some((e) => !("name" in e && e.name)), r = m ? [] : {}, h = c.map((e, n) => [e, n]).filter(([e]) => "indexed" in e && e.indexed), l = [];
16
+ for (let e = 0; e < h.length; e++) {
17
+ const [n, t] = h[e], a = x[e];
18
+ if (!a) {
19
+ if (d)
20
+ throw new T({
21
+ abiItem: i,
22
+ param: n
23
+ });
24
+ l.push([n, t]);
25
+ continue;
26
+ }
27
+ r[m ? t : n.name || t] = M({
28
+ param: n,
29
+ value: a
26
30
  });
27
31
  }
28
- const s = r.filter((e) => !("indexed" in e && e.indexed));
29
- if (s.length > 0) {
30
- if (i && i !== "0x")
32
+ const p = c.filter((e) => !("indexed" in e && e.indexed)), g = d ? p : [...l.map(([e]) => e), ...p];
33
+ if (g.length > 0) {
34
+ if (s && s !== "0x")
31
35
  try {
32
- const e = w(s, i);
33
- if (e)
34
- if (f)
35
- for (let t = 0; t < r.length; t++)
36
- c[t] = c[t] ?? e.shift();
36
+ const e = I(g, s);
37
+ if (e) {
38
+ let n = 0;
39
+ if (!d)
40
+ for (const [t, a] of l)
41
+ r[m ? a : t.name || a] = e[n++];
42
+ if (m)
43
+ for (let t = 0; t < c.length; t++)
44
+ r[t] === void 0 && n < e.length && (r[t] = e[n++]);
37
45
  else
38
- for (let t = 0; t < s.length; t++)
39
- c[s[t].name] = e[t];
46
+ for (let t = 0; t < p.length; t++)
47
+ r[p[t].name] = e[n++];
48
+ }
40
49
  } catch (e) {
41
- if (m)
42
- throw e instanceof I || e instanceof S ? new l({
43
- abiItem: n,
44
- data: i,
45
- params: s,
46
- size: T(i)
50
+ if (d)
51
+ throw e instanceof S || e instanceof z ? new w({
52
+ abiItem: i,
53
+ data: s,
54
+ params: g,
55
+ size: L(s)
47
56
  }) : e;
48
57
  }
49
- else if (m)
50
- throw new l({
51
- abiItem: n,
58
+ else if (d)
59
+ throw new w({
60
+ abiItem: i,
52
61
  data: "0x",
53
- params: s,
62
+ params: g,
54
63
  size: 0
55
64
  });
56
65
  }
57
66
  return {
58
67
  eventName: y,
59
- args: Object.values(c).length > 0 ? c : void 0
68
+ args: Object.values(r).length > 0 ? r : void 0
60
69
  };
61
70
  }
62
- function O({ param: o, value: d }) {
63
- return o.type === "string" || o.type === "bytes" || o.type === "tuple" || o.type.match(/^(.*)\[(\d+)?\]$/) ? d : (w([o], d) || [])[0];
71
+ function M({ param: o, value: f }) {
72
+ return o.type === "string" || o.type === "bytes" || o.type === "tuple" || o.type.match(/^(.*)\[(\d+)?\]$/) ? f : (I([o], f) || [])[0];
64
73
  }
65
74
  export {
66
- U as decodeEventLog
75
+ $ as decodeEventLog
67
76
  };
package/dist/index24.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),f=require("./index7.cjs"),w=require("./index23.cjs"),a=require("./index34.cjs"),p=require("@gardenfi/react-hooks"),S=require("@gardenfi/garden-book"),g=require("./index62.cjs"),d=require("./index63.cjs"),u=require("framer-motion"),T=()=>{const{transactions:c,isLoading:m}=w.transactionHistoryStore(),{allAssets:s}=f.assetInfoStore(),{pendingOrders:o}=p.useGarden(),i=t.useMemo(()=>c.filter(e=>a.getAssetFromSwap(e.source_swap,s)&&a.getAssetFromSwap(e.destination_swap,s)),[c,s]),l=t.useMemo(()=>(o==null?void 0:o.filter(e=>a.getAssetFromSwap(e.source_swap,s)&&a.getAssetFromSwap(e.destination_swap,s)))??[],[o,s]),n=t.useMemo(()=>[...l,...i],[l,i]);return t.createElement(u.AnimatePresence,{mode:"wait"},t.createElement(u.motion.div,{className:"flex w-full flex-col overflow-y-auto scrollbar-hide h-full"},m?t.createElement(d.TransactionsSkeleton,null):n.length===0?t.createElement(S.Typography,{size:"h5",className:"py-4 text-center"},"No transactions found."):n.map((e,r)=>t.createElement("div",{key:e.order_id||r,className:"w-full"},t.createElement(g.TransactionRow,{order:e,status:e.status,isLast:r===n.length-1,isFirst:r===0})))))};exports.Transactions=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),f=require("./index7.cjs"),w=require("./index23.cjs"),a=require("./index34.cjs"),p=require("@gardenfi/react-hooks"),S=require("@gardenfi/garden-book"),g=require("./index42.cjs"),d=require("./index43.cjs"),u=require("framer-motion"),T=()=>{const{transactions:c,isLoading:m}=w.transactionHistoryStore(),{allAssets:s}=f.assetInfoStore(),{pendingOrders:o}=p.useGarden(),i=t.useMemo(()=>c.filter(e=>a.getAssetFromSwap(e.source_swap,s)&&a.getAssetFromSwap(e.destination_swap,s)),[c,s]),l=t.useMemo(()=>(o==null?void 0:o.filter(e=>a.getAssetFromSwap(e.source_swap,s)&&a.getAssetFromSwap(e.destination_swap,s)))??[],[o,s]),n=t.useMemo(()=>[...l,...i],[l,i]);return t.createElement(u.AnimatePresence,{mode:"wait"},t.createElement(u.motion.div,{className:"flex w-full flex-col overflow-y-auto scrollbar-hide h-full"},m?t.createElement(d.TransactionsSkeleton,null):n.length===0?t.createElement(S.Typography,{size:"h5",className:"py-4 text-center"},"No transactions found."):n.map((e,r)=>t.createElement("div",{key:e.order_id||r,className:"w-full"},t.createElement(g.TransactionRow,{order:e,status:e.status,isLast:r===n.length-1,isFirst:r===0})))))};exports.Transactions=T;
package/dist/index24.js CHANGED
@@ -4,8 +4,8 @@ import { transactionHistoryStore as u } from "./index23.js";
4
4
  import { getAssetFromSwap as a } from "./index34.js";
5
5
  import { useGarden as w } from "@gardenfi/react-hooks";
6
6
  import { Typography as d } from "@gardenfi/garden-book";
7
- import { TransactionRow as h } from "./index62.js";
8
- import { TransactionsSkeleton as y } from "./index63.js";
7
+ import { TransactionRow as h } from "./index42.js";
8
+ import { TransactionsSkeleton as y } from "./index43.js";
9
9
  import { AnimatePresence as E, motion as T } from "framer-motion";
10
10
  const L = () => {
11
11
  const { transactions: l, isLoading: f } = u(), { allAssets: e } = p(), { pendingOrders: o } = w(), m = i(
package/dist/index242.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index44.cjs"),y=require("./index192.cjs"),h=require("./index220.cjs"),n=require("./index224.cjs"),w=require("./index228.cjs"),u="x-batch-gateway:true";async function i(t){const{data:l,ccipRequest:o}=t,{args:[d]}=h.decodeFunctionData({abi:c.batchGatewayAbi,data:l}),a=[],s=[];return await Promise.all(d.map(async(r,e)=>{try{s[e]=r.urls.includes(u)?await i({data:r.data,ccipRequest:o}):await o(r),a[e]=!1}catch(b){a[e]=!0,s[e]=g(b)}})),w.encodeFunctionResult({abi:c.batchGatewayAbi,functionName:"query",result:[a,s]})}function g(t){return t.name==="HttpRequestError"&&t.status?n.encodeErrorResult({abi:c.batchGatewayAbi,errorName:"HttpError",args:[t.status,t.shortMessage]}):n.encodeErrorResult({abi:[y.solidityError],errorName:"Error",args:["shortMessage"in t?t.shortMessage:t.message]})}exports.localBatchGatewayRequest=i;exports.localBatchGatewayUrl=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index46.cjs"),y=require("./index192.cjs"),h=require("./index220.cjs"),n=require("./index224.cjs"),w=require("./index228.cjs"),u="x-batch-gateway:true";async function i(t){const{data:l,ccipRequest:o}=t,{args:[d]}=h.decodeFunctionData({abi:c.batchGatewayAbi,data:l}),a=[],s=[];return await Promise.all(d.map(async(r,e)=>{try{s[e]=r.urls.includes(u)?await i({data:r.data,ccipRequest:o}):await o(r),a[e]=!1}catch(b){a[e]=!0,s[e]=g(b)}})),w.encodeFunctionResult({abi:c.batchGatewayAbi,functionName:"query",result:[a,s]})}function g(t){return t.name==="HttpRequestError"&&t.status?n.encodeErrorResult({abi:c.batchGatewayAbi,errorName:"HttpError",args:[t.status,t.shortMessage]}):n.encodeErrorResult({abi:[y.solidityError],errorName:"Error",args:["shortMessage"in t?t.shortMessage:t.message]})}exports.localBatchGatewayRequest=i;exports.localBatchGatewayUrl=u;
package/dist/index242.js CHANGED
@@ -1,4 +1,4 @@
1
- import { batchGatewayAbi as o } from "./index44.js";
1
+ import { batchGatewayAbi as o } from "./index46.js";
2
2
  import { solidityError as l } from "./index192.js";
3
3
  import { decodeFunctionData as f } from "./index220.js";
4
4
  import { encodeErrorResult as n } from "./index224.js";
package/dist/index247.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index344.cjs"),c=require("./index345.cjs"),A=BigInt(0),u=BigInt(1),H=BigInt(2),L=BigInt(7),S=BigInt(256),T=BigInt(113),O=[],y=[],w=[];for(let n=0,t=u,s=1,i=0;n<24;n++){[s,i]=[i,(2*s+3*i)%5],O.push(2*(5*i+s)),y.push((n+1)*(n+2)/2%64);let o=A;for(let r=0;r<7;r++)t=(t<<u^(t>>L)*T)%S,t&H&&(o^=u<<(u<<BigInt(r))-u);w.push(o)}const _=f.split(w,!0),F=_[0],X=_[1],I=(n,t,s)=>s>32?f.rotlBH(n,t,s):f.rotlSH(n,t,s),x=(n,t,s)=>s>32?f.rotlBL(n,t,s):f.rotlSL(n,t,s);function b(n,t=24){const s=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let e=0;e<10;e++)s[e]=n[e]^n[e+10]^n[e+20]^n[e+30]^n[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,l=(e+2)%10,p=s[l],a=s[l+1],g=I(p,a,1)^s[h],B=x(p,a,1)^s[h+1];for(let d=0;d<50;d+=10)n[e+d]^=g,n[e+d+1]^=B}let o=n[2],r=n[3];for(let e=0;e<24;e++){const h=y[e],l=I(o,r,h),p=x(o,r,h),a=O[e];o=n[a],r=n[a+1],n[a]=l,n[a+1]=p}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=n[e+h];for(let h=0;h<10;h++)n[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}n[0]^=F[i],n[1]^=X[i]}c.clean(s)}class k extends c.Hash{constructor(t,s,i,o=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=s,this.outputLen=i,this.enableXOF=o,this.rounds=r,c.anumber(i),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=c.u32(this.state)}clone(){return this._cloneInto()}keccak(){c.swap32IfBE(this.state32),b(this.state32,this.rounds),c.swap32IfBE(this.state32),this.posOut=0,this.pos=0}update(t){c.aexists(this),t=c.toBytes(t),c.abytes(t);const{blockLen:s,state:i}=this,o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)i[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:i,blockLen:o}=this;t[i]^=s,s&128&&i===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){c.aexists(this,!1),c.abytes(t),this.finish();const s=this.state,{blockLen:i}=this;for(let o=0,r=t.length;o<r;){this.posOut>=i&&this.keccak();const e=Math.min(i-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return c.anumber(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(c.aoutput(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,c.clean(this.state)}_cloneInto(t){const{blockLen:s,suffix:i,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new k(s,i,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=i,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const m=(n,t,s)=>c.createHasher(()=>new k(t,n,s)),E=m(1,136,256/8);exports.Keccak=k;exports.keccakP=b;exports.keccak_256=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index339.cjs"),c=require("./index340.cjs"),A=BigInt(0),u=BigInt(1),H=BigInt(2),L=BigInt(7),S=BigInt(256),T=BigInt(113),O=[],y=[],w=[];for(let n=0,t=u,s=1,i=0;n<24;n++){[s,i]=[i,(2*s+3*i)%5],O.push(2*(5*i+s)),y.push((n+1)*(n+2)/2%64);let o=A;for(let r=0;r<7;r++)t=(t<<u^(t>>L)*T)%S,t&H&&(o^=u<<(u<<BigInt(r))-u);w.push(o)}const _=f.split(w,!0),F=_[0],X=_[1],I=(n,t,s)=>s>32?f.rotlBH(n,t,s):f.rotlSH(n,t,s),x=(n,t,s)=>s>32?f.rotlBL(n,t,s):f.rotlSL(n,t,s);function b(n,t=24){const s=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let e=0;e<10;e++)s[e]=n[e]^n[e+10]^n[e+20]^n[e+30]^n[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,l=(e+2)%10,p=s[l],a=s[l+1],g=I(p,a,1)^s[h],B=x(p,a,1)^s[h+1];for(let d=0;d<50;d+=10)n[e+d]^=g,n[e+d+1]^=B}let o=n[2],r=n[3];for(let e=0;e<24;e++){const h=y[e],l=I(o,r,h),p=x(o,r,h),a=O[e];o=n[a],r=n[a+1],n[a]=l,n[a+1]=p}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=n[e+h];for(let h=0;h<10;h++)n[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}n[0]^=F[i],n[1]^=X[i]}c.clean(s)}class k extends c.Hash{constructor(t,s,i,o=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=s,this.outputLen=i,this.enableXOF=o,this.rounds=r,c.anumber(i),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=c.u32(this.state)}clone(){return this._cloneInto()}keccak(){c.swap32IfBE(this.state32),b(this.state32,this.rounds),c.swap32IfBE(this.state32),this.posOut=0,this.pos=0}update(t){c.aexists(this),t=c.toBytes(t),c.abytes(t);const{blockLen:s,state:i}=this,o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)i[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:i,blockLen:o}=this;t[i]^=s,s&128&&i===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){c.aexists(this,!1),c.abytes(t),this.finish();const s=this.state,{blockLen:i}=this;for(let o=0,r=t.length;o<r;){this.posOut>=i&&this.keccak();const e=Math.min(i-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return c.anumber(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(c.aoutput(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,c.clean(this.state)}_cloneInto(t){const{blockLen:s,suffix:i,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new k(s,i,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=i,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const m=(n,t,s)=>c.createHasher(()=>new k(t,n,s)),E=m(1,136,256/8);exports.Keccak=k;exports.keccakP=b;exports.keccak_256=E;
package/dist/index247.js CHANGED
@@ -1,5 +1,5 @@
1
- import { split as L, rotlSH as T, rotlSL as S, rotlBH as m, rotlBL as F } from "./index344.js";
2
- import { createHasher as X, Hash as E, anumber as d, u32 as U, swap32IfBE as I, aexists as x, toBytes as P, abytes as k, aoutput as M, clean as y } from "./index345.js";
1
+ import { split as L, rotlSH as T, rotlSL as S, rotlBH as m, rotlBL as F } from "./index339.js";
2
+ import { createHasher as X, Hash as E, anumber as d, u32 as U, swap32IfBE as I, aexists as x, toBytes as P, abytes as k, aoutput as M, clean as y } from "./index340.js";
3
3
  const R = BigInt(0), f = BigInt(1), j = BigInt(2), q = BigInt(7), v = BigInt(256), z = BigInt(113), _ = [], g = [], B = [];
4
4
  for (let n = 0, t = f, s = 1, i = 0; n < 24; n++) {
5
5
  [s, i] = [i, (2 * s + 3 * i) % 5], _.push(2 * (5 * i + s)), g.push((n + 1) * (n + 2) / 2 % 64);
package/dist/index248.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index346.cjs"),s=e.sha256;exports.sha256=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index341.cjs"),s=e.sha256;exports.sha256=s;
package/dist/index248.js CHANGED
@@ -1,4 +1,4 @@
1
- import { sha256 as s } from "./index346.js";
1
+ import { sha256 as s } from "./index341.js";
2
2
  const o = s;
3
3
  export {
4
4
  o as sha256
package/dist/index249.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index347.cjs"),r=require("./index348.cjs");function n(t){return e.hashSignature(r.toSignature(t))}exports.toSignatureHash=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index342.cjs"),r=require("./index343.cjs");function n(t){return e.hashSignature(r.toSignature(t))}exports.toSignatureHash=n;
package/dist/index249.js CHANGED
@@ -1,5 +1,5 @@
1
- import { hashSignature as t } from "./index347.js";
2
- import { toSignature as o } from "./index348.js";
1
+ import { hashSignature as t } from "./index342.js";
2
+ import { toSignature as o } from "./index343.js";
3
3
  function a(r) {
4
4
  return t(o(r));
5
5
  }
package/dist/index260.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./index346.cjs"),C=require("./index350.cjs"),n=require("./index351.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const k=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),x=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),G=BigInt(0),M=BigInt(1),w=BigInt(2),h=(t,f)=>(t+f/w)/f;function N(t){const f=k,e=BigInt(3),r=BigInt(6),p=BigInt(11),a=BigInt(22),s=BigInt(23),i=BigInt(44),d=BigInt(88),o=t*t*t%f,c=o*o*t%f,g=n.pow2(c,e,f)*c%f,b=n.pow2(g,e,f)*c%f,l=n.pow2(b,w,f)*o%f,B=n.pow2(l,p,f)*l%f,I=n.pow2(B,a,f)*B%f,_=n.pow2(I,i,f)*I%f,m=n.pow2(_,d,f)*_%f,S=n.pow2(m,i,f)*I%f,P=n.pow2(S,e,f)*c%f,v=n.pow2(P,s,f)*B%f,E=n.pow2(v,r,f)*o%f,q=n.pow2(E,w,f);if(!u.eql(u.sqr(q),t))throw new Error("Cannot find square root");return q}const u=n.Field(k,void 0,void 0,{sqrt:N}),O=C.createCurve({a:G,b:BigInt(7),Fp:u,n:x,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const f=x,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-M*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),p=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=e,s=BigInt("0x100000000000000000000000000000000"),i=h(a*t,f),d=h(-r*t,f);let o=n.mod(t-i*e-d*p,f),c=n.mod(-i*r-d*a,f);const g=o>s,b=c>s;if(g&&(o=f-o),b&&(c=f-c),o>s||c>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:o,k2neg:b,k2:c}}}},F.sha256);exports.secp256k1=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./index341.cjs"),C=require("./index345.cjs"),n=require("./index346.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const k=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),x=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),G=BigInt(0),M=BigInt(1),w=BigInt(2),h=(t,f)=>(t+f/w)/f;function N(t){const f=k,e=BigInt(3),r=BigInt(6),p=BigInt(11),a=BigInt(22),s=BigInt(23),i=BigInt(44),d=BigInt(88),o=t*t*t%f,c=o*o*t%f,g=n.pow2(c,e,f)*c%f,b=n.pow2(g,e,f)*c%f,l=n.pow2(b,w,f)*o%f,B=n.pow2(l,p,f)*l%f,I=n.pow2(B,a,f)*B%f,_=n.pow2(I,i,f)*I%f,m=n.pow2(_,d,f)*_%f,S=n.pow2(m,i,f)*I%f,P=n.pow2(S,e,f)*c%f,v=n.pow2(P,s,f)*B%f,E=n.pow2(v,r,f)*o%f,q=n.pow2(E,w,f);if(!u.eql(u.sqr(q),t))throw new Error("Cannot find square root");return q}const u=n.Field(k,void 0,void 0,{sqrt:N}),O=C.createCurve({a:G,b:BigInt(7),Fp:u,n:x,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const f=x,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-M*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),p=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=e,s=BigInt("0x100000000000000000000000000000000"),i=h(a*t,f),d=h(-r*t,f);let o=n.mod(t-i*e-d*p,f),c=n.mod(-i*r-d*a,f);const g=o>s,b=c>s;if(g&&(o=f-o),b&&(c=f-c),o>s||c>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:o,k2neg:b,k2:c}}}},F.sha256);exports.secp256k1=O;
package/dist/index260.js CHANGED
@@ -1,6 +1,6 @@
1
- import { sha256 as C } from "./index346.js";
2
- import { createCurve as G } from "./index350.js";
3
- import { Field as N, mod as k, pow2 as t } from "./index351.js";
1
+ import { sha256 as C } from "./index341.js";
2
+ import { createCurve as G } from "./index345.js";
3
+ import { Field as N, mod as k, pow2 as t } from "./index346.js";
4
4
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5
5
  const q = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), w = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), M = BigInt(0), O = BigInt(1), _ = BigInt(2), h = (n, f) => (n + f / _) / f;
6
6
  function W(n) {
package/dist/index272.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index102.cjs"),s=require("./index353.cjs");async function i(e){const{authorization:r,signature:t}=e;return o.recoverAddress({hash:s.hashAuthorization(r),signature:t??r})}exports.recoverAuthorizationAddress=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index102.cjs"),s=require("./index356.cjs");async function i(e){const{authorization:r,signature:t}=e;return o.recoverAddress({hash:s.hashAuthorization(r),signature:t??r})}exports.recoverAuthorizationAddress=i;
package/dist/index272.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { recoverAddress as i } from "./index102.js";
2
- import { hashAuthorization as e } from "./index353.js";
2
+ import { hashAuthorization as e } from "./index356.js";
3
3
  async function a(o) {
4
4
  const { authorization: r, signature: t } = o;
5
5
  return i({
package/dist/index273.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index277.cjs"),a=require("./index355.cjs");function i(t){return{...typeof t.baseFeePerGas=="bigint"&&{baseFeePerGas:e.fromNumber(t.baseFeePerGas)},...typeof t.blobBaseFee=="bigint"&&{blobBaseFee:e.fromNumber(t.blobBaseFee)},...typeof t.feeRecipient=="string"&&{feeRecipient:t.feeRecipient},...typeof t.gasLimit=="bigint"&&{gasLimit:e.fromNumber(t.gasLimit)},...typeof t.number=="bigint"&&{number:e.fromNumber(t.number)},...typeof t.prevRandao=="bigint"&&{prevRandao:e.fromNumber(t.prevRandao)},...typeof t.time=="bigint"&&{time:e.fromNumber(t.time)},...t.withdrawals&&{withdrawals:t.withdrawals.map(a.toRpc)}}}exports.toRpc=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index277.cjs"),a=require("./index358.cjs");function i(t){return{...typeof t.baseFeePerGas=="bigint"&&{baseFeePerGas:e.fromNumber(t.baseFeePerGas)},...typeof t.blobBaseFee=="bigint"&&{blobBaseFee:e.fromNumber(t.blobBaseFee)},...typeof t.feeRecipient=="string"&&{feeRecipient:t.feeRecipient},...typeof t.gasLimit=="bigint"&&{gasLimit:e.fromNumber(t.gasLimit)},...typeof t.number=="bigint"&&{number:e.fromNumber(t.number)},...typeof t.prevRandao=="bigint"&&{prevRandao:e.fromNumber(t.prevRandao)},...typeof t.time=="bigint"&&{time:e.fromNumber(t.time)},...t.withdrawals&&{withdrawals:t.withdrawals.map(a.toRpc)}}}exports.toRpc=i;
package/dist/index273.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { fromNumber as a } from "./index277.js";
2
- import { toRpc as e } from "./index355.js";
2
+ import { toRpc as e } from "./index358.js";
3
3
  function n(t) {
4
4
  return {
5
5
  ...typeof t.baseFeePerGas == "bigint" && {
package/dist/index276.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index294.cjs"),c=require("./index295.cjs"),o=require("./index296.cjs");function a(t){const n=c.parseStructs(t),r=[],i=t.length;for(let e=0;e<i;e++){const s=t[e];u.isStructSignature(s)||r.push(o.parseSignature(s,n))}return r}exports.parseAbi=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index289.cjs"),c=require("./index290.cjs"),o=require("./index291.cjs");function a(t){const n=c.parseStructs(t),r=[],i=t.length;for(let e=0;e<i;e++){const s=t[e];u.isStructSignature(s)||r.push(o.parseSignature(s,n))}return r}exports.parseAbi=a;
package/dist/index276.js CHANGED
@@ -1,6 +1,6 @@
1
- import { isStructSignature as c } from "./index294.js";
2
- import { parseStructs as s } from "./index295.js";
3
- import { parseSignature as p } from "./index296.js";
1
+ import { isStructSignature as c } from "./index289.js";
2
+ import { parseStructs as s } from "./index290.js";
3
+ import { parseSignature as p } from "./index291.js";
4
4
  function a(t) {
5
5
  const i = s(t), o = [], e = t.length;
6
6
  for (let r = 0; r < e; r++) {
package/dist/index278.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index285.cjs");class r extends Error{static setStaticOptions(t){r.prototype.docsOrigin=t.docsOrigin,r.prototype.showVersion=t.showVersion,r.prototype.version=t.version}constructor(t,e={}){const i=(()=>{var a;if(e.cause instanceof r){if(e.cause.details)return e.cause.details;if(e.cause.shortMessage)return e.cause.shortMessage}return e.cause&&"details"in e.cause&&typeof e.cause.details=="string"?e.cause.details:(a=e.cause)!=null&&a.message?e.cause.message:e.details})(),u=e.cause instanceof r&&e.cause.docsPath||e.docsPath,n=e.docsOrigin??r.prototype.docsOrigin,l=`${n}${u??""}`,c=!!(e.version??r.prototype.showVersion),o=e.version??r.prototype.version,b=[t||"An error occurred.",...e.metaMessages?["",...e.metaMessages]:[],...i||u||c?["",i?`Details: ${i}`:void 0,u?`See: ${l}`:void 0,c?`Version: ${o}`:void 0]:[]].filter(a=>typeof a=="string").join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index349.cjs");class r extends Error{static setStaticOptions(t){r.prototype.docsOrigin=t.docsOrigin,r.prototype.showVersion=t.showVersion,r.prototype.version=t.version}constructor(t,e={}){const i=(()=>{var a;if(e.cause instanceof r){if(e.cause.details)return e.cause.details;if(e.cause.shortMessage)return e.cause.shortMessage}return e.cause&&"details"in e.cause&&typeof e.cause.details=="string"?e.cause.details:(a=e.cause)!=null&&a.message?e.cause.message:e.details})(),u=e.cause instanceof r&&e.cause.docsPath||e.docsPath,n=e.docsOrigin??r.prototype.docsOrigin,l=`${n}${u??""}`,c=!!(e.version??r.prototype.showVersion),o=e.version??r.prototype.version,b=[t||"An error occurred.",...e.metaMessages?["",...e.metaMessages]:[],...i||u||c?["",i?`Details: ${i}`:void 0,u?`See: ${l}`:void 0,c?`Version: ${o}`:void 0]:[]].filter(a=>typeof a=="string").join(`
2
2
  `);super(b,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=e.cause,this.details=i,this.docs=l,this.docsOrigin=n,this.docsPath=u,this.shortMessage=t,this.showVersion=c,this.version=o}walk(t){return d(this,t)}}Object.defineProperty(r,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${f.getVersion()}`}});r.setStaticOptions(r.defaultStaticOptions);function d(s,t){return t!=null&&t(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause?d(s.cause,t):t?null:s}exports.BaseError=r;
package/dist/index278.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getVersion as f } from "./index285.js";
1
+ import { getVersion as f } from "./index349.js";
2
2
  class r extends Error {
3
3
  static setStaticOptions(t) {
4
4
  r.prototype.docsOrigin = t.docsOrigin, r.prototype.showVersion = t.showVersion, r.prototype.version = t.version;
package/dist/index28.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),wr=require("./index6.cjs"),o=require("./index12.cjs"),b=require("@gardenfi/orderbook"),Tr=require("lodash.debounce"),lr=require("@gardenfi/core"),Br=require("@gardenfi/react-hooks"),L=require("bignumber.js"),j=require("./index34.cjs"),kr=require("./index7.cjs"),Cr=require("./index14.cjs"),Or=()=>{var er,tr;const{inputAmount:i,outputAmount:m,inputAsset:r,outputAsset:n,isSwapping:C,isApproving:ar,rate:dr,error:T,btcAddress:E,tokenPrices:fr,isFetchingQuote:pr,isEditBTCAddress:g,networkFees:x,setIsSwapping:B,setAmount:f,setRate:H,setError:u,swapAssets:mr,setAsset:hr,setIsFetchingQuote:O,isComparisonVisible:q,setIsValidBitcoinAddress:F,setShowBtcAddress:U,setShowFeesAndRateDetails:W,setTokenPrices:A,clearSwapState:_,setBtcAddress:D,setIsComparisonVisible:Ar,currentNetwork:G,setSolverId:yr,solverId:Er}=wr.swapStore(),{balances:V}=kr.assetInfoStore(),{setIsOpen:K,setOrder:z}=Cr.orderInProgressStore(),{swap:J,getQuote:P,garden:e}=Br.useGarden(),h=c.useRef(null),Q=c.useMemo(()=>{if(!(!r||!V))return V[b.ChainAsset.from(r).toString()]},[r,V]),br=c.useMemo(()=>{if(!(!Q||!r))return j.formatAmount(Q.toString(10),r.decimals,Math.min(r.decimals,8))},[Q,r]),X=c.useMemo(()=>!!(r&&n&&i&&m&&Number(i)!==0&&Number(m)!==0),[r,n,i,m]),Y=c.useMemo(()=>{var t;return(g||!((t=e==null?void 0:e.htlcs.bitcoin)!=null&&t.htlcActorAddress))&&((r==null?void 0:r.chain)&&b.isBitcoin(r.chain)||(n==null?void 0:n.chain)&&b.isBitcoin(n.chain))},[g,(er=e==null?void 0:e.htlcs.bitcoin)==null?void 0:er.htlcActorAddress,r,n]),I=c.useMemo(()=>!!(r&&n&&(b.isBitcoin(r.chain)||b.isBitcoin(n.chain))),[r,n]),Z=c.useMemo(()=>I?E?lr.validateBTCAddress(E,G):!1:!0,[E,I]),R=c.useMemo(()=>!!(r&&m&&i&&n&&Z&&!T.inputError&&!T.outputError&&!T.liquidityError&&!T.insufficientBalanceError),[r,m,i,n,T,Z]),$=c.useMemo(()=>I?!!(R&&E):R,[R,I,E]),{minAmount:S,maxAmount:v}=c.useMemo(()=>{const t={minAmount:0,maxAmount:0};return!r||!n||!r.min_amount||!r.max_amount?t:{minAmount:j.formatAmount(r.min_amount,r.decimals,r.decimals),maxAmount:j.formatAmount(r.max_amount,r.decimals,r.decimals)}},[r,n]),w=c.useMemo(()=>Tr(async(t,d,l,a)=>{var nr,sr,ir,ur,cr;if(!P||C)return;O({input:a,output:!a}),h.current&&h.current.abort(),h.current=new AbortController;const p=a?l.decimals:d.decimals,y=new L(t).multipliedBy(10**p),s=await P({fromAsset:d,toAsset:l,amount:y.toNumber(),isExactOut:a,options:{request:{signal:h.current.signal}}});if(!s||!s.ok){if((nr=s==null?void 0:s.error)!=null&&nr.includes("AbortError")){u({liquidityError:o.Errors.none}),O({input:!1,output:!1});return}else(sr=s==null?void 0:s.error)!=null&&sr.includes("insufficient liquidity")?(u({liquidityError:o.Errors.insufficientLiquidity}),f(a?o.IOType.input:o.IOType.output,"")):(ir=s==null?void 0:s.error)!=null&&ir.includes("output amount too less")?(u({outputError:o.Errors.outLow}),f(o.IOType.input,"")):(ur=s==null?void 0:s.error)!=null&&ur.includes("output amount too high")?(u({outputError:o.Errors.outHigh}),f(o.IOType.input,"")):(cr=s==null?void 0:s.error)!=null&&cr.includes("invalid from_asset")?(u({outputError:o.Errors.invalidFomAssset}),f(o.IOType.input,"")):f(a?o.IOType.input:o.IOType.output,"");O({input:!1,output:!1}),A({input:"0",output:"0"});return}const N=a?s.val[0].source.display:s.val[0].destination.display;yr(s.val[0].solver_id);let or=Number(N);d.symbol==="USDC"&&l.symbol==="USDC"&&(or=Number(N)+x);const vr=or/Number(t);H(vr),f(a?o.IOType.input:o.IOType.output,N),O({input:!1,output:!1}),A({input:s.val[0].source.value.toString(),output:s.val[0].destination.value.toString()}),u({liquidityError:o.Errors.none})},500),[P,O,H,f,A,u,C,x]),k=c.useCallback(async(t,d,l,a)=>{w(t,d,l,a)},[w]),M=c.useCallback(async t=>{f(o.IOType.input,t);const d=Number(t);if(!d){w.cancel(),h.current&&h.current.abort(),f(o.IOType.output,""),A({input:"0",output:"0"}),u({inputError:o.Errors.none,liquidityError:o.Errors.none});return}if(r&&S&&d<S){u({inputError:o.Errors.minError(S.toString(),r==null?void 0:r.symbol)}),f(o.IOType.output,""),A({input:"0",output:"0"}),w.cancel(),h.current&&h.current.abort();return}if(r&&v&&d>v){u({inputError:o.Errors.maxError(v.toString(),r==null?void 0:r.symbol)}),f(o.IOType.output,""),w.cancel(),h.current&&h.current.abort();return}u({inputError:o.Errors.none}),!(!r||!n||!Number(t))&&k(t,r,n,!1)},[r,n,S,v,k,w,f,u,A]),Ir=async t=>{f(o.IOType.output,t);const d=Number(t);if(!d){w.cancel(),h.current&&h.current.abort(),f(o.IOType.input,""),u({outputError:o.Errors.none});return}u({outputError:o.Errors.none}),!(!r||!n||!d)&&k(t,r,n,!0)},rr=c.useMemo(()=>{var d,l,a,p;if(!r||!n||!i||i==="0"||!m||m==="0")return null;const t={evm:{check:y=>b.isEVM(y),address:(d=e==null?void 0:e.htlcs.evm)==null?void 0:d.htlcActorAddress},starknet:{check:y=>b.isStarknet(y),address:(l=e==null?void 0:e.htlcs.starknet)==null?void 0:l.htlcActorAddress},solana:{check:y=>b.isSolana(y),address:(a=e==null?void 0:e.htlcs.solana)==null?void 0:a.htlcActorAddress},sui:{check:y=>b.isSui(y),address:(p=e==null?void 0:e.htlcs.sui)==null?void 0:p.htlcActorAddress}};for(const[y,{check:s,address:N}]of Object.entries(t))if((s(r.chain)||s(n.chain))&&!N)return y;return null},[r,n,i,m,e]),Sr=async()=>{if(rr||!e||!$||!J||!r||!n)return;B(!0);const t=new L(i).multipliedBy(10**r.decimals).toFixed(),d=new L(m).multipliedBy(10**n.decimals).toFixed();try{const l=await J({fromAsset:r,toAsset:n,sendAmount:t,receiveAmount:d,solverId:Er,...I&&{addresses:{bitcoin:E}}});if(!l.ok){l.error.includes("destination amount too high")?k(i,r,n,!1):console.error("failed to create order ❌",l.error),B(!1);return}let a;if(console.log("orderCreated ✅",l.val),typeof l.val=="string"?a=l.val:l.val&&typeof l.val.order_id=="string"&&(a=l.val.order_id),b.isBitcoin(r.chain)){if(!a)return;const p=await(e==null?void 0:e.getOrder(a));if(!(p!=null&&p.val)||p!=null&&p.error){console.error("failed to get order ❌",p==null?void 0:p.error),B(!1);return}K(!0),z(e,a),B(!1),_();return}if(!a)return;K(!1),z(e,a),B(!1),_()}catch(l){throw console.error("failed to create order ❌",l),B(!1),l}};return c.useEffect(()=>{if(!r||!n||!i||C||q)return;const t=setInterval(()=>{k(i,r,n,!1)},5e3);return()=>clearInterval(t)},[i,r,n,k,C,q]),c.useEffect(()=>{!r||!n||(u({inputError:""}),M(i))},[r,M,u]),c.useEffect(()=>{if(m=="0"||!m||i=="0"||!i){A({input:"0",output:"0"});return}},[i,m,A,u]),c.useEffect(()=>{if(!i||!S||!v)return;const t=Number(i);if(t){if(t<S&&r){u({inputError:o.Errors.minError(S.toString(),r.symbol)}),A({input:"0",output:"0"}),f(o.IOType.output,"");return}if(t>v&&r){u({inputError:o.Errors.maxError(v.toString(),r.symbol)}),A({input:"0",output:"0"}),f(o.IOType.output,"");return}}},[i,S,v,r,u,A,M,f]),c.useEffect(()=>{u({insufficientBalanceError:o.Errors.none})},[u,r,n,i]),c.useEffect(()=>{var t,d;(t=e==null?void 0:e.htlcs.bitcoin)!=null&&t.htlcActorAddress&&D((d=e==null?void 0:e.htlcs.bitcoin)==null?void 0:d.htlcActorAddress)},[(tr=e==null?void 0:e.htlcs.bitcoin)==null?void 0:tr.htlcActorAddress,D]),c.useEffect(()=>{if(!I){F(!0);return}const t=E?lr.validateBTCAddress(E,G):!1;F(t)},[E,I,F]),c.useEffect(()=>{W(!!X),U(!!Y)},[Y,X]),{inputAmount:i,outputAmount:m,inputAsset:r,outputAsset:n,tokenPrices:fr,rate:dr,error:T,isEditBTCAddress:g,loading:pr,validSwap:$,isSwapping:C,isApproving:ar,isBitcoinSwap:I,inputTokenBalance:br,needsWalletConnection:rr,btcAddress:E,controller:h,isComparisonVisible:q,setBtcAddress:D,swapAssets:mr,handleInputAmountChange:M,handleOutputAmountChange:Ir,handleSwapClick:Sr,setAsset:hr,clearSwapState:_,setIsComparisonVisible:Ar}};exports.useSwap=Or;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),wr=require("./index6.cjs"),o=require("./index12.cjs"),y=require("@gardenfi/orderbook"),Tr=require("lodash.debounce"),lr=require("@gardenfi/core"),Br=require("@gardenfi/react-hooks"),L=require("bignumber.js"),j=require("./index34.cjs"),kr=require("./index7.cjs"),Cr=require("./index14.cjs"),Or=()=>{var er,tr;const{inputAmount:i,outputAmount:m,inputAsset:r,outputAsset:n,isSwapping:C,isApproving:ar,rate:dr,error:T,btcAddress:b,tokenPrices:fr,isFetchingQuote:pr,isEditBTCAddress:g,networkFees:x,setIsSwapping:B,setAmount:f,setRate:H,setError:u,swapAssets:mr,setAsset:hr,setIsFetchingQuote:O,isComparisonVisible:q,setIsValidBitcoinAddress:F,setShowBtcAddress:U,setShowFeesAndRateDetails:W,setTokenPrices:A,clearSwapState:_,setBtcAddress:D,setIsComparisonVisible:Ar,currentNetwork:G,setSolverId:Er,solverId:br}=wr.swapStore(),{balances:V}=kr.assetInfoStore(),{setIsOpen:K,setOrder:z}=Cr.orderInProgressStore(),{swap:J,getQuote:P,garden:e}=Br.useGarden(),h=c.useRef(null),Q=c.useMemo(()=>{if(!(!r||!V))return V[y.ChainAsset.from(r).toString()]},[r,V]),yr=c.useMemo(()=>{if(!(!Q||!r))return j.formatAmount(Q.toString(10),r.decimals,Math.min(r.decimals,8))},[Q,r]),X=c.useMemo(()=>!!(r&&n&&i&&m&&Number(i)!==0&&Number(m)!==0),[r,n,i,m]),Y=c.useMemo(()=>{var t;return(g||!((t=e==null?void 0:e.htlcs.bitcoin)!=null&&t.htlcActorAddress))&&((r==null?void 0:r.chain)&&y.isBitcoin(r.chain)||(n==null?void 0:n.chain)&&y.isBitcoin(n.chain))},[g,(er=e==null?void 0:e.htlcs.bitcoin)==null?void 0:er.htlcActorAddress,r,n]),I=c.useMemo(()=>!!(r&&n&&(y.isBitcoin(r.chain)||y.isBitcoin(n.chain))),[r,n]),Z=c.useMemo(()=>I?b?lr.validateBTCAddress(b,G):!1:!0,[b,I]),R=c.useMemo(()=>!!(r&&m&&i&&n&&Z&&!T.inputError&&!T.outputError&&!T.liquidityError&&!T.insufficientBalanceError),[r,m,i,n,T,Z]),$=c.useMemo(()=>I?!!(R&&b):R,[R,I,b]),{minAmount:S,maxAmount:v}=c.useMemo(()=>{const t={minAmount:0,maxAmount:0};return!r||!n||!r.min_amount||!r.max_amount?t:{minAmount:j.formatAmount(r.min_amount,r.decimals,r.decimals),maxAmount:j.formatAmount(r.max_amount,r.decimals,r.decimals)}},[r,n]),w=c.useMemo(()=>Tr(async(t,d,l,a)=>{var nr,sr,ir,ur,cr;if(!P||C)return;O({input:a,output:!a}),h.current&&h.current.abort(),h.current=new AbortController;const p=a?l.decimals:d.decimals,E=new L(t).multipliedBy(10**p),s=await P({fromAsset:d,toAsset:l,amount:E.toNumber(),isExactOut:a,options:{request:{signal:h.current.signal}}});if(!s||!s.ok){if((nr=s==null?void 0:s.error)!=null&&nr.includes("AbortError")){u({liquidityError:o.Errors.none}),O({input:!1,output:!1});return}else(sr=s==null?void 0:s.error)!=null&&sr.includes("insufficient liquidity")?(u({liquidityError:o.Errors.insufficientLiquidity}),f(a?o.IOType.input:o.IOType.output,"")):(ir=s==null?void 0:s.error)!=null&&ir.includes("output amount too less")?(u({outputError:o.Errors.outLow}),f(o.IOType.input,"")):(ur=s==null?void 0:s.error)!=null&&ur.includes("output amount too high")?(u({outputError:o.Errors.outHigh}),f(o.IOType.input,"")):(cr=s==null?void 0:s.error)!=null&&cr.includes("invalid from_asset")?(u({outputError:o.Errors.invalidFomAssset}),f(o.IOType.input,"")):f(a?o.IOType.input:o.IOType.output,"");O({input:!1,output:!1}),A({input:"0",output:"0"});return}const N=a?s.val[0].source.display:s.val[0].destination.display;Er(s.val[0].solver_id);let or=Number(N);d.symbol==="USDC"&&l.symbol==="USDC"&&(or=Number(N)+x);const vr=or/Number(t);H(vr),f(a?o.IOType.input:o.IOType.output,N),O({input:!1,output:!1}),A({input:s.val[0].source.value.toString(),output:s.val[0].destination.value.toString()}),u({liquidityError:o.Errors.none})},500),[P,O,H,f,A,u,C,x]),k=c.useCallback(async(t,d,l,a)=>{w(t,d,l,a)},[w]),M=c.useCallback(async t=>{f(o.IOType.input,t);const d=Number(t);if(!d){w.cancel(),h.current&&h.current.abort(),f(o.IOType.output,""),A({input:"0",output:"0"}),u({inputError:o.Errors.none,liquidityError:o.Errors.none});return}if(r&&S&&d<S){u({inputError:o.Errors.minError(S.toString(),r==null?void 0:r.symbol)}),f(o.IOType.output,""),A({input:"0",output:"0"}),w.cancel(),h.current&&h.current.abort();return}if(r&&v&&d>v){u({inputError:o.Errors.maxError(v.toString(),r==null?void 0:r.symbol)}),f(o.IOType.output,""),w.cancel(),h.current&&h.current.abort();return}u({inputError:o.Errors.none}),!(!r||!n||!Number(t))&&k(t,r,n,!1)},[r,n,S,v,k,w,f,u,A]),Ir=async t=>{f(o.IOType.output,t);const d=Number(t);if(!d){w.cancel(),h.current&&h.current.abort(),f(o.IOType.input,""),u({outputError:o.Errors.none});return}u({outputError:o.Errors.none}),!(!r||!n||!d)&&k(t,r,n,!0)},rr=c.useMemo(()=>{var d,l,a,p;if(!r||!n||!i||i==="0"||!m||m==="0")return null;const t={evm:{check:E=>y.isEVM(E),address:(d=e==null?void 0:e.htlcs.evm)==null?void 0:d.htlcActorAddress},starknet:{check:E=>y.isStarknet(E),address:(l=e==null?void 0:e.htlcs.starknet)==null?void 0:l.htlcActorAddress},solana:{check:E=>y.isSolana(E),address:(a=e==null?void 0:e.htlcs.solana)==null?void 0:a.htlcActorAddress},sui:{check:E=>y.isSui(E),address:(p=e==null?void 0:e.htlcs.sui)==null?void 0:p.htlcActorAddress}};for(const[E,{check:s,address:N}]of Object.entries(t))if((s(r.chain)||s(n.chain))&&!N)return E;return null},[r,n,i,m,e]),Sr=async()=>{if(rr||!e||!$||!J||!r||!n)return;B(!0);const t=new L(i).multipliedBy(10**r.decimals).toFixed(),d=new L(m).multipliedBy(10**n.decimals).toFixed();try{const l=await J({fromAsset:r,toAsset:n,sendAmount:t,receiveAmount:d,solverId:br,...I&&{addresses:{bitcoin:b}}});if(!l.ok){l.error.includes("destination amount too high")?k(i,r,n,!1):console.error("failed to create order ❌",l.error),B(!1);return}let a;if(console.log("orderCreated ✅",l.val),typeof l.val=="string"?a=l.val:l.val&&"order_id"in l.val&&(a=l.val.order_id),y.isBitcoin(r.chain)){if(!a)return;const p=await(e==null?void 0:e.getOrder(a));if(!(p!=null&&p.val)||p!=null&&p.error){console.error("failed to get order ❌",p==null?void 0:p.error),B(!1);return}K(!0),z(e,a),B(!1),_();return}if(!a)return;K(!1),z(e,a),B(!1),_()}catch(l){throw console.error("failed to create order ❌",l),B(!1),l}};return c.useEffect(()=>{if(!r||!n||!i||C||q)return;const t=setInterval(()=>{k(i,r,n,!1)},5e3);return()=>clearInterval(t)},[i,r,n,k,C,q]),c.useEffect(()=>{!r||!n||(u({inputError:""}),M(i))},[r,M,u]),c.useEffect(()=>{if(m=="0"||!m||i=="0"||!i){A({input:"0",output:"0"});return}},[i,m,A,u]),c.useEffect(()=>{if(!i||!S||!v)return;const t=Number(i);if(t){if(t<S&&r){u({inputError:o.Errors.minError(S.toString(),r.symbol)}),A({input:"0",output:"0"}),f(o.IOType.output,"");return}if(t>v&&r){u({inputError:o.Errors.maxError(v.toString(),r.symbol)}),A({input:"0",output:"0"}),f(o.IOType.output,"");return}}},[i,S,v,r,u,A,M,f]),c.useEffect(()=>{u({insufficientBalanceError:o.Errors.none})},[u,r,n,i]),c.useEffect(()=>{var t,d;(t=e==null?void 0:e.htlcs.bitcoin)!=null&&t.htlcActorAddress&&D((d=e==null?void 0:e.htlcs.bitcoin)==null?void 0:d.htlcActorAddress)},[(tr=e==null?void 0:e.htlcs.bitcoin)==null?void 0:tr.htlcActorAddress,D]),c.useEffect(()=>{if(!I){F(!0);return}const t=b?lr.validateBTCAddress(b,G):!1;F(t)},[b,I,F]),c.useEffect(()=>{W(!!X),U(!!Y)},[Y,X]),{inputAmount:i,outputAmount:m,inputAsset:r,outputAsset:n,tokenPrices:fr,rate:dr,error:T,isEditBTCAddress:g,loading:pr,validSwap:$,isSwapping:C,isApproving:ar,isBitcoinSwap:I,inputTokenBalance:yr,needsWalletConnection:rr,btcAddress:b,controller:h,isComparisonVisible:q,setBtcAddress:D,swapAssets:mr,handleInputAmountChange:M,handleOutputAmountChange:Ir,handleSwapClick:Sr,setAsset:hr,clearSwapState:_,setIsComparisonVisible:Ar}};exports.useSwap=Or;