@multiversx/sdk-dapp-liquidity 0.2.0-alpha.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 (499) hide show
  1. package/README.md +186 -0
  2. package/all-networks-EJIVYZ_i.mjs +4 -0
  3. package/all-networks-NYACMyeN.js +4 -0
  4. package/api/confirmRate.d.ts +11 -0
  5. package/api/confirmRate.js +30 -0
  6. package/api/confirmRate.mjs +29 -0
  7. package/api/getChains.d.ts +6 -0
  8. package/api/getChains.js +12 -0
  9. package/api/getChains.mjs +11 -0
  10. package/api/getRate.d.ts +10 -0
  11. package/api/getRate.js +28 -0
  12. package/api/getRate.mjs +27 -0
  13. package/api/getTokens.d.ts +7 -0
  14. package/api/getTokens.js +14 -0
  15. package/api/getTokens.mjs +13 -0
  16. package/api/getTokensBalances.d.ts +8 -0
  17. package/api/getTokensBalances.js +17 -0
  18. package/api/getTokensBalances.mjs +16 -0
  19. package/api/getTransactions.d.ts +7 -0
  20. package/api/getTransactions.js +14 -0
  21. package/api/getTransactions.mjs +13 -0
  22. package/api/index.d.ts +7 -0
  23. package/api/index.js +17 -0
  24. package/api/index.mjs +16 -0
  25. package/api/sendTransactions.d.ts +11 -0
  26. package/api/sendTransactions.js +29 -0
  27. package/api/sendTransactions.mjs +28 -0
  28. package/api/tests/confirmRate.spec.d.ts +1 -0
  29. package/api/tests/confirmRate.spec.js +124 -0
  30. package/api/tests/confirmRate.spec.mjs +122 -0
  31. package/api/tests/getChains.spec.d.ts +1 -0
  32. package/api/tests/getChains.spec.js +37 -0
  33. package/api/tests/getChains.spec.mjs +35 -0
  34. package/api/tests/getRate.spec.d.ts +1 -0
  35. package/api/tests/getRate.spec.js +83 -0
  36. package/api/tests/getRate.spec.mjs +81 -0
  37. package/api/tests/getTokens.spec.d.ts +1 -0
  38. package/api/tests/getTokens.spec.js +60 -0
  39. package/api/tests/getTokens.spec.mjs +58 -0
  40. package/api/tests/getTransactions.spec.d.ts +1 -0
  41. package/api/tests/getTransactions.spec.js +89 -0
  42. package/api/tests/getTransactions.spec.mjs +87 -0
  43. package/api/tests/sendTransactions.spec.d.ts +1 -0
  44. package/api/tests/sendTransactions.spec.js +83 -0
  45. package/api/tests/sendTransactions.spec.mjs +81 -0
  46. package/bignumber-B8vjg9qn.js +1334 -0
  47. package/bignumber-CKZkoo0g.mjs +1334 -0
  48. package/constants/index.d.ts +1 -0
  49. package/constants/index.js +5 -0
  50. package/constants/index.mjs +4 -0
  51. package/default-BYtXv70Z.mjs +4 -0
  52. package/default-H3AbmzFV.js +4 -0
  53. package/dto/Chain.dto.d.ts +16 -0
  54. package/dto/Chain.dto.js +2 -0
  55. package/dto/Chain.dto.mjs +1 -0
  56. package/dto/ConfirmRate.dto.d.ts +11 -0
  57. package/dto/ConfirmRate.dto.js +2 -0
  58. package/dto/ConfirmRate.dto.mjs +1 -0
  59. package/dto/Token.dto.d.ts +14 -0
  60. package/dto/Token.dto.js +2 -0
  61. package/dto/Token.dto.mjs +1 -0
  62. package/dto/TokenBalance.dto.d.ts +4 -0
  63. package/dto/TokenBalance.dto.js +2 -0
  64. package/dto/TokenBalance.dto.mjs +1 -0
  65. package/dto/Transaction.dto.d.ts +14 -0
  66. package/dto/Transaction.dto.js +2 -0
  67. package/dto/Transaction.dto.mjs +1 -0
  68. package/dto/index.d.ts +5 -0
  69. package/dto/index.js +2 -0
  70. package/dto/index.mjs +1 -0
  71. package/helpers/base64Utils.d.ts +3 -0
  72. package/helpers/base64Utils.js +32 -0
  73. package/helpers/base64Utils.mjs +31 -0
  74. package/helpers/decodeLoginToken.d.ts +9 -0
  75. package/helpers/decodeLoginToken.js +28 -0
  76. package/helpers/decodeLoginToken.mjs +27 -0
  77. package/helpers/decodeToken.d.ts +11 -0
  78. package/helpers/decodeToken.js +40 -0
  79. package/helpers/decodeToken.mjs +39 -0
  80. package/helpers/getApiURL.d.ts +1 -0
  81. package/helpers/getApiURL.js +8 -0
  82. package/helpers/getApiURL.mjs +7 -0
  83. package/helpers/getBridgeURL.d.ts +1 -0
  84. package/helpers/getBridgeURL.js +8 -0
  85. package/helpers/getBridgeURL.mjs +7 -0
  86. package/helpers/getMvxApiURL.d.ts +1 -0
  87. package/helpers/getMvxApiURL.js +8 -0
  88. package/helpers/getMvxApiURL.mjs +7 -0
  89. package/helpers/getMvxChainId.d.ts +1 -0
  90. package/helpers/getMvxChainId.js +8 -0
  91. package/helpers/getMvxChainId.mjs +7 -0
  92. package/helpers/getMvxExplorerAddress.d.ts +1 -0
  93. package/helpers/getMvxExplorerAddress.js +8 -0
  94. package/helpers/getMvxExplorerAddress.mjs +7 -0
  95. package/helpers/index.d.ts +9 -0
  96. package/helpers/index.js +23 -0
  97. package/helpers/index.mjs +22 -0
  98. package/helpers/serializeTransaction.d.ts +3 -0
  99. package/helpers/serializeTransaction.js +9 -0
  100. package/helpers/serializeTransaction.mjs +8 -0
  101. package/helpers/tests/base64Utils.spec.d.ts +1 -0
  102. package/helpers/tests/base64Utils.spec.js +30 -0
  103. package/helpers/tests/base64Utils.spec.mjs +28 -0
  104. package/helpers/tests/decodeLoginToken.spec.d.ts +1 -0
  105. package/helpers/tests/decodeLoginToken.spec.js +35 -0
  106. package/helpers/tests/decodeLoginToken.spec.mjs +33 -0
  107. package/helpers/tests/decodeToken.spec.d.ts +1 -0
  108. package/helpers/tests/decodeToken.spec.js +28 -0
  109. package/helpers/tests/decodeToken.spec.mjs +26 -0
  110. package/index-B9WqxUXM.mjs +91 -0
  111. package/index-BXwpbIDQ.mjs +107 -0
  112. package/index-CnudU77V.js +329 -0
  113. package/index-DSnomXRI.mjs +68025 -0
  114. package/index-DZHiA1sX.js +107 -0
  115. package/index-cvy2-uZ_.js +67946 -0
  116. package/index.d.ts +6 -0
  117. package/index.js +189 -0
  118. package/index.mjs +185 -0
  119. package/package.json +107 -0
  120. package/react-B9sQBOh0.mjs +3040 -0
  121. package/react-BaXyw3AO.js +3040 -0
  122. package/react-CNXJSTCv.js +38 -0
  123. package/react-CSQpf1zk.mjs +38 -0
  124. package/reactjs/components/AccountAddress/AccountAddress.d.ts +6 -0
  125. package/reactjs/components/AccountAddress/AccountAddress.js +25 -0
  126. package/reactjs/components/AccountAddress/AccountAddress.mjs +24 -0
  127. package/reactjs/components/AccountAddress/index.d.ts +1 -0
  128. package/reactjs/components/AccountAddress/index.js +5 -0
  129. package/reactjs/components/AccountAddress/index.mjs +4 -0
  130. package/reactjs/components/AmountCard/AmountCard.d.ts +6 -0
  131. package/reactjs/components/AmountCard/AmountCard.js +33 -0
  132. package/reactjs/components/AmountCard/AmountCard.mjs +32 -0
  133. package/reactjs/components/AmountCard/index.d.ts +1 -0
  134. package/reactjs/components/AmountCard/index.js +5 -0
  135. package/reactjs/components/AmountCard/index.mjs +4 -0
  136. package/reactjs/components/AmountInput/AmountInput.d.ts +13 -0
  137. package/reactjs/components/AmountInput/AmountInput.js +61 -0
  138. package/reactjs/components/AmountInput/AmountInput.mjs +60 -0
  139. package/reactjs/components/AmountInput/index.d.ts +1 -0
  140. package/reactjs/components/AmountInput/index.js +5 -0
  141. package/reactjs/components/AmountInput/index.mjs +4 -0
  142. package/reactjs/components/BridgeForm/BridgeForm.d.ts +16 -0
  143. package/reactjs/components/BridgeForm/BridgeForm.js +680 -0
  144. package/reactjs/components/BridgeForm/BridgeForm.mjs +679 -0
  145. package/reactjs/components/BridgeForm/index.d.ts +1 -0
  146. package/reactjs/components/BridgeForm/index.js +5 -0
  147. package/reactjs/components/BridgeForm/index.mjs +4 -0
  148. package/reactjs/components/BridgeHistory/BridgeHistory.d.ts +4 -0
  149. package/reactjs/components/BridgeHistory/BridgeHistory.js +233 -0
  150. package/reactjs/components/BridgeHistory/BridgeHistory.mjs +232 -0
  151. package/reactjs/components/BridgeHistory/index.d.ts +1 -0
  152. package/reactjs/components/BridgeHistory/index.js +5 -0
  153. package/reactjs/components/BridgeHistory/index.mjs +4 -0
  154. package/reactjs/components/Connect/BridgeAccountDisplay.d.ts +6 -0
  155. package/reactjs/components/Connect/BridgeAccountDisplay.js +85 -0
  156. package/reactjs/components/Connect/BridgeAccountDisplay.mjs +84 -0
  157. package/reactjs/components/Connect/BridgeConnectButton.d.ts +7 -0
  158. package/reactjs/components/Connect/BridgeConnectButton.js +26 -0
  159. package/reactjs/components/Connect/BridgeConnectButton.mjs +25 -0
  160. package/reactjs/components/Connect/CustomConnectButton.d.ts +7 -0
  161. package/reactjs/components/Connect/CustomConnectButton.js +42 -0
  162. package/reactjs/components/Connect/CustomConnectButton.mjs +41 -0
  163. package/reactjs/components/Connect/MvxAccountDisplay.d.ts +9 -0
  164. package/reactjs/components/Connect/MvxAccountDisplay.js +75 -0
  165. package/reactjs/components/Connect/MvxAccountDisplay.mjs +74 -0
  166. package/reactjs/components/Connect/MvxConnectButton.d.ts +11 -0
  167. package/reactjs/components/Connect/MvxConnectButton.js +43 -0
  168. package/reactjs/components/Connect/MvxConnectButton.mjs +42 -0
  169. package/reactjs/components/Connect/SwitchChainButton.d.ts +7 -0
  170. package/reactjs/components/Connect/SwitchChainButton.js +33 -0
  171. package/reactjs/components/Connect/SwitchChainButton.mjs +32 -0
  172. package/reactjs/components/Connect/index.d.ts +6 -0
  173. package/reactjs/components/Connect/index.js +15 -0
  174. package/reactjs/components/Connect/index.mjs +14 -0
  175. package/reactjs/components/CopyButton/CopyButton.d.ts +6 -0
  176. package/reactjs/components/CopyButton/CopyButton.js +42 -0
  177. package/reactjs/components/CopyButton/CopyButton.mjs +41 -0
  178. package/reactjs/components/CopyButton/index.d.ts +1 -0
  179. package/reactjs/components/CopyButton/index.js +5 -0
  180. package/reactjs/components/CopyButton/index.mjs +4 -0
  181. package/reactjs/components/CopyButton/utils/copyToClipboard.d.ts +1 -0
  182. package/reactjs/components/CopyButton/utils/copyToClipboard.js +38 -0
  183. package/reactjs/components/CopyButton/utils/copyToClipboard.mjs +37 -0
  184. package/reactjs/components/CopyButton/utils/index.d.ts +1 -0
  185. package/reactjs/components/CopyButton/utils/index.js +5 -0
  186. package/reactjs/components/CopyButton/utils/index.mjs +4 -0
  187. package/reactjs/components/DisplayAmount/DisplayAmount.d.ts +21 -0
  188. package/reactjs/components/DisplayAmount/DisplayAmount.js +91 -0
  189. package/reactjs/components/DisplayAmount/DisplayAmount.mjs +90 -0
  190. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.d.ts +7 -0
  191. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +40 -0
  192. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.mjs +39 -0
  193. package/reactjs/components/DisplayAmount/components/AnimateNumber/index.d.ts +0 -0
  194. package/reactjs/components/DisplayAmount/components/AnimateNumber/index.js +2 -0
  195. package/reactjs/components/DisplayAmount/components/AnimateNumber/index.mjs +1 -0
  196. package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.d.ts +14 -0
  197. package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.js +62 -0
  198. package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.mjs +61 -0
  199. package/reactjs/components/DisplayAmount/components/index.d.ts +0 -0
  200. package/reactjs/components/DisplayAmount/components/index.js +2 -0
  201. package/reactjs/components/DisplayAmount/components/index.mjs +1 -0
  202. package/reactjs/components/DisplayAmount/index.d.ts +1 -0
  203. package/reactjs/components/DisplayAmount/index.js +5 -0
  204. package/reactjs/components/DisplayAmount/index.mjs +4 -0
  205. package/reactjs/components/DisplayAmount/utils/index.d.ts +1 -0
  206. package/reactjs/components/DisplayAmount/utils/index.js +5 -0
  207. package/reactjs/components/DisplayAmount/utils/index.mjs +4 -0
  208. package/reactjs/components/DisplayAmount/utils/truncateAmount.d.ts +1 -0
  209. package/reactjs/components/DisplayAmount/utils/truncateAmount.js +22 -0
  210. package/reactjs/components/DisplayAmount/utils/truncateAmount.mjs +21 -0
  211. package/reactjs/components/SmallLoader/SmallLoader.d.ts +4 -0
  212. package/reactjs/components/SmallLoader/SmallLoader.js +22 -0
  213. package/reactjs/components/SmallLoader/SmallLoader.mjs +21 -0
  214. package/reactjs/components/SmallLoader/index.d.ts +1 -0
  215. package/reactjs/components/SmallLoader/index.js +5 -0
  216. package/reactjs/components/SmallLoader/index.mjs +4 -0
  217. package/reactjs/components/TokenSelector/TokenSelector.d.ts +16 -0
  218. package/reactjs/components/TokenSelector/TokenSelector.js +158 -0
  219. package/reactjs/components/TokenSelector/TokenSelector.mjs +157 -0
  220. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.d.ts +8 -0
  221. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +86 -0
  222. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +85 -0
  223. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.d.ts +11 -0
  224. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +45 -0
  225. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +44 -0
  226. package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.d.ts +6 -0
  227. package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js +19 -0
  228. package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.mjs +18 -0
  229. package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.d.ts +3 -0
  230. package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js +7 -0
  231. package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.mjs +6 -0
  232. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.d.ts +4 -0
  233. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +33 -0
  234. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +32 -0
  235. package/reactjs/components/TokenSelector/components/ChainSelect/types/chainSelectOption.d.ts +10 -0
  236. package/reactjs/components/TokenSelector/components/ChainSelect/types/chainSelectOption.js +2 -0
  237. package/reactjs/components/TokenSelector/components/ChainSelect/types/chainSelectOption.mjs +1 -0
  238. package/reactjs/components/TokenSelector/components/ChainSelect/types/partialChainOption.d.ts +10 -0
  239. package/reactjs/components/TokenSelector/components/ChainSelect/types/partialChainOption.js +2 -0
  240. package/reactjs/components/TokenSelector/components/ChainSelect/types/partialChainOption.mjs +1 -0
  241. package/reactjs/components/TokenSelector/components/SelectContainer.d.ts +7 -0
  242. package/reactjs/components/TokenSelector/components/SelectContainer.js +41 -0
  243. package/reactjs/components/TokenSelector/components/SelectContainer.mjs +40 -0
  244. package/reactjs/components/TokenSelector/components/SelectContent.d.ts +10 -0
  245. package/reactjs/components/TokenSelector/components/SelectContent.js +93 -0
  246. package/reactjs/components/TokenSelector/components/SelectContent.mjs +92 -0
  247. package/reactjs/components/TokenSelector/components/SelectedOption.d.ts +5 -0
  248. package/reactjs/components/TokenSelector/components/SelectedOption.js +29 -0
  249. package/reactjs/components/TokenSelector/components/SelectedOption.mjs +28 -0
  250. package/reactjs/components/TokenSelector/components/TokenIcon.d.ts +8 -0
  251. package/reactjs/components/TokenSelector/components/TokenIcon.js +82 -0
  252. package/reactjs/components/TokenSelector/components/TokenIcon.mjs +81 -0
  253. package/reactjs/components/TokenSelector/components/TokenItem.d.ts +7 -0
  254. package/reactjs/components/TokenSelector/components/TokenItem.js +69 -0
  255. package/reactjs/components/TokenSelector/components/TokenItem.mjs +68 -0
  256. package/reactjs/components/TokenSelector/components/TokenList.d.ts +7 -0
  257. package/reactjs/components/TokenSelector/components/TokenList.js +21 -0
  258. package/reactjs/components/TokenSelector/components/TokenList.mjs +20 -0
  259. package/reactjs/components/TokenSelector/components/TokenSymbol.d.ts +9 -0
  260. package/reactjs/components/TokenSelector/components/TokenSymbol.js +26 -0
  261. package/reactjs/components/TokenSelector/components/TokenSymbol.mjs +25 -0
  262. package/reactjs/components/TokenSelector/index.d.ts +1 -0
  263. package/reactjs/components/TokenSelector/index.js +5 -0
  264. package/reactjs/components/TokenSelector/index.mjs +4 -0
  265. package/reactjs/components/TransactionToast/TransactionToast.d.ts +9 -0
  266. package/reactjs/components/TransactionToast/TransactionToast.js +54 -0
  267. package/reactjs/components/TransactionToast/TransactionToast.mjs +53 -0
  268. package/reactjs/components/TransactionToast/TransactionToastContainer.d.ts +3 -0
  269. package/reactjs/components/TransactionToast/TransactionToastContainer.js +21 -0
  270. package/reactjs/components/TransactionToast/TransactionToastContainer.mjs +20 -0
  271. package/reactjs/components/TransactionToast/index.d.ts +2 -0
  272. package/reactjs/components/TransactionToast/index.js +7 -0
  273. package/reactjs/components/TransactionToast/index.mjs +6 -0
  274. package/reactjs/components/TrimAddress/TrimAddress.d.ts +8 -0
  275. package/reactjs/components/TrimAddress/TrimAddress.js +26 -0
  276. package/reactjs/components/TrimAddress/TrimAddress.mjs +25 -0
  277. package/reactjs/components/TrimAddress/index.d.ts +1 -0
  278. package/reactjs/components/TrimAddress/index.js +5 -0
  279. package/reactjs/components/TrimAddress/index.mjs +4 -0
  280. package/reactjs/components/base/MxButton/MxButton.d.ts +13 -0
  281. package/reactjs/components/base/MxButton/MxButton.js +72 -0
  282. package/reactjs/components/base/MxButton/MxButton.mjs +71 -0
  283. package/reactjs/components/base/MxButton/index.d.ts +1 -0
  284. package/reactjs/components/base/MxButton/index.js +5 -0
  285. package/reactjs/components/base/MxButton/index.mjs +4 -0
  286. package/reactjs/components/base/MxCard/MxCard.d.ts +10 -0
  287. package/reactjs/components/base/MxCard/MxCard.js +55 -0
  288. package/reactjs/components/base/MxCard/MxCard.mjs +54 -0
  289. package/reactjs/components/base/MxCard/index.d.ts +1 -0
  290. package/reactjs/components/base/MxCard/index.js +5 -0
  291. package/reactjs/components/base/MxCard/index.mjs +4 -0
  292. package/reactjs/components/base/MxLink/MxLink.d.ts +10 -0
  293. package/reactjs/components/base/MxLink/MxLink.js +71 -0
  294. package/reactjs/components/base/MxLink/MxLink.mjs +70 -0
  295. package/reactjs/components/base/MxLink/index.d.ts +1 -0
  296. package/reactjs/components/base/MxLink/index.js +5 -0
  297. package/reactjs/components/base/MxLink/index.mjs +4 -0
  298. package/reactjs/components/base/MxSearch/MxSearch.d.ts +10 -0
  299. package/reactjs/components/base/MxSearch/MxSearch.js +70 -0
  300. package/reactjs/components/base/MxSearch/MxSearch.mjs +69 -0
  301. package/reactjs/components/base/MxSearch/index.d.ts +1 -0
  302. package/reactjs/components/base/MxSearch/index.js +5 -0
  303. package/reactjs/components/base/MxSearch/index.mjs +4 -0
  304. package/reactjs/components/base/MxSlideover/MxSlideover.d.ts +10 -0
  305. package/reactjs/components/base/MxSlideover/MxSlideover.js +79 -0
  306. package/reactjs/components/base/MxSlideover/MxSlideover.mjs +78 -0
  307. package/reactjs/components/base/MxSlideover/index.d.ts +1 -0
  308. package/reactjs/components/base/MxSlideover/index.js +5 -0
  309. package/reactjs/components/base/MxSlideover/index.mjs +4 -0
  310. package/reactjs/components/base/MxTooltip/MxTooltip.d.ts +23 -0
  311. package/reactjs/components/base/MxTooltip/MxTooltip.js +163 -0
  312. package/reactjs/components/base/MxTooltip/MxTooltip.mjs +162 -0
  313. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.d.ts +11 -0
  314. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +34 -0
  315. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs +33 -0
  316. package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.d.ts +1 -0
  317. package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.js +5 -0
  318. package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.mjs +4 -0
  319. package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.d.ts +13 -0
  320. package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.js +28 -0
  321. package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.mjs +27 -0
  322. package/reactjs/components/base/MxTooltip/components/TooltipContent/index.d.ts +1 -0
  323. package/reactjs/components/base/MxTooltip/components/TooltipContent/index.js +5 -0
  324. package/reactjs/components/base/MxTooltip/components/TooltipContent/index.mjs +4 -0
  325. package/reactjs/components/base/MxTooltip/components/index.d.ts +2 -0
  326. package/reactjs/components/base/MxTooltip/components/index.js +7 -0
  327. package/reactjs/components/base/MxTooltip/components/index.mjs +6 -0
  328. package/reactjs/components/base/MxTooltip/index.d.ts +1 -0
  329. package/reactjs/components/base/MxTooltip/index.js +5 -0
  330. package/reactjs/components/base/MxTooltip/index.mjs +4 -0
  331. package/reactjs/components/base/index.d.ts +6 -0
  332. package/reactjs/components/base/index.js +15 -0
  333. package/reactjs/components/base/index.mjs +14 -0
  334. package/reactjs/components/index.d.ts +13 -0
  335. package/reactjs/components/index.js +51 -0
  336. package/reactjs/components/index.mjs +50 -0
  337. package/reactjs/constants/chains.d.ts +35 -0
  338. package/reactjs/constants/chains.js +38 -0
  339. package/reactjs/constants/chains.mjs +37 -0
  340. package/reactjs/constants/index.d.ts +3 -0
  341. package/reactjs/constants/index.js +12 -0
  342. package/reactjs/constants/index.mjs +11 -0
  343. package/reactjs/context/Web3AppProvider.d.ts +12 -0
  344. package/reactjs/context/Web3AppProvider.js +29 -0
  345. package/reactjs/context/Web3AppProvider.mjs +28 -0
  346. package/reactjs/context/queryClient.d.ts +3 -0
  347. package/reactjs/context/queryClient.js +12 -0
  348. package/reactjs/context/queryClient.mjs +11 -0
  349. package/reactjs/context/useWeb3App.d.ts +1 -0
  350. package/reactjs/context/useWeb3App.js +13 -0
  351. package/reactjs/context/useWeb3App.mjs +12 -0
  352. package/reactjs/hooks/index.d.ts +11 -0
  353. package/reactjs/hooks/index.js +32 -0
  354. package/reactjs/hooks/index.mjs +31 -0
  355. package/reactjs/hooks/useAccount.d.ts +77 -0
  356. package/reactjs/hooks/useAccount.js +18 -0
  357. package/reactjs/hooks/useAccount.mjs +17 -0
  358. package/reactjs/hooks/useBalances.d.ts +10 -0
  359. package/reactjs/hooks/useBalances.js +7 -0
  360. package/reactjs/hooks/useBalances.mjs +6 -0
  361. package/reactjs/hooks/useBridgeFormik.d.ts +98 -0
  362. package/reactjs/hooks/useBridgeFormik.js +182 -0
  363. package/reactjs/hooks/useBridgeFormik.mjs +181 -0
  364. package/reactjs/hooks/useDebounce.d.ts +1 -0
  365. package/reactjs/hooks/useDebounce.js +14 -0
  366. package/reactjs/hooks/useDebounce.mjs +13 -0
  367. package/reactjs/hooks/useFetchBridgeData.d.ts +45 -0
  368. package/reactjs/hooks/useFetchBridgeData.js +44 -0
  369. package/reactjs/hooks/useFetchBridgeData.mjs +43 -0
  370. package/reactjs/hooks/useFetchTokens.d.ts +42 -0
  371. package/reactjs/hooks/useFetchTokens.js +105 -0
  372. package/reactjs/hooks/useFetchTokens.mjs +104 -0
  373. package/reactjs/hooks/useGetChainId.d.ts +1 -0
  374. package/reactjs/hooks/useGetChainId.js +12 -0
  375. package/reactjs/hooks/useGetChainId.mjs +11 -0
  376. package/reactjs/hooks/useResolveTokenChain.d.ts +9 -0
  377. package/reactjs/hooks/useResolveTokenChain.js +21 -0
  378. package/reactjs/hooks/useResolveTokenChain.mjs +20 -0
  379. package/reactjs/hooks/useSendTransactions.d.ts +3 -0
  380. package/reactjs/hooks/useSendTransactions.js +19 -0
  381. package/reactjs/hooks/useSendTransactions.mjs +18 -0
  382. package/reactjs/hooks/useSignTransaction.d.ts +69 -0
  383. package/reactjs/hooks/useSignTransaction.js +17 -0
  384. package/reactjs/hooks/useSignTransaction.mjs +16 -0
  385. package/reactjs/hooks/validation/index.d.ts +4 -0
  386. package/reactjs/hooks/validation/index.js +11 -0
  387. package/reactjs/hooks/validation/index.mjs +10 -0
  388. package/reactjs/hooks/validation/useAmountSchema.d.ts +2 -0
  389. package/reactjs/hooks/validation/useAmountSchema.js +31 -0
  390. package/reactjs/hooks/validation/useAmountSchema.mjs +13 -0
  391. package/reactjs/hooks/validation/useSecondAmountSchema.d.ts +2 -0
  392. package/reactjs/hooks/validation/useSecondAmountSchema.js +27 -0
  393. package/reactjs/hooks/validation/useSecondAmountSchema.mjs +9 -0
  394. package/reactjs/hooks/validation/useTestHasEnoughFunds.d.ts +3 -0
  395. package/reactjs/hooks/validation/useTestHasEnoughFunds.js +38 -0
  396. package/reactjs/hooks/validation/useTestHasEnoughFunds.mjs +37 -0
  397. package/reactjs/hooks/validation/useTestIsConnected.d.ts +3 -0
  398. package/reactjs/hooks/validation/useTestIsConnected.js +21 -0
  399. package/reactjs/hooks/validation/useTestIsConnected.mjs +20 -0
  400. package/reactjs/index.d.ts +10 -0
  401. package/reactjs/index.js +153 -0
  402. package/reactjs/index.mjs +149 -0
  403. package/reactjs/init/index.d.ts +1 -0
  404. package/reactjs/init/index.js +5 -0
  405. package/reactjs/init/index.mjs +4 -0
  406. package/reactjs/init/init.d.ts +48 -0
  407. package/reactjs/init/init.js +53 -0
  408. package/reactjs/init/init.mjs +35 -0
  409. package/reactjs/init/tests/init.spec.d.ts +1 -0
  410. package/reactjs/init/tests/init.spec.js +108 -0
  411. package/reactjs/init/tests/init.spec.mjs +106 -0
  412. package/reactjs/queries/index.d.ts +7 -0
  413. package/reactjs/queries/index.js +20 -0
  414. package/reactjs/queries/index.mjs +19 -0
  415. package/reactjs/queries/useGetAllTokens.query.d.ts +3 -0
  416. package/reactjs/queries/useGetAllTokens.query.js +31 -0
  417. package/reactjs/queries/useGetAllTokens.query.mjs +30 -0
  418. package/reactjs/queries/useGetChains.query.d.ts +3 -0
  419. package/reactjs/queries/useGetChains.query.js +31 -0
  420. package/reactjs/queries/useGetChains.query.mjs +30 -0
  421. package/reactjs/queries/useGetEvmTokensBalances.query.d.ts +22 -0
  422. package/reactjs/queries/useGetEvmTokensBalances.query.js +78 -0
  423. package/reactjs/queries/useGetEvmTokensBalances.query.mjs +77 -0
  424. package/reactjs/queries/useGetHistory.query.d.ts +4 -0
  425. package/reactjs/queries/useGetHistory.query.js +47 -0
  426. package/reactjs/queries/useGetHistory.query.mjs +46 -0
  427. package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +23 -0
  428. package/reactjs/queries/useGetMvxTokensBalances.query.js +60 -0
  429. package/reactjs/queries/useGetMvxTokensBalances.query.mjs +59 -0
  430. package/reactjs/queries/useGetRate.mutation.d.ts +6 -0
  431. package/reactjs/queries/useGetRate.mutation.js +19 -0
  432. package/reactjs/queries/useGetRate.mutation.mjs +18 -0
  433. package/reactjs/queries/useGetTokens.query.d.ts +3 -0
  434. package/reactjs/queries/useGetTokens.query.js +34 -0
  435. package/reactjs/queries/useGetTokens.query.mjs +33 -0
  436. package/reactjs/reexports.d.ts +6 -0
  437. package/reactjs/reexports.js +21 -0
  438. package/reactjs/reexports.mjs +17 -0
  439. package/reactjs/utils/delay.d.ts +1 -0
  440. package/reactjs/utils/delay.js +7 -0
  441. package/reactjs/utils/delay.mjs +6 -0
  442. package/reactjs/utils/formatAmount.d.ts +7 -0
  443. package/reactjs/utils/formatAmount.js +24 -0
  444. package/reactjs/utils/formatAmount.mjs +23 -0
  445. package/reactjs/utils/getCleanStringAmount.d.ts +4 -0
  446. package/reactjs/utils/getCleanStringAmount.js +12 -0
  447. package/reactjs/utils/getCleanStringAmount.mjs +11 -0
  448. package/reactjs/utils/getCompletePathname.d.ts +1 -0
  449. package/reactjs/utils/getCompletePathname.js +6 -0
  450. package/reactjs/utils/getCompletePathname.mjs +5 -0
  451. package/reactjs/utils/getInitialTokens.d.ts +8 -0
  452. package/reactjs/utils/getInitialTokens.js +13 -0
  453. package/reactjs/utils/getInitialTokens.mjs +12 -0
  454. package/reactjs/utils/hasEnoughFunds.d.ts +5 -0
  455. package/reactjs/utils/hasEnoughFunds.js +20 -0
  456. package/reactjs/utils/hasEnoughFunds.mjs +19 -0
  457. package/reactjs/utils/index.d.ts +12 -0
  458. package/reactjs/utils/index.js +27 -0
  459. package/reactjs/utils/index.mjs +26 -0
  460. package/reactjs/utils/isStringFloat.d.ts +1 -0
  461. package/reactjs/utils/isStringFloat.js +22 -0
  462. package/reactjs/utils/isStringFloat.mjs +21 -0
  463. package/reactjs/utils/mxClsx.d.ts +3 -0
  464. package/reactjs/utils/mxClsx.js +21 -0
  465. package/reactjs/utils/mxClsx.mjs +20 -0
  466. package/reactjs/utils/pipe.d.ts +7 -0
  467. package/reactjs/utils/pipe.js +26 -0
  468. package/reactjs/utils/pipe.mjs +25 -0
  469. package/reactjs/utils/removeCommas.d.ts +1 -0
  470. package/reactjs/utils/removeCommas.js +7 -0
  471. package/reactjs/utils/removeCommas.mjs +6 -0
  472. package/reactjs/utils/roundAmount.d.ts +1 -0
  473. package/reactjs/utils/roundAmount.js +41 -0
  474. package/reactjs/utils/roundAmount.mjs +40 -0
  475. package/reactjs/utils/testNumber.d.ts +1 -0
  476. package/reactjs/utils/testNumber.js +5 -0
  477. package/reactjs/utils/testNumber.mjs +4 -0
  478. package/store/inMemoryStore.d.ts +12 -0
  479. package/store/inMemoryStore.js +40 -0
  480. package/store/inMemoryStore.mjs +39 -0
  481. package/types/batchTransactions.d.ts +6 -0
  482. package/types/batchTransactions.js +2 -0
  483. package/types/batchTransactions.mjs +1 -0
  484. package/types/index.d.ts +4 -0
  485. package/types/index.js +2 -0
  486. package/types/index.mjs +1 -0
  487. package/types/rate.d.ts +11 -0
  488. package/types/rate.js +2 -0
  489. package/types/rate.mjs +1 -0
  490. package/types/token.d.ts +12 -0
  491. package/types/token.js +2 -0
  492. package/types/token.mjs +1 -0
  493. package/types/transaction.d.ts +14 -0
  494. package/types/transaction.js +2 -0
  495. package/types/transaction.mjs +1 -0
  496. package/useBalances-Bxtc4GNK.js +199 -0
  497. package/useBalances-DA3zEruz.mjs +199 -0
  498. package/w3m-modal-DCcF1qEB.js +356 -0
  499. package/w3m-modal-DK3G5GJp.mjs +356 -0
