@rango-dev/widget-embedded 0.20.1-next.8 → 0.21.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 (294) hide show
  1. package/dist/QueueManager.d.ts.map +1 -1
  2. package/dist/components/AppRouter.d.ts.map +1 -1
  3. package/dist/components/AppRoutes.d.ts.map +1 -1
  4. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +169 -1
  5. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  6. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +4 -0
  7. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  8. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +514 -1089
  9. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  10. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  12. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +12 -0
  13. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
  14. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts +5 -0
  15. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -0
  16. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +654 -0
  17. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -0
  18. package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts +10 -0
  19. package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts.map +1 -0
  20. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +20 -0
  21. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  22. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +0 -1
  23. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  24. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  25. package/dist/components/Layout/Layout.d.ts +2 -3
  26. package/dist/components/Layout/Layout.d.ts.map +1 -1
  27. package/dist/components/Layout/Layout.helpers.d.ts +2 -0
  28. package/dist/components/Layout/Layout.helpers.d.ts.map +1 -0
  29. package/dist/components/Layout/Layout.styles.d.ts +14 -4
  30. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  31. package/dist/components/Layout/Layout.types.d.ts +6 -3
  32. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  33. package/dist/components/Layout/PageContainer.d.ts +166 -0
  34. package/dist/components/Layout/PageContainer.d.ts.map +1 -0
  35. package/dist/components/Layout/ScrollableArea.d.ts +164 -0
  36. package/dist/components/Layout/ScrollableArea.d.ts.map +1 -0
  37. package/dist/components/Layout/index.d.ts +2 -0
  38. package/dist/components/Layout/index.d.ts.map +1 -1
  39. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +4 -0
  40. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  41. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +56 -0
  42. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
  43. package/dist/components/NoResult/NoResult.styles.d.ts +12 -0
  44. package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
  45. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  46. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +16 -0
  47. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  48. package/dist/components/Quote/Quote.d.ts.map +1 -1
  49. package/dist/components/Quote/Quote.styles.d.ts +387 -3
  50. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  51. package/dist/components/Quote/Quote.types.d.ts +19 -0
  52. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  53. package/dist/components/Quote/QuoteCostDetails.d.ts +4 -0
  54. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -0
  55. package/dist/components/Quote/QuoteCostDetails.styles.d.ts +806 -0
  56. package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -0
  57. package/dist/components/Quote/QuoteSummary.d.ts.map +1 -1
  58. package/dist/components/Quote/QuoteSummary.styles.d.ts +8 -0
  59. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
  60. package/dist/components/Quote/QuoteTrigger .d.ts +4 -0
  61. package/dist/components/Quote/QuoteTrigger .d.ts.map +1 -0
  62. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +16 -0
  63. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
  64. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +40 -0
  65. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
  66. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +20 -0
  67. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
  68. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +1 -0
  69. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -1
  70. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
  71. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +16 -0
  72. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  73. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +1 -0
  74. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
  75. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +1 -0
  76. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -1
  77. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +1 -0
  78. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -1
  79. package/dist/components/SearchInput/SearchInput.styles.d.ts +4 -0
  80. package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
  81. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +11 -156
  82. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  83. package/dist/components/SettingsContainer/index.d.ts +1 -1
  84. package/dist/components/SettingsContainer/index.d.ts.map +1 -1
  85. package/dist/components/Slippage/Slippage.styles.d.ts +20 -0
  86. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  87. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  88. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  89. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
  90. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
  91. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +523 -1
  92. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  93. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -1
  94. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +4 -0
  95. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
  96. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
  97. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
  98. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  99. package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
  100. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +4 -0
  101. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
  102. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +2 -0
  103. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
  104. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  105. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +20 -0
  106. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  107. package/dist/components/TokenList/TokenList.styles.d.ts +68 -0
  108. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  109. package/dist/components/WalletModal/WalletModalContent.styles.d.ts +16 -0
  110. package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
  111. package/dist/components/WidgetEvents.d.ts.map +1 -1
  112. package/dist/components/common/ActivateTabAlert/ActivateTabAlert.d.ts +4 -0
  113. package/dist/components/common/ActivateTabAlert/ActivateTabAlert.d.ts.map +1 -0
  114. package/dist/components/common/ActivateTabAlert/ActivateTabAlert.types.d.ts +4 -0
  115. package/dist/components/common/ActivateTabAlert/ActivateTabAlert.types.d.ts.map +1 -0
  116. package/dist/components/common/ActivateTabAlert/index.d.ts +2 -0
  117. package/dist/components/common/ActivateTabAlert/index.d.ts.map +1 -0
  118. package/dist/components/common/ActivateTabModal/ActivateTabModal.d.ts +4 -0
  119. package/dist/components/common/ActivateTabModal/ActivateTabModal.d.ts.map +1 -0
  120. package/dist/components/common/ActivateTabModal/ActivateTabModal.types.d.ts +6 -0
  121. package/dist/components/common/ActivateTabModal/ActivateTabModal.types.d.ts.map +1 -0
  122. package/dist/components/common/ActivateTabModal/index.d.ts +2 -0
  123. package/dist/components/common/ActivateTabModal/index.d.ts.map +1 -0
  124. package/dist/constants/index.d.ts +1 -0
  125. package/dist/constants/index.d.ts.map +1 -1
  126. package/dist/constants/quote.d.ts +12 -0
  127. package/dist/constants/quote.d.ts.map +1 -0
  128. package/dist/constants/searchParams.d.ts +6 -6
  129. package/dist/constants/searchParams.d.ts.map +1 -1
  130. package/dist/containers/App/App.d.ts.map +1 -1
  131. package/dist/containers/App/App.styles.d.ts +4 -0
  132. package/dist/containers/App/App.styles.d.ts.map +1 -1
  133. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +1 -1
  134. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  135. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +10 -314
  136. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  137. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -7
  138. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  139. package/dist/containers/Widget/Widget.d.ts.map +1 -1
  140. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -1
  141. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +7 -0
  142. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -1
  143. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
  144. package/dist/hooks/useLanguage.d.ts +2 -1
  145. package/dist/hooks/useLanguage.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/useSyncUrlAndStore/index.d.ts +2 -0
  149. package/dist/hooks/useSyncUrlAndStore/index.d.ts.map +1 -0
  150. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts +2 -0
  151. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -0
  152. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.helpers.d.ts +4 -0
  153. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.helpers.d.ts.map +1 -0
  154. package/dist/index.d.ts +4 -4
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js +2 -1
  157. package/dist/index.js.map +4 -4
  158. package/dist/libs/tabManager/index.d.ts +3 -0
  159. package/dist/libs/tabManager/index.d.ts.map +1 -0
  160. package/dist/libs/tabManager/tabManager.constants.d.ts +4 -0
  161. package/dist/libs/tabManager/tabManager.constants.d.ts.map +1 -0
  162. package/dist/libs/tabManager/tabManager.d.ts +63 -0
  163. package/dist/libs/tabManager/tabManager.d.ts.map +1 -0
  164. package/dist/libs/tabManager/tabManager.types.d.ts +29 -0
  165. package/dist/libs/tabManager/tabManager.types.d.ts.map +1 -0
  166. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  167. package/dist/pages/HistoryPage.d.ts.map +1 -1
  168. package/dist/pages/Home.d.ts.map +1 -1
  169. package/dist/pages/LanguagePage.d.ts.map +1 -1
  170. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  171. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  172. package/dist/pages/SettingsPage.d.ts.map +1 -1
  173. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  174. package/dist/pages/ThemePage.d.ts.map +1 -1
  175. package/dist/pages/WalletsPage.d.ts.map +1 -1
  176. package/dist/store/AppStore.d.ts +2 -2
  177. package/dist/store/app.d.ts +2 -2
  178. package/dist/store/slices/settings.d.ts +2 -2
  179. package/dist/store/slices/settings.d.ts.map +1 -1
  180. package/dist/store/ui.d.ts +12 -10
  181. package/dist/store/ui.d.ts.map +1 -1
  182. package/dist/types/notification.d.ts +1 -2
  183. package/dist/types/notification.d.ts.map +1 -1
  184. package/dist/utils/date.d.ts.map +1 -1
  185. package/dist/utils/quote.d.ts +5 -2
  186. package/dist/utils/quote.d.ts.map +1 -1
  187. package/dist/utils/swap.d.ts +5 -1
  188. package/dist/utils/swap.d.ts.map +1 -1
  189. package/dist/utils/ui.d.ts +2 -0
  190. package/dist/utils/ui.d.ts.map +1 -1
  191. package/package.json +7 -7
  192. package/src/QueueManager.tsx +4 -1
  193. package/src/components/AppRouter.tsx +1 -8
  194. package/src/components/AppRoutes.tsx +11 -0
  195. package/src/components/BlockchainList/BlockchainList.styles.ts +4 -3
  196. package/src/components/BlockchainList/BlockchainList.tsx +1 -1
  197. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +27 -96
  198. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +25 -40
  199. package/src/components/ConfirmWalletsModal/WalletList.tsx +3 -0
  200. package/src/components/CustomCollapsible/CustomCollapsible.styles.ts +75 -0
  201. package/src/components/CustomCollapsible/CustomCollapsible.tsx +55 -0
  202. package/src/components/CustomCollapsible/CustomCollapsible.types.ts +10 -0
  203. package/src/components/HeaderButtons/HeaderButtons.styles.ts +4 -1
  204. package/src/components/HeaderButtons/HeaderButtons.types.ts +0 -1
  205. package/src/components/HeaderButtons/HomeButtons.tsx +1 -2
  206. package/src/components/Layout/Layout.helpers.ts +16 -0
  207. package/src/components/Layout/Layout.styles.ts +17 -31
  208. package/src/components/Layout/Layout.tsx +60 -29
  209. package/src/components/Layout/Layout.types.ts +9 -8
  210. package/src/components/Layout/PageContainer.tsx +24 -0
  211. package/src/components/Layout/ScrollableArea.tsx +11 -0
  212. package/src/components/Layout/index.ts +2 -0
  213. package/src/components/NotificationContent/NotificationContent.tsx +10 -4
  214. package/src/components/Quote/Quote.styles.ts +44 -5
  215. package/src/components/Quote/Quote.tsx +10 -77
  216. package/src/components/Quote/Quote.types.ts +22 -0
  217. package/src/components/Quote/QuoteCostDetails.styles.ts +50 -0
  218. package/src/components/Quote/QuoteCostDetails.tsx +218 -0
  219. package/src/components/Quote/QuoteSummary.tsx +3 -2
  220. package/src/components/Quote/QuoteTrigger .tsx +215 -0
  221. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +3 -1
  222. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +0 -1
  223. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +3 -1
  224. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
  225. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +3 -1
  226. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +3 -1
  227. package/src/components/SettingsContainer/SettingsContainer.style.ts +0 -5
  228. package/src/components/SettingsContainer/index.ts +0 -1
  229. package/src/components/Slippage/Slippage.tsx +5 -5
  230. package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
  231. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +12 -13
  232. package/src/components/SwapDetails/SwapDetails.helpers.tsx +43 -3
  233. package/src/components/SwapDetails/SwapDetails.styles.ts +18 -6
  234. package/src/components/SwapDetails/SwapDetails.tsx +16 -5
  235. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +13 -7
  236. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +2 -0
  237. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +9 -1
  238. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +10 -2
  239. package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +2 -0
  240. package/src/components/SwapsGroup/SwapsGroup.tsx +18 -7
  241. package/src/components/TokenList/TokenList.styles.ts +2 -0
  242. package/src/components/TokenList/TokenList.tsx +1 -1
  243. package/src/components/WidgetEvents.tsx +2 -14
  244. package/src/components/common/ActivateTabAlert/ActivateTabAlert.tsx +26 -0
  245. package/src/components/common/ActivateTabAlert/ActivateTabAlert.types.ts +3 -0
  246. package/src/components/common/ActivateTabAlert/index.ts +1 -0
  247. package/src/components/common/ActivateTabModal/ActivateTabModal.tsx +31 -0
  248. package/src/components/common/ActivateTabModal/ActivateTabModal.types.ts +5 -0
  249. package/src/components/common/ActivateTabModal/index.ts +1 -0
  250. package/src/constants/index.ts +1 -0
  251. package/src/constants/quote.ts +23 -0
  252. package/src/constants/searchParams.ts +6 -6
  253. package/src/containers/App/App.styles.ts +2 -0
  254. package/src/containers/App/App.tsx +1 -4
  255. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
  256. package/src/containers/QuoteInfo/QuoteInfo.tsx +30 -77
  257. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -7
  258. package/src/containers/Wallets/Wallets.tsx +3 -3
  259. package/src/containers/Widget/Widget.tsx +6 -1
  260. package/src/containers/WidgetInfo/WidgetInfo.tsx +13 -1
  261. package/src/containers/WidgetInfo/WidgetInfo.types.ts +7 -0
  262. package/src/containers/WidgetProvider/WidgetProvider.tsx +2 -1
  263. package/src/hooks/useLanguage.ts +6 -4
  264. package/src/hooks/useSwapInput.ts +6 -1
  265. package/src/hooks/useSyncStoresWithConfig.ts +3 -17
  266. package/src/hooks/useSyncUrlAndStore/index.ts +1 -0
  267. package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.helpers.ts +35 -0
  268. package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +135 -0
  269. package/src/index.ts +2 -2
  270. package/src/libs/tabManager/index.ts +2 -0
  271. package/src/libs/tabManager/tabManager.constants.ts +3 -0
  272. package/src/libs/tabManager/tabManager.ts +222 -0
  273. package/src/libs/tabManager/tabManager.types.ts +28 -0
  274. package/src/pages/ConfirmSwapPage.tsx +55 -47
  275. package/src/pages/HistoryPage.tsx +5 -17
  276. package/src/pages/Home.tsx +47 -43
  277. package/src/pages/LanguagePage.tsx +3 -4
  278. package/src/pages/LiquiditySourcePage.tsx +8 -6
  279. package/src/pages/SelectBlockchainPage.tsx +41 -41
  280. package/src/pages/SelectSwapItemsPage.tsx +45 -39
  281. package/src/pages/SettingsPage.tsx +3 -4
  282. package/src/pages/SwapDetailsPage.tsx +21 -7
  283. package/src/pages/ThemePage.tsx +3 -4
  284. package/src/pages/WalletsPage.tsx +15 -13
  285. package/src/store/slices/settings.ts +3 -3
  286. package/src/store/ui.ts +39 -11
  287. package/src/types/notification.ts +0 -7
  288. package/src/utils/date.ts +5 -4
  289. package/src/utils/quote.ts +18 -28
  290. package/src/utils/swap.ts +35 -0
  291. package/src/utils/ui.ts +20 -0
  292. package/dist/components/UpdateUrl.d.ts +0 -2
  293. package/dist/components/UpdateUrl.d.ts.map +0 -1
  294. package/src/components/UpdateUrl.tsx +0 -158
