@multiversx/sdk-dapp-liquidity 2.1.0-alpha.0 → 2.1.0-alpha.2

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 (362) hide show
  1. package/all-networks--dfVLHLJ.js +2 -0
  2. package/all-networks-Czd8zS1n.mjs +4 -0
  3. package/api/checkAccount.js +1 -21
  4. package/api/checkAccount.mjs +13 -13
  5. package/api/confirmRate.js +1 -29
  6. package/api/confirmRate.mjs +17 -22
  7. package/api/getChains.js +1 -17
  8. package/api/getChains.mjs +10 -10
  9. package/api/getRate.js +1 -27
  10. package/api/getRate.mjs +17 -20
  11. package/api/getTokens.js +1 -22
  12. package/api/getTokens.mjs +14 -15
  13. package/api/getTokensBalances.js +1 -21
  14. package/api/getTokensBalances.mjs +13 -13
  15. package/api/getTransactions.js +1 -38
  16. package/api/getTransactions.mjs +25 -31
  17. package/api/index.js +1 -18
  18. package/api/index.mjs +16 -16
  19. package/api/sendTransactions.js +1 -32
  20. package/api/sendTransactions.mjs +19 -19
  21. package/api/tests/confirmRate.spec.js +1 -130
  22. package/api/tests/confirmRate.spec.mjs +44 -58
  23. package/api/tests/getChains.spec.js +1 -43
  24. package/api/tests/getChains.spec.mjs +15 -18
  25. package/api/tests/getRate.spec.js +1 -87
  26. package/api/tests/getRate.spec.mjs +35 -49
  27. package/api/tests/getTokens.spec.js +1 -68
  28. package/api/tests/getTokens.spec.mjs +23 -29
  29. package/api/tests/getTransactions.spec.js +1 -94
  30. package/api/tests/getTransactions.spec.mjs +35 -51
  31. package/api/tests/sendTransactions.spec.js +1 -96
  32. package/api/tests/sendTransactions.spec.mjs +44 -52
  33. package/constants/index.js +1 -4
  34. package/constants/index.mjs +2 -2
  35. package/default-D0Jk5ROI.mjs +4 -0
  36. package/default-DbU6vPaB.js +2 -0
  37. package/helpers/assertRateConfirmationMatchesIntent.js +1 -23
  38. package/helpers/assertRateConfirmationMatchesIntent.mjs +13 -16
  39. package/helpers/base64Utils.js +1 -31
  40. package/helpers/base64Utils.mjs +14 -24
  41. package/helpers/decodeLoginToken.js +1 -27
  42. package/helpers/decodeLoginToken.mjs +13 -18
  43. package/helpers/decodeToken.js +1 -39
  44. package/helpers/decodeToken.mjs +20 -31
  45. package/helpers/getApiURL.js +1 -7
  46. package/helpers/getApiURL.mjs +3 -5
  47. package/helpers/getBridgeURL.js +1 -7
  48. package/helpers/getBridgeURL.mjs +3 -5
  49. package/helpers/getDisplayName.js +1 -11
  50. package/helpers/getDisplayName.mjs +3 -8
  51. package/helpers/getMvxApiURL.js +1 -7
  52. package/helpers/getMvxApiURL.mjs +3 -5
  53. package/helpers/getMvxChainId.js +1 -7
  54. package/helpers/getMvxChainId.mjs +3 -5
  55. package/helpers/getMvxExplorerAddress.js +1 -7
  56. package/helpers/getMvxExplorerAddress.mjs +3 -5
  57. package/helpers/index.js +1 -26
  58. package/helpers/index.mjs +24 -24
  59. package/helpers/safeImageUrl.js +1 -23
  60. package/helpers/safeImageUrl.mjs +10 -20
  61. package/helpers/serializeTransaction.js +1 -8
  62. package/helpers/serializeTransaction.mjs +3 -5
  63. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.js +1 -63
  64. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.mjs +31 -41
  65. package/helpers/tests/base64Utils.spec.js +1 -29
  66. package/helpers/tests/base64Utils.spec.mjs +11 -24
  67. package/helpers/tests/decodeLoginToken.spec.js +1 -34
  68. package/helpers/tests/decodeLoginToken.spec.mjs +13 -24
  69. package/helpers/tests/decodeToken.spec.js +1 -27
  70. package/helpers/tests/decodeToken.spec.mjs +7 -12
  71. package/helpers/tests/safeImageUrl.spec.js +1 -48
  72. package/helpers/tests/safeImageUrl.spec.mjs +28 -43
  73. package/helpers/tests/serializeTransaction.spec.js +1 -36
  74. package/helpers/tests/serializeTransaction.spec.mjs +13 -24
  75. package/index.js +1 -232
  76. package/index.mjs +196 -196
  77. package/package.json +5 -4
  78. package/react.esm-B0AMOHxa.js +73 -0
  79. package/react.esm-BxvJJ86Q.mjs +9949 -0
  80. package/reactjs/adapters/SuiAdapter.js +1 -378
  81. package/reactjs/adapters/SuiAdapter.mjs +160 -217
  82. package/reactjs/components/AccountAddress/AccountAddress.js +1 -31
  83. package/reactjs/components/AccountAddress/AccountAddress.mjs +16 -16
  84. package/reactjs/components/AccountAddress/index.js +1 -4
  85. package/reactjs/components/AccountAddress/index.mjs +2 -2
  86. package/reactjs/components/AmountCard/AmountCard.js +1 -33
  87. package/reactjs/components/AmountCard/AmountCard.mjs +19 -21
  88. package/reactjs/components/AmountCard/index.js +1 -4
  89. package/reactjs/components/AmountCard/index.mjs +2 -2
  90. package/reactjs/components/AmountInput/AmountInput.js +1 -71
  91. package/reactjs/components/AmountInput/AmountInput.mjs +42 -46
  92. package/reactjs/components/AmountInput/index.js +1 -4
  93. package/reactjs/components/AmountInput/index.mjs +2 -2
  94. package/reactjs/components/BridgeForm/BridgeForm.d.ts +9 -0
  95. package/reactjs/components/BridgeForm/BridgeForm.js +1 -89
  96. package/reactjs/components/BridgeForm/BridgeForm.mjs +72 -79
  97. package/reactjs/components/BridgeForm/Deposit.js +1 -675
  98. package/reactjs/components/BridgeForm/Deposit.mjs +380 -504
  99. package/reactjs/components/BridgeForm/Transfer.js +1 -561
  100. package/reactjs/components/BridgeForm/Transfer.mjs +315 -428
  101. package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.js +1 -78
  102. package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.mjs +47 -70
  103. package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.js +1 -58
  104. package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.mjs +36 -47
  105. package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +1 -266
  106. package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +163 -231
  107. package/reactjs/components/BridgeForm/index.js +1 -4
  108. package/reactjs/components/BridgeForm/index.mjs +2 -2
  109. package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +1 -76
  110. package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +33 -65
  111. package/reactjs/components/BridgeHistory/BridgeHistory.js +1 -381
  112. package/reactjs/components/BridgeHistory/BridgeHistory.mjs +170 -200
  113. package/reactjs/components/BridgeHistory/index.js +1 -4
  114. package/reactjs/components/BridgeHistory/index.mjs +2 -2
  115. package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -150
  116. package/reactjs/components/Connect/BridgeAccountDisplay.mjs +99 -115
  117. package/reactjs/components/Connect/BridgeConnectButton.js +1 -35
  118. package/reactjs/components/Connect/BridgeConnectButton.mjs +20 -20
  119. package/reactjs/components/Connect/ChainSelectConnect.js +1 -144
  120. package/reactjs/components/Connect/ChainSelectConnect.mjs +70 -83
  121. package/reactjs/components/Connect/CustomConnectButton.js +1 -40
  122. package/reactjs/components/Connect/CustomConnectButton.mjs +24 -30
  123. package/reactjs/components/Connect/MvxAccountDisplay.js +1 -97
  124. package/reactjs/components/Connect/MvxAccountDisplay.mjs +47 -50
  125. package/reactjs/components/Connect/MvxConnectButton.js +1 -43
  126. package/reactjs/components/Connect/MvxConnectButton.mjs +35 -40
  127. package/reactjs/components/Connect/SwitchChainButton.js +1 -29
  128. package/reactjs/components/Connect/SwitchChainButton.mjs +15 -18
  129. package/reactjs/components/Connect/index.js +1 -16
  130. package/reactjs/components/Connect/index.mjs +14 -14
  131. package/reactjs/components/CopyButton/CopyButton.js +1 -46
  132. package/reactjs/components/CopyButton/CopyButton.mjs +33 -36
  133. package/reactjs/components/CopyButton/index.js +1 -4
  134. package/reactjs/components/CopyButton/index.mjs +2 -2
  135. package/reactjs/components/CopyButton/utils/copyToClipboard.js +1 -38
  136. package/reactjs/components/CopyButton/utils/copyToClipboard.mjs +20 -32
  137. package/reactjs/components/CopyButton/utils/index.js +1 -4
  138. package/reactjs/components/CopyButton/utils/index.mjs +2 -2
  139. package/reactjs/components/DisplayAmount/DisplayAmount.js +1 -90
  140. package/reactjs/components/DisplayAmount/DisplayAmount.mjs +68 -75
  141. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +1 -39
  142. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.mjs +26 -33
  143. package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.js +1 -61
  144. package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.mjs +38 -46
  145. package/reactjs/components/DisplayAmount/index.js +1 -4
  146. package/reactjs/components/DisplayAmount/index.mjs +2 -2
  147. package/reactjs/components/DisplayAmount/utils/index.js +1 -4
  148. package/reactjs/components/DisplayAmount/utils/index.mjs +2 -2
  149. package/reactjs/components/DisplayAmount/utils/truncateAmount.js +1 -21
  150. package/reactjs/components/DisplayAmount/utils/truncateAmount.mjs +9 -13
  151. package/reactjs/components/Error/Error.js +1 -66
  152. package/reactjs/components/Error/Error.mjs +29 -29
  153. package/reactjs/components/Error/index.js +1 -4
  154. package/reactjs/components/Error/index.mjs +2 -2
  155. package/reactjs/components/SmallLoader/SmallLoader.js +1 -21
  156. package/reactjs/components/SmallLoader/SmallLoader.mjs +13 -18
  157. package/reactjs/components/SmallLoader/index.js +1 -4
  158. package/reactjs/components/SmallLoader/index.mjs +2 -2
  159. package/reactjs/components/ToggleDirection/ToggleDirection.js +1 -30
  160. package/reactjs/components/ToggleDirection/ToggleDirection.mjs +22 -28
  161. package/reactjs/components/TokenSelector/TokenSelector.js +1 -172
  162. package/reactjs/components/TokenSelector/TokenSelector.mjs +98 -118
  163. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +1 -94
  164. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +48 -57
  165. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +1 -55
  166. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +45 -48
  167. package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js +1 -18
  168. package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.mjs +9 -14
  169. package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js +1 -6
  170. package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.mjs +2 -4
  171. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +1 -43
  172. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +21 -21
  173. package/reactjs/components/TokenSelector/components/SelectContainer.js +1 -40
  174. package/reactjs/components/TokenSelector/components/SelectContainer.mjs +36 -38
  175. package/reactjs/components/TokenSelector/components/SelectContent.js +1 -136
  176. package/reactjs/components/TokenSelector/components/SelectContent.mjs +79 -103
  177. package/reactjs/components/TokenSelector/components/SelectedOption.js +1 -28
  178. package/reactjs/components/TokenSelector/components/SelectedOption.mjs +22 -24
  179. package/reactjs/components/TokenSelector/components/TokenIcon.js +1 -82
  180. package/reactjs/components/TokenSelector/components/TokenIcon.mjs +52 -58
  181. package/reactjs/components/TokenSelector/components/TokenItem.js +1 -80
  182. package/reactjs/components/TokenSelector/components/TokenItem.mjs +41 -54
  183. package/reactjs/components/TokenSelector/components/TokenList.js +1 -23
  184. package/reactjs/components/TokenSelector/components/TokenList.mjs +19 -21
  185. package/reactjs/components/TokenSelector/components/TokenSymbol.js +1 -25
  186. package/reactjs/components/TokenSelector/components/TokenSymbol.mjs +14 -15
  187. package/reactjs/components/TokenSelector/index.js +1 -4
  188. package/reactjs/components/TokenSelector/index.mjs +2 -2
  189. package/reactjs/components/TransactionToast/TransactionToast.js +1 -53
  190. package/reactjs/components/TransactionToast/TransactionToast.mjs +27 -28
  191. package/reactjs/components/TransactionToast/TransactionToastContainer.js +1 -20
  192. package/reactjs/components/TransactionToast/TransactionToastContainer.mjs +16 -18
  193. package/reactjs/components/TransactionToast/index.js +1 -6
  194. package/reactjs/components/TransactionToast/index.mjs +4 -4
  195. package/reactjs/components/TrimAddress/TrimAddress.js +1 -27
  196. package/reactjs/components/TrimAddress/TrimAddress.mjs +19 -24
  197. package/reactjs/components/TrimAddress/index.js +1 -4
  198. package/reactjs/components/TrimAddress/index.mjs +2 -2
  199. package/reactjs/components/base/MxButton/MxButton.js +1 -71
  200. package/reactjs/components/base/MxButton/MxButton.mjs +46 -46
  201. package/reactjs/components/base/MxButton/index.js +1 -4
  202. package/reactjs/components/base/MxButton/index.mjs +2 -2
  203. package/reactjs/components/base/MxCard/MxCard.js +1 -54
  204. package/reactjs/components/base/MxCard/MxCard.mjs +34 -34
  205. package/reactjs/components/base/MxCard/index.js +1 -4
  206. package/reactjs/components/base/MxCard/index.mjs +2 -2
  207. package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +1 -28
  208. package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +24 -26
  209. package/reactjs/components/base/MxCircleLoader/index.js +1 -4
  210. package/reactjs/components/base/MxCircleLoader/index.mjs +2 -2
  211. package/reactjs/components/base/MxLink/MxLink.js +1 -70
  212. package/reactjs/components/base/MxLink/MxLink.mjs +44 -46
  213. package/reactjs/components/base/MxLink/index.js +1 -4
  214. package/reactjs/components/base/MxLink/index.mjs +2 -2
  215. package/reactjs/components/base/MxSearch/MxSearch.js +1 -69
  216. package/reactjs/components/base/MxSearch/MxSearch.mjs +37 -41
  217. package/reactjs/components/base/MxSearch/index.js +1 -4
  218. package/reactjs/components/base/MxSearch/index.mjs +2 -2
  219. package/reactjs/components/base/MxSlideover/MxSlideover.js +1 -78
  220. package/reactjs/components/base/MxSlideover/MxSlideover.mjs +72 -74
  221. package/reactjs/components/base/MxSlideover/index.js +1 -4
  222. package/reactjs/components/base/MxSlideover/index.mjs +2 -2
  223. package/reactjs/components/base/MxTooltip/MxTooltip.js +1 -163
  224. package/reactjs/components/base/MxTooltip/MxTooltip.mjs +92 -135
  225. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +1 -33
  226. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs +29 -31
  227. package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.js +1 -4
  228. package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.mjs +2 -2
  229. package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.js +1 -27
  230. package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.mjs +23 -25
  231. package/reactjs/components/base/MxTooltip/components/TooltipContent/index.js +1 -4
  232. package/reactjs/components/base/MxTooltip/components/TooltipContent/index.mjs +2 -2
  233. package/reactjs/components/base/MxTooltip/components/index.js +1 -6
  234. package/reactjs/components/base/MxTooltip/components/index.mjs +4 -4
  235. package/reactjs/components/base/MxTooltip/index.js +1 -4
  236. package/reactjs/components/base/MxTooltip/index.mjs +2 -2
  237. package/reactjs/components/base/index.js +1 -14
  238. package/reactjs/components/base/index.mjs +12 -12
  239. package/reactjs/components/index.js +1 -54
  240. package/reactjs/components/index.mjs +52 -52
  241. package/reactjs/constants/chains.js +1 -54
  242. package/reactjs/constants/chains.mjs +33 -52
  243. package/reactjs/constants/index.js +1 -13
  244. package/reactjs/constants/index.mjs +9 -10
  245. package/reactjs/context/Web3AppProvider.js +1 -42
  246. package/reactjs/context/Web3AppProvider.mjs +34 -36
  247. package/reactjs/context/queryClient.js +1 -11
  248. package/reactjs/context/queryClient.mjs +5 -8
  249. package/reactjs/context/useWeb3App.js +1 -12
  250. package/reactjs/context/useWeb3App.mjs +7 -8
  251. package/reactjs/helpers/index.js +1 -6
  252. package/reactjs/helpers/index.mjs +4 -4
  253. package/reactjs/helpers/resolveBridgeApiChainId.js +1 -40
  254. package/reactjs/helpers/resolveBridgeApiChainId.mjs +21 -34
  255. package/reactjs/hooks/index.js +1 -35
  256. package/reactjs/hooks/index.mjs +33 -33
  257. package/reactjs/hooks/tests/useGenericSignMessage.spec.js +1 -68
  258. package/reactjs/hooks/tests/useGenericSignMessage.spec.mjs +23 -38
  259. package/reactjs/hooks/tests/useSignTransaction.spec.js +1 -195
  260. package/reactjs/hooks/tests/useSignTransaction.spec.mjs +72 -110
  261. package/reactjs/hooks/useAccount.js +1 -13
  262. package/reactjs/hooks/useAccount.mjs +7 -8
  263. package/reactjs/hooks/useBalances.js +1 -53
  264. package/reactjs/hooks/useBalances.mjs +28 -40
  265. package/reactjs/hooks/useBridgeApiChainId.js +1 -13
  266. package/reactjs/hooks/useBridgeApiChainId.mjs +9 -9
  267. package/reactjs/hooks/useBridgeFormik.js +1 -167
  268. package/reactjs/hooks/useBridgeFormik.mjs +110 -155
  269. package/reactjs/hooks/useDebounce.js +1 -13
  270. package/reactjs/hooks/useDebounce.mjs +8 -10
  271. package/reactjs/hooks/useFetchBridgeData.js +1 -45
  272. package/reactjs/hooks/useFetchBridgeData.mjs +37 -38
  273. package/reactjs/hooks/useFetchTokens.js +1 -115
  274. package/reactjs/hooks/useFetchTokens.mjs +80 -108
  275. package/reactjs/hooks/useGenericSignMessage.js +1 -75
  276. package/reactjs/hooks/useGenericSignMessage.mjs +44 -64
  277. package/reactjs/hooks/useGetChainId.js +1 -11
  278. package/reactjs/hooks/useGetChainId.mjs +7 -8
  279. package/reactjs/hooks/useResolveTokenChain.js +1 -20
  280. package/reactjs/hooks/useResolveTokenChain.mjs +11 -14
  281. package/reactjs/hooks/useSendTransactions.js +1 -25
  282. package/reactjs/hooks/useSendTransactions.mjs +19 -23
  283. package/reactjs/hooks/useSignTransaction.js +1 -112
  284. package/reactjs/hooks/useSignTransaction.mjs +50 -76
  285. package/reactjs/hooks/useSuiConnect.js +1 -86
  286. package/reactjs/hooks/useSuiConnect.mjs +52 -70
  287. package/reactjs/hooks/validation/index.js +1 -10
  288. package/reactjs/hooks/validation/index.mjs +8 -8
  289. package/reactjs/hooks/validation/useAmountSchema.js +1 -32
  290. package/reactjs/hooks/validation/useAmountSchema.mjs +8 -11
  291. package/reactjs/hooks/validation/useSecondAmountSchema.js +1 -26
  292. package/reactjs/hooks/validation/useSecondAmountSchema.mjs +5 -6
  293. package/reactjs/hooks/validation/useTestHasEnoughFunds.js +1 -37
  294. package/reactjs/hooks/validation/useTestHasEnoughFunds.mjs +20 -29
  295. package/reactjs/hooks/validation/useTestIsConnected.js +1 -27
  296. package/reactjs/hooks/validation/useTestIsConnected.mjs +13 -19
  297. package/reactjs/index.js +1 -190
  298. package/reactjs/index.mjs +154 -154
  299. package/reactjs/init/index.js +1 -5
  300. package/reactjs/init/index.mjs +3 -3
  301. package/reactjs/init/init.js +1 -147
  302. package/reactjs/init/init.mjs +57 -78
  303. package/reactjs/queries/index.js +1 -17
  304. package/reactjs/queries/index.mjs +15 -15
  305. package/reactjs/queries/useCheckAccount.query.js +1 -39
  306. package/reactjs/queries/useCheckAccount.query.mjs +29 -33
  307. package/reactjs/queries/useGetAllTokens.query.js +1 -35
  308. package/reactjs/queries/useGetAllTokens.query.mjs +26 -30
  309. package/reactjs/queries/useGetChains.query.js +1 -34
  310. package/reactjs/queries/useGetChains.query.mjs +26 -28
  311. package/reactjs/queries/useGetHistory.query.js +1 -69
  312. package/reactjs/queries/useGetHistory.query.mjs +53 -57
  313. package/reactjs/queries/useGetMvxTokensBalances.query.js +1 -66
  314. package/reactjs/queries/useGetMvxTokensBalances.query.mjs +38 -46
  315. package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -81
  316. package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +49 -57
  317. package/reactjs/queries/useGetRate.mutation.js +1 -18
  318. package/reactjs/queries/useGetRate.mutation.mjs +12 -15
  319. package/reactjs/reexports.js +1 -48
  320. package/reactjs/reexports.mjs +13 -13
  321. package/reactjs/utils/delay.js +1 -6
  322. package/reactjs/utils/delay.mjs +3 -3
  323. package/reactjs/utils/formatAmount.js +1 -23
  324. package/reactjs/utils/formatAmount.mjs +16 -17
  325. package/reactjs/utils/getCleanStringAmount.js +1 -11
  326. package/reactjs/utils/getCleanStringAmount.mjs +6 -8
  327. package/reactjs/utils/getCompletePathname.js +1 -5
  328. package/reactjs/utils/getCompletePathname.mjs +3 -3
  329. package/reactjs/utils/getInitialTokens.js +1 -12
  330. package/reactjs/utils/getInitialTokens.mjs +6 -7
  331. package/reactjs/utils/hasEnoughFunds.js +1 -19
  332. package/reactjs/utils/hasEnoughFunds.mjs +11 -14
  333. package/reactjs/utils/index.js +1 -26
  334. package/reactjs/utils/index.mjs +24 -24
  335. package/reactjs/utils/isStringFloat.js +1 -21
  336. package/reactjs/utils/isStringFloat.mjs +11 -18
  337. package/reactjs/utils/mxClsx.js +1 -8
  338. package/reactjs/utils/mxClsx.mjs +4 -6
  339. package/reactjs/utils/pipe.js +1 -25
  340. package/reactjs/utils/pipe.mjs +13 -17
  341. package/reactjs/utils/removeCommas.js +1 -6
  342. package/reactjs/utils/removeCommas.mjs +2 -4
  343. package/reactjs/utils/roundAmount.js +1 -40
  344. package/reactjs/utils/roundAmount.mjs +16 -36
  345. package/reactjs/utils/testNumber.js +1 -4
  346. package/reactjs/utils/testNumber.mjs +2 -2
  347. package/store/inMemoryStore.js +1 -39
  348. package/store/inMemoryStore.mjs +17 -21
  349. package/style.css +1 -2274
  350. package/types/chainType.js +1 -11
  351. package/types/chainType.mjs +2 -9
  352. package/types/errors.js +1 -9
  353. package/types/errors.mjs +4 -5
  354. package/types/providerType.js +1 -9
  355. package/types/providerType.mjs +2 -7
  356. package/types/transaction.d.ts +2 -0
  357. package/all-networks-EJIVYZ_i.mjs +0 -4
  358. package/all-networks-NYACMyeN.js +0 -4
  359. package/default-BYtXv70Z.mjs +0 -4
  360. package/default-H3AbmzFV.js +0 -4
  361. package/react.esm-7GsOwMPq.js +0 -11815
  362. package/react.esm-CU-Iqz8D.mjs +0 -11796
