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