@@ -14,14 +14,13 @@ import {
14
14
  } from '@rango-dev/ui';
15
15
  import React, { useState } from 'react';
16
16
 
17
- import { Layout } from '../components/Layout';
17
+ import { Layout, PageContainer } from '../components/Layout';
18
18
  import { LoadingLiquiditySourceList } from '../components/LoadingLiquiditySourceList';
19
19
  import { SearchInput } from '../components/SearchInput';
20
20
  import {
21
21
  LiquiditySourceList,
22
22
  LiquiditySourceSuffix,
23
23
  NotFoundContainer,
24
- SettingsContainer,
25
24
  } from '../components/SettingsContainer';
26
25
  import { useAppStore } from '../store/AppStore';
27
26
  import { containsText } from '../utils/numbers';
@@ -40,6 +39,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
40
39
  const supportedUniqueSwappersGroups: Array<UniqueSwappersGroupType> =
41
40
  getUniqueSwappersGroups(swappers, disabledLiquiditySources);
42
41
 
42
+ const types = { Exchanges: i18n.t('Exchanges'), Bridges: i18n.t('Bridges') };
43
43
  const validTypes: Array<LiquiditySourceType> = [];
44
44
  if (sourceType === 'Exchanges') {
45
45
  validTypes.push('DEX');
@@ -103,19 +103,21 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
103
103
  suffix: (
104
104
  <LiquiditySourceSuffix>
105
105
  <Button variant="ghost" size="xsmall" onClick={toggleAllSources}>
106
- {i18n.t(hasSelectAll ? 'Deselect all' : 'Select all')}
106
+ {hasSelectAll ? i18n.t('Deselect all') : i18n.t('Select all')}
107
107
  </Button>
108
108
  </LiquiditySourceSuffix>
109
109
  ),
110
110
  }}>