@@ -1,38 +1,38 @@
1
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import { formatAmount } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
3
- import { useAppKitNetwork } from "@reown/appkit/react";
4
- import debounce from "lodash/debounce";
5
- import { useRef, useState, useMemo, useCallback, useEffect } from "react";
6
- import { toast } from "react-toastify";
7
- import { useBridgeTokenSelection } from "./hooks/useBridgeTokenSelection.mjs";
8
- import { MVX_CHAIN_IDS } from "../../../constants/index.mjs";
9
- import { getApiURL } from "../../../helpers/getApiURL.mjs";
1
+ import { jsx as r, Fragment as li, jsxs as a } from "react/jsx-runtime";
2
+ import { formatAmount as ci } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
3
+ import { useAppKitNetwork as di } from "@reown/appkit/react";
4
+ import mi from "lodash/debounce";
5
+ import { useRef as ui, useState as C, useMemo as m, useCallback as u, useEffect as I } from "react";
6
+ import { toast as ue } from "react-toastify";
7
+ import { useBridgeTokenSelection as pi } from "./hooks/useBridgeTokenSelection.mjs";
8
+ import { MVX_CHAIN_IDS as pe } from "../../../constants/index.mjs";
9
+ import { getApiURL as hi } from "../../../helpers/getApiURL.mjs";
10
10
  import "../../constants/index.mjs";
