@rango-dev/widget-embedded 0.17.1-next.2 → 0.17.1-next.21

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 (374) hide show
  1. package/dist/QueueManager.d.ts +5 -2
  2. package/dist/QueueManager.d.ts.map +1 -1
  3. package/dist/components/AppRouter.d.ts +0 -2
  4. package/dist/components/AppRouter.d.ts.map +1 -1
  5. package/dist/components/AppRoutes.d.ts +1 -6
  6. package/dist/components/AppRoutes.d.ts.map +1 -1
  7. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -3
  8. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  9. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
  10. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +1 -3
  12. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
  13. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  14. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +1 -4
  15. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  16. package/dist/components/Layout/Layout.d.ts.map +1 -1
  17. package/dist/components/Layout/Layout.types.d.ts +2 -2
  18. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  19. package/dist/components/NoResult/NoResult.d.ts +4 -0
  20. package/dist/components/NoResult/NoResult.d.ts.map +1 -0
  21. package/dist/components/NoResult/NoResult.helpers.d.ts +4 -0
  22. package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -0
  23. package/dist/components/{NoRoutes/NoRoutes.styles.d.ts → NoResult/NoResult.styles.d.ts} +1 -1
  24. package/dist/components/{NoRoutes/NoRoutes.styles.d.ts.map → NoResult/NoResult.styles.d.ts.map} +1 -1
  25. package/dist/components/{NoRoutes/NoRoutes.types.d.ts → NoResult/NoResult.types.d.ts} +3 -3
  26. package/dist/components/NoResult/NoResult.types.d.ts.map +1 -0
  27. package/dist/components/NoResult/index.d.ts +2 -0
  28. package/dist/components/NoResult/index.d.ts.map +1 -0
  29. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  30. package/dist/components/Quote/Quote.d.ts +4 -0
  31. package/dist/components/Quote/Quote.d.ts.map +1 -0
  32. package/dist/components/Quote/Quote.styles.d.ts +1588 -0
  33. package/dist/components/Quote/Quote.styles.d.ts.map +1 -0
  34. package/dist/components/Quote/Quote.types.d.ts +21 -0
  35. package/dist/components/Quote/Quote.types.d.ts.map +1 -0
  36. package/dist/components/Quote/QuoteSkeleton.d.ts +4 -0
  37. package/dist/components/Quote/QuoteSkeleton.d.ts.map +1 -0
  38. package/dist/components/Quote/QuoteSkeleton.styles.d.ts +319 -0
  39. package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +1 -0
  40. package/dist/components/Quote/QuoteSkeleton.types.d.ts +6 -0
  41. package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +1 -0
  42. package/dist/components/Quote/QuoteSummary.d.ts +11 -0
  43. package/dist/components/Quote/QuoteSummary.d.ts.map +1 -0
  44. package/dist/components/Quote/QuoteSummary.styles.d.ts +158 -0
  45. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
  46. package/dist/components/Quote/index.d.ts +4 -0
  47. package/dist/components/Quote/index.d.ts.map +1 -0
  48. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +11 -0
  49. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -0
  50. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +4 -0
  51. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +1 -0
  52. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +4 -0
  53. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -0
  54. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +9 -0
  55. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -0
  56. package/dist/components/{RouteErrors/RouteErrors.styles.d.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts} +1 -1
  57. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -0
  58. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +23 -0
  59. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -0
  60. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +11 -0
  61. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -0
  62. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +11 -0
  63. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -0
  64. package/dist/components/QuoteWarningsAndErrors/index.d.ts +2 -0
  65. package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +1 -0
  66. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  67. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  68. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.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.map +1 -1
  71. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  72. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  73. package/dist/components/UpdateUrl.d.ts +1 -6
  74. package/dist/components/UpdateUrl.d.ts.map +1 -1
  75. package/dist/components/WidgetEvents.d.ts.map +1 -1
  76. package/dist/constants/errors.d.ts +4 -4
  77. package/dist/constants/errors.d.ts.map +1 -1
  78. package/dist/constants/index.d.ts +1 -0
  79. package/dist/constants/index.d.ts.map +1 -1
  80. package/dist/constants/messages.d.ts +1 -1
  81. package/dist/constants/navigationRoutes.d.ts +1 -2
  82. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  83. package/dist/constants/searchParams.d.ts +2 -1
  84. package/dist/constants/searchParams.d.ts.map +1 -1
  85. package/dist/constants/warnings.d.ts +2 -2
  86. package/dist/constants/warnings.d.ts.map +1 -1
  87. package/dist/containers/App/App.d.ts +3 -0
  88. package/dist/containers/App/App.d.ts.map +1 -0
  89. package/dist/containers/App/App.styles.d.ts +158 -0
  90. package/dist/containers/App/App.styles.d.ts.map +1 -0
  91. package/dist/containers/App/index.d.ts +2 -0
  92. package/dist/containers/App/index.d.ts.map +1 -0
  93. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +4 -0
  94. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -0
  95. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +788 -0
  96. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -0
  97. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +20 -0
  98. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -0
  99. package/dist/containers/QuoteInfo/index.d.ts +2 -0
  100. package/dist/containers/QuoteInfo/index.d.ts.map +1 -0
  101. package/dist/containers/Wallets/Wallets.d.ts +6 -0
  102. package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
  103. package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
  104. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
  105. package/dist/containers/Wallets/index.d.ts +2 -0
  106. package/dist/containers/Wallets/index.d.ts.map +1 -0
  107. package/dist/containers/Widget/Widget.d.ts +5 -0
  108. package/dist/containers/Widget/Widget.d.ts.map +1 -0
  109. package/dist/containers/Widget/Widget.types.d.ts +5 -0
  110. package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
  111. package/dist/containers/Widget/index.d.ts +3 -0
  112. package/dist/containers/Widget/index.d.ts.map +1 -0
  113. package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
  114. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
  115. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +14 -0
  116. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
  117. package/dist/containers/WidgetInfo/index.d.ts +2 -0
  118. package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
  119. package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
  120. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
  121. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
  122. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
  123. package/dist/containers/WidgetProvider/index.d.ts +2 -0
  124. package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
  125. package/dist/hooks/useConfirmSwap/index.d.ts +2 -0
  126. package/dist/hooks/useConfirmSwap/index.d.ts.map +1 -0
  127. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +3 -0
  128. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -0
  129. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +19 -0
  130. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -0
  131. package/dist/hooks/{useConfirmSwap.d.ts → useConfirmSwap/useConfirmSwap.types.d.ts} +5 -7
  132. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -0
  133. package/dist/hooks/{useFetchBestRoute.d.ts → useFetchQuote.d.ts} +3 -3
  134. package/dist/hooks/useFetchQuote.d.ts.map +1 -0
  135. package/dist/hooks/useForceAutoConnect.d.ts +2 -0
  136. package/dist/hooks/useForceAutoConnect.d.ts.map +1 -0
  137. package/dist/hooks/useLanguage.d.ts +1 -1
  138. package/dist/hooks/useLanguage.d.ts.map +1 -1
  139. package/dist/hooks/useNavigateBack.d.ts +1 -3
  140. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  141. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +1 -1
  142. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts +2 -2
  143. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -1
  144. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +5 -7
  145. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
  146. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +1 -0
  147. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
  148. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +5 -1
  149. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
  150. package/dist/hooks/useSwapInput.d.ts +4 -2
  151. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  152. package/dist/hooks/useSyncStoresWithConfig.d.ts +1 -2
  153. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  154. package/dist/hooks/useWalletList.d.ts.map +1 -1
  155. package/dist/index.d.ts +13 -5
  156. package/dist/index.d.ts.map +1 -1
  157. package/dist/index.js +1 -1
  158. package/dist/index.js.map +4 -4
  159. package/dist/pages/ConfirmSwapPage.d.ts +1 -6
  160. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  161. package/dist/pages/HistoryPage.d.ts.map +1 -1
  162. package/dist/pages/Home.d.ts.map +1 -1
  163. package/dist/pages/LanguagePage.d.ts.map +1 -1
  164. package/dist/pages/LiquiditySourcePage.d.ts +1 -2
  165. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  166. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  167. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  168. package/dist/pages/SettingsPage.d.ts +1 -6
  169. package/dist/pages/SettingsPage.d.ts.map +1 -1
  170. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  171. package/dist/pages/ThemePage.d.ts.map +1 -1
  172. package/dist/pages/WalletsPage.d.ts +1 -8
  173. package/dist/pages/WalletsPage.d.ts.map +1 -1
  174. package/dist/store/AppStore.d.ts +11 -0
  175. package/dist/store/AppStore.d.ts.map +1 -0
  176. package/dist/store/app.d.ts +5 -23
  177. package/dist/store/app.d.ts.map +1 -1
  178. package/dist/store/{bestRoute.d.ts → quote.d.ts} +39 -27
  179. package/dist/store/quote.d.ts.map +1 -0
  180. package/dist/store/settings.d.ts +3 -2
  181. package/dist/store/settings.d.ts.map +1 -1
  182. package/dist/store/slices/config.d.ts +3 -2
  183. package/dist/store/slices/config.d.ts.map +1 -1
  184. package/dist/store/slices/data.d.ts +3 -0
  185. package/dist/store/slices/data.d.ts.map +1 -1
  186. package/dist/store/wallets.d.ts +5 -4
  187. package/dist/store/wallets.d.ts.map +1 -1
  188. package/dist/types/config.d.ts +19 -5
  189. package/dist/types/config.d.ts.map +1 -1
  190. package/dist/types/index.d.ts +1 -1
  191. package/dist/types/index.d.ts.map +1 -1
  192. package/dist/types/quote.d.ts +82 -0
  193. package/dist/types/quote.d.ts.map +1 -0
  194. package/dist/types/swap.d.ts +3 -13
  195. package/dist/types/swap.d.ts.map +1 -1
  196. package/dist/utils/colors.d.ts.map +1 -1
  197. package/dist/utils/configs.d.ts +1 -0
  198. package/dist/utils/configs.d.ts.map +1 -1
  199. package/dist/utils/meta.d.ts +2 -1
  200. package/dist/utils/meta.d.ts.map +1 -1
  201. package/dist/utils/numbers.d.ts +1 -1
  202. package/dist/utils/numbers.d.ts.map +1 -1
  203. package/dist/utils/{routing.d.ts → quote.d.ts} +16 -12
  204. package/dist/utils/quote.d.ts.map +1 -0
  205. package/dist/utils/settings.d.ts +3 -2
  206. package/dist/utils/settings.d.ts.map +1 -1
  207. package/dist/utils/swap.d.ts +34 -23
  208. package/dist/utils/swap.d.ts.map +1 -1
  209. package/dist/utils/wallets.d.ts +2 -2
  210. package/dist/utils/wallets.d.ts.map +1 -1
  211. package/package.json +6 -6
  212. package/src/QueueManager.tsx +18 -17
  213. package/src/components/AppRouter.tsx +8 -32
  214. package/src/components/AppRoutes.tsx +57 -69
  215. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  216. package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
  217. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
  218. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +39 -45
  219. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -3
  220. package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
  221. package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
  222. package/src/components/Layout/Layout.tsx +10 -7
  223. package/src/components/Layout/Layout.types.ts +2 -2
  224. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
  225. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
  226. package/src/components/{NoRoutes/NoRoutes.helper.ts → NoResult/NoResult.helpers.ts} +23 -16
  227. package/src/components/{NoRoutes/NoRoutes.styles.ts → NoResult/NoResult.styles.ts} +2 -0
  228. package/src/components/{NoRoutes/NoRoutes.tsx → NoResult/NoResult.tsx} +10 -12
  229. package/src/components/{NoRoutes/NoRoutes.types.ts → NoResult/NoResult.types.ts} +3 -2
  230. package/src/components/NoResult/index.ts +1 -0
  231. package/src/components/NotificationContent/NotificationContent.tsx +5 -3
  232. package/src/components/Quote/Quote.styles.ts +239 -0
  233. package/src/components/Quote/Quote.tsx +413 -0
  234. package/src/components/Quote/Quote.types.ts +15 -0
  235. package/src/components/Quote/QuoteSkeleton.styles.ts +110 -0
  236. package/src/components/Quote/QuoteSkeleton.tsx +108 -0
  237. package/src/components/Quote/QuoteSkeleton.types.ts +5 -0
  238. package/src/components/Quote/QuoteSummary.styles.ts +15 -0
  239. package/src/components/Quote/QuoteSummary.tsx +46 -0
  240. package/src/components/Quote/index.ts +3 -0
  241. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +107 -0
  242. package/src/components/{RouteErrors/RouteErrorsModalItem.tsx → QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx} +4 -4
  243. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +74 -0
  244. package/src/components/{RouteErrors/RouteErrors.styles.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts} +8 -1
  245. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +103 -0
  246. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +25 -0
  247. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +77 -0
  248. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +38 -0
  249. package/src/components/QuoteWarningsAndErrors/index.ts +1 -0
  250. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -4
  251. package/src/components/SwapDetails/SwapDetails.tsx +17 -24
  252. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
  253. package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
  254. package/src/components/SwapsGroup/SwapsGroup.styles.ts +8 -1
  255. package/src/components/SwapsGroup/SwapsGroup.tsx +0 -2
  256. package/src/components/SwitchFromAndTo.tsx +2 -2
  257. package/src/components/TokenList/TokenList.styles.ts +14 -2
  258. package/src/components/TokenList/TokenList.tsx +6 -7
  259. package/src/components/UpdateUrl.tsx +36 -29
  260. package/src/components/WidgetEvents.tsx +4 -2
  261. package/src/constants/errors.ts +17 -15
  262. package/src/constants/index.ts +1 -0
  263. package/src/constants/messages.ts +1 -1
  264. package/src/constants/navigationRoutes.ts +7 -8
  265. package/src/constants/searchParams.ts +1 -0
  266. package/src/constants/warnings.ts +7 -7
  267. package/src/containers/App/App.styles.ts +18 -0
  268. package/src/containers/App/App.tsx +55 -0
  269. package/src/containers/App/index.ts +1 -0
  270. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +31 -0
  271. package/src/containers/QuoteInfo/QuoteInfo.tsx +98 -0
  272. package/src/containers/QuoteInfo/QuoteInfo.types.ts +20 -0
  273. package/src/containers/QuoteInfo/index.ts +1 -0
  274. package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +40 -32
  275. package/src/containers/Wallets/Wallets.types.ts +12 -0
  276. package/src/containers/Wallets/index.ts +1 -0
  277. package/src/containers/Widget/Widget.tsx +19 -0
  278. package/src/containers/Widget/Widget.types.ts +5 -0
  279. package/src/containers/Widget/index.ts +2 -0
  280. package/src/containers/WidgetInfo/WidgetInfo.tsx +47 -0
  281. package/src/containers/WidgetInfo/WidgetInfo.types.ts +14 -0
  282. package/src/containers/WidgetInfo/index.ts +1 -0
  283. package/src/containers/WidgetProvider/WidgetProvider.tsx +28 -0
  284. package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
  285. package/src/containers/WidgetProvider/index.ts +1 -0
  286. package/src/hooks/useConfirmSwap/index.ts +1 -0
  287. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +172 -0
  288. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +137 -0
  289. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +19 -0
  290. package/src/hooks/{useFetchBestRoute.ts → useFetchQuote.ts} +3 -3
  291. package/src/hooks/useForceAutoConnect.ts +27 -0
  292. package/src/hooks/useLanguage.ts +2 -2
  293. package/src/hooks/useNavigateBack.ts +3 -52
  294. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
  295. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +37 -7
  296. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +60 -0
  297. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +78 -3
  298. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +13 -4
  299. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
  300. package/src/hooks/useSwapInput.ts +139 -46
  301. package/src/hooks/useSyncStoresWithConfig.ts +22 -19
  302. package/src/hooks/useWalletList.ts +3 -5
  303. package/src/index.ts +14 -3
  304. package/src/pages/ConfirmSwapPage.tsx +95 -248
  305. package/src/pages/HistoryPage.tsx +1 -5
  306. package/src/pages/Home.tsx +75 -270
  307. package/src/pages/LanguagePage.tsx +0 -5
  308. package/src/pages/LiquiditySourcePage.tsx +22 -35
  309. package/src/pages/SelectBlockchainPage.tsx +31 -24
  310. package/src/pages/SelectSwapItemsPage.tsx +9 -23
  311. package/src/pages/SettingsPage.tsx +8 -15
  312. package/src/pages/SwapDetailsPage.tsx +6 -7
  313. package/src/pages/ThemePage.tsx +0 -4
  314. package/src/pages/WalletsPage.tsx +4 -15
  315. package/src/services/httpService.ts +1 -1
  316. package/src/store/AppStore.tsx +35 -0
  317. package/src/store/app.ts +18 -6
  318. package/src/store/{bestRoute.ts → quote.ts} +68 -60
  319. package/src/store/settings.ts +7 -4
  320. package/src/store/slices/config.ts +25 -15
  321. package/src/store/slices/data.ts +64 -29
  322. package/src/store/wallets.ts +12 -8
  323. package/src/types/config.ts +20 -5
  324. package/src/types/index.ts +1 -1
  325. package/src/types/quote.ts +107 -0
  326. package/src/types/swap.ts +3 -12
  327. package/src/utils/colors.ts +2 -1
  328. package/src/utils/configs.ts +2 -1
  329. package/src/utils/meta.ts +8 -1
  330. package/src/utils/numbers.ts +1 -1
  331. package/src/utils/quote.ts +338 -0
  332. package/src/utils/settings.ts +8 -7
  333. package/src/utils/swap.ts +153 -116
  334. package/src/utils/wallets.ts +29 -17
  335. package/dist/Wallets.d.ts +0 -17
  336. package/dist/Wallets.d.ts.map +0 -1
  337. package/dist/Widget.d.ts +0 -9
  338. package/dist/Widget.d.ts.map +0 -1
  339. package/dist/components/NoRoutes/NoRoutes.d.ts +0 -4
  340. package/dist/components/NoRoutes/NoRoutes.d.ts.map +0 -1
  341. package/dist/components/NoRoutes/NoRoutes.helper.d.ts +0 -3
  342. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +0 -1
  343. package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +0 -1
  344. package/dist/components/NoRoutes/index.d.ts +0 -2
  345. package/dist/components/NoRoutes/index.d.ts.map +0 -1
  346. package/dist/components/RouteErrors/RouteErrors.d.ts +0 -4
  347. package/dist/components/RouteErrors/RouteErrors.d.ts.map +0 -1
  348. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +0 -1
  349. package/dist/components/RouteErrors/RouteErrors.types.d.ts +0 -24
  350. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +0 -1
  351. package/dist/components/RouteErrors/RouteErrorsModal.d.ts +0 -4
  352. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +0 -1
  353. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +0 -4
  354. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +0 -1
  355. package/dist/components/RouteErrors/index.d.ts +0 -2
  356. package/dist/components/RouteErrors/index.d.ts.map +0 -1
  357. package/dist/hooks/useConfirmSwap.d.ts.map +0 -1
  358. package/dist/hooks/useFetchBestRoute.d.ts.map +0 -1
  359. package/dist/store/bestRoute.d.ts.map +0 -1
  360. package/dist/store/meta.d.ts +0 -23
  361. package/dist/store/meta.d.ts.map +0 -1
  362. package/dist/types/routing.d.ts +0 -65
  363. package/dist/types/routing.d.ts.map +0 -1
  364. package/dist/utils/routing.d.ts.map +0 -1
  365. package/src/Widget.tsx +0 -119
  366. package/src/components/NoRoutes/index.ts +0 -1
  367. package/src/components/RouteErrors/RouteErrors.tsx +0 -79
  368. package/src/components/RouteErrors/RouteErrors.types.ts +0 -29
  369. package/src/components/RouteErrors/RouteErrorsModal.tsx +0 -129
  370. package/src/components/RouteErrors/index.ts +0 -1
  371. package/src/hooks/useConfirmSwap.ts +0 -303
  372. package/src/store/meta.ts +0 -39
  373. package/src/types/routing.ts +0 -77
  374. package/src/utils/routing.ts +0 -321