111
- <SettingsContainer>
111
+ <PageContainer view>
112
112
  <SearchInput
113
113
  value={searchedFor}
114
114
  setValue={setSearchedFor}
115
115
  fullWidth
116
116
  color="light"
117
117
  variant="contained"
118
- placeholder={i18n.t('Search {sourceType}', { sourceType })}
118
+ placeholder={i18n.t('Search {sourceType}', {
119
+ sourceType: types[sourceType],
120
+ })}
119
121
  onChange={searchHandler}
120
122
  />
121
123
  {fetchStatus === 'loading' && <LoadingLiquiditySourceList />}
@@ -145,7 +147,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
145
147
  </LiquiditySourceList>
146
148
  )
147
149
  )}
148
- </SettingsContainer>
150
+ </PageContainer>
149
151
  </Layout>
150
152
  );
151
153
  }
@@ -2,12 +2,12 @@ import { i18n } from '@lingui/core';
2
2
  import {
3
3
  Divider,
4
4
  getCountCategories,
5
- SelectableCategoryList
5
+ SelectableCategoryList,
6
6
  } from '@rango-dev/ui';
7
7
  import React, { useState } from 'react';
8
8
 
9
9
  import { BlockchainList } from '../components/BlockchainList';
10
- import { Layout } from '../components/Layout';
10
+ import { Layout, PageContainer } from '../components/Layout';
11
11
  import { SearchInput } from '../components/SearchInput';