11
- import { safeImageUrl } from "../../../helpers/safeImageUrl.mjs";
12
- import { ProviderType } from "../../../types/providerType.mjs";
13
- import { useWeb3App } from "../../context/useWeb3App.mjs";
14
- import { sameBridgeApiChainId, toBridgeApiChainId } from "../../helpers/resolveBridgeApiChainId.mjs";
11
+ import { safeImageUrl as J } from "../../../helpers/safeImageUrl.mjs";
12
+ import { ProviderType as fi } from "../../../types/providerType.mjs";
13
+ import { useWeb3App as he } from "../../context/useWeb3App.mjs";
14
+ import { sameBridgeApiChainId as Z, toBridgeApiChainId as gi } from "../../helpers/resolveBridgeApiChainId.mjs";
15
15
  import "yup";
16
16
  import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
17
17
  import "bignumber.js";
18
- import { useAccount } from "../../hooks/useAccount.mjs";
18
+ import { useAccount as qi } from "../../hooks/useAccount.mjs";
19
19
  import "axios";
20
- import { useBridgeFormik, BridgeFormikValuesEnum } from "../../hooks/useBridgeFormik.mjs";
21
- import { useFetchBridgeData } from "../../hooks/useFetchBridgeData.mjs";
22
- import { useBridgeApiChainId } from "../../hooks/useBridgeApiChainId.mjs";
20
+ import { useBridgeFormik as bi, BridgeFormikValuesEnum as F } from "../../hooks/useBridgeFormik.mjs";
21
+ import { useFetchBridgeData as vi } from "../../hooks/useFetchBridgeData.mjs";
22
+ import { useBridgeApiChainId as Ci } from "../../hooks/useBridgeApiChainId.mjs";
23
23
  import "@tanstack/react-query";
