@rango-dev/widget-embedded 0.17.1-next.3 → 0.17.1-next.31

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