12
12
  import { useNavigateBack } from '../hooks/useNavigateBack';
13
13
  import { useAppStore } from '../store/AppStore';
@@ -27,7 +27,7 @@ export function SelectBlockchainPage(props: PropTypes) {
27
27
  const fetchStatus = useAppStore().fetchStatus;
28
28
 
29
29
  const blockchains = useAppStore().blockchains({
30
- type: type
30
+ type,
31
31
  });
32
32
 
33
33
  const countActiveCategories = getCountCategories(blockchains);
@@ -37,47 +37,47 @@ export function SelectBlockchainPage(props: PropTypes) {
37
37
  return (
38
38
  <Layout
39
39
  header={{
40
- title: i18n.t(`Select Blockchain`)
40
+ title: i18n.t(`Select Blockchain`),
41
41
  }}>
42
- <Divider size={12} />
42
+ <PageContainer view>
43
+ {showCategory && (
44
+ <>
45
+ <SelectableCategoryList
46
+ setCategory={setBlockchainCategory}
47
+ category={blockchainCategory}
48
+ blockchains={blockchains}
49
+ isLoading={fetchStatus === 'loading'}
50
+ />
51
+ <Divider size={24} />
52
+ </>
53
+ )}
43
54
 
44
- {showCategory && (
45
- <>
46
- <SelectableCategoryList
47
- setCategory={setBlockchainCategory}
48
- category={blockchainCategory}
49
- blockchains={blockchains}
50
- isLoading={fetchStatus === 'loading'}
51
- />
52
- <Divider size={24} />
53
- </>
54
- )}
55
+ <SearchInput
56
+ value={searchedFor}
57
+ autoFocus
58
+ placeholder={i18n.t('Search Blockchain')}
59
+ color="light"
60
+ variant="contained"
61
+ size="large"
62
+ setValue={() => setSearchedFor('')}
63
+ onChange={(event) => setSearchedFor(event.target.value)}
64
+ />
65
+ <Divider size={16} />
55
66
 
56
- <SearchInput
57
- value={searchedFor}
58
- autoFocus
59
- placeholder={i18n.t('Search Blockchain')}
60
- color="light"
61
- variant="contained"
62
- size="large"
63
- setValue={() => setSearchedFor('')}
64
- onChange={(event) => setSearchedFor(event.target.value)}
65
- />
66
- <Divider size={16} />
67
-
68
- <BlockchainList
69
- list={blockchains}
70
- searchedFor={searchedFor}
71
- blockchainCategory={blockchainCategory}
72
- onChange={(blockchain) => {
73
- if (type === 'source') {
74
- setFromBlockchain(blockchain);
75
- } else {
76
- setToBlockchain(blockchain);
77
- }
78
- navigateBack();
79
- }}
80
- />
67
+ <BlockchainList
68
+ list={blockchains}
69
+ searchedFor={searchedFor}
70
+ blockchainCategory={blockchainCategory}
71
+ onChange={(blockchain) => {
72
+ if (type === 'source') {
73
+ setFromBlockchain(blockchain);
74
+ } else {
75
+ setToBlockchain(blockchain);
76
+ }
77
+ navigateBack();
78
+ }}
79
+ />
80
+ </PageContainer>
81
81
  </Layout>
82
82
  );
83
83
  }
@@ -6,7 +6,7 @@ import React, { useState } from 'react';
6
6
  import { useNavigate } from 'react-router-dom';
7
7
 
8
8
  import { BlockchainsSection } from '../components/BlockchainsSection';
9
- import { Layout } from '../components/Layout';
9
+ import { Layout, PageContainer } from '../components/Layout';
10
10
  import { SearchInput } from '../components/SearchInput';
11
11
  import { TokenList } from '../components/TokenList/TokenList';
12
12
  import { navigationRoutes } from '../constants/navigationRoutes';
@@ -68,51 +68,57 @@ export function SelectSwapItemsPage(props: PropTypes) {
68
68
  setToToken({ token, meta: { blockchains, tokens } });
69
69
  }
70
70
  };