24
- import { useGetChainId } from "../../hooks/useGetChainId.mjs";
25
- import { useSendTransactions } from "../../hooks/useSendTransactions.mjs";
24
+ import { useGetChainId as Ii } from "../../hooks/useGetChainId.mjs";
25
+ import { useSendTransactions as Bi } from "../../hooks/useSendTransactions.mjs";
26
26
  import "@reown/appkit-adapter-solana/react";
27
27
  import "@solana/web3.js";
28
28
  import "wagmi";
29
29
  import "@reown/appkit-controllers";
30
- import { useInvalidateHistoryQuery } from "../../queries/useGetHistory.query.mjs";
31
- import { useGetRateMutation } from "../../queries/useGetRate.mutation.mjs";
32
- import { mxClsx } from "../../utils/mxClsx.mjs";
33
- import { AmountCard } from "../AmountCard/AmountCard.mjs";
34
- import { AmountInput } from "../AmountInput/AmountInput.mjs";
35
- import { MxButton } from "../base/MxButton/MxButton.mjs";
30
+ import { useInvalidateHistoryQuery as Ai } from "../../queries/useGetHistory.query.mjs";
31
+ import { useGetRateMutation as xi } from "../../queries/useGetRate.mutation.mjs";
32
+ import { mxClsx as fe } from "../../utils/mxClsx.mjs";
33
+ import { AmountCard as ge } from "../AmountCard/AmountCard.mjs";
34
+ import { AmountInput as qe } from "../AmountInput/AmountInput.mjs";
35
+ import { MxButton as Ni } from "../base/MxButton/MxButton.mjs";
36
36
  import "../base/MxCard/MxCard.mjs";
37
37
  import "../base/MxLink/MxLink.mjs";
38
38
  import "../base/MxSearch/MxSearch.mjs";
@@ -42,513 +42,400 @@ import "@headlessui/react";
42
42
  import "react-dom";
43
43
  import "react-popper";
44
44
  import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