@@ -1,32 +1,16 @@
1
- import type { SwapResult } from 'rango-sdk';
2
-
3
1
  import { i18n } from '@lingui/core';
4
- import {
5
- Alert,
6
- BestRoute,
7
- BestRouteSkeleton,
8
- Button,
9
- Divider,
10
- styled,
11
- SwapInput,
12
- Typography,
13
- WarningIcon,
14
- } from '@rango-dev/ui';
2
+ import { Button, styled, SwapInput, WarningIcon } from '@rango-dev/ui';
15
3
  import React, { useEffect, useRef, useState } from 'react';
16
4
  import { useNavigate } from 'react-router-dom';
17
5
 
18
6
  import { HomeButtons } from '../components/HeaderButtons';
19
7
  import { Layout } from '../components/Layout';
20
- import { NoRoutes } from '../components/NoRoutes';
21
- import { RouteErrors } from '../components/RouteErrors';
22
8
  import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
23
9
  import { errorMessages } from '../constants/errors';
24
10
  import { navigationRoutes } from '../constants/navigationRoutes';
25
11
  import {
26
12
  BALANCE_MAX_DECIMALS,
27
13
  BALANCE_MIN_DECIMALS,
28
- GAS_FEE_MAX_DECIMALS,
29
- GAS_FEE_MIN_DECIMALS,
30
14
  PERCENTAGE_CHANGE_MAX_DECIMALS,
31
15
  PERCENTAGE_CHANGE_MIN_DECIMALS,
32
16
  TOKEN_AMOUNT_MAX_DECIMALS,
@@ -34,36 +18,24 @@ import {
34
18
  USD_VALUE_MAX_DECIMALS,
35
19
  USD_VALUE_MIN_DECIMALS,
36
20
  } from '../constants/routing';
21
+ import { QuoteInfo } from '../containers/QuoteInfo';
37
22
  import { useSwapInput } from '../hooks/useSwapInput';
38
- import { useBestRouteStore } from '../store/bestRoute';
39
- import { useMetaStore } from '../store/meta';
23
+ import { useAppStore } from '../store/AppStore';
24
+ import { useQuoteStore } from '../store/quote';
40
25
  import { useUiStore } from '../store/ui';
41
26
  import { useWalletsStore } from '../store/wallets';
42
- import { ButtonState } from '../types';
43
- import { getContainer } from '../utils/common';
44
- import { getBlockchainShortNameFor } from '../utils/meta';
45
- import {
46
- numberToString,
47
- secondsToString,
48
- totalArrivalTime,
49
- } from '../utils/numbers';
50
- import { getFormattedBestRoute, getPriceImpactLevel } from '../utils/routing';
51
- import {
52
- canComputePriceImpact,
53
- getOutputRatio,
54
- getPercentageChange,
55
- getSwapButtonState,
56
- getTotalFeeInUsd,
57
- hasLimitError,
58
- LimitErrorMessage,
59
- outputRatioHasWarning,
60
- } from '../utils/swap';
27
+ import { numberToString } from '../utils/numbers';
28
+ import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
29
+ import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
61
30
  import { getBalanceFromWallet } from '../utils/wallets';
62
31
 
63
32
  const Container = styled('div', {
64
33
  display: 'flex',
65
34
  flexDirection: 'column',
66
35
  overflowY: 'visible',
36
+ '& .quote__container': {
37
+ paddingTop: '$2',
38
+ },
67
39
  });
68
40
 
69
41
  const FromContainer = styled('div', {
@@ -76,27 +48,13 @@ const InputsContainer = styled('div', {
76
48
  gap: 5,
77
49
  alignSelf: 'stretch',
78
50
  });
79
-
80
- const BestRouteContainer = styled('div', {
81
- width: '100%',
82
- paddingTop: '$2',
83
- });
84
-
85
- const FooterStepAlarm = styled('div', {
86
- paddingBottom: '$15',
87
- });
88
-
89
- const FooterAlert = styled('div', {
90
- width: '100%',
91
- display: 'flex',
92
- });
93
-
94
51
  export function Home() {
95
52
  const navigate = useNavigate();
96
53
  const {
97
- fetch: refetchBestRoute,
98
- loading: fetchingBestRoute,
99
- error: bestRouteError,
54
+ fetch: fetchQuote,
55
+ loading: fetchingQuote,
56
+ error: quoteError,
57
+ warning: quoteWarning,
100
58
  } = useSwapInput();
101
59
  const {
102
60
  fromToken,
@@ -108,56 +66,42 @@ export function Home() {
108
66
  inputUsdValue,
109
67
  outputAmount,
110
68
  outputUsdValue,
111
- bestRoute,
112
- resetRouteWallets,
113
- } = useBestRouteStore();
69
+ quote,
70
+ resetQuoteWallets,
71
+ setQuoteWarningsConfirmed,
72
+ } = useQuoteStore();
114
73
 
115
- const {
116
- meta: { tokens, blockchains },
117
- loadingStatus: loadingMetaStatus,
118
- } = useMetaStore();
74
+ const fetchMetaStatus = useAppStore().fetchStatus;
119
75
 
120
76
  const connectedWallets = useWalletsStore.use.connectedWallets();
121
77
  const setCurrentPage = useUiStore.use.setCurrentPage();
122
- const [openWarningModal, setOpenWarningModal] = useState(false);
123
- const {
124
- fromAmountRangeError,
125
- swap: swapHasError,
126
- recommendation,
127
- } = LimitErrorMessage(bestRoute);
78
+ const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
128
79
  const layoutRef = useRef<HTMLDivElement>(null);
129
80
 
130
- const showBestRoute =
131
- !!Number(inputAmount) &&
132
- (!!bestRoute || fetchingBestRoute || !!bestRouteError);
133
-
134
81
  const needsToWarnEthOnPath = false;
135
82
 
136
- const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
137
- const highValueLoss = outputRatioHasWarning(inputUsdValue, outToInRatio);
138
-
139
83
  const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
140
- bestRoute,
84
+ quote,
141
85
  inputAmount,
142
86
  inputUsdValue
143
87
  );
144
88
 
145
89
  const priceImpactOutputCanNotBeComputed = !canComputePriceImpact(
146
- bestRoute,
90
+ quote,
147
91
  inputAmount,
148
92
  outputUsdValue
149
93
  );
150
- const swapButtonState = getSwapButtonState(
151
- loadingMetaStatus,
152
- connectedWallets,
153
- fetchingBestRoute,
154
- bestRoute,
155
- hasLimitError(bestRoute),
156
- highValueLoss,
157
- priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed,
94
+
95
+ const swapButtonState = getSwapButtonState({
96
+ fetchMetaStatus,
97
+ fetchingQuote,
98
+ inputAmount,
99
+ quote,
100
+ anyWalletConnected: connectedWallets.length > 0,
101
+ error: quoteError,
102
+ warning: quoteWarning,
158
103
  needsToWarnEthOnPath,
159
- inputAmount
160
- );
104
+ });
161
105
 
162
106
  const tokenBalance =
163
107
  !!fromBlockchain && !!fromToken
@@ -193,90 +137,14 @@ export function Home() {
193
137
 
194
138
  useEffect(() => {
195
139
  setCurrentPage(navigationRoutes.home);
196
- resetRouteWallets();
140
+ resetQuoteWallets();
197
141
  return setCurrentPage.bind(null, '');
198
142
  }, []);
199
143
 
200
144
  const percentageChange =
201
145
  !inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
202
146
  ? null
203
- : getPercentageChange(
204
- inputUsdValue.toNumber(),
205
- outputUsdValue.toNumber()
206
- );
207
-
208
- const getBestRouteSteps = (swaps: SwapResult[]) => {
209
- return swaps.map((swap, index) => ({
210
- swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
211
- from: {
212
- token: { displayName: swap.from.symbol, image: swap.from.logo },
213
- chain: {
214
- displayName:
215
- getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
216
- image: swap.from.blockchainLogo,
217
- },
218
- price: {
219
- value:
220
- index === 0
221
- ? numberToString(
222
- inputAmount,
223
- TOKEN_AMOUNT_MIN_DECIMALS,
224
- TOKEN_AMOUNT_MAX_DECIMALS
225
- )
226
- : swap.fromAmount,
227
- },
228
- },
229
- to: {
230
- token: { displayName: swap.to.symbol, image: swap.to.logo },
231
- chain: {
232
- displayName:
233
- getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
234
- image: swap.to.blockchainLogo,
235
- },
236
- price: {
237
- value: swap.toAmount,
238
- },
239
- },
240
- alerts:
241
- swap.swapperId === swapHasError?.swapperId ? (
242
- <FooterStepAlarm>
243
- <Alert
244
- type="error"
245
- title={recommendation}
246
- footer={
247
- <FooterAlert>
248
- <Typography size="xsmall" variant="body" color="neutral700">
249
- {fromAmountRangeError}
250
- </Typography>
251
- <Divider direction="horizontal" size={8} />
252
- <Typography size="xsmall" variant="body" color="neutral700">
253
- |
254
- </Typography>
255
- <Divider direction="horizontal" size={8} />
256
- <Typography size="xsmall" variant="body" color="neutral700">
257
- {i18n.t({
258
- id: 'Yours: {amount} {symbol}',
259
- values: {
260
- amount: numberToString(
261
- swapHasError?.fromAmount || null,
262
- TOKEN_AMOUNT_MIN_DECIMALS,
263
- TOKEN_AMOUNT_MAX_DECIMALS
264
- ),
265
- symbol: swap?.from.symbol,
266
- },
267
- })}
268
- </Typography>
269
- </FooterAlert>
270
- }
271
- />
272
- </FooterStepAlarm>
273
- ) : undefined,
274
- }));
275
- };
276
-
277
- const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
278
-
279
- const bestRouteData = getFormattedBestRoute(bestRoute);
147
+ : getPriceImpact(inputUsdValue.toString(), outputUsdValue.toString());
280
148
 
281
149
  return (
282
150
  <Layout
@@ -289,15 +157,14 @@ export function Home() {
289
157
  size="large"
290
158
  disabled={swapButtonState.disabled}
291
159
  prefix={
292
- !swapButtonState.disabled &&
293
- swapButtonState.hasWarning && <WarningIcon />
160
+ swapButtonState.action === 'confirm-warning' && <WarningIcon />
294
161
  }
295
162
  fullWidth
296
163
  onClick={() => {
297
- if (swapButtonState.state === ButtonState.WAITFORCONNECTING) {
164
+ if (swapButtonState.action === 'connect-wallet') {
298
165
  navigate(navigationRoutes.wallets);
299
- } else if (swapButtonState.state === ButtonState.NEEDTOCONFIRM) {
300
- setOpenWarningModal(true);
166
+ } else if (swapButtonState.action === 'confirm-warning') {
167
+ setShowQuoteWarningModal(true);
301
168
  } else {
302
169
  navigate(navigationRoutes.confirmSwap);
303
170
  }
@@ -306,14 +173,15 @@ export function Home() {
306
173
  </Button>
307
174
  }
308
175
  header={{
309
- hasConnectWallet: true,
176
+ onWallet: () => {
177
+ navigate(navigationRoutes.wallets);
178
+ },
179
+ hasBackButton: false,
310
180
  title: i18n.t('Swap'),
311
181
  suffix: (
312
182
  <HomeButtons
313
183
  layoutRef={layoutRef.current}
314
- onClickRefresh={
315
- !!bestRoute || bestRouteError ? refetchBestRoute : undefined
316
- }
184
+ onClickRefresh={!!quote || quoteError ? fetchQuote : undefined}
317
185
  onClickHistory={() => navigate(navigationRoutes.swaps)}
318
186
  onClickSettings={() => navigate(navigationRoutes.settings)}
319
187
  />
@@ -335,7 +203,7 @@ export function Home() {
335
203
  displayName: fromToken?.symbol || '',
336
204
  image: fromToken?.image || '',
337
205
  }}
338
- onClickToken={() => navigate('from-swap')}
206
+ onClickToken={() => navigate(navigationRoutes.fromSwap)}
339
207
  price={{
340
208
  value: inputAmount,
341
209
  usdValue: priceImpactInputCanNotBeComputed
@@ -349,8 +217,8 @@ export function Home() {
349
217
  ? errorMessages().unknownPriceError.impactTitle
350
218
  : undefined,
351
219
  }}
352
- disabled={loadingMetaStatus === 'failed'}
353
- loading={loadingMetaStatus === 'loading'}
220
+ disabled={fetchMetaStatus === 'failed'}
221
+ loading={fetchMetaStatus === 'loading'}
354
222
  onSelectMaxBalance={() => {
355
223
  if (tokenBalance !== '0') {
356
224
  setInputAmount(tokenBalanceReal.split(',').join(''));
@@ -360,9 +228,10 @@ export function Home() {
360
228
  <SwitchFromAndToButton />
361
229
  </FromContainer>
362
230
  <SwapInput
363
- sharpBottomStyle={!!bestRoute?.result || fetchingBestRoute}
231
+ sharpBottomStyle={!!quote?.result || fetchingQuote}
364
232
  label={i18n.t('To')}
365
233
  mode="To"
234
+ fetchingQuote={fetchingQuote}
366
235
  chain={{
367
236
  displayName: toBlockchain?.displayName || '',
368
237
  image: toBlockchain?.logo || '',
@@ -371,18 +240,12 @@ export function Home() {
371
240
  displayName: toToken?.symbol || '',
372
241
  image: toToken?.image || '',
373
242
  }}
374
- percentageChange={
375
- !!percentageChange?.lt(0)
376
- ? numberToString(
377
- percentageChange,
378
- PERCENTAGE_CHANGE_MIN_DECIMALS,
379
- PERCENTAGE_CHANGE_MAX_DECIMALS
380
- )
381
- : null
382
- }
383
- warningLevel={getPriceImpactLevel(
384
- percentageChange?.toNumber() ?? 0
243
+ percentageChange={numberToString(
244
+ getPriceImpact(inputUsdValue, outputUsdValue),
245
+ PERCENTAGE_CHANGE_MIN_DECIMALS,
246
+ PERCENTAGE_CHANGE_MAX_DECIMALS
385
247
  )}
248
+ warningLevel={getPriceImpactLevel(percentageChange ?? 0)}
386
249
  price={{
387
250
  value: numberToString(
388
251
  outputAmount,
@@ -400,89 +263,31 @@ export function Home() {
400
263
  ? errorMessages().unknownPriceError.impactTitle
401
264
  : undefined,
402
265
  }}
403
- onClickToken={() => navigate('to-swap')}
404
- disabled={loadingMetaStatus === 'failed'}
405
- loading={loadingMetaStatus === 'loading'}
266
+ onClickToken={() => navigate(navigationRoutes.toSwap)}
267
+ disabled={fetchMetaStatus === 'failed'}
268
+ loading={fetchMetaStatus === 'loading'}
406
269
  />
407
270
  </InputsContainer>
408
- {fetchingBestRoute && (
409
- <BestRouteContainer>
410
- <BestRouteSkeleton type="basic" />
411
- </BestRouteContainer>
412
- )}
413
- {showBestRoute &&
414
- !fetchingBestRoute &&
415
- bestRouteData?.result?.swaps?.length ? (
416
- <BestRouteContainer>
417
- <BestRoute
418
- type="basic"
419
- recommended={true}
420
- tooltipContainer={getContainer()}
421
- input={{
422
- value: numberToString(
423
- inputAmount,
424
- TOKEN_AMOUNT_MIN_DECIMALS,
425
- TOKEN_AMOUNT_MAX_DECIMALS
426
- ),
427
- usdValue: numberToString(
428
- inputUsdValue,
429
- USD_VALUE_MIN_DECIMALS,
430
- USD_VALUE_MAX_DECIMALS
431
- ),
432
- }}
433
- output={{
434
- value: numberToString(
435
- outputAmount,
436
- TOKEN_AMOUNT_MIN_DECIMALS,
437
- TOKEN_AMOUNT_MAX_DECIMALS
438
- ),
439
- usdValue: numberToString(
440
- outputUsdValue,
441
- USD_VALUE_MIN_DECIMALS,
442
- USD_VALUE_MAX_DECIMALS
443
- ),
444
- }}
445
- steps={getBestRouteSteps(bestRouteData.result.swaps)}
446
- percentageChange={numberToString(
447
- percentageChange,
448
- PERCENTAGE_CHANGE_MIN_DECIMALS,
449
- PERCENTAGE_CHANGE_MAX_DECIMALS
450
- )}
451
- totalFee={numberToString(
452
- totalFeeInUsd,
453
- GAS_FEE_MIN_DECIMALS,
454
- GAS_FEE_MAX_DECIMALS
455
- )}
456
- totalTime={secondsToString(
457
- totalArrivalTime(bestRoute?.result?.swaps)
458
- )}
459
- />
460
- </BestRouteContainer>
461
- ) : showBestRoute && !fetchingBestRoute ? (
462
- <>
463
- <Divider size={20} />
464
- <NoRoutes
465
- diagnosisMessage={bestRouteData?.diagnosisMessages?.[0]}
466
- fetch={refetchBestRoute}
467
- error={!!bestRouteError}
468
- />
469
- </>
470
- ) : null}
271
+ <div className="quote__container">
272
+ <QuoteInfo
273
+ quote={quote}
274
+ loading={fetchingQuote}
275
+ error={quoteError}
276
+ warning={quoteWarning}
277
+ type="basic"
278
+ refetchQuote={fetchQuote}
279
+ showWarningModal={showQuoteWarningModal}
280
+ onOpenWarningModal={() => setShowQuoteWarningModal(true)}
281
+ onCloseWarningModal={() => setShowQuoteWarningModal(false)}
282
+ onConfirmWarningModal={() => {
283
+ setShowQuoteWarningModal(false);
284
+ setQuoteWarningsConfirmed(true);
285
+ navigate(navigationRoutes.confirmSwap);
286
+ }}
287
+ onChangeSettings={() => navigate(navigationRoutes.settings)}
288
+ />
289
+ </div>
471
290
  </Container>
472
- <RouteErrors
473
- openModal={openWarningModal}
474
- onToggle={setOpenWarningModal}
475
- totalFeeInUsd={totalFeeInUsd}
476
- outputUsdValue={outputUsdValue}
477
- inputUsdValue={inputUsdValue}
478
- percentageChange={percentageChange}
479
- highValueLoss={highValueLoss}
480
- priceImpactCanNotBeComputed={
481
- priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed
482
- }
483
- loading={fetchingBestRoute || loadingMetaStatus === 'loading'}
484
- extraSpace={!!bestRoute?.result || !bestRoute}
485
- />
486
291
  </Layout>
487
292
  );
488
293
  }
@@ -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.bind(null, navigationRoutes.settings),
42
37
  title: i18n.t('Language'),
43
38
  }}>
44
39
  <SettingsContainer>
@@ -23,32 +23,22 @@ import {
23
23
  NotFoundContainer,
24
24
  SettingsContainer,
25
25
  } from '../components/SettingsContainer';
26
- import { navigationRoutes } from '../constants/navigationRoutes';
27
- import { useNavigateBack } from '../hooks/useNavigateBack';
28
- import { useMetaStore } from '../store/meta';
26
+ import { useAppStore } from '../store/AppStore';
29
27
  import { useSettingsStore } from '../store/settings';
30
28
  import { containsText } from '../utils/numbers';
31
- import {
32
- getUniqueSwappersGroups,
33
- sortLiquiditySourcesByGroupTitle,
34
- } from '../utils/settings';
29
+ import { getUniqueSwappersGroups } from '../utils/settings';
35
30
 
36
31
  interface PropTypes {
37
- supportedSwappers?: string[];
38
32
  sourceType: 'Exchanges' | 'Bridges';
39
33
  }
40
34
 
41
- export function LiquiditySourcePage({
42
- supportedSwappers,
43
- sourceType,
44
- }: PropTypes) {
35
+ export function LiquiditySourcePage({ sourceType }: PropTypes) {
36
+ const fetchStatus = useAppStore().fetchStatus;
37
+ const swappers = useAppStore().swappers();
45
38
  const [searchedFor, setSearchedFor] = useState<string>('');
46
39
  const toggleLiquiditySource = useSettingsStore.use.toggleLiquiditySource();
47
- const { navigateBackFrom } = useNavigateBack();
48
- const loadingMetaStatus = useMetaStore.use.loadingStatus();
49
-
50
40
  const supportedUniqueSwappersGroups: Array<UniqueSwappersGroupType> =
51
- getUniqueSwappersGroups(supportedSwappers);
41
+ getUniqueSwappersGroups(swappers);
52
42
 
53
43
  const validTypes: Array<LiquiditySourceType> = [];
54
44
  if (sourceType === 'Exchanges') {
@@ -79,22 +69,20 @@ export function LiquiditySourcePage({
79
69
  });
80
70
  };
81
71
 
82
- const list = liquiditySources
83
- .sort(sortLiquiditySourcesByGroupTitle)
84
- .map((sourceItem) => {
85
- const { selected, groupTitle, logo } = sourceItem;
86
- return {
87
- start: <Image src={logo} size={22} type="circular" />,
88
- onClick: () => toggleLiquiditySource(groupTitle),
89
- end: <Checkbox checked={selected} />,
90
- title: (
91
- <Typography variant="title" size="xmedium">
92
- {i18n.t(groupTitle)}
93
- </Typography>
94
- ),
95
- ...sourceItem,
96
- };
97
- });
72
+ const list = liquiditySources.map((sourceItem) => {
73
+ const { selected, groupTitle, logo } = sourceItem;
74
+ return {
75
+ start: <Image src={logo} size={22} type="circular" />,
76
+ onClick: () => toggleLiquiditySource(groupTitle),
77
+ end: <Checkbox checked={selected} />,
78
+ title: (
79
+ <Typography variant="title" size="xmedium">
80
+ {i18n.t(groupTitle)}
81
+ </Typography>
82
+ ),
83
+ ...sourceItem,
84
+ };
85
+ });
98
86
 
99
87
  const searchHandler = (event: React.ChangeEvent<HTMLInputElement>) => {
100
88
  const value = event.target.value;
@@ -111,7 +99,6 @@ export function LiquiditySourcePage({
111
99
  return (
112
100
  <Layout
113
101
  header={{
114
- onBack: navigateBackFrom.bind(null, navigationRoutes.settings),
115
102
  title: i18n.t(sourceType),
116
103
  suffix: (
117
104
  <LiquiditySourceSuffix>
@@ -131,7 +118,7 @@ export function LiquiditySourcePage({
131
118
  placeholder={i18n.t('Search {sourceType}', { sourceType })}
132
119
  onChange={searchHandler}
133
120
  />
134
- {loadingMetaStatus === 'loading' && <LoadingLiquiditySourceList />}
121
+ {fetchStatus === 'loading' && <LoadingLiquiditySourceList />}
135
122
 
136
123
  {!filteredList.length && !!searchedFor ? (
137
124
  <NotFoundContainer>
@@ -141,7 +128,7 @@ export function LiquiditySourcePage({
141
128
  />
142
129
  </NotFoundContainer>
143
130
  ) : (
144
- loadingMetaStatus === 'success' && (
131
+ fetchStatus === 'success' && (
145
132
  <LiquiditySourceList>
146
133
  {filteredList.map((sourceItem) => {
147
134
  return (