71
+ const types = {
72
+ source: i18n.t('Source'),
73
+ destination: i18n.t('Destination'),
74
+ };
71
75
 
72
76
  return (
73
77
  <Layout
74
78
  header={{
75
- title: i18n.t('Swap {type}', { type }),
79
+ title: i18n.t('Swap {type}', { type: types[type] }),
76
80
  }}>
77
- <BlockchainsSection
78
- blockchains={blockchains}
79
- type={type == 'source' ? 'from' : 'to'}
80
- blockchain={type === 'source' ? fromBlockchain : toBlockchain}
81
- onMoreClick={() => navigate(navigationRoutes.blockchains)}
82
- onChange={(blockchain) => {
83
- updateBlockchain(blockchain);
84
- }}
85
- />
86
- <Divider size={24} />
87
- <SearchInput
88
- value={searchedFor}
89
- autoFocus
90
- placeholder={i18n.t('Search Token')}
91
- color="light"
92
- variant="contained"
93
- size="large"
94
- setValue={() => setSearchedFor('')}
95
- onChange={(event) => setSearchedFor(event.target.value)}
96
- />
97
- <Divider size={16} />
98
- <TokenList
99
- list={tokensList}
100
- selectedBlockchain={selectedBlockchainName}
101
- searchedFor={searchedFor}
102
- type={type}
103
- onChange={(token) => {
104
- updateToken(token);
81
+ <PageContainer>
82
+ <BlockchainsSection
83
+ blockchains={blockchains}
84
+ type={type == 'source' ? 'from' : 'to'}
85
+ blockchain={type === 'source' ? fromBlockchain : toBlockchain}
86
+ onMoreClick={() => navigate(navigationRoutes.blockchains)}
87
+ onChange={(blockchain) => {
88
+ updateBlockchain(blockchain);
89
+ }}
90
+ />
91
+ <Divider size={24} />
92
+ <SearchInput
93
+ value={searchedFor}
94
+ autoFocus
95
+ placeholder={i18n.t('Search Token')}
96
+ color="light"
97
+ variant="contained"
98
+ size="large"
99
+ setValue={() => setSearchedFor('')}
100
+ onChange={(event) => setSearchedFor(event.target.value)}
101
+ />
102
+ <Divider size={16} />
103
+ <TokenList
104
+ list={tokensList}
105
+ selectedBlockchain={selectedBlockchainName}
106
+ searchedFor={searchedFor}
107
+ type={type}
108
+ onChange={(token) => {
109
+ updateToken(token);
105
110
 
106
- const tokenBlockchain = blockchains.find(
107
- (chain) => token.blockchain === chain.name
108
- );
109
- if (tokenBlockchain) {
110
- updateBlockchain(tokenBlockchain);
111
- }
111
+ const tokenBlockchain = blockchains.find(
112
+ (chain) => token.blockchain === chain.name
113
+ );
114
+ if (tokenBlockchain) {
115
+ updateBlockchain(tokenBlockchain);
116
+ }
112
117
 
113
- navigateBack();
114
- }}
115
- />
118
+ navigateBack();
119
+ }}
120
+ />
121
+ </PageContainer>
116
122
  </Layout>
117
123
  );
118
124
  }
