@rango-dev/widget-embedded 0.17.1-next.8 → 0.18.0

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 (361) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/dist/QueueManager.d.ts +3 -1
  3. package/dist/QueueManager.d.ts.map +1 -1
  4. package/dist/components/AppRouter.d.ts.map +1 -1
  5. package/dist/components/AppRoutes.d.ts.map +1 -1
  6. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
  7. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -1
  8. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  9. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +690 -61
  10. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  12. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  13. package/dist/components/Layout/Layout.d.ts.map +1 -1
  14. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  15. package/dist/components/Layout/Layout.types.d.ts +2 -2
  16. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  17. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -1
  18. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +1727 -0
  19. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
  20. package/dist/components/NoResult/NoResult.d.ts.map +1 -1
  21. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  22. package/dist/components/Quote/Quote.d.ts.map +1 -1
  23. package/dist/components/Quote/Quote.styles.d.ts +793 -5
  24. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  25. package/dist/components/Quote/Quote.types.d.ts +0 -1
  26. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  27. package/dist/components/Quote/QuoteSummary.styles.d.ts +157 -0
  28. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
  29. package/dist/components/Quote/index.d.ts +0 -1
  30. package/dist/components/Quote/index.d.ts.map +1 -1
  31. package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +1 -0
  32. package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.styles.d.ts +314 -0
  33. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -0
  34. package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +1 -0
  35. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts +4 -0
  36. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -0
  37. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +1571 -0
  38. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -0
  39. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +6 -0
  40. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +1 -0
  41. package/dist/components/QuoteSkeleton/StepSkeleton.d.ts +4 -0
  42. package/dist/components/QuoteSkeleton/StepSkeleton.d.ts.map +1 -0
  43. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +786 -0
  44. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -0
  45. package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts +4 -0
  46. package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts.map +1 -0
  47. package/dist/components/QuoteSkeleton/index.d.ts +4 -0
  48. package/dist/components/QuoteSkeleton/index.d.ts.map +1 -0
  49. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
  50. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
  51. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  52. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +1 -0
  53. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
  54. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  55. package/dist/components/Slippage/Slippage.styles.d.ts +158 -0
  56. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  57. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  58. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  59. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
  60. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
  61. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +628 -0
  62. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  63. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  64. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  65. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +1 -1
  66. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -1
  67. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +1 -1
  68. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
  69. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  70. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +157 -0
  71. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  72. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  73. package/dist/components/TokenList/TokenList.helpers.d.ts +2 -2
  74. package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
  75. package/dist/components/TokenList/TokenList.styles.d.ts +1100 -1
  76. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  77. package/dist/components/TokenList/TokenList.types.d.ts +4 -9
  78. package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
  79. package/dist/components/TokenList/index.d.ts +0 -1
  80. package/dist/components/TokenList/index.d.ts.map +1 -1
  81. package/dist/components/UpdateUrl.d.ts.map +1 -1
  82. package/dist/constants/errors.d.ts.map +1 -1
  83. package/dist/constants/index.d.ts +1 -0
  84. package/dist/constants/index.d.ts.map +1 -1
  85. package/dist/constants/navigationRoutes.d.ts +1 -2
  86. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  87. package/dist/constants/searchParams.d.ts +2 -1
  88. package/dist/constants/searchParams.d.ts.map +1 -1
  89. package/dist/containers/App/App.d.ts +3 -0
  90. package/dist/containers/App/App.d.ts.map +1 -0
  91. package/dist/containers/App/App.styles.d.ts +158 -0
  92. package/dist/containers/App/App.styles.d.ts.map +1 -0
  93. package/dist/containers/App/index.d.ts +2 -0
  94. package/dist/containers/App/index.d.ts.map +1 -0
  95. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  96. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +316 -0
  97. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  98. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +3 -0
  99. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  100. package/dist/containers/Wallets/Wallets.d.ts +6 -0
  101. package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
  102. package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
  103. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
  104. package/dist/containers/Wallets/index.d.ts +2 -0
  105. package/dist/containers/Wallets/index.d.ts.map +1 -0
  106. package/dist/containers/Widget/Widget.d.ts +5 -0
  107. package/dist/containers/Widget/Widget.d.ts.map +1 -0
  108. package/dist/containers/Widget/Widget.types.d.ts +5 -0
  109. package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
  110. package/dist/containers/Widget/index.d.ts +3 -0
  111. package/dist/containers/Widget/index.d.ts.map +1 -0
  112. package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
  113. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
  114. package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts +20 -0
  115. package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +1 -0
  116. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +21 -0
  117. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
  118. package/dist/containers/WidgetInfo/index.d.ts +2 -0
  119. package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
  120. package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
  121. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
  122. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
  123. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
  124. package/dist/containers/WidgetProvider/index.d.ts +2 -0
  125. package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
  126. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
  127. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +6 -3
  128. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
  129. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts +1 -1
  130. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -1
  131. package/dist/hooks/useForceAutoConnect.d.ts +2 -0
  132. package/dist/hooks/useForceAutoConnect.d.ts.map +1 -0
  133. package/dist/hooks/useLanguage.d.ts +1 -1
  134. package/dist/hooks/useLanguage.d.ts.map +1 -1
  135. package/dist/hooks/useNavigateBack.d.ts +1 -3
  136. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  137. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +1 -1
  138. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts +2 -2
  139. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -1
  140. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +3 -5
  141. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
  142. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +1 -0
  143. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
  144. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +5 -1
  145. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
  146. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  147. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  148. package/dist/hooks/useTheme.d.ts +1 -1
  149. package/dist/hooks/useTheme.d.ts.map +1 -1
  150. package/dist/index.d.ts +20 -8
  151. package/dist/index.d.ts.map +1 -1
  152. package/dist/index.js +1 -1
  153. package/dist/index.js.map +4 -4
  154. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  155. package/dist/pages/HistoryPage.d.ts.map +1 -1
  156. package/dist/pages/Home.d.ts.map +1 -1
  157. package/dist/pages/LanguagePage.d.ts.map +1 -1
  158. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  159. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  160. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  161. package/dist/pages/SettingsPage.d.ts.map +1 -1
  162. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  163. package/dist/pages/ThemePage.d.ts.map +1 -1
  164. package/dist/pages/WalletsPage.d.ts.map +1 -1
  165. package/dist/store/AppStore.d.ts +37 -1
  166. package/dist/store/AppStore.d.ts.map +1 -1
  167. package/dist/store/app.d.ts +39 -2
  168. package/dist/store/app.d.ts.map +1 -1
  169. package/dist/store/notification.d.ts +4 -3
  170. package/dist/store/notification.d.ts.map +1 -1
  171. package/dist/store/quote.d.ts +9 -9
  172. package/dist/store/quote.d.ts.map +1 -1
  173. package/dist/store/slices/config.d.ts.map +1 -1
  174. package/dist/store/slices/data.d.ts +2 -2
  175. package/dist/store/slices/data.d.ts.map +1 -1
  176. package/dist/store/slices/settings.d.ts +39 -0
  177. package/dist/store/slices/settings.d.ts.map +1 -0
  178. package/dist/store/ui.d.ts +2 -1
  179. package/dist/store/ui.d.ts.map +1 -1
  180. package/dist/store/wallets.d.ts +9 -5
  181. package/dist/store/wallets.d.ts.map +1 -1
  182. package/dist/types/config.d.ts +36 -3
  183. package/dist/types/config.d.ts.map +1 -1
  184. package/dist/types/swap.d.ts +4 -14
  185. package/dist/types/swap.d.ts.map +1 -1
  186. package/dist/types/wallets.d.ts +15 -1
  187. package/dist/types/wallets.d.ts.map +1 -1
  188. package/dist/utils/colors.d.ts.map +1 -1
  189. package/dist/utils/configs.d.ts +1 -0
  190. package/dist/utils/configs.d.ts.map +1 -1
  191. package/dist/utils/meta.d.ts +2 -1
  192. package/dist/utils/meta.d.ts.map +1 -1
  193. package/dist/utils/providers.d.ts +2 -2
  194. package/dist/utils/providers.d.ts.map +1 -1
  195. package/dist/utils/queue.d.ts +2 -2
  196. package/dist/utils/queue.d.ts.map +1 -1
  197. package/dist/utils/quote.d.ts +1 -1
  198. package/dist/utils/quote.d.ts.map +1 -1
  199. package/dist/utils/settings.d.ts +4 -1
  200. package/dist/utils/settings.d.ts.map +1 -1
  201. package/dist/utils/swap.d.ts +13 -5
  202. package/dist/utils/swap.d.ts.map +1 -1
  203. package/dist/utils/time.d.ts +1 -1
  204. package/dist/utils/time.d.ts.map +1 -1
  205. package/dist/utils/wallets.d.ts +7 -8
  206. package/dist/utils/wallets.d.ts.map +1 -1
  207. package/package.json +12 -10
  208. package/src/QueueManager.tsx +4 -3
  209. package/src/components/AppRouter.tsx +5 -27
  210. package/src/components/AppRoutes.tsx +54 -33
  211. package/src/components/BlockchainList/BlockchainList.styles.ts +2 -2
  212. package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
  213. package/src/components/BlockchainsSection/BlockchainsSection.tsx +19 -10
  214. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +29 -10
  215. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +15 -7
  216. package/src/components/ConfirmWalletsModal/WalletList.tsx +3 -3
  217. package/src/components/HeaderButtons/HomeButtons.tsx +28 -18
  218. package/src/components/Layout/Layout.styles.ts +2 -0
  219. package/src/components/Layout/Layout.tsx +20 -7
  220. package/src/components/Layout/Layout.types.ts +2 -2
  221. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +65 -61
  222. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +28 -34
  223. package/src/components/NoResult/NoResult.helpers.ts +12 -12
  224. package/src/components/NoResult/NoResult.tsx +2 -5
  225. package/src/components/NotificationContent/NotificationContent.tsx +2 -1
  226. package/src/components/Quote/Quote.styles.ts +49 -12
  227. package/src/components/Quote/Quote.tsx +107 -38
  228. package/src/components/Quote/Quote.types.ts +0 -1
  229. package/src/components/Quote/QuoteSummary.styles.ts +9 -8
  230. package/src/components/Quote/QuoteSummary.tsx +2 -2
  231. package/src/components/Quote/index.ts +0 -1
  232. package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +42 -0
  233. package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +30 -0
  234. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +57 -0
  235. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +76 -0
  236. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +6 -0
  237. package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +33 -0
  238. package/src/components/QuoteSkeleton/StepSkeleton.tsx +44 -0
  239. package/src/components/QuoteSkeleton/StepSkeleton.types.ts +1 -0
  240. package/src/components/QuoteSkeleton/index.ts +3 -0
  241. package/src/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx +1 -1
  242. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +11 -4
  243. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +8 -1
  244. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +13 -13
  245. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
  246. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +3 -3
  247. package/src/components/Slippage/Slippage.styles.ts +15 -5
  248. package/src/components/Slippage/Slippage.tsx +11 -10
  249. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +5 -8
  250. package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
  251. package/src/components/SwapDetails/SwapDetails.styles.ts +36 -33
  252. package/src/components/SwapDetails/SwapDetails.tsx +28 -39
  253. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
  254. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
  255. package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
  256. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +14 -8
  257. package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +1 -1
  258. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +1 -1
  259. package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +1 -1
  260. package/src/components/SwapsGroup/SwapsGroup.styles.ts +10 -1
  261. package/src/components/SwapsGroup/SwapsGroup.tsx +3 -5
  262. package/src/components/TokenList/TokenList.helpers.ts +2 -2
  263. package/src/components/TokenList/TokenList.styles.ts +74 -38
  264. package/src/components/TokenList/TokenList.tsx +30 -20
  265. package/src/components/TokenList/TokenList.types.ts +4 -10
  266. package/src/components/TokenList/index.ts +0 -1
  267. package/src/components/UpdateUrl.tsx +4 -5
  268. package/src/constants/errors.ts +9 -5
  269. package/src/constants/index.ts +1 -0
  270. package/src/constants/navigationRoutes.ts +7 -8
  271. package/src/constants/searchParams.ts +1 -0
  272. package/src/containers/App/App.styles.ts +18 -0
  273. package/src/containers/App/App.tsx +52 -0
  274. package/src/containers/App/index.ts +1 -0
  275. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +17 -1
  276. package/src/containers/QuoteInfo/QuoteInfo.tsx +46 -44
  277. package/src/containers/QuoteInfo/QuoteInfo.types.ts +3 -0
  278. package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +25 -31
  279. package/src/containers/Wallets/Wallets.types.ts +12 -0
  280. package/src/containers/Wallets/index.ts +1 -0
  281. package/src/containers/Widget/Widget.tsx +19 -0
  282. package/src/containers/Widget/Widget.types.ts +5 -0
  283. package/src/containers/Widget/index.ts +2 -0
  284. package/src/containers/WidgetInfo/WidgetInfo.helpers.ts +64 -0
  285. package/src/containers/WidgetInfo/WidgetInfo.tsx +62 -0
  286. package/src/containers/WidgetInfo/WidgetInfo.types.ts +21 -0
  287. package/src/containers/WidgetInfo/index.ts +1 -0
  288. package/src/containers/WidgetProvider/WidgetProvider.tsx +28 -0
  289. package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
  290. package/src/containers/WidgetProvider/index.ts +1 -0
  291. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +15 -11
  292. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +21 -20
  293. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +1 -1
  294. package/src/hooks/useForceAutoConnect.ts +27 -0
  295. package/src/hooks/useLanguage.ts +4 -5
  296. package/src/hooks/useNavigateBack.ts +3 -52
  297. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
  298. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +37 -7
  299. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +60 -0
  300. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +78 -3
  301. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +15 -6
  302. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
  303. package/src/hooks/useSwapInput.ts +86 -28
  304. package/src/hooks/useSyncStoresWithConfig.ts +18 -5
  305. package/src/hooks/useTheme.ts +4 -5
  306. package/src/index.ts +53 -5
  307. package/src/pages/ConfirmSwapPage.tsx +61 -33
  308. package/src/pages/HistoryPage.tsx +2 -7
  309. package/src/pages/Home.tsx +55 -81
  310. package/src/pages/LanguagePage.tsx +0 -5
  311. package/src/pages/LiquiditySourcePage.tsx +3 -7
  312. package/src/pages/SelectBlockchainPage.tsx +26 -18
  313. package/src/pages/SelectSwapItemsPage.tsx +13 -26
  314. package/src/pages/SettingsPage.tsx +26 -17
  315. package/src/pages/SwapDetailsPage.tsx +3 -4
  316. package/src/pages/ThemePage.tsx +2 -7
  317. package/src/pages/WalletsPage.tsx +5 -8
  318. package/src/services/httpService.ts +1 -1
  319. package/src/store/AppStore.tsx +7 -1
  320. package/src/store/app.ts +31 -5
  321. package/src/store/quote.ts +3 -4
  322. package/src/store/slices/config.ts +1 -0
  323. package/src/store/slices/data.ts +10 -6
  324. package/src/store/slices/settings.ts +168 -0
  325. package/src/store/wallets.ts +57 -29
  326. package/src/types/config.ts +48 -3
  327. package/src/types/swap.ts +4 -13
  328. package/src/types/wallets.ts +18 -1
  329. package/src/utils/colors.ts +2 -1
  330. package/src/utils/configs.ts +2 -1
  331. package/src/utils/date.ts +1 -1
  332. package/src/utils/meta.ts +8 -1
  333. package/src/utils/providers.ts +8 -5
  334. package/src/utils/queue.ts +2 -2
  335. package/src/utils/quote.ts +7 -7
  336. package/src/utils/settings.ts +11 -5
  337. package/src/utils/swap.ts +46 -40
  338. package/src/utils/time.ts +1 -1
  339. package/src/utils/wallets.ts +127 -144
  340. package/dist/Wallets.d.ts +0 -18
  341. package/dist/Wallets.d.ts.map +0 -1
  342. package/dist/Widget.d.ts +0 -9
  343. package/dist/Widget.d.ts.map +0 -1
  344. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +0 -4
  345. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +0 -1
  346. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +0 -4
  347. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +0 -1
  348. package/dist/components/Quote/QuoteSkeleton.d.ts.map +0 -1
  349. package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +0 -1
  350. package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +0 -1
  351. package/dist/store/settings.d.ts +0 -82
  352. package/dist/store/settings.d.ts.map +0 -1
  353. package/src/Widget.tsx +0 -106
  354. package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +0 -41
  355. package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +0 -3
  356. package/src/components/Quote/QuoteSkeleton.styles.ts +0 -110
  357. package/src/components/Quote/QuoteSkeleton.tsx +0 -108
  358. package/src/store/settings.ts +0 -161
  359. /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.d.ts +0 -0
  360. /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.d.ts +0 -0
  361. /package/src/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.ts +0 -0