@@ -0,0 +1,680 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const faSpinner = require("@fortawesome/free-solid-svg-icons/faSpinner");
6
+ const reactFontawesome = require("@fortawesome/react-fontawesome");
7
+ const formatAmount = require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
8
+ const debounce = require("lodash/debounce");
9
+ const require$$0 = require("react");
10
+ const reactRouterDom = require("react-router-dom");
11
+ const reactToastify = require("react-toastify");
12
+ const wagmi = require("wagmi");
13
+ const helpers_getApiURL = require("../../../helpers/getApiURL.js");
14
+ const reactjs_context_useWeb3App = require("../../context/useWeb3App.js");
15
+ const reactjs_hooks_useAccount = require("../../hooks/useAccount.js");
16
+ const reactjs_hooks_useBridgeFormik = require("../../hooks/useBridgeFormik.js");
17
+ const reactjs_hooks_useFetchBridgeData = require("../../hooks/useFetchBridgeData.js");
18
+ const reactjs_hooks_useGetChainId = require("../../hooks/useGetChainId.js");
19
+ const reactjs_hooks_useSendTransactions = require("../../hooks/useSendTransactions.js");
20
+ const reactjs_hooks_useSignTransaction = require("../../hooks/useSignTransaction.js");
21
+ const reactjs_queries_useGetHistory_query = require("../../queries/useGetHistory.query.js");
22
+ const reactjs_queries_useGetRate_mutation = require("../../queries/useGetRate.mutation.js");
23
+ const reactjs_utils_getCompletePathname = require("../../utils/getCompletePathname.js");
24
+ const reactjs_utils_getInitialTokens = require("../../utils/getInitialTokens.js");
25
+ const reactjs_utils_mxClsx = require("../../utils/mxClsx.js");
26
+ const reactjs_components_AmountCard_AmountCard = require("../AmountCard/AmountCard.js");
27
+ const reactjs_components_AmountInput_AmountInput = require("../AmountInput/AmountInput.js");
28
+ const reactjs_components_base_MxButton_MxButton = require("../base/MxButton/MxButton.js");
29
+ require("../base/MxCard/MxCard.js");
30
+ require("../base/MxLink/MxLink.js");
31
+ require("../base/MxSearch/MxSearch.js");
32
+ require("@fortawesome/free-solid-svg-icons/faClose");
33
+ require("@headlessui/react");
34
+ require("react-dom");
35
+ require("react-popper");
36
+ require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");
37
+ const reactjs_components_BridgeHistory_BridgeHistory = require("../BridgeHistory/BridgeHistory.js");
38
+ const reactjs_components_Connect_BridgeConnectButton = require("../Connect/BridgeConnectButton.js");
39
+ require("../../../index-cvy2-uZ_.js");
40
+ const viem = require("viem");
41
+ require("viem/chains");
42
+ const reactjs_components_Connect_MvxConnectButton = require("../Connect/MvxConnectButton.js");
43
+ const reactjs_components_Connect_BridgeAccountDisplay = require("../Connect/BridgeAccountDisplay.js");
44
+ const reactjs_components_Connect_MvxAccountDisplay = require("../Connect/MvxAccountDisplay.js");
45
+ const reactjs_components_TokenSelector_TokenSelector = require("../TokenSelector/TokenSelector.js");
46
+ const actions = require("viem/actions");
47
+ const reactjs_hooks_useBalances = require("../../../useBalances-Bxtc4GNK.js");
48
+ function deepEqual(a, b) {
49
+ if (a === b)
50
+ return true;
51
+ if (a && b && typeof a === "object" && typeof b === "object") {
52
+ if (a.constructor !== b.constructor)
53
+ return false;
54
+ let length;
55
+ let i;
56
+ if (Array.isArray(a) && Array.isArray(b)) {
57
+ length = a.length;
58
+ if (length !== b.length)
59
+ return false;
60
+ for (i = length; i-- !== 0; )
61
+ if (!deepEqual(a[i], b[i]))
62
+ return false;
63
+ return true;
64
+ }
65
+ if (a.valueOf !== Object.prototype.valueOf)
66
+ return a.valueOf() === b.valueOf();
67
+ if (a.toString !== Object.prototype.toString)
68
+ return a.toString() === b.toString();
69
+ const keys = Object.keys(a);
70
+ length = keys.length;
71
+ if (length !== Object.keys(b).length)
72
+ return false;
73
+ for (i = length; i-- !== 0; )
74
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
75
+ return false;
76
+ for (i = length; i-- !== 0; ) {
77
+ const key = keys[i];
78
+ if (key && !deepEqual(a[key], b[key]))
79
+ return false;
80
+ }
81
+ return true;
82
+ }
83
+ return a !== a && b !== b;
84
+ }
85
+ let previousConnections = [];
86
+ function getConnections(config) {
87
+ const connections = [...config.state.connections.values()];
88
+ if (config.state.status === "reconnecting")
89
+ return previousConnections;
90
+ if (deepEqual(previousConnections, connections))
91
+ return previousConnections;
92
+ previousConnections = connections;
93
+ return connections;
94
+ }
95
+ async function waitForTransactionReceipt(config, parameters) {
96
+ const { chainId, timeout = 0, ...rest } = parameters;
97
+ const client = config.getClient({ chainId });
98
+ const action = reactjs_hooks_useBalances.getAction(client, actions.waitForTransactionReceipt, "waitForTransactionReceipt");
99
+ const receipt = await action({ ...rest, timeout });
100
+ if (receipt.status === "reverted") {
101
+ const action_getTransaction = reactjs_hooks_useBalances.getAction(client, actions.getTransaction, "getTransaction");
102
+ const txn = await action_getTransaction({ hash: receipt.transactionHash });
103
+ const action_call = reactjs_hooks_useBalances.getAction(client, actions.call, "call");
104
+ const code = await action_call({
105
+ ...txn,
106
+ data: txn.input,
107
+ gasPrice: txn.type !== "eip1559" ? txn.gasPrice : void 0,
108
+ maxFeePerGas: txn.type === "eip1559" ? txn.maxFeePerGas : void 0,
109
+ maxPriorityFeePerGas: txn.type === "eip1559" ? txn.maxPriorityFeePerGas : void 0
110
+ });
111
+ const reason = (code == null ? void 0 : code.data) ? viem.hexToString(`0x${code.data.substring(138)}`) : "unknown reason";
112
+ throw new Error(reason);
113
+ }
114
+ return {
115
+ ...receipt,
116
+ chainId: client.chain.id
117
+ };
118
+ }
119
+ const BridgeForm = ({
120
+ mvxChainId,
121
+ mvxAddress,
122
+ username,
123
+ nativeAuthToken,
124
+ callbackRoute = "/",
125
+ refetchTrigger,
126
+ showHistory,
127
+ onSuccessfullySentTransaction,
128
+ onFailedSentTransaction,
129
+ onHistoryClose,
130
+ onMvxConnect,
131
+ onMvxDisconnect
132
+ }) => {
133
+ var _a, _b, _c, _d, _e, _f;
134
+ const [isTokenSelectorVisible, setIsTokenSelectorVisible] = require$$0.useState(false);
135
+ const [pendingSigning, setPendingSigning] = require$$0.useState(false);
136
+ const [siginingTransactionsCount, setSigningTransactionsCount] = require$$0.useState(0);
137
+ const navigate = reactRouterDom.useNavigate();
138
+ const account = reactjs_hooks_useAccount.useAccount();
139
+ const { chains: sdkChains } = wagmi.useSwitchChain();
140
+ const { config, options } = reactjs_context_useWeb3App.useWeb3App();
141
+ const chainId = reactjs_hooks_useGetChainId.useGetChainId();
142
+ const {
143
+ evmTokensWithBalances,
144
+ mvxTokensWithBalances,
145
+ isTokensLoading: tokensLoading,
146
+ isLoadingEvmTokensBalances,
147
+ isLoadingMvxTokensBalances,
148
+ chains = [],
149
+ isChainsLoading
150
+ } = reactjs_hooks_useFetchBridgeData.useFetchBridgeData({
151
+ refetchTrigger,
152
+ mvxAddress,
153
+ mvxApiURL: options.mvxApiURL
154
+ });
155
+ const isTokensLoading = tokensLoading || isLoadingEvmTokensBalances || isLoadingMvxTokensBalances || isChainsLoading;
156
+ const activeChain = require$$0.useMemo(() => {
157
+ return sdkChains.find(
158
+ (chain) => chain.id.toString() === (chainId == null ? void 0 : chainId.toString())
159
+ );
160
+ }, [chainId, sdkChains]);
161
+ const mvxChain = require$$0.useMemo(() => {
162
+ return chains.find(
163
+ (chain) => chain.chainId.toString() === mvxChainId.toString()
164
+ );
165
+ }, [chainId, chains]);
166
+ const { signTransaction } = reactjs_hooks_useSignTransaction.useSignTransaction();
167
+ const sendTransactions = reactjs_hooks_useSendTransactions.useSendTransactions();
168
+ const {
169
+ mutate: getRate,
170
+ data: rate,
171
+ isPending: isPendingRate,
172
+ error: rateError
173
+ } = reactjs_queries_useGetRate_mutation.useGetRateMutation();
174
+ const rateValidationError = ((_a = rateError == null ? void 0 : rateError.response) == null ? void 0 : _a.status) === 400 ? (_b = rateError == null ? void 0 : rateError.response) == null ? void 0 : _b.data.message : void 0;
175
+ const ref = require$$0.useRef(null);
176
+ const [firstToken, setFirstToken] = require$$0.useState();
177
+ const [firstAmount, setFirstAmount] = require$$0.useState("");
178
+ const [secondToken, setSecondToken] = require$$0.useState();
179
+ const [secondAmount, setSecondAmount] = require$$0.useState("");
180
+ const bridgeAddress = account.address;
181
+ const isAuthenticated = account.isConnected && Boolean(bridgeAddress);
182
+ const fromOptions = require$$0.useMemo(
183
+ () => (evmTokensWithBalances && evmTokensWithBalances.map((token) => {
184
+ return {
185
+ ...token,
186
+ identifier: token.address,
187
+ ticker: token.symbol
188
+ };
189
+ })) ?? [],
190
+ [evmTokensWithBalances]
191
+ );
192
+ const toOptions = require$$0.useMemo(
193
+ () => (mvxTokensWithBalances && mvxTokensWithBalances.map((token) => {
194
+ return {
195
+ ...token,
196
+ identifier: token.address,
197
+ ticker: token.symbol
198
+ };
199
+ })) ?? [],
200
+ [mvxTokensWithBalances]
201
+ );
202
+ const selectedChainOption = require$$0.useMemo(
203
+ () => (chains == null ? void 0 : chains.find(
204
+ (option) => option.chainId.toString() === (activeChain == null ? void 0 : activeChain.id.toString())
205
+ )) ?? (chains == null ? void 0 : chains[0]),
206
+ [activeChain == null ? void 0 : activeChain.id, chains]
207
+ );
208
+ const hasAmounts = firstAmount !== "" && secondAmount !== "";
209
+ const fetchRateDebounced = require$$0.useCallback(
210
+ debounce(async (amount) => {
211
+ if (!amount || !account.address || !(firstToken == null ? void 0 : firstToken.address) || !(secondToken == null ? void 0 : secondToken.address) || !selectedChainOption || !chainId) {
212
+ return;
213
+ }
214
+ getRate({
215
+ nativeAuthToken: nativeAuthToken ?? "",
216
+ body: {
217
+ tokenIn: firstToken.address,
218
+ amountIn: amount,
219
+ fromChainId: chainId.toString(),
220
+ tokenOut: secondToken.address,
221
+ toChainId: mvxChainId
222
+ }
223
+ });
224
+ }, 500),
225
+ [
226
+ account.address,
227
+ firstToken == null ? void 0 : firstToken.address,
228
+ secondToken == null ? void 0 : secondToken.address,
229
+ selectedChainOption
230
+ ]
231
+ );
232
+ const handleOnChangeFirstAmount = require$$0.useCallback((amount) => {
233
+ setFirstAmount(() => amount);
234
+ setLastChangedField(reactjs_hooks_useBridgeFormik.BridgeFormikValuesEnum.firstAmount);
235
+ }, []);
236
+ const handleOnChangeSecondAmount = require$$0.useCallback((amount) => {
237
+ setSecondAmount(() => amount);
238
+ setLastChangedField(reactjs_hooks_useBridgeFormik.BridgeFormikValuesEnum.secondAmount);
239
+ }, []);
240
+ const handleHistoryClose = require$$0.useCallback(() => {
241
+ onHistoryClose == null ? void 0 : onHistoryClose();
242
+ }, [onHistoryClose]);
243
+ const handleOnFirstMaxBtnChange = require$$0.useCallback(() => {
244
+ const formattedBalance = formatAmount.formatAmount({
245
+ decimals: firstToken == null ? void 0 : firstToken.decimals,
246
+ input: (firstToken == null ? void 0 : firstToken.balance) ?? "0",
247
+ addCommas: false,
248
+ digits: 4
249
+ });
250
+ formik.setFieldValue("firstAmount", formattedBalance);
251
+ handleOnChangeFirstAmount(formattedBalance);
252
+ }, [firstToken == null ? void 0 : firstToken.balance, firstToken == null ? void 0 : firstToken.decimals, handleOnChangeFirstAmount]);
253
+ const onSuccess = require$$0.useCallback(
254
+ async (txHashes) => {
255
+ handleOnChangeFirstAmount("");
256
+ handleOnChangeSecondAmount("");
257
+ reactjs_queries_useGetHistory_query.invalidateHistoryQuery();
258
+ reactjs_queries_useGetHistory_query.invalidateHistoryQuery();
259
+ onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction(txHashes);
260
+ },
261
+ [
262
+ handleOnChangeFirstAmount,
263
+ handleOnChangeSecondAmount,
264
+ onSuccessfullySentTransaction
265
+ ]
266
+ );
267
+ const updateUrlParams = require$$0.useCallback(
268
+ ({ firstTokenId, secondTokenId }) => {
269
+ if (isTokensLoading || !bridgeAddress) {
270
+ return;
271
+ }
272
+ const currentUrl = reactjs_utils_getCompletePathname.getCompletePathname();
273
+ const searchParams = new URLSearchParams(window.location.search);
274
+ if (firstTokenId) {
275
+ searchParams.set("firstToken", firstTokenId);
276
+ }
277
+ if (secondTokenId) {
278
+ searchParams.set("secondToken", secondTokenId);
279
+ }
280
+ const newUrl = `${callbackRoute}?${searchParams.toString()}`;
281
+ if (currentUrl === newUrl) {
282
+ return;
283
+ }
284
+ navigate(newUrl, { replace: true });
285
+ },
286
+ [bridgeAddress, callbackRoute, isTokensLoading, navigate]
287
+ );
288
+ const onChangeFirstSelect = require$$0.useCallback(
289
+ (option) => {
290
+ if (!option) {
291
+ return;
292
+ }
293
+ setFirstToken(() => option);
294
+ updateUrlParams({ firstTokenId: option == null ? void 0 : option.address });
295
+ const secondOption = toOptions.find((x) => x.name === (option == null ? void 0 : option.name));
296
+ if (!secondOption) {
297
+ return;
298
+ }
299
+ setSecondToken(() => secondOption);
300
+ updateUrlParams({ secondTokenId: secondOption == null ? void 0 : secondOption.address });
301
+ },
302
+ [toOptions, updateUrlParams]
303
+ );
304
+ const onChangeSecondSelect = require$$0.useCallback(
305
+ (option) => {
306
+ if (!option) {
307
+ return;
308
+ }
309
+ setSecondToken(() => option);
310
+ updateUrlParams({ secondTokenId: option == null ? void 0 : option.address });
311
+ const firstOption = fromOptions.find((x) => x.name === (option == null ? void 0 : option.name));
312
+ if (!firstOption) {
313
+ return;
314
+ }
315
+ setFirstToken(() => firstOption);
316
+ updateUrlParams({ firstTokenId: firstOption == null ? void 0 : firstOption.address });
317
+ },
318
+ [fromOptions, updateUrlParams]
319
+ );
320
+ const setInitialSelectedTokens = () => {
321
+ var _a2, _b2, _c2, _d2;
322
+ if (isTokensLoading) {
323
+ return;
324
+ }
325
+ const initialTokens = reactjs_utils_getInitialTokens.getInitialTokens();
326
+ const firstOption = (fromOptions == null ? void 0 : fromOptions.find(
327
+ ({ identifier }) => [initialTokens == null ? void 0 : initialTokens.firstTokenId].includes(identifier)
328
+ )) ?? fromOptions.find(
329
+ (option) => {
330
+ var _a3;
331
+ return option.chainId.toString() === ((_a3 = activeChain == null ? void 0 : activeChain.id) == null ? void 0 : _a3.toString());
332
+ }
333
+ );
334
+ const secondOption = (toOptions == null ? void 0 : toOptions.find(
335
+ ({ address }) => address === ((firstOption == null ? void 0 : firstOption.name) ?? (initialTokens == null ? void 0 : initialTokens.secondTokenId))
336
+ )) ?? toOptions.find((x) => x.name === (firstOption == null ? void 0 : firstOption.name));
337
+ const hasOptionsSelected = Boolean(firstToken) && Boolean(secondToken) && ((_a2 = firstToken == null ? void 0 : firstToken.address) == null ? void 0 : _a2.toLowerCase()) === ((_b2 = firstOption == null ? void 0 : firstOption.address) == null ? void 0 : _b2.toLowerCase()) && ((_c2 = secondToken == null ? void 0 : secondToken.address) == null ? void 0 : _c2.toLowerCase()) === ((_d2 = secondOption == null ? void 0 : secondOption.address) == null ? void 0 : _d2.toLowerCase());
338
+ if (hasOptionsSelected) {
339
+ return;
340
+ }
341
+ if (!firstOption || !secondOption) {
342
+ return;
343
+ }
344
+ setFirstToken(firstOption);
345
+ setSecondToken(secondOption);
346
+ updateUrlParams({
347
+ firstTokenId: firstOption == null ? void 0 : firstOption.address,
348
+ secondTokenId: secondOption == null ? void 0 : secondOption.address
349
+ });
350
+ };
351
+ const onSubmit = require$$0.useCallback(
352
+ async (transactions) => {
353
+ const signedTransactions = [];
354
+ setPendingSigning(true);
355
+ setSigningTransactionsCount(() => transactions.length);
356
+ try {
357
+ let txIndex = -1;
358
+ for (const transaction of transactions) {
359
+ ++txIndex;
360
+ try {
361
+ const txHash = await signTransaction({
362
+ ...transaction,
363
+ value: BigInt(transaction.value),
364
+ gas: BigInt(transaction.gasLimit),
365
+ account: bridgeAddress
366
+ });
367
+ signedTransactions.push({
368
+ ...transaction,
369
+ txHash
370
+ });
371
+ setSigningTransactionsCount(
372
+ () => transactions.length - 1 - txIndex
373
+ );
374
+ if (txIndex === transactions.length - 1) {
375
+ continue;
376
+ }
377
+ const transactionReceipt = await waitForTransactionReceipt(config, {
378
+ confirmations: 1,
379
+ hash: txHash
380
+ });
381
+ console.log({
382
+ transactionReceipt,
383
+ hash: txHash
384
+ });
385
+ } catch (e) {
386
+ reactToastify.toast.dismiss();
387
+ reactToastify.toast.error("Transaction aborted");
388
+ onFailedSentTransaction == null ? void 0 : onFailedSentTransaction("Transaction aborted");
389
+ setPendingSigning(false);
390
+ return;
391
+ }
392
+ }
393
+ await sendTransactions({
394
+ transactions: signedTransactions,
395
+ url: helpers_getApiURL.getApiURL() ?? "",
396
+ token: nativeAuthToken ?? ""
397
+ });
398
+ const txHashes = signedTransactions.map((tx) => tx.txHash);
399
+ onSuccess(txHashes);
400
+ setPendingSigning(false);
401
+ } catch (e) {
402
+ console.error(e);
403
+ reactToastify.toast.dismiss();
404
+ reactToastify.toast.error("Transaction cancelled");
405
+ onFailedSentTransaction == null ? void 0 : onFailedSentTransaction("Transaction cancelled");
406
+ setPendingSigning(false);
407
+ setSigningTransactionsCount(0);
408
+ resetSwapForm();
409
+ handleOnChangeFirstAmount("");
410
+ handleOnChangeSecondAmount("");
411
+ }
412
+ },
413
+ [
414
+ bridgeAddress,
415
+ handleOnChangeFirstAmount,
416
+ handleOnChangeSecondAmount,
417
+ nativeAuthToken,
418
+ onSuccess,
419
+ sendTransactions,
420
+ signTransaction
421
+ ]
422
+ );
423
+ const {
424
+ formik,
425
+ firstAmountError,
426
+ secondAmountError,
427
+ fromChainError,
428
+ handleBlur,
429
+ handleChange,
430
+ handleSubmit,
431
+ resetSwapForm,
432
+ setLastChangedField
433
+ } = reactjs_hooks_useBridgeFormik.useBridgeFormik({
434
+ fee: rate == null ? void 0 : rate.fee,
435
+ nativeAuthToken,
436
+ mvxAccountAddress: mvxAddress,
437
+ firstToken,
438
+ firstAmount,
439
+ fromChainId: chainId == null ? void 0 : chainId.toString(),
440
+ toChainId: mvxChainId,
441
+ secondToken,
442
+ secondAmount,
443
+ onSubmit
444
+ });
445
+ const hasError = Boolean(
446
+ firstAmountError || secondAmountError || fromChainError || rateValidationError
447
+ );
448
+ require$$0.useEffect(() => {
449
+ if (!firstAmount) {
450
+ setSecondAmount("");
451
+ }
452
+ fetchRateDebounced(firstAmount);
453
+ }, [firstAmount, fetchRateDebounced]);
454
+ require$$0.useEffect(() => {
455
+ return setSecondAmount((rate == null ? void 0 : rate.amountOut) ?? "");
456
+ }, [rate]);
457
+ require$$0.useEffect(setInitialSelectedTokens, [isTokensLoading, chainId]);
458
+ require$$0.useEffect(() => {
459
+ const selectedTokenOption = evmTokensWithBalances == null ? void 0 : evmTokensWithBalances.find(
460
+ (x) => x.address === (firstToken == null ? void 0 : firstToken.address)
461
+ );
462
+ if (!selectedTokenOption) {
463
+ return;
464
+ }
465
+ setFirstToken((prevState) => {
466
+ if (!prevState) {
467
+ return prevState;
468
+ }
469
+ return {
470
+ ...prevState,
471
+ balance: selectedTokenOption == null ? void 0 : selectedTokenOption.balance
472
+ };
473
+ });
474
+ }, [evmTokensWithBalances, firstToken == null ? void 0 : firstToken.address]);
475
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
476
+ "form",
477
+ {
478
+ ref,
479
+ noValidate: true,
480
+ className: "liq-flex liq-flex-col liq-gap-1 liq-relative",
481
+ autoComplete: "off",
482
+ onSubmit: handleSubmit,
483
+ children: [
484
+ showHistory && /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_BridgeHistory_BridgeHistory.BridgeHistory, { mvxAddress, onClose: handleHistoryClose }),
485
+ /* @__PURE__ */ jsxRuntime.jsxs(
486
+ reactjs_components_AmountCard_AmountCard.AmountCard,
487
+ {
488
+ className: reactjs_utils_mxClsx.mxClsx(
489
+ "liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
490
+ {
491
+ "liq-pointer-events-none": isTokenSelectorVisible,
492
+ "focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80": !isTokenSelectorVisible
493
+ }
494
+ ),
495
+ children: [
496
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
497
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "From" }),
498
+ /* @__PURE__ */ jsxRuntime.jsx(
499
+ reactjs_components_Connect_BridgeAccountDisplay.BridgeAccountDisplay,
500
+ {
501
+ disabled: isPendingRate,
502
+ activeChain: selectedChainOption
503
+ }
504
+ )
505
+ ] }),
506
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
507
+ /* @__PURE__ */ jsxRuntime.jsx(
508
+ reactjs_components_AmountInput_AmountInput.AmountInput,
509
+ {
510
+ inputName: "firstAmount",
511
+ inputValue: formik.values.firstAmount ?? "",
512
+ amountError: firstAmount !== "" ? rateValidationError ?? firstAmountError : void 0,
513
+ disabled: false,
514
+ onInputDebounceChange: handleOnChangeFirstAmount,
515
+ onInputChange: handleChange,
516
+ onBlur: handleBlur
517
+ }
518
+ ),
519
+ /* @__PURE__ */ jsxRuntime.jsx(
520
+ reactjs_components_TokenSelector_TokenSelector.TokenSelector,
521
+ {
522
+ name: "firstToken",
523
+ disabled: isPendingRate,
524
+ options: fromOptions,
525
+ areOptionsLoading: isTokensLoading,
526
+ color: "neutral-850",
527
+ onChange: onChangeFirstSelect,
528
+ onBlur: handleBlur,
529
+ onMaxBtnClick: handleOnFirstMaxBtnChange,
530
+ selectedOption: firstToken,
531
+ onTokenSelectorDisplay: (visible) => setIsTokenSelectorVisible(visible)
532
+ }
533
+ )
534
+ ] })
535
+ ]
536
+ }
537
+ ),
538
+ /* @__PURE__ */ jsxRuntime.jsxs(
539
+ reactjs_components_AmountCard_AmountCard.AmountCard,
540
+ {
541
+ className: reactjs_utils_mxClsx.mxClsx(
542
+ "liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
543
+ {
544
+ "liq-pointer-events-none": isTokenSelectorVisible
545
+ }
546
+ ),
547
+ children: [
548
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
549
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "To" }),
550
+ /* @__PURE__ */ jsxRuntime.jsx(
551
+ reactjs_components_Connect_MvxAccountDisplay.MvxAccountDisplay,
552
+ {
553
+ accountAddress: mvxAddress,
554
+ chainIcon: (mvxChain == null ? void 0 : mvxChain.svgUrl) ?? "",
555
+ username,
556
+ accountExplorerUrl: `${options.mvxExplorerAddress}/accounts/${mvxAddress}`,
557
+ showTag: true,
558
+ onDisconnect: onMvxDisconnect,
559
+ onConnect: onMvxConnect
560
+ }
561
+ )
562
+ ] }),
563
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
564
+ /* @__PURE__ */ jsxRuntime.jsx(
565
+ reactjs_components_AmountInput_AmountInput.AmountInput,
566
+ {
567
+ inputName: "secondAmount",
568
+ inputValue: formik.values.secondAmount ?? "",
569
+ amountError: secondAmount !== "" ? fromChainError ?? secondAmountError : void 0,
570
+ disabled: false,
571
+ onInputDebounceChange: handleOnChangeSecondAmount,
572
+ onInputChange: handleChange,
573
+ onBlur: handleBlur
574
+ }
575
+ ),
576
+ /* @__PURE__ */ jsxRuntime.jsx(
577
+ reactjs_components_TokenSelector_TokenSelector.TokenSelector,
578
+ {
579
+ name: "secondToken",
580
+ disabled: true,
581
+ omitDisableClass: true,
582
+ options: toOptions,
583
+ areOptionsLoading: isTokensLoading,
584
+ color: "neutral-850",
585
+ onChange: onChangeSecondSelect,
586
+ onBlur: handleBlur,
587
+ selectedOption: secondToken
588
+ }
589
+ )
590
+ ] })
591
+ ]
592
+ }
593
+ ),
594
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-justify-center", children: [
595
+ !mvxAddress && /* @__PURE__ */ jsxRuntime.jsx(
596
+ reactjs_components_Connect_MvxConnectButton.MvxConnectButton,
597
+ {
598
+ mvxAccountAddress: mvxAddress,
599
+ chain: mvxChain,
600
+ onClick: onMvxConnect
601
+ }
602
+ ),
603
+ mvxAddress && !isAuthenticated && /* @__PURE__ */ jsxRuntime.jsx(
604
+ reactjs_components_Connect_BridgeConnectButton.BridgeConnectButton,
605
+ {
606
+ className: "liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50",
607
+ disabled: isPendingRate,
608
+ activeChain: selectedChainOption
609
+ }
610
+ ),
611
+ mvxAddress && isAuthenticated && /* @__PURE__ */ jsxRuntime.jsxs(
612
+ reactjs_components_base_MxButton_MxButton.MxButton,
613
+ {
614
+ type: "submit",
615
+ variant: "neutral-850",
616
+ className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
617
+ disabled: !hasAmounts || isPendingRate || !mvxAddress || !account.address || hasError || pendingSigning,
618
+ children: [
619
+ hasAmounts && !pendingSigning && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-justify-center liq-gap-2", children: [
620
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Deposit on " }),
621
+ /* @__PURE__ */ jsxRuntime.jsx(
622
+ "img",
623
+ {
624
+ src: (mvxChain == null ? void 0 : mvxChain.svgUrl) ?? "",
625
+ alt: "",
626
+ className: "liq-h-[1.5rem] liq-w-[1.5rem]"
627
+ }
628
+ ),
629
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "MultiversX" })
630
+ ] }),
631
+ !hasAmounts && !pendingSigning && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-text-neutral-100", children: "Enter amount" }),
632
+ pendingSigning && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
633
+ /* @__PURE__ */ jsxRuntime.jsx(
634
+ reactFontawesome.FontAwesomeIcon,
635
+ {
636
+ icon: faSpinner.faSpinner,
637
+ spin: true,
638
+ className: "liq-mx-1 liq-flex liq-items-center"
639
+ }
640
+ ),
641
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Depositing on" }),
642
+ /* @__PURE__ */ jsxRuntime.jsx(
643
+ "img",
644
+ {
645
+ src: (mvxChain == null ? void 0 : mvxChain.svgUrl) ?? "",
646
+ alt: "",
647
+ className: "liq-h-[1.5rem] liq-w-[1.5rem]"
648
+ }
649
+ ),
650
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "MultiversX" })
651
+ ] })
652
+ ]
653
+ }
654
+ )
655
+ ] }),
656
+ account.address && siginingTransactionsCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: [
657
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
658
+ "You will be asked to sign ",
659
+ siginingTransactionsCount,
660
+ " ",
661
+ siginingTransactionsCount > 1 ? "transactions" : "transaction",
662
+ " ",
663
+ "on",
664
+ " "
665
+ ] }),
666
+ /* @__PURE__ */ jsxRuntime.jsx(
667
+ "img",
668
+ {
669
+ src: (_d = (_c = getConnections(config)[0]) == null ? void 0 : _c.connector) == null ? void 0 : _d.icon,
670
+ alt: "",
671
+ className: "liq-mx-1 liq-h-[1rem] liq-w-[1rem]"
672
+ }
673
+ ),
674
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: (_f = (_e = getConnections(config)[0]) == null ? void 0 : _e.connector) == null ? void 0 : _f.name })
675
+ ] })
676
+ ]
677
+ }
678
+ ) });
679
+ };
680
+ exports.BridgeForm = BridgeForm;