@@ -13,8 +13,7 @@ import {
13
13
  import React from 'react';
14
14
  import { useNavigate } from 'react-router-dom';
15
15
 
16
- import { Layout } from '../components/Layout';
17
- import { SettingsContainer } from '../components/SettingsContainer';
16
+ import { Layout, PageContainer } from '../components/Layout';
18
17
  import { Slippage } from '../components/Slippage';
19
18
  import { SlippageTooltipContainer as TooltipContainer } from '../components/Slippage/Slippage.styles';
20
19
  import { navigationRoutes } from '../constants/navigationRoutes';
@@ -183,7 +182,7 @@ export function SettingsPage() {
183
182
  header={{
184
183
  title: i18n.t('Settings'),
185
184
  }}>
186
- <SettingsContainer>
185
+ <PageContainer>
187
186
  <Slippage />
188
187
  <List
189
188
  type={
@@ -191,7 +190,7 @@ export function SettingsPage() {
191
190
  }
192
191
  items={settingItems}
193
192
  />
194
- </SettingsContainer>
193
+ </PageContainer>
195
194
  </Layout>
196
195
  );
197
196
  }
@@ -1,27 +1,41 @@
1
+ import { i18n } from '@lingui/core';
1
2
  import { cancelSwap } from '@rango-dev/queue-manager-rango-preset';
2
3
  import { useManager } from '@rango-dev/queue-manager-react';
4
+ import { Alert } from '@rango-dev/ui';
3
5
  import React from 'react';
6
+ import { useParams } from 'react-router-dom';
4
7
 
5
8
  import { SwapDetails } from '../components/SwapDetails';
6
9
  import { SwapDetailsPlaceholder } from '../components/SwapDetails/SwapDetails.Placeholder';
7
10
  import { useNavigateBack } from '../hooks/useNavigateBack';
8
11
  import { useAppStore } from '../store/AppStore';
9
- import { useUiStore } from '../store/ui';
10
12
  import { getPendingSwaps } from '../utils/queue';
11
13
 
12
14
  export function SwapDetailsPage() {
13
15
  const { manager, state } = useManager();
14
16
  const loading = !state.loadedFromPersistor;
15
17
  const pendingSwaps = getPendingSwaps(manager);
16
- const requestId = useUiStore.use.selectedSwapRequestId();
18
+ const { requestId } = useParams<{ requestId: string }>();
17
19
  const navigateBack = useNavigateBack();
18
20
  const { fetchStatus: fetchMetaStatus } = useAppStore();
19
21
 
22
+ if (!requestId) {
23
+ return (
24
+ <Alert
25
+ containerStyles={{ margin: '20px' }}
26
+ type="error"
27
+ title={i18n.t(
28
+ 'The request ID is necessary to display the swap details.'
29
+ )}
30
+ />
31
+ );
32
+ }
33
+
20
34
  const showSkeleton = loading || fetchMetaStatus === 'loading';
21
35
 
22
- const selectedSwap = pendingSwaps.find(
23
- ({ swap }) => swap.requestId === requestId
24
- );
36
+ const selectedSwap = requestId
37
+ ? pendingSwaps.find(({ swap }) => swap.requestId === requestId)
38
+ : undefined;
25
39
 
26
40
  const onCancel = () => {
27
41
  if (selectedSwap?.id) {
@@ -47,7 +61,7 @@ export function SwapDetailsPage() {
47
61
  if (!swap || showSkeleton) {
48
62
  return (
49
63
  <SwapDetailsPlaceholder
50
- requestId={requestId || ''}
64
+ requestId={requestId}
51
65
  showSkeleton={showSkeleton}
52
66
  />
53
67
  );
@@ -56,7 +70,7 @@ export function SwapDetailsPage() {
56
70
  return (
57
71
  <SwapDetails
58
72
  swap={swap}
59
- requestId={requestId || ''}
73
+ requestId={requestId}
60
74
  onCancel={onCancel}
61
75
  onDelete={onDelete}
62
76
  />
@@ -11,8 +11,7 @@ import {
11
11
  } from '@rango-dev/ui';
12
12
  import React from 'react';
13
13
 
14
- import { Layout } from '../components/Layout';
15
- import { SettingsContainer } from '../components/SettingsContainer';
14
+ import { Layout, PageContainer } from '../components/Layout';
16
15
  import { useAppStore } from '../store/AppStore';
17
16
 
18
17
  type Theme = 'dark' | 'light' | 'auto';
@@ -70,7 +69,7 @@ export function ThemePage() {
70
69
  header={{
71
70
  title: i18n.t('Theme'),
72
71
  }}>
73
- <SettingsContainer>
72
+ <PageContainer>
74
73
  <RadioRoot
75
74
  onValueChange={(value) => setTheme(value as Theme)}
76
75
  value={theme}>
@@ -85,7 +84,7 @@ export function ThemePage() {
85
84
  items={themesList}
86
85
  />
87
86
  </RadioRoot>
88
- </SettingsContainer>
87
+ </PageContainer>
89
88
  </Layout>
90
89
  );
91
90
  }
@@ -2,12 +2,13 @@ import type { WalletType } from '@rango-dev/wallets-shared';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
4
  import { styled, Typography, Wallet, WalletState } from '@rango-dev/ui';
5
- import React, { Fragment, useState } from 'react';
5
+ import React, { useState } from 'react';
6
6
 
7
- import { Layout } from '../components/Layout';
7
+ import { Layout, PageContainer } from '../components/Layout';
8
8
  import { WalletModal } from '../components/WalletModal';
9
9
  import { useWalletList } from '../hooks/useWalletList';
10
10
  import { useAppStore } from '../store/AppStore';
11
+ import { useUiStore } from '../store/ui';
11
12
  import { getContainer } from '../utils/common';
12
13
 
13
14
  const ListContainer = styled('div', {
@@ -20,7 +21,7 @@ const ListContainer = styled('div', {
20
21
  height: '100%',
21
22
  });
22
23
 
23
- const Container = styled('div', {
24
+ const Container = styled(PageContainer, {
24
25
  textAlign: 'center',
25
26
  });
26
27
 
@@ -32,6 +33,7 @@ export function WalletsPage() {
32
33
  const [openModal, setOpenModal] = useState(false);
33
34
  const [selectedWalletType, setSelectedWalletType] = useState<WalletType>('');
34
35
  let modalTimerId: ReturnType<typeof setTimeout> | null = null;
36
+ const isActiveTab = useUiStore.use.isActiveTab();
35
37
 
36
38
  const { list, handleClick, error } = useWalletList({
37
39
  config,
@@ -71,16 +73,16 @@ export function WalletsPage() {
71
73
  {list.map((wallet, index) => {
72
74
  const key = `wallet-${index}-${wallet.type}`;
73
75
  return (
74
- <Fragment key={key}>
75
- <Wallet
76
- {...wallet}
77
- container={getContainer()}
78
- onClick={(type) => {
79
- void handleClick(type);
80
- }}
81
- isLoading={fetchMetaStatus === 'loading'}
82
- />
83
- </Fragment>
76
+ <Wallet
77
+ key={key}
78
+ {...wallet}
79
+ container={getContainer()}
80
+ onClick={(type) => {
81
+ void handleClick(type);
82
+ }}
83
+ isLoading={fetchMetaStatus === 'loading'}
84
+ disabled={!isActiveTab}
85
+ />
84
86
  );
85
87
  })}
86
88
  <WalletModal
@@ -15,7 +15,7 @@ export type ThemeMode = 'auto' | 'dark' | 'light';
15
15
 
16
16
  export interface SettingsSlice {
17
17
  theme: ThemeMode;
18
- language: Language;
18
+ language: Language | null;
19
19
  disabledLiquiditySources: string[];
20
20
  /** Keeping a history of blockchains that user has selected (in Swap process) */
21
21
  preferredBlockchains: string[];
@@ -31,7 +31,7 @@ export interface SettingsSlice {
31
31
  toggleInfiniteApprove: () => void;
32
32
  toggleLiquiditySource: (name: string) => void;
33
33
  setTheme: (theme: ThemeMode) => void;
34
- setLanguage: (language: Language) => void;
34
+ setLanguage: (language: Language | null) => void;
35
35
  toggleAllLiquiditySources: (
36
36
  swappers: SwapperMeta[],
37
37
  shouldReset?: boolean
@@ -53,7 +53,7 @@ export const createSettingsSlice: StateCreator<
53
53
  > = (set, get) => ({
54
54
  disabledLiquiditySources: [],
55
55
  theme: 'auto',
56
- language: DEFAULT_LANGUAGE,
56
+ language: null,
57
57
  preferredBlockchains: [],
58
58
  slippage: DEFAULT_SLIPPAGE,
59
59
  customSlippage: null,
package/src/store/ui.ts CHANGED
@@ -1,21 +1,49 @@
1
+ import type { TabManagerInterface } from '../libs/tabManager';
2
+
1
3
  import { create } from 'zustand';
2
4
 
5
+ import { TabManager } from '../libs/tabManager';
6
+
3
7
  import createSelectors from './selectors';
4
8
 
5
9
  interface UiState {
6
- connectWalletsButtonDisabled: boolean;
7
- selectedSwapRequestId: string | null;
8
- currentPage: string;
9
- setSelectedSwap: (requestId: string | null) => void;
10
- setCurrentPage: (path: string) => void;
10
+ isActiveTab: boolean;
11
+ tabManagerInitiated: boolean;
12
+ showActivateTabModal: boolean;
13
+ activateCurrentTab: (
14
+ setCurrentTabAsActive: () => void,
15
+ hasRunningSwaps: boolean
16
+ ) => void;
17
+ setShowActivateTabModal: (flag: boolean) => void;
11
18
  }
12
19
 
13
20
  export const useUiStore = createSelectors(
14
- create<UiState>()((set) => ({
15
- connectWalletsButtonDisabled: false,
16
- selectedSwapRequestId: null,
17
- currentPage: '',
18
- setSelectedSwap: (requestId) => set({ selectedSwapRequestId: requestId }),
19
- setCurrentPage: (path) => set({ currentPage: path }),
21
+ create<UiState>()((set, get) => ({
22
+ isActiveTab: false,
23
+ tabManagerInitiated: false,
24
+ showActivateTabModal: false,
25
+ activateCurrentTab: (setCurrentTabAsActive, hasRunningSwaps) => {
26
+ const { showActivateTabModal } = get();
27
+
28
+ if (!showActivateTabModal && hasRunningSwaps) {
29
+ set({ showActivateTabModal: true });
30
+ } else if (showActivateTabModal || !hasRunningSwaps) {
31
+ setCurrentTabAsActive();
32
+ }
33
+ },
34
+ setShowActivateTabModal: (flag) => {
35
+ set({ showActivateTabModal: flag });
36
+ },
20
37
  }))
21
38
  );
39
+
40
+ const tabManager: TabManagerInterface = new TabManager({
41
+ onInit: () => useUiStore.setState({ tabManagerInitiated: true }),
42
+ onClaim: () =>
43
+ useUiStore.setState({ isActiveTab: true, showActivateTabModal: false }),
44
+ onRelease: () => useUiStore.setState({ isActiveTab: false }),
45
+ });
46
+
47
+ export const setCurrentTabAsActive = tabManager.forceClaim;
48
+
49
+ export const destroyTabManager = tabManager.destroy;
@@ -3,7 +3,6 @@ import {
3
3
  type RouteEvent,
4
4
  type Step,
5
5
  type StepEvent,
6
- StepExecutionBlockedEventStatus,
7
6
  } from '@rango-dev/queue-manager-rango-preset';
8
7
 
9
8
  type NotificationRoute = {
@@ -25,9 +24,3 @@ export type Notification = Pick<Route, 'requestId'> & {
25
24
  read: boolean;
26
25
  route: NotificationRoute;
27
26
  };
28
-
29
- export const validBlockedStatuses: StepExecutionBlockedEventStatus[] = [
30
- StepExecutionBlockedEventStatus.WAITING_FOR_CHANGE_WALLET_ACCOUNT,
31
- StepExecutionBlockedEventStatus.WAITING_FOR_NETWORK_CHANGE,
32
- StepExecutionBlockedEventStatus.WAITING_FOR_WALLET_CONNECT,
33
- ];
package/src/utils/date.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { GroupBy } from '../components/SwapsGroup/SwapsGroup.types';
2
2
  import type { PendingSwap } from 'rango-types';
3
3
 
4
+ import { i18n } from '@lingui/core';
4
5
  import dayjs from 'dayjs';
5
6
 
6
7
  export const groupSwapsByDate: GroupBy = (swaps) => {
@@ -14,28 +15,28 @@ export const groupSwapsByDate: GroupBy = (swaps) => {
14
15
  [
15
16
  'today',
16
17
  {
17
- title: 'Today',
18
+ title: i18n.t('Today'),
18
19
  swaps: [],
19
20
  },
20
21
  ],
21
22
  [
22
23
  'week',
23
24
  {
24
- title: 'This week',
25
+ title: i18n.t('This week'),
25
26
  swaps: [],
26
27
  },
27
28
  ],
28
29
  [
29
30
  'month',
30
31
  {
31
- title: 'This month',
32
+ title: i18n.t('This month'),
32
33
  swaps: [],
33
34
  },
34
35
  ],
35
36
  [
36
37
  'year',
37
38
  {
38
- title: 'This year',
39
+ title: i18n.t('This year'),
39
40
  swaps: [],
40
41
  },
41
42
  ],
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-magic-numbers */
2
2
  import type { QuoteError, QuoteWarning, Wallet } from '../types';
3
- import type { PriceImpactWarningLevel } from '@rango-dev/ui';
3
+ import type { PriceImpactWarningLevel, Step } from '@rango-dev/ui';
4
4
  import type {
5
5
  SimulationAssetAndAmount,
6
6
  SimulationValidationStatus,
@@ -35,33 +35,6 @@ import {
35
35
  hasProperSlippage,
36
36
  } from './swap';
37
37
 
38
- export function searchParamsToToken(
39
- tokens: Token[],
40
- searchParams: string | null,
41
- chain: BlockchainMeta | null
42
- ): Token | null {
43
- if (!chain) {
44
- return null;
45
- }
46
- return (
47
- tokens.find((token) => {
48
- const symbolAndAddress = searchParams?.split('--');
49
- if (symbolAndAddress?.length === 1) {
50
- return (
51
- token.symbol === symbolAndAddress[0] &&
52
- token.address === null &&
53
- token.blockchain === chain.name
54
- );
55
- }
56
- return (
57
- token.symbol === symbolAndAddress?.[0] &&
58
- token.address === symbolAndAddress?.[1] &&
59
- token.blockchain === chain.name
60
- );
61
- }) || null
62
- );
63
- }
64
-
65
38
  export function getQuoteToTokenUsdPrice(
66
39
  quote: BestRouteResponse | null
67
40
  ): number | null | undefined {
@@ -336,3 +309,20 @@ export function getPriceImpact(
336
309
 
337
310
  return percentageChange && percentageChange < 0 ? percentageChange : null;
338
311
  }
312
+
313
+ export const getUniqueBlockchains = (steps: Step[]) => {
314
+ const set = new Set();
315
+ const result: { displayName: string; image: string }[] = [];
316
+ steps.forEach((step) => {
317
+ if (!set.has(step.from.chain.displayName)) {
318
+ set.add(step.from.chain.displayName);
319
+ result.push(step.from.chain);
320
+ }
321
+ if (!set.has(step.to.chain.displayName)) {
322
+ set.add(step.to.chain.displayName);
323
+ result.push(step.to.chain);
324
+ }
325
+ });
326
+
327
+ return result;
328
+ };