@@ -1,6 +1,4 @@
1
1
  /* eslint-disable @typescript-eslint/no-magic-numbers */
2
- import type { WidgetTheme } from '../types';
3
-
4
2
  import {
5
3
  createTheme,
6
4
  darkTheme as defaultDarkTheme,
@@ -8,7 +6,8 @@ import {
8
6
  } from '@rango-dev/ui';
9
7
  import { useEffect, useState } from 'react';
10
8
 
11
- import { useSettingsStore } from '../store/settings';
9
+ import { useAppStore } from '../store/AppStore';
10
+ import { type WidgetTheme } from '../types';
12
11
  import {
13
12
  DEFAULT_FONT_FAMILY,
14
13
  DEFAULT_PRIMARY_RADIUS,
@@ -26,8 +25,8 @@ export function useTheme(props: WidgetTheme) {
26
25
  } = props;
27
26
 
28
27
  const [OSTheme, setOSTheme] = useState('light');
29
- const theme = useSettingsStore.use.theme();
30
- const setTheme = useSettingsStore.use.setTheme();
28
+
29
+ const { setTheme, theme } = useAppStore();
31
30
 
32
31
  const { dark, light } = customizedThemeTokens(colors);
33
32
 
package/src/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { WidgetProps } from './containers/Widget';
2
+ import type { ConnectedWallet } from './store/wallets';
1
3
  import type {
2
4
  BlockchainAndTokenConfig,
3
5
  WidgetColors,
@@ -5,10 +7,12 @@ import type {
5
7
  WidgetConfig,
6
8
  WidgetTheme,
7
9
  } from './types';
8
- import type { WidgetProps } from './Widget';
9
10
  import type {
11
+ EventSeverity,
12
+ PendingSwapWithQueueID,
10
13
  Route,
11
14
  RouteEvent,
15
+ RouteExecutionEvents,
12
16
  RouteFailedEvent,
13
17
  RouteStartedEvent,
14
18
  RouteSucceededEvent,
@@ -27,7 +31,16 @@ import type {
27
31
  EventHandler as HandleWalletsUpdate,
28
32
  ProviderInterface,
29
33
  } from '@rango-dev/wallets-react';
30
- import type { WalletType } from '@rango-dev/wallets-shared';
34
+ import type {
35
+ WalletInfo,
36
+ WalletState,
37
+ WalletType,
38
+ } from '@rango-dev/wallets-shared';
39
+ import type {
40
+ PendingSwap,
41
+ PendingSwapNetworkStatus,
42
+ PendingSwapStep,
43
+ } from 'rango-types';
31
44
 
32
45
  import {
33
46
  MainEvents,
@@ -37,10 +50,18 @@ import {
37
50
  StepExecutionEventStatus,
38
51
  useEvents as useWidgetEvents,
39
52
  } from '@rango-dev/queue-manager-rango-preset';
40
- import { useWallets } from '@rango-dev/wallets-react';
53
+ import {
54
+ readAccountAddress,
55
+ useWallets,
56
+ Events as WalletEvents,
57
+ } from '@rango-dev/wallets-react';
58
+ import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
41
59
 
42
- import { WidgetWallets } from './Wallets';
43
- import { Widget } from './Widget';
60
+ import { WidgetWallets } from './containers/Wallets';
61
+ import { Widget } from './containers/Widget';
62
+ import { useWidget } from './containers/WidgetInfo';
63
+ import { WidgetProvider } from './containers/WidgetProvider';
64
+ import { customizedThemeTokens } from './utils/ui';
44
65
 
45
66
  export type {
46
67
  WidgetConfig,
@@ -67,15 +88,42 @@ export type {
67
88
  StepApprovalTxSucceededEvent,
68
89
  StepOutputRevealedEvent,
69
90
  HandleWalletsUpdate,
91
+ ConnectedWallet,
70
92
  };
71
93
  export {
72
94
  Widget,
95
+ /**
96
+ * @deprecated Use `WidgetProvider` instead. This component will be removed in future versions.
97
+ */
73
98
  WidgetWallets,
99
+ WidgetProvider,
100
+ useWidget,
74
101
  useWallets,
75
102
  useWidgetEvents,
103
+ customizedThemeTokens,
76
104
  MainEvents,
77
105
  RouteEventType,
78
106
  StepEventType,
79
107
  StepExecutionEventStatus,
80
108
  StepExecutionBlockedEventStatus,
81
109
  };
110
+
111
+ // Internal type exports for Rango
112
+ export type {
113
+ WalletState,
114
+ WalletInfo,
115
+ PendingSwap,
116
+ PendingSwapWithQueueID,
117
+ PendingSwapStep,
118
+ RouteExecutionEvents,
119
+ EventSeverity,
120
+ };
121
+
122
+ // Internal function and enum exports for Rango
123
+ export {
124
+ readAccountAddress,
125
+ Networks,
126
+ WalletEvents,
127
+ WalletTypes,
128
+ PendingSwapNetworkStatus,
129
+ };
@@ -9,6 +9,7 @@ import { useManager } from '@rango-dev/queue-manager-react';
9
9
  import {
10
10
  Alert,
11
11
  Button,
12
+ css,
12
13
  Divider,
13
14
  IconButton,
14
15
  RefreshIcon,
@@ -18,7 +19,7 @@ import {
18
19
  Typography,
19
20
  WalletIcon,
20
21
  } from '@rango-dev/ui';
21
- import React, { useEffect, useState } from 'react';
22
+ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
22
23
  import { flushSync } from 'react-dom';
23
24
  import { useNavigate } from 'react-router-dom';
24
25
 
@@ -30,6 +31,7 @@ import { navigationRoutes } from '../constants/navigationRoutes';
30
31
  import { getQuoteUpdateWarningMessage } from '../constants/warnings';
31
32
  import { QuoteInfo } from '../containers/QuoteInfo';
32
33
  import { useConfirmSwap } from '../hooks/useConfirmSwap';
34
+ import { useAppStore } from '../store/AppStore';
33
35
  import { useQuoteStore } from '../store/quote';
34
36
  import { useUiStore } from '../store/ui';
35
37
  import { useWalletsStore } from '../store/wallets';
@@ -39,18 +41,9 @@ import { getContainer } from '../utils/common';
39
41
  const Container = styled('div', {
40
42
  position: 'relative',
41
43
  width: '100%',
42
- '& .description': {
43
- display: 'flex',
44
- justifyContent: 'space-between',
45
- alignItems: 'center',
46
- paddingBottom: '$10',
47
- },
48
- '& .icon': {
49
- width: '$24',
50
- height: '$24',
51
- display: 'flex',
52
- justifyContent: 'center',
53
- alignItems: 'center',
44
+
45
+ '& .quote-update__alert': {
46
+ paddingTop: '$10',
54
47
  },
55
48
  });
56
49
 
@@ -58,16 +51,31 @@ const Buttons = styled('div', {
58
51
  width: '100%',
59
52
  display: 'flex',
60
53
  justifyContent: 'space-between',
61
- '& .confirm-button': {
62
- flexGrow: 1,
63
- paddingRight: '$10',
64
- },
65
54
  [`& ${IconButton}`]: {
66
55
  width: '$48',
67
56
  height: '$48',
68
57
  },
69
58
  });
70
59
 
60
+ const confirmBtnStyles = css({
61
+ flexGrow: 1,
62
+ paddingRight: '$10',
63
+ });
64
+
65
+ const iconStyles = css({
66
+ width: '$24',
67
+ height: '$24',
68
+ display: 'flex',
69
+ justifyContent: 'center',
70
+ alignItems: 'center',
71
+ });
72
+
73
+ const descriptionStyles = css({
74
+ display: 'flex',
75
+ justifyContent: 'space-between',
76
+ alignItems: 'center',
77
+ });
78
+
71
79
  export function ConfirmSwapPage() {
72
80
  //TODO: move component's logics to a custom hook
73
81
  const {
@@ -86,6 +94,8 @@ export function ConfirmSwapPage() {
86
94
  const showWalletsOnInit = !quoteWalletsConfirmed;
87
95
  const [showWallets, setShowWallets] = useState(false);
88
96
  const setSelectedSwap = useUiStore.use.setSelectedSwap();
97
+ const disabledLiquiditySources = useAppStore().disabledLiquiditySources;
98
+ const prevDisabledLiquiditySources = useRef(disabledLiquiditySources);
89
99
  const { manager } = useManager();
90
100
  const {
91
101
  fetch: confirmSwap,
@@ -119,12 +129,11 @@ export function ConfirmSwapPage() {
119
129
  { id: confirmSwapResult.swap.requestId }
120
130
  );
121
131
  setSelectedSwap(confirmSwapResult.swap.requestId);
122
- navigate(
123
- '/' + navigationRoutes.swaps + `/${confirmSwapResult.swap.requestId}`,
124
- {
125
- replace: true,
126
- }
127
- );
132
+
133
+ const swap_url = `../${navigationRoutes.swaps}/${confirmSwapResult.swap.requestId}`;
134
+ navigate(swap_url, {
135
+ replace: true,
136
+ });
128
137
  setTimeout(() => {
129
138
  setInputAmount('');
130
139
  }, 0);
@@ -152,13 +161,23 @@ export function ConfirmSwapPage() {
152
161
  swap: null,
153
162
  warnings: null,
154
163
  });
155
- confirmSwap({ selectedWallets })
164
+ confirmSwap({ selectedWallets, customDestination })
156
165
  .then((res) => {
157
166
  setConfirmSwapResult(res);
158
167
  })
159
168
  .catch((error) => console.error(error));
160
169
  };
161
170
 
171
+ useEffect(() => {
172
+ const disabledLiquiditySourceReset =
173
+ !!prevDisabledLiquiditySources.current.length &&
174
+ !disabledLiquiditySources.length;
175
+ if (disabledLiquiditySourceReset) {
176
+ void onRefresh();
177
+ }
178
+ prevDisabledLiquiditySources.current = disabledLiquiditySources;
179
+ }, [disabledLiquiditySources.length]);
180
+
162
181
  useEffect(() => {
163
182
  if (showWalletsOnInit) {
164
183
  cancelFetch();
@@ -238,12 +257,20 @@ export function ConfirmSwapPage() {
238
257
  connectedWallets.length,
239
258
  ]);
240
259
 
260
+ useLayoutEffect(() => {
261
+ if (!quote) {
262
+ navigate(`../`);
263
+ }
264
+ }, []);
265
+
241
266
  return (
242
267
  <Layout
243
268
  header={{
244
269
  title: i18n.t('Confirm Swap'),
245
- onBack: () => navigate(-1),
246
- hasConnectWallet: true,
270
+ onWallet: () => {
271
+ const wallets_url = `../${navigationRoutes.wallets}`;
272
+ navigate(wallets_url);
273
+ },
247
274
  suffix: (
248
275
  <Tooltip
249
276
  container={getContainer()}
@@ -252,7 +279,7 @@ export function ConfirmSwapPage() {
252
279
  <HeaderButton
253
280
  size="small"
254
281
  variant="ghost"
255
- onClick={() => navigate('/' + navigationRoutes.settings)}>
282
+ onClick={() => navigate('../' + navigationRoutes.settings)}>
256
283
  <SettingsIcon size={18} color="black" />
257
284
  </HeaderButton>
258
285
  </Tooltip>
@@ -260,7 +287,7 @@ export function ConfirmSwapPage() {
260
287
  }}
261
288
  footer={
262
289
  <Buttons>
263
- <div className="confirm-button">
290
+ <div className={confirmBtnStyles()}>
264
291
  <Button
265
292
  variant="contained"
266
293
  type="primary"
@@ -293,7 +320,7 @@ export function ConfirmSwapPage() {
293
320
  )}
294
321
 
295
322
  <Container>
296
- <div className="description">
323
+ <div className={descriptionStyles()}>
297
324
  <Typography variant="title" size="small">
298
325
  {i18n.t('You get')}
299
326
  </Typography>
@@ -302,7 +329,7 @@ export function ConfirmSwapPage() {
302
329
  variant="ghost"
303
330
  disabled={fetchingConfirmationQuote}
304
331
  onClick={onRefresh}>
305
- <div className="icon">
332
+ <div className={iconStyles()}>
306
333
  <RefreshIcon size={16} />
307
334
  </div>
308
335
  </Button>
@@ -314,7 +341,7 @@ export function ConfirmSwapPage() {
314
341
  </>
315
342
  )}
316
343
  {confirmSwapResult.warnings?.quoteUpdate && (
317
- <>
344
+ <div className="quote-update__alert">
318
345
  <Alert
319
346
  variant="alarm"
320
347
  type="warning"
@@ -325,13 +352,13 @@ export function ConfirmSwapPage() {
325
352
  )
326
353
  }
327
354
  />
328
- <Divider size={12} />
329
- </>
355
+ </div>
330
356
  )}
331
357
  <QuoteInfo
332
358
  quote={quote}
333
359
  type="swap-preview"
334
360
  expanded={true}
361
+ alertPosition="top"
335
362
  error={confirmSwapResult.error}
336
363
  loading={fetchingConfirmationQuote}
337
364
  warning={confirmSwapResult.warnings?.quote ?? null}
@@ -343,6 +370,7 @@ export function ConfirmSwapPage() {
343
370
  setShowQuoteWarningModal(false);
344
371
  await addNewSwap();
345
372
  }}
373
+ onChangeSettings={() => navigate('../' + navigationRoutes.settings)}
346
374
  />
347
375
  </Container>
348
376
  </Layout>
@@ -1,5 +1,4 @@
1
- import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
2
- import type { PendingSwapStep } from 'rango-types';
1
+ import type { PendingSwap, PendingSwapStep } from 'rango-types';
3
2
 
4
3
  import { i18n } from '@lingui/core';
5
4
  import { useManager } from '@rango-dev/queue-manager-react';
@@ -11,8 +10,6 @@ import { Layout } from '../components/Layout';
11
10
  import { SearchInput } from '../components/SearchInput';
12
11
  import { SwapsGroup } from '../components/SwapsGroup';
13
12
  import { NotFoundContainer } from '../components/SwapsGroup/SwapsGroup.styles';
14
- import { navigationRoutes } from '../constants/navigationRoutes';
15
- import { useNavigateBack } from '../hooks/useNavigateBack';
16
13
  import { useUiStore } from '../store/ui';
17
14
  import { groupSwapsByDate } from '../utils/date';
18
15
  import { containsText } from '../utils/numbers';
@@ -51,7 +48,6 @@ const isStepContainsText = (steps: PendingSwapStep[], value: string) => {
51
48
  export function HistoryPage() {
52
49
  const setSelectedSwap = useUiStore.use.setSelectedSwap();
53
50
  const navigate = useNavigate();
54
- const { navigateBackFrom } = useNavigateBack();
55
51
  const { manager, state } = useManager();
56
52
  const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
57
53
  const [searchedFor, setSearchedFor] = useState<string>('');
@@ -78,7 +74,6 @@ export function HistoryPage() {
78
74
  return (
79
75
  <Layout
80
76
  header={{
81
- onBack: () => navigateBackFrom(navigationRoutes.swaps),
82
77
  title: i18n.t('History'),
83
78
  }}>
84
79
  <Container>
@@ -108,7 +103,7 @@ export function HistoryPage() {
108
103
  list={filteredList}
109
104
  onSwapClick={(requestId) => {
110
105
  setSelectedSwap(requestId);
111
- navigate(`${requestId}`, { replace: true });
106
+ navigate(requestId);
112
107
  }}
113
108
  groupBy={groupSwapsByDate}
114
109
  isLoading={loading}
@@ -9,8 +9,6 @@ import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
9
9
  import { errorMessages } from '../constants/errors';
10
10
  import { navigationRoutes } from '../constants/navigationRoutes';
11
11
  import {
12
- BALANCE_MAX_DECIMALS,
13
- BALANCE_MIN_DECIMALS,
14
12
  PERCENTAGE_CHANGE_MAX_DECIMALS,
15
13
  PERCENTAGE_CHANGE_MIN_DECIMALS,
16
14
  TOKEN_AMOUNT_MAX_DECIMALS,
@@ -24,23 +22,18 @@ import { useAppStore } from '../store/AppStore';
24
22
  import { useQuoteStore } from '../store/quote';
25
23
  import { useUiStore } from '../store/ui';
26
24
  import { useWalletsStore } from '../store/wallets';
27
- import { ButtonState } from '../types';
28
25
  import { numberToString } from '../utils/numbers';
29
26
  import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
30
- import {
31
- canComputePriceImpact,
32
- getOutputRatio,
33
- getPercentageChange,
34
- getSwapButtonState,
35
- hasHighValueLoss,
36
- hasLimitError,
37
- } from '../utils/swap';
38
- import { getBalanceFromWallet } from '../utils/wallets';
27
+ import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
28
+ import { formatBalance, isFetchingBalance } from '../utils/wallets';
39
29
 
40
30
  const Container = styled('div', {
41
31
  display: 'flex',
42
32
  flexDirection: 'column',
43
33
  overflowY: 'visible',
34
+ '& .quote__container': {
35
+ paddingTop: '$2',
36
+ },
44
37
  });
45
38
 
46
39
  const FromContainer = styled('div', {
@@ -78,16 +71,16 @@ export function Home() {
78
71
 
79
72
  const fetchMetaStatus = useAppStore().fetchStatus;
80
73
 
81
- const connectedWallets = useWalletsStore.use.connectedWallets();
74
+ const { connectedWallets, getBalanceFor } = useWalletsStore();
82
75
  const setCurrentPage = useUiStore.use.setCurrentPage();
83
76
  const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
84
77
  const layoutRef = useRef<HTMLDivElement>(null);
78
+ const fetchingBalance =
79
+ !!fromBlockchain &&
80
+ isFetchingBalance(connectedWallets, fromBlockchain.name);
85
81
 
86
82
  const needsToWarnEthOnPath = false;
87
83
 
88
- const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
89
- const highValueLoss = hasHighValueLoss(inputUsdValue, outToInRatio);
90
-
91
84
  const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
92
85
  quote,
93
86
  inputAmount,
@@ -99,48 +92,26 @@ export function Home() {
99
92
  inputAmount,
100
93
  outputUsdValue
101
94
  );
102
- const swapButtonState = getSwapButtonState(
95
+
96
+ const swapButtonState = getSwapButtonState({
103
97
  fetchMetaStatus,
104
- connectedWallets,
105
98
  fetchingQuote,
99
+ inputAmount,
106
100
  quote,
107
- hasLimitError(quote),
108
- highValueLoss,
109
- priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed,
101
+ anyWalletConnected: connectedWallets.length > 0,
102
+ error: quoteError,
103
+ warning: quoteWarning,
110
104
  needsToWarnEthOnPath,
111
- inputAmount
112
- );
105
+ });
113
106
 
114
- const tokenBalance =
115
- !!fromBlockchain && !!fromToken
116
- ? numberToString(
117
- getBalanceFromWallet(
118
- connectedWallets,
119
- fromBlockchain?.name,
120
- fromToken?.symbol,
121
- fromToken?.address
122
- )?.amount || '0',
123
- BALANCE_MIN_DECIMALS,
124
- BALANCE_MAX_DECIMALS
125
- )
126
- : '0';
107
+ const fromTokenBalance = fromToken ? getBalanceFor(fromToken) : null;
108
+
109
+ const fromTokenFormattedBalance =
110
+ formatBalance(fromTokenBalance)?.amount ?? '0';
127
111
 
128
112
  const tokenBalanceReal =
129
113
  !!fromBlockchain && !!fromToken
130
- ? numberToString(
131
- getBalanceFromWallet(
132
- connectedWallets,
133
- fromBlockchain?.name,
134
- fromToken?.symbol,
135
- fromToken?.address
136
- )?.amount || '0',
137
- getBalanceFromWallet(
138
- connectedWallets,
139
- fromBlockchain?.name,
140
- fromToken?.symbol,
141
- fromToken?.address
142
- )?.decimal
143
- )
114
+ ? numberToString(fromTokenBalance?.amount, fromTokenBalance?.decimals)
144
115
  : '0';
145
116
 
146
117
  useEffect(() => {
@@ -152,10 +123,8 @@ export function Home() {
152
123
  const percentageChange =
153
124
  !inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
154
125
  ? null
155
- : getPercentageChange(
156
- inputUsdValue.toString(),
157
- outputUsdValue.toString()
158
- );
126
+ : getPriceImpact(inputUsdValue.toString(), outputUsdValue.toString());
127
+
159
128
  return (
160
129
  <Layout
161
130
  ref={layoutRef}
@@ -167,14 +136,13 @@ export function Home() {
167
136
  size="large"
168
137
  disabled={swapButtonState.disabled}
169
138
  prefix={
170
- !swapButtonState.disabled &&
171
- swapButtonState.hasWarning && <WarningIcon />
139
+ swapButtonState.action === 'confirm-warning' && <WarningIcon />
172
140
  }
173
141
  fullWidth
174
142
  onClick={() => {
175
- if (swapButtonState.state === ButtonState.WAITFORCONNECTING) {
143
+ if (swapButtonState.action === 'connect-wallet') {
176
144
  navigate(navigationRoutes.wallets);
177
- } else if (quoteWarning) {
145
+ } else if (swapButtonState.action === 'confirm-warning') {
178
146
  setShowQuoteWarningModal(true);
179
147
  } else {
180
148
  navigate(navigationRoutes.confirmSwap);
@@ -184,7 +152,10 @@ export function Home() {
184
152
  </Button>
185
153
  }
186
154
  header={{
187
- hasConnectWallet: true,
155
+ onWallet: () => {
156
+ navigate(navigationRoutes.wallets);
157
+ },
158
+ hasBackButton: false,
188
159
  title: i18n.t('Swap'),
189
160
  suffix: (
190
161
  <HomeButtons
@@ -200,11 +171,9 @@ export function Home() {
200
171
  <FromContainer>
201
172
  <SwapInput
202
173
  label={i18n.t('From')}
203
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
204
- //@ts-ignore
205
174
  mode="From"
206
175
  onInputChange={setInputAmount}
207
- balance={tokenBalance}
176
+ balance={fromTokenFormattedBalance}
208
177
  chain={{
209
178
  displayName: fromBlockchain?.displayName || '',
210
179
  image: fromBlockchain?.logo || '',
@@ -213,7 +182,7 @@ export function Home() {
213
182
  displayName: fromToken?.symbol || '',
214
183
  image: fromToken?.image || '',
215
184
  }}
216
- onClickToken={() => navigate('from-swap')}
185
+ onClickToken={() => navigate(navigationRoutes.fromSwap)}
217
186
  price={{
218
187
  value: inputAmount,
219
188
  usdValue: priceImpactInputCanNotBeComputed
@@ -229,8 +198,9 @@ export function Home() {
229
198
  }}
230
199
  disabled={fetchMetaStatus === 'failed'}
231
200
  loading={fetchMetaStatus === 'loading'}
201
+ loadingBalance={fetchingBalance}
232
202
  onSelectMaxBalance={() => {
233
- if (tokenBalance !== '0') {
203
+ if (fromTokenFormattedBalance !== '0') {
234
204
  setInputAmount(tokenBalanceReal.split(',').join(''));
235
205
  }
236
206
  }}
@@ -241,6 +211,7 @@ export function Home() {
241
211
  sharpBottomStyle={!!quote?.result || fetchingQuote}
242
212
  label={i18n.t('To')}
243
213
  mode="To"
214
+ fetchingQuote={fetchingQuote}
244
215
  chain={{
245
216
  displayName: toBlockchain?.displayName || '',
246
217
  image: toBlockchain?.logo || '',
@@ -272,27 +243,30 @@ export function Home() {
272
243
  ? errorMessages().unknownPriceError.impactTitle
273
244
  : undefined,
274
245
  }}
275
- onClickToken={() => navigate('to-swap')}
246
+ onClickToken={() => navigate(navigationRoutes.toSwap)}
276
247
  disabled={fetchMetaStatus === 'failed'}
277
248
  loading={fetchMetaStatus === 'loading'}
278
249
  />
279
250
  </InputsContainer>
280
- <QuoteInfo
281
- quote={quote}
282
- loading={fetchingQuote}
283
- error={quoteError}
284
- warning={quoteWarning}
285
- type="basic"
286
- refetchQuote={fetchQuote}
287
- showWarningModal={showQuoteWarningModal}
288
- onOpenWarningModal={() => setShowQuoteWarningModal(true)}
289
- onCloseWarningModal={() => setShowQuoteWarningModal(false)}
290
- onConfirmWarningModal={() => {
291
- setShowQuoteWarningModal(false);
292
- setQuoteWarningsConfirmed(true);
293
- navigate(navigationRoutes.confirmSwap);
294
- }}
295
- />
251
+ <div className="quote__container">
252
+ <QuoteInfo
253
+ quote={quote}
254
+ loading={fetchingQuote}
255
+ error={quoteError}
256
+ warning={quoteWarning}
257
+ type="basic"
258
+ refetchQuote={fetchQuote}
259
+ showWarningModal={showQuoteWarningModal}
260
+ onOpenWarningModal={() => setShowQuoteWarningModal(true)}
261
+ onCloseWarningModal={() => setShowQuoteWarningModal(false)}
262
+ onConfirmWarningModal={() => {
263
+ setShowQuoteWarningModal(false);
264
+ setQuoteWarningsConfirmed(true);
265
+ navigate(navigationRoutes.confirmSwap);
266
+ }}
267
+ onChangeSettings={() => navigate(navigationRoutes.settings)}
268
+ />
269
+ </div>
296
270
  </Container>
297
271
  </Layout>
298
272
  );
@@ -10,13 +10,9 @@ import React from 'react';
10
10
 
11
11
  import { Layout } from '../components/Layout';
12
12
  import { SettingsContainer } from '../components/SettingsContainer';
13
- import { navigationRoutes } from '../constants/navigationRoutes';
14
13
  import { useLanguage } from '../hooks/useLanguage';
15
- import { useNavigateBack } from '../hooks/useNavigateBack';
16
14
 
17
15
  export function LanguagePage() {
18
- const { navigateBackFrom } = useNavigateBack();
19
-
20
16
  const { activeLanguage, changeLanguage, languages } = useLanguage();
21
17
 
22
18
  const languageList = languages.map((languageItem) => {
@@ -38,7 +34,6 @@ export function LanguagePage() {
38
34
  return (
39
35
  <Layout
40
36
  header={{
41
- onBack: () => navigateBackFrom(navigationRoutes.settings),
42
37
  title: i18n.t('Language'),
43
38
  }}>
44
39
  <SettingsContainer>