45
- import { BridgeHistory } from "../BridgeHistory/BridgeHistory.mjs";
46
- import { BridgeConnectButton } from "../Connect/BridgeConnectButton.mjs";
47
- import { MvxConnectButton } from "../Connect/MvxConnectButton.mjs";
48
- import { BridgeAccountDisplay } from "../Connect/BridgeAccountDisplay.mjs";
49
- import { MvxAccountDisplay } from "../Connect/MvxAccountDisplay.mjs";
50
- import { ToggleDirection } from "../ToggleDirection/ToggleDirection.mjs";
51
- import { TokenSelector } from "../TokenSelector/TokenSelector.mjs";
52
- let fetchRateInterval;
53
- const Transfer = ({
54
- mvxChainId,
55
- mvxAddress,
56
- username,
57
- callbackRoute = "/",
58
- firstTokenIdentifier,
59
- secondTokenIdentifier,
60
- firstTokenAmount,
61
- secondTokenAmount,
62
- refetchTrigger,
63
- showHistory,
64
- forcedDestinationTokenSymbol,
65
- onSuccessfullySentTransaction,
66
- onFailedSentTransaction,
67
- onHistoryClose,
68
- onMvxConnect,
69
- onMvxDisconnect,
70
- onNavigate,
71
- onChangeDirection
45
+ import { BridgeHistory as wi } from "../BridgeHistory/BridgeHistory.mjs";
46
+ import { BridgeConnectButton as yi } from "../Connect/BridgeConnectButton.mjs";
47
+ import { MvxConnectButton as Di } from "../Connect/MvxConnectButton.mjs";
48
+ import { BridgeAccountDisplay as Oi } from "../Connect/BridgeAccountDisplay.mjs";
49
+ import { MvxAccountDisplay as Mi } from "../Connect/MvxAccountDisplay.mjs";
50
+ import { ToggleDirection as Ei } from "../ToggleDirection/ToggleDirection.mjs";
51
+ import { TokenSelector as be } from "../TokenSelector/TokenSelector.mjs";
52
+ let U;
53
+ const Ot = ({
54
+ mvxChainId: D,
55
+ mvxAddress: o,
56
+ username: ve,
57
+ callbackRoute: Ce = "/",
58
+ firstTokenIdentifier: Ie,
59
+ secondTokenIdentifier: Be,
60
+ firstTokenAmount: O,
61
+ secondTokenAmount: B,
62
+ refetchTrigger: Ae,
63
+ showHistory: xe,
64
+ forcedDestinationTokenSymbol: Ne,
65
+ onSuccessfullySentTransaction: p,
66
+ onFailedSentTransaction: f,
67
+ onHistoryClose: M,
68
+ onMvxConnect: S,
69
+ onMvxDisconnect: we,
70
+ onNavigate: ye,
71
+ onChangeDirection: De
72
72
  }) => {
73
- var _a, _b;
74
- const ref = useRef(null);
75
- const [isTokenSelectorVisible, setIsTokenSelectorVisible] = useState(false);
76
- const [forceRefetchRate, setForceRefetchRate] = useState(1);
77
- const [siginingTransactionsCount, setSigningTransactionsCount] = useState(0);
78
- const [latestTransactions, setLatestTransactions] = useState([]);
79
- const account = useAccount();
80
- const { switchNetwork } = useAppKitNetwork();
81
- const invalidateHistoryQuery = useInvalidateHistoryQuery();
82
- const {
83
- options,
84
- supportedChains: sdkChains,
85
- nativeAuthToken,
86
- bridgeOnly
87
- } = useWeb3App();
88
- const chainId = useGetChainId();
89
- const bridgeApiChainId = useBridgeApiChainId();
90
- const sendTransactions = useSendTransactions();
91
- const {
92
- signMvxTransactions,
93
- resetMvxTransactionHash,
94
- latestMvxTransactionHash
95
- } = useWeb3App();
96
- const {
97
- evmTokensWithBalances,
98
- mvxTokensWithBalances,
99
- isTokensLoading: tokensLoading,
100
- isLoadingEvmTokensBalances,
101
- isLoadingMvxTokensBalances,
102
- chains = [],
103
- isChainsLoading
104
- } = useFetchBridgeData({
105
- refetchTrigger,
106
- mvxAddress,
107
- mvxApiURL: options.mvxApiURL
108
- });
109
- const isTokensLoading = tokensLoading || isLoadingEvmTokensBalances || isLoadingMvxTokensBalances || isChainsLoading;
110
- const activeChain = useMemo(() => {
111
- return sdkChains.find((chain) => sameBridgeApiChainId(chain.id, chainId));
112
- }, [chainId, sdkChains]);
113
- const mvxChain = useMemo(() => {
114
- return chains.find(
115
- (chain) => chain.chainId.toString() === mvxChainId.toString()
116
- );
117
- }, [chainId, chains]);
118
- const {
119
- mutate: getRate,
120
- data: rate,
121
- isPending: isPendingRate,
122
- error: rateError
123
- } = useGetRateMutation();
124
- 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;
125
- const handleSwitchNetwork = useCallback(
126
- (chain) => {
127
- const sdkChain = sdkChains.find(
128
- (c) => sameBridgeApiChainId(c.id, chain.id)
73
+ var de, me;
74
+ const Oe = ui(null), [j, Me] = C(!1), [Ee, Re] = C(1), [k, T] = C(0), [ee, ie] = C([]), s = qi(), { switchNetwork: te } = di(), re = Ai(), {
75
+ options: ne,
76
+ supportedChains: A,
77
+ nativeAuthToken: P,
78
+ bridgeOnly: Ve
79
+ } = he(), W = Ii(), oe = Ci(), ae = Bi(), {
80
+ signMvxTransactions: G,
81
+ resetMvxTransactionHash: Q,
82
+ latestMvxTransactionHash: _
83
+ } = he(), {
84
+ evmTokensWithBalances: Le,
85
+ mvxTokensWithBalances: Fe,
86
+ isTokensLoading: Ue,
87
+ isLoadingEvmTokensBalances: je,
88
+ isLoadingMvxTokensBalances: ke,
89
+ chains: x = [],
90
+ isChainsLoading: Pe
91
+ } = vi({
92
+ refetchTrigger: Ae,
93
+ mvxAddress: o,
94
+ mvxApiURL: ne.mvxApiURL
95
+ }), $ = Ue || je || ke || Pe, We = m(() => A.find((e) => Z(e.id, W)), [W, A]), g = m(() => x.find(
96
+ (e) => e.chainId.toString() === D.toString()
97
+ ), [W, x]), {
98
+ mutate: Ge,
99
+ data: n,
100
+ isPending: N,
101
+ error: q
102
+ } = xi(), w = ((de = q == null ? void 0 : q.response) == null ? void 0 : de.status) === 400 ? (me = q == null ? void 0 : q.response) == null ? void 0 : me.data.message : void 0, Qe = u(
103
+ (e) => {
104
+ const v = A.find(
105
+ (si) => Z(si.id, e.id)
129
106
  );
130
- if (sdkChain) {
131
- switchNetwork(sdkChain);
132
- }
107
+ v && te(v);
133
108
  },
134
- [sdkChains, switchNetwork]
135
- );
136
- const {
137
- firstToken,
138
- secondToken,
139
- fromOptions,
140
- toOptions,
141
- selectedChainOption,
142
- onChangeFirstSelect,
143
- onChangeSecondSelect,
144
- handleChangeDirection: handleTokenChangeDirection
145
- } = useBridgeTokenSelection({
146
- chains,
147
- activeChain,
148
- sdkChains,
149
- switchNetwork: handleSwitchNetwork,
150
- fromTokens: mvxTokensWithBalances,
151
- toTokens: evmTokensWithBalances,
152
- firstTokenIdentifier,
153
- secondTokenIdentifier,
154
- forcedDestinationTokenSymbol,
155
- isTokensLoading,
156
- mvxChainId,
157
- callbackRoute,
158
- onNavigate
159
- });
160
- const handleChangeDirection = () => {
161
- handleTokenChangeDirection();
162
- onChangeDirection();
163
- };
164
- const [firstAmount, setFirstAmount] = useState(firstTokenAmount ?? "");
165
- const [secondAmount, setSecondAmount] = useState(secondTokenAmount ?? "");
166
- const isFirstTokenMvx = useMemo(() => {
167
- return firstToken ? MVX_CHAIN_IDS.includes(firstToken.chainId.toString()) : false;
168
- }, [firstToken == null ? void 0 : firstToken.chainId]);
169
- const isSecondTokenMvx = useMemo(() => {
170
- return secondToken ? MVX_CHAIN_IDS.includes(secondToken.chainId.toString()) : false;
171
- }, [secondToken == null ? void 0 : secondToken.chainId]);
172
- const secondTokenChain = useMemo(() => {
173
- if (!secondToken) {
174
- return selectedChainOption;
175
- }
176
- return chains.find(
177
- (chain) => sameBridgeApiChainId(chain.chainId, secondToken.chainId)
178
- ) ?? selectedChainOption;
179
- }, [secondToken == null ? void 0 : secondToken.chainId, chains, selectedChainOption]);
180
- const bridgeToChainId = useMemo(
181
- () => toBridgeApiChainId(secondToken == null ? void 0 : secondToken.chainId) ?? bridgeApiChainId,
182
- [secondToken == null ? void 0 : secondToken.chainId, bridgeApiChainId]
183
- );
184
- const bridgeAddress = account.address;
185
- const isAuthenticated = account.isConnected && Boolean(bridgeAddress);
186
- const hasAmounts = firstAmount !== "" && secondAmount !== "";
187
- const fetchRateDebounced = useCallback(
188
- debounce(async (amount) => {
189
- if (!amount || !Number(amount) || !account.address || !(firstToken == null ? void 0 : firstToken.address) || !(secondToken == null ? void 0 : secondToken.address) || !selectedChainOption || !bridgeToChainId) {
190
- return;
191
- }
192
- getRate({
193
- nativeAuthToken: nativeAuthToken ?? "",
109
+ [A, te]
110
+ ), {
111
+ firstToken: i,
112
+ secondToken: t,
113
+ fromOptions: _e,
114
+ toOptions: $e,
115
+ selectedChainOption: y,
116
+ onChangeFirstSelect: ze,
117
+ onChangeSecondSelect: He,
118
+ handleChangeDirection: Ke
119
+ } = pi({
120
+ chains: x,
121
+ activeChain: We,
122
+ sdkChains: A,
123
+ switchNetwork: Qe,
124
+ fromTokens: Fe,
125
+ toTokens: Le,
126
+ firstTokenIdentifier: Ie,
127
+ secondTokenIdentifier: Be,
128
+ forcedDestinationTokenSymbol: Ne,
129
+ isTokensLoading: $,
130
+ mvxChainId: D,
131
+ callbackRoute: Ce,
132
+ onNavigate: ye
133
+ }), Xe = () => {
134
+ Ke(), De();
135
+ }, [l, Ye] = C(O ?? ""), [E, R] = C(B ?? ""), Je = m(() => i ? pe.includes(i.chainId.toString()) : !1, [i == null ? void 0 : i.chainId]), Ze = m(() => t ? pe.includes(t.chainId.toString()) : !1, [t == null ? void 0 : t.chainId]), c = m(() => t ? x.find(
136
+ (e) => Z(e.chainId, t.chainId)
137
+ ) ?? y : y, [t == null ? void 0 : t.chainId, x, y]), V = m(
138
+ () => gi(t == null ? void 0 : t.chainId) ?? oe,
139
+ [t == null ? void 0 : t.chainId, oe]
140
+ ), se = s.address, le = s.isConnected && !!se, z = l !== "" && E !== "", H = u(
141
+ mi(async (e) => {
142
+ !e || !Number(e) || !s.address || !(i != null && i.address) || !(t != null && t.address) || !y || !V || Ge({
143
+ nativeAuthToken: P ?? "",
194
144
  body: {
195
- tokenIn: firstToken.address,
196
- amountIn: amount,
197
- fromChainId: mvxChainId,
198
- tokenOut: secondToken.address,
199
- toChainId: bridgeToChainId
145
+ tokenIn: i.address,
146
+ amountIn: e,
147
+ fromChainId: D,
148
+ tokenOut: t.address,
149
+ toChainId: V
200
150
  }
201
151
  });
202
152
  }, 500),
203
153
  [
204
- account.address,
205
- bridgeToChainId,
206
- firstToken == null ? void 0 : firstToken.address,
207
- secondToken == null ? void 0 : secondToken.address,
208
- selectedChainOption
154
+ s.address,
155
+ V,
156
+ i == null ? void 0 : i.address,
157
+ t == null ? void 0 : t.address,
158
+ y
209
159
  ]
210
- );
211
- const handleOnChangeFirstAmount = useCallback((amount) => {
212
- setFirstAmount(() => amount);
213
- }, []);
214
- const handleOnChangeSecondAmount = useCallback((amount) => {
215
- setSecondAmount(() => amount);
216
- }, []);
217
- const handleHistoryClose = useCallback(() => {
218
- onHistoryClose == null ? void 0 : onHistoryClose();
219
- }, [onHistoryClose]);
220
- const handleOnFirstMaxBtnChange = useCallback(() => {
221
- const formattedBalance = formatAmount({
222
- decimals: firstToken == null ? void 0 : firstToken.decimals,
223
- input: (firstToken == null ? void 0 : firstToken.balance) ?? "0",
224
- addCommas: false,
160
+ ), d = u((e) => {
161
+ Ye(() => e);
162
+ }, []), b = u((e) => {
163
+ R(() => e);
164
+ }, []), Se = u(() => {
165
+ M == null || M();
166
+ }, [M]), Te = u(() => {
167
+ const e = ci({
168
+ decimals: i == null ? void 0 : i.decimals,
169
+ input: (i == null ? void 0 : i.balance) ?? "0",
170
+ addCommas: !1,
225
171
  digits: 4
226
172
  });
227
- formik.setFieldValue("firstAmount", formattedBalance);
228
- handleOnChangeFirstAmount(formattedBalance);
229
- }, [firstToken == null ? void 0 : firstToken.balance, firstToken == null ? void 0 : firstToken.decimals, handleOnChangeFirstAmount]);
230
- const onSuccess = useCallback(
231
- async (txHashes) => {
232
- handleOnChangeFirstAmount("");
233
- handleOnChangeSecondAmount("");
234
- invalidateHistoryQuery();
235
- invalidateHistoryQuery();
236
- onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction(txHashes);
173
+ h.setFieldValue("firstAmount", e), d(e);
174
+ }, [i == null ? void 0 : i.balance, i == null ? void 0 : i.decimals, d]), ei = u(
175
+ async (e) => {
176
+ d(""), b(""), re(), re(), p == null || p(e);
237
177
  },
238
178
  [
239
- handleOnChangeFirstAmount,
240
- handleOnChangeSecondAmount,
241
- onSuccessfullySentTransaction
179
+ d,
180
+ b,
181
+ p
242
182
  ]
243
- );
244
- const onSubmit = useCallback(
245
- async ({ transactions }) => {
246
- setSigningTransactionsCount(() => transactions.length);
183
+ ), ii = u(
184
+ async ({ transactions: e }) => {
185
+ T(() => e.length);
247
186
  try {
248
- if (!signMvxTransactions) {
187
+ if (!G)
249
188
  throw new Error("signMvxTransactions function is not provided");
250
- }
251
- await signMvxTransactions(transactions);
252
- setLatestTransactions(transactions);
253
- } catch (e) {
254
- console.error(e);
255
- toast.dismiss();
256
- toast.error("Transaction cancelled");
257
- onFailedSentTransaction == null ? void 0 : onFailedSentTransaction("Transaction cancelled");
258
- setSigningTransactionsCount(0);
259
- resetSwapForm();
260
- handleOnChangeFirstAmount("");
261
- handleOnChangeSecondAmount("");
189
+ await G(e), ie(e);
190
+ } catch (v) {
191
+ console.error(v), ue.dismiss(), ue.error("Transaction cancelled"), f == null || f("Transaction cancelled"), T(0), ri(), d(""), b("");
262
192
  }
263
193
  },
264
194
  [
265
- bridgeAddress,
266
- handleOnChangeFirstAmount,
267
- handleOnChangeSecondAmount,
268
- nativeAuthToken,
269
- onSuccess,
270
- signMvxTransactions
195
+ se,
196
+ d,
197
+ b,
198
+ P,
199
+ ei,
200
+ G
271
201
  ]
272
- );
273
- const {
274
- formik,
275
- firstAmountError,
276
- secondAmountError,
277
- fromChainError,
278
- handleBlur,
279
- handleChange,
280
- handleSubmit,
281
- resetSwapForm
282
- } = useBridgeFormik({
283
- isMvxConnected: Boolean(mvxAddress),
284
- rate,
285
- sender: mvxAddress ?? "",
286
- receiver: account.address ?? "",
287
- firstToken,
288
- firstAmount,
289
- fromChainId: mvxChainId,
290
- toChainId: bridgeToChainId,
291
- secondToken,
292
- secondAmount,
293
- setForceRefetchRate,
294
- onSubmit
295
- });
296
- const hasError = Boolean(
297
- firstAmountError || secondAmountError || fromChainError || rateValidationError
298
- );
299
- const amountErrorFirstInput = useMemo(() => {
300
- return firstAmount !== "" ? rateValidationError ?? firstAmountError : void 0;
301
- }, [firstAmountError, firstAmount, rateValidationError]);
302
- const amountErrorSecondInput = useMemo(() => {
303
- return secondAmount !== "" ? fromChainError ?? secondAmountError : void 0;
304
- }, [fromChainError, secondAmountError, secondAmount]);
305
- useEffect(() => {
306
- if (!firstAmount) {
307
- setSecondAmount("");
308
- }
309
- fetchRateDebounced(firstAmount);
310
- if (fetchRateInterval) {
311
- clearInterval(fetchRateInterval);
312
- }
313
- fetchRateInterval = setInterval(() => {
314
- fetchRateDebounced(firstAmount);
315
- }, 50 * 1e3);
316
- return () => clearInterval(fetchRateInterval);
317
- }, [firstAmount, forceRefetchRate, fetchRateDebounced]);
318
- useEffect(() => {
319
- if (!(rate == null ? void 0 : rate.amountOut)) {
320
- return;
321
- }
322
- formik.setFieldValue(BridgeFormikValuesEnum.secondAmount, rate.amountOut);
323
- setSecondAmount(rate.amountOut);
324
- }, [rate == null ? void 0 : rate.amountOut]);
325
- useEffect(() => {
326
- if (rateValidationError) {
327
- formik.setFieldValue(BridgeFormikValuesEnum.secondAmount, "0");
328
- setSecondAmount("0");
329
- }
330
- }, [rateValidationError]);
331
- useEffect(() => {
332
- if (firstTokenAmount) {
333
- formik.setFieldValue(
334
- BridgeFormikValuesEnum.firstAmount,
335
- firstTokenAmount
336
- );
337
- handleOnChangeFirstAmount(firstTokenAmount);
338
- }
339
- }, []);
340
- useEffect(() => {
341
- if (secondTokenAmount) {
342
- formik.setFieldValue(
343
- BridgeFormikValuesEnum.secondAmount,
344
- secondTokenAmount
345
- );
346
- handleOnChangeSecondAmount(secondTokenAmount);
347
- }
348
- }, [secondTokenAmount]);
349
- useEffect(() => {
350
- if (latestMvxTransactionHash) {
202
+ ), {
203
+ formik: h,
204
+ firstAmountError: K,
205
+ secondAmountError: X,
206
+ fromChainError: Y,
207
+ handleBlur: L,
208
+ handleChange: ce,
209
+ handleSubmit: ti,
210
+ resetSwapForm: ri
211
+ } = bi({
212
+ isMvxConnected: !!o,
213
+ rate: n,
214
+ sender: o ?? "",
215
+ receiver: s.address ?? "",
216
+ firstToken: i,
217
+ firstAmount: l,
218
+ fromChainId: D,
219
+ toChainId: V,
220
+ secondToken: t,
221
+ secondAmount: E,
222
+ setForceRefetchRate: Re,
223
+ onSubmit: ii
224
+ }), ni = !!(K || X || Y || w), oi = m(() => l !== "" ? w ?? K : void 0, [K, l, w]), ai = m(() => E !== "" ? Y ?? X : void 0, [Y, X, E]);
225
+ return I(() => (l || R(""), H(l), U && clearInterval(U), U = setInterval(() => {
226
+ H(l);
227
+ }, 50 * 1e3), () => clearInterval(U)), [l, Ee, H]), I(() => {
228
+ n != null && n.amountOut && (h.setFieldValue(F.secondAmount, n.amountOut), R(n.amountOut));
229
+ }, [n == null ? void 0 : n.amountOut]), I(() => {
230
+ w && (h.setFieldValue(F.secondAmount, "0"), R("0"));
231
+ }, [w]), I(() => {
232
+ O && (h.setFieldValue(
233
+ F.firstAmount,
234
+ O
235
+ ), d(O));
236
+ }, []), I(() => {
237
+ B && (h.setFieldValue(
238
+ F.secondAmount,
239
+ B
240
+ ), b(B));
241
+ }, [B]), I(() => {
242
+ if (_)
351
243
  try {
352
- const txHash = latestMvxTransactionHash;
353
- sendTransactions({
354
- transactions: latestTransactions.map((tx) => ({
355
- ...tx,
356
- txHash,
357
- receiver: account.address
244
+ const e = _;
245
+ ae({
246
+ transactions: ee.map((v) => ({
247
+ ...v,
248
+ txHash: e,
249
+ receiver: s.address
358
250
  })),
359
- provider: (rate == null ? void 0 : rate.provider) ?? ProviderType.None,
360
- url: getApiURL() ?? "",
361
- token: nativeAuthToken ?? ""
362
- });
363
- onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction([txHash]);
364
- } catch (err) {
365
- console.error("Error while sending transactions:", err);
366
- onFailedSentTransaction == null ? void 0 : onFailedSentTransaction(
251
+ provider: (n == null ? void 0 : n.provider) ?? fi.None,
252
+ url: hi() ?? "",
253
+ token: P ?? ""
254
+ }), p == null || p([e]);
255
+ } catch (e) {
256
+ console.error("Error while sending transactions:", e), f == null || f(
367
257
  "An error occurred while sending the transaction"
368
258
  );
369
259
  return;
370
260
  } finally {
371
- resetMvxTransactionHash == null ? void 0 : resetMvxTransactionHash();
372
- setLatestTransactions([]);
261
+ Q == null || Q(), ie([]);
373
262
  }
374
- }
375
263
  }, [
376
- latestMvxTransactionHash,
377
- latestTransactions,
378
- rate == null ? void 0 : rate.provider,
379
- sendTransactions
380
- ]);
381
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
264
+ _,
265
+ ee,
266
+ n == null ? void 0 : n.provider,
267
+ ae
268
+ ]), /* @__PURE__ */ r(li, { children: /* @__PURE__ */ a(
382
269
  "form",
383
270
  {
384
- ref,
385
- noValidate: true,
271
+ ref: Oe,
272
+ noValidate: !0,
386
273
  className: "liq-flex liq-flex-col liq-gap-1 liq-relative",
387
274
  autoComplete: "off",
388
- onSubmit: handleSubmit,
275
+ onSubmit: ti,
389
276
  children: [
390
- showHistory && /* @__PURE__ */ jsx(BridgeHistory, { mvxAddress, onClose: handleHistoryClose }),
391
- /* @__PURE__ */ jsxs(
392
- AmountCard,
277
+ xe && /* @__PURE__ */ r(wi, { mvxAddress: o, onClose: Se }),
278
+ /* @__PURE__ */ a(
279
+ ge,
393
280
  {
394
- className: mxClsx(
281
+ className: fe(
395
282
  "liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
396
283
  {
397
- "liq-pointer-events-none": isTokenSelectorVisible,
398
- "focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80": !isTokenSelectorVisible
284
+ "liq-pointer-events-none": j,
285
+ "focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80": !j
399
286
  }
400
287
  ),
401
288
  children: [
402
- /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
403
- /* @__PURE__ */ jsx("span", { children: "From" }),
404
- /* @__PURE__ */ jsx(
405
- MvxAccountDisplay,
289
+ /* @__PURE__ */ a("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
290
+ /* @__PURE__ */ r("span", { children: "From" }),
291
+ /* @__PURE__ */ r(
292
+ Mi,
406
293
  {
407
- accountAddress: mvxAddress,
408
- chainIcon: safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
409
- username,
410
- accountExplorerUrl: `${options.mvxExplorerAddress}/accounts/${mvxAddress}`,
411
- showTag: true,
412
- onDisconnect: onMvxDisconnect,
413
- onConnect: onMvxConnect
294
+ accountAddress: o,
295
+ chainIcon: J(g == null ? void 0 : g.pngUrl),
296
+ username: ve,
297
+ accountExplorerUrl: `${ne.mvxExplorerAddress}/accounts/${o}`,
298
+ showTag: !0,
299
+ onDisconnect: we,
300
+ onConnect: S
414
301
  }
415
302
  )
416
303
  ] }),
417
- /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
418
- /* @__PURE__ */ jsx(
419
- AmountInput,
304
+ /* @__PURE__ */ a("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
305
+ /* @__PURE__ */ r(
306
+ qe,
420
307
  {
421
308
  inputName: "firstAmount",
422
- inputValue: formik.values.firstAmount,
423
- amountError: amountErrorFirstInput,
424
- disabled: false,
425
- onInputDebounceChange: handleOnChangeFirstAmount,
426
- onInputChange: handleChange,
427
- onBlur: handleBlur
309
+ inputValue: h.values.firstAmount,
310
+ amountError: oi,
311
+ disabled: !1,
312
+ onInputDebounceChange: d,
313
+ onInputChange: ce,
314
+ onBlur: L
428
315
  }
429
316
  ),
430
- /* @__PURE__ */ jsx(
431
- TokenSelector,
317
+ /* @__PURE__ */ r(
318
+ be,
432
319
  {
433
320
  name: "firstToken",
434
- disabled: isPendingRate,
435
- options: fromOptions,
436
- areOptionsLoading: isTokensLoading,
437
- isMvxSelector: isFirstTokenMvx,
438
- isDestination: false,
321
+ disabled: N,
322
+ options: _e,
323
+ areOptionsLoading: $,
324
+ isMvxSelector: Je,
325
+ isDestination: !1,
439
326
  color: "neutral-850",
440
- onChange: onChangeFirstSelect,
441
- onBlur: handleBlur,
442
- onMaxBtnClick: handleOnFirstMaxBtnChange,
443
- selectedOption: firstToken,
444
- onTokenSelectorDisplay: (visible) => setIsTokenSelectorVisible(visible)
327
+ onChange: ze,
328
+ onBlur: L,
329
+ onMaxBtnClick: Te,
330
+ selectedOption: i,
331
+ onTokenSelectorDisplay: (e) => Me(e)
445
332
  }
446
333
  )
447
334
  ] })
448
335
  ]
449
336
  }
450
337
  ),
451
- /* @__PURE__ */ jsx("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: bridgeOnly && /* @__PURE__ */ jsx(ToggleDirection, { onChangeDirection: handleChangeDirection }) }),
452
- /* @__PURE__ */ jsxs(
453
- AmountCard,
338
+ /* @__PURE__ */ r("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: Ve && /* @__PURE__ */ r(Ei, { onChangeDirection: Xe }) }),
339
+ /* @__PURE__ */ a(
340
+ ge,
454
341
  {
455
- className: mxClsx(
342
+ className: fe(
456
343
  "liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
457
344
  {
458
- "liq-pointer-events-none": isTokenSelectorVisible
345
+ "liq-pointer-events-none": j
459
346
  }
460
347
  ),
461
348
  children: [
462
- /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
463
- /* @__PURE__ */ jsx("span", { children: "To" }),
464
- /* @__PURE__ */ jsx(
465
- BridgeAccountDisplay,
349
+ /* @__PURE__ */ a("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
350
+ /* @__PURE__ */ r("span", { children: "To" }),
351
+ /* @__PURE__ */ r(
352
+ Oi,
466
353
  {
467
- disabled: isPendingRate,
468
- activeChain: secondTokenChain
354
+ disabled: N,
355
+ activeChain: c
469
356
  }
470
357
  )
471
358
  ] }),
472
- /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
473
- /* @__PURE__ */ jsx(
474
- AmountInput,
359
+ /* @__PURE__ */ a("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
360
+ /* @__PURE__ */ r(
361
+ qe,
475
362
  {
476
363
  inputName: "secondAmount",
477
- inputValue: formik.values.secondAmount,
478
- amountError: amountErrorSecondInput,
479
- disabled: false,
480
- onInputDebounceChange: handleOnChangeSecondAmount,
481
- onInputChange: handleChange,
482
- onBlur: handleBlur
364
+ inputValue: h.values.secondAmount,
365
+ amountError: ai,
366
+ disabled: !1,
367
+ onInputDebounceChange: b,
368
+ onInputChange: ce,
369
+ onBlur: L
483
370
  }
484
371
  ),
485
- /* @__PURE__ */ jsx(
486
- TokenSelector,
372
+ /* @__PURE__ */ r(
373
+ be,
487
374
  {
488
375
  name: "secondToken",
489
- disabled: isPendingRate,
490
- omitDisableClass: true,
491
- options: toOptions,
492
- areOptionsLoading: isTokensLoading,
493
- isMvxSelector: isSecondTokenMvx,
376
+ disabled: N,
377
+ omitDisableClass: !0,
378
+ options: $e,
379
+ areOptionsLoading: $,
380
+ isMvxSelector: Ze,
494
381
  color: "neutral-850",
495
- onChange: onChangeSecondSelect,
496
- onBlur: handleBlur,
497
- selectedOption: secondToken
382
+ onChange: He,
383
+ onBlur: L,
384
+ selectedOption: t
498
385
  }
499
386
  )
500
387
  ] })
501
388
  ]
502
389
  }
503
390
  ),
504
- /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-items-center liq-justify-center", children: [
505
- !mvxAddress && /* @__PURE__ */ jsx(
506
- MvxConnectButton,
391
+ /* @__PURE__ */ a("div", { className: "liq-flex liq-items-center liq-justify-center", children: [
392
+ !o && /* @__PURE__ */ r(
393
+ Di,
507
394
  {
508
- mvxAccountAddress: mvxAddress,
509
- icon: safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
510
- onClick: onMvxConnect
395
+ mvxAccountAddress: o,
396
+ icon: J(g == null ? void 0 : g.pngUrl),
397
+ onClick: S
511
398
  }
512
399
  ),
513
- mvxAddress && !isAuthenticated && /* @__PURE__ */ jsx(
514
- BridgeConnectButton,
400
+ o && !le && /* @__PURE__ */ r(
401
+ yi,
515
402
  {
516
403
  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",
517
- disabled: isPendingRate,
518
- activeChain: secondTokenChain
404
+ disabled: N,
405
+ activeChain: c
519
406
  }
520
407
  ),
521
- mvxAddress && isAuthenticated && /* @__PURE__ */ jsxs(
522
- MxButton,
408
+ o && le && /* @__PURE__ */ a(
409
+ Ni,
523
410
  {
524
411
  "data-testid": "submit-button",
525
412
  type: "submit",
526
413
  variant: "neutral-850",
527
414
  className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
528
- disabled: !hasAmounts || isPendingRate || !mvxAddress || !account.address || hasError,
415
+ disabled: !z || N || !o || !s.address || ni,
529
416
  children: [
530
- hasAmounts && /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
531
- /* @__PURE__ */ jsx("div", { children: "Transfer to " }),
532
- /* @__PURE__ */ jsx(
417
+ z && /* @__PURE__ */ a("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
418
+ /* @__PURE__ */ r("div", { children: "Transfer to " }),
419
+ /* @__PURE__ */ r(
533
420
  "img",
534
421
  {
535
- src: safeImageUrl(secondTokenChain == null ? void 0 : secondTokenChain.pngUrl),
422
+ src: J(c == null ? void 0 : c.pngUrl),
536
423
  alt: "",
537
424
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
538
425
  }
539
426
  ),
540
- /* @__PURE__ */ jsx("div", { children: secondTokenChain == null ? void 0 : secondTokenChain.networkName })
427
+ /* @__PURE__ */ r("div", { children: c == null ? void 0 : c.networkName })
541
428
  ] }),
542
- !hasAmounts && /* @__PURE__ */ jsx("span", { className: "liq-text-neutral-100", children: "Enter amount" })
429
+ !z && /* @__PURE__ */ r("span", { className: "liq-text-neutral-100", children: "Enter amount" })
543
430
  ]
544
431
  }
545
432
  )
546
433
  ] }),
547
- account.address && siginingTransactionsCount > 0 && /* @__PURE__ */ jsx("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ jsxs("div", { children: [
434
+ s.address && k > 0 && /* @__PURE__ */ r("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ a("div", { children: [
548
435
  "You will be asked to sign ",
549
- siginingTransactionsCount,
436
+ k,
550
437
  " ",
551
- siginingTransactionsCount > 1 ? "transactions" : "transaction",
438
+ k > 1 ? "transactions" : "transaction",
552
439
  " ",
553
440
  "on your wallet"
554
441
  ] }) })
@@ -557,5 +444,5 @@ const Transfer = ({
557
444
  ) });
558
445
  };
559
446
  export {
560
- Transfer
447
+ Ot as Transfer
561
448
  };