@rango-dev/widget-embedded 0.17.1-next.9 → 0.19.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 (271) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/QueueManager.d.ts +1 -2
  3. package/dist/QueueManager.d.ts.map +1 -1
  4. package/dist/Wallets.d.ts +0 -1
  5. package/dist/Wallets.d.ts.map +1 -1
  6. package/dist/Widget.d.ts +1 -1
  7. package/dist/Widget.d.ts.map +1 -1
  8. package/dist/components/AppRouter.d.ts +2 -0
  9. package/dist/components/AppRouter.d.ts.map +1 -1
  10. package/dist/components/AppRoutes.d.ts +6 -1
  11. package/dist/components/AppRoutes.d.ts.map +1 -1
  12. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +3 -1
  13. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  14. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
  15. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  16. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +3 -1
  17. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
  18. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  19. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +4 -1
  20. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  21. package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
  22. package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
  23. package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
  24. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
  25. package/dist/components/{NoResult/NoResult.styles.d.ts → NoRoutes/NoRoutes.styles.d.ts} +1 -1
  26. package/dist/components/{NoResult/NoResult.styles.d.ts.map → NoRoutes/NoRoutes.styles.d.ts.map} +1 -1
  27. package/dist/components/{NoResult/NoResult.types.d.ts → NoRoutes/NoRoutes.types.d.ts} +3 -3
  28. package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
  29. package/dist/components/NoRoutes/index.d.ts +2 -0
  30. package/dist/components/NoRoutes/index.d.ts.map +1 -0
  31. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  32. package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
  33. package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
  34. package/dist/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts → RouteErrors/RouteErrors.styles.d.ts} +1 -1
  35. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
  36. package/dist/components/RouteErrors/RouteErrors.types.d.ts +24 -0
  37. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
  38. package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
  39. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
  40. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
  41. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
  42. package/dist/components/RouteErrors/index.d.ts +2 -0
  43. package/dist/components/RouteErrors/index.d.ts.map +1 -0
  44. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  45. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  46. package/dist/components/UpdateUrl.d.ts +6 -1
  47. package/dist/components/UpdateUrl.d.ts.map +1 -1
  48. package/dist/components/WidgetEvents.d.ts.map +1 -1
  49. package/dist/constants/errors.d.ts +4 -4
  50. package/dist/constants/errors.d.ts.map +1 -1
  51. package/dist/constants/messages.d.ts +1 -1
  52. package/dist/constants/searchParams.d.ts +1 -2
  53. package/dist/constants/searchParams.d.ts.map +1 -1
  54. package/dist/constants/warnings.d.ts +2 -2
  55. package/dist/constants/warnings.d.ts.map +1 -1
  56. package/dist/hooks/{useConfirmSwap/useConfirmSwap.types.d.ts → useConfirmSwap.d.ts} +7 -5
  57. package/dist/hooks/useConfirmSwap.d.ts.map +1 -0
  58. package/dist/hooks/{useFetchQuote.d.ts → useFetchBestRoute.d.ts} +3 -3
  59. package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
  60. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
  61. package/dist/hooks/useSwapInput.d.ts +2 -4
  62. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  63. package/dist/hooks/useSyncStoresWithConfig.d.ts +2 -1
  64. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  65. package/dist/hooks/useWalletList.d.ts.map +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/index.js.map +4 -4
  68. package/dist/pages/ConfirmSwapPage.d.ts +6 -1
  69. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  70. package/dist/pages/Home.d.ts.map +1 -1
  71. package/dist/pages/LiquiditySourcePage.d.ts +2 -1
  72. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  73. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  74. package/dist/pages/SettingsPage.d.ts +6 -1
  75. package/dist/pages/SettingsPage.d.ts.map +1 -1
  76. package/dist/pages/WalletsPage.d.ts +8 -1
  77. package/dist/pages/WalletsPage.d.ts.map +1 -1
  78. package/dist/store/app.d.ts +23 -5
  79. package/dist/store/app.d.ts.map +1 -1
  80. package/dist/store/{quote.d.ts → bestRoute.d.ts} +27 -39
  81. package/dist/store/bestRoute.d.ts.map +1 -0
  82. package/dist/store/meta.d.ts +23 -0
  83. package/dist/store/meta.d.ts.map +1 -0
  84. package/dist/store/settings.d.ts +2 -3
  85. package/dist/store/settings.d.ts.map +1 -1
  86. package/dist/store/slices/config.d.ts +2 -3
  87. package/dist/store/slices/config.d.ts.map +1 -1
  88. package/dist/store/slices/data.d.ts +0 -3
  89. package/dist/store/slices/data.d.ts.map +1 -1
  90. package/dist/store/wallets.d.ts +4 -5
  91. package/dist/store/wallets.d.ts.map +1 -1
  92. package/dist/types/config.d.ts +5 -5
  93. package/dist/types/config.d.ts.map +1 -1
  94. package/dist/types/index.d.ts +1 -1
  95. package/dist/types/index.d.ts.map +1 -1
  96. package/dist/types/routing.d.ts +65 -0
  97. package/dist/types/routing.d.ts.map +1 -0
  98. package/dist/utils/numbers.d.ts +1 -1
  99. package/dist/utils/numbers.d.ts.map +1 -1
  100. package/dist/utils/{quote.d.ts → routing.d.ts} +12 -16
  101. package/dist/utils/routing.d.ts.map +1 -0
  102. package/dist/utils/settings.d.ts +2 -3
  103. package/dist/utils/settings.d.ts.map +1 -1
  104. package/dist/utils/swap.d.ts +22 -25
  105. package/dist/utils/swap.d.ts.map +1 -1
  106. package/dist/utils/wallets.d.ts +2 -2
  107. package/dist/utils/wallets.d.ts.map +1 -1
  108. package/package.json +8 -8
  109. package/src/QueueManager.tsx +14 -14
  110. package/src/Wallets.tsx +15 -35
  111. package/src/Widget.tsx +24 -11
  112. package/src/components/AppRouter.tsx +5 -6
  113. package/src/components/AppRoutes.tsx +39 -6
  114. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  115. package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
  116. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -2
  117. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +40 -28
  118. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +3 -1
  119. package/src/components/ConfirmWalletsModal/WalletList.tsx +5 -6
  120. package/src/components/ConfirmWalletsModal/WalletList.type.ts +4 -1
  121. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
  122. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
  123. package/src/components/{NoResult/NoResult.helpers.ts → NoRoutes/NoRoutes.helper.ts} +9 -16
  124. package/src/components/{NoResult/NoResult.styles.ts → NoRoutes/NoRoutes.styles.ts} +0 -2
  125. package/src/components/{NoResult/NoResult.tsx → NoRoutes/NoRoutes.tsx} +12 -10
  126. package/src/components/{NoResult/NoResult.types.ts → NoRoutes/NoRoutes.types.ts} +2 -3
  127. package/src/components/NoRoutes/index.ts +1 -0
  128. package/src/components/NotificationContent/NotificationContent.tsx +2 -3
  129. package/src/components/RouteErrors/RouteErrors.tsx +79 -0
  130. package/src/components/RouteErrors/RouteErrors.types.ts +29 -0
  131. package/src/components/RouteErrors/RouteErrorsModal.tsx +129 -0
  132. package/src/components/{QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx → RouteErrors/RouteErrorsModalItem.tsx} +3 -3
  133. package/src/components/RouteErrors/index.ts +1 -0
  134. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
  135. package/src/components/SwapDetails/SwapDetails.tsx +22 -18
  136. package/src/components/SwitchFromAndTo.tsx +2 -2
  137. package/src/components/TokenList/TokenList.tsx +6 -5
  138. package/src/components/UpdateUrl.tsx +26 -36
  139. package/src/components/WidgetEvents.tsx +2 -4
  140. package/src/constants/errors.ts +10 -8
  141. package/src/constants/messages.ts +1 -1
  142. package/src/constants/searchParams.ts +0 -1
  143. package/src/constants/warnings.ts +7 -7
  144. package/src/hooks/useConfirmSwap.ts +303 -0
  145. package/src/hooks/{useFetchQuote.ts → useFetchBestRoute.ts} +3 -3
  146. package/src/hooks/useNavigateBack.ts +3 -3
  147. package/src/hooks/useSwapInput.ts +23 -58
  148. package/src/hooks/useSyncStoresWithConfig.ts +19 -22
  149. package/src/hooks/useWalletList.ts +5 -3
  150. package/src/pages/ConfirmSwapPage.tsx +235 -58
  151. package/src/pages/HistoryPage.tsx +1 -1
  152. package/src/pages/Home.tsx +247 -58
  153. package/src/pages/LanguagePage.tsx +1 -1
  154. package/src/pages/LiquiditySourcePage.tsx +32 -23
  155. package/src/pages/SelectBlockchainPage.tsx +7 -6
  156. package/src/pages/SelectSwapItemsPage.tsx +5 -5
  157. package/src/pages/SettingsPage.tsx +13 -9
  158. package/src/pages/SwapDetailsPage.tsx +3 -3
  159. package/src/pages/ThemePage.tsx +1 -1
  160. package/src/pages/WalletsPage.tsx +12 -5
  161. package/src/store/app.ts +6 -18
  162. package/src/store/{quote.ts → bestRoute.ts} +60 -68
  163. package/src/store/meta.ts +39 -0
  164. package/src/store/settings.ts +4 -7
  165. package/src/store/slices/config.ts +15 -25
  166. package/src/store/slices/data.ts +29 -64
  167. package/src/store/wallets.ts +8 -11
  168. package/src/types/config.ts +5 -5
  169. package/src/types/index.ts +1 -1
  170. package/src/types/routing.ts +77 -0
  171. package/src/utils/numbers.ts +1 -1
  172. package/src/utils/routing.ts +321 -0
  173. package/src/utils/settings.ts +7 -8
  174. package/src/utils/swap.ts +85 -113
  175. package/src/utils/wallets.ts +17 -29
  176. package/dist/components/NoResult/NoResult.d.ts +0 -4
  177. package/dist/components/NoResult/NoResult.d.ts.map +0 -1
  178. package/dist/components/NoResult/NoResult.helpers.d.ts +0 -4
  179. package/dist/components/NoResult/NoResult.helpers.d.ts.map +0 -1
  180. package/dist/components/NoResult/NoResult.types.d.ts.map +0 -1
  181. package/dist/components/NoResult/index.d.ts +0 -2
  182. package/dist/components/NoResult/index.d.ts.map +0 -1
  183. package/dist/components/Quote/Quote.d.ts +0 -4
  184. package/dist/components/Quote/Quote.d.ts.map +0 -1
  185. package/dist/components/Quote/Quote.styles.d.ts +0 -1429
  186. package/dist/components/Quote/Quote.styles.d.ts.map +0 -1
  187. package/dist/components/Quote/Quote.types.d.ts +0 -22
  188. package/dist/components/Quote/Quote.types.d.ts.map +0 -1
  189. package/dist/components/Quote/QuoteSkeleton.d.ts +0 -4
  190. package/dist/components/Quote/QuoteSkeleton.d.ts.map +0 -1
  191. package/dist/components/Quote/QuoteSkeleton.styles.d.ts +0 -319
  192. package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +0 -1
  193. package/dist/components/Quote/QuoteSkeleton.types.d.ts +0 -6
  194. package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +0 -1
  195. package/dist/components/Quote/QuoteSummary.d.ts +0 -11
  196. package/dist/components/Quote/QuoteSummary.d.ts.map +0 -1
  197. package/dist/components/Quote/QuoteSummary.styles.d.ts +0 -158
  198. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +0 -1
  199. package/dist/components/Quote/index.d.ts +0 -4
  200. package/dist/components/Quote/index.d.ts.map +0 -1
  201. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +0 -11
  202. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +0 -1
  203. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +0 -4
  204. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +0 -1
  205. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +0 -4
  206. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +0 -1
  207. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +0 -9
  208. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +0 -1
  209. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +0 -1
  210. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +0 -22
  211. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +0 -1
  212. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +0 -11
  213. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +0 -1
  214. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +0 -11
  215. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +0 -1
  216. package/dist/components/QuoteWarningsAndErrors/index.d.ts +0 -2
  217. package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +0 -1
  218. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +0 -4
  219. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +0 -1
  220. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -472
  221. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +0 -1
  222. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -17
  223. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +0 -1
  224. package/dist/containers/QuoteInfo/index.d.ts +0 -2
  225. package/dist/containers/QuoteInfo/index.d.ts.map +0 -1
  226. package/dist/hooks/useConfirmSwap/index.d.ts +0 -2
  227. package/dist/hooks/useConfirmSwap/index.d.ts.map +0 -1
  228. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +0 -3
  229. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +0 -1
  230. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +0 -16
  231. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +0 -1
  232. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +0 -1
  233. package/dist/hooks/useFetchQuote.d.ts.map +0 -1
  234. package/dist/hooks/useForceAutoConnect.d.ts +0 -2
  235. package/dist/hooks/useForceAutoConnect.d.ts.map +0 -1
  236. package/dist/store/AppStore.d.ts +0 -11
  237. package/dist/store/AppStore.d.ts.map +0 -1
  238. package/dist/store/quote.d.ts.map +0 -1
  239. package/dist/types/quote.d.ts +0 -82
  240. package/dist/types/quote.d.ts.map +0 -1
  241. package/dist/utils/quote.d.ts.map +0 -1
  242. package/src/components/NoResult/index.ts +0 -1
  243. package/src/components/Quote/Quote.styles.ts +0 -212
  244. package/src/components/Quote/Quote.tsx +0 -345
  245. package/src/components/Quote/Quote.types.ts +0 -16
  246. package/src/components/Quote/QuoteSkeleton.styles.ts +0 -110
  247. package/src/components/Quote/QuoteSkeleton.tsx +0 -108
  248. package/src/components/Quote/QuoteSkeleton.types.ts +0 -5
  249. package/src/components/Quote/QuoteSummary.styles.ts +0 -15
  250. package/src/components/Quote/QuoteSummary.tsx +0 -46
  251. package/src/components/Quote/index.ts +0 -3
  252. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +0 -107
  253. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +0 -67
  254. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +0 -103
  255. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +0 -24
  256. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +0 -77
  257. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +0 -38
  258. package/src/components/QuoteWarningsAndErrors/index.ts +0 -1
  259. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
  260. package/src/containers/QuoteInfo/QuoteInfo.tsx +0 -97
  261. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -17
  262. package/src/containers/QuoteInfo/index.ts +0 -1
  263. package/src/hooks/useConfirmSwap/index.ts +0 -1
  264. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +0 -168
  265. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +0 -136
  266. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +0 -19
  267. package/src/hooks/useForceAutoConnect.ts +0 -27
  268. package/src/store/AppStore.tsx +0 -35
  269. package/src/types/quote.ts +0 -107
  270. package/src/utils/quote.ts +0 -338
  271. /package/src/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts → RouteErrors/RouteErrors.styles.ts} +0 -0
@@ -1,16 +1,32 @@
1
+ import type { SwapResult } from 'rango-sdk';
2
+
1
3
  import { i18n } from '@lingui/core';
2
- import { Button, styled, SwapInput, WarningIcon } from '@rango-dev/ui';
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';
3
15
  import React, { useEffect, useRef, useState } from 'react';
4
16
  import { useNavigate } from 'react-router-dom';
5
17
 
6
18
  import { HomeButtons } from '../components/HeaderButtons';
7
19
  import { Layout } from '../components/Layout';
20
+ import { NoRoutes } from '../components/NoRoutes';
21
+ import { RouteErrors } from '../components/RouteErrors';
8
22
  import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
9
23
  import { errorMessages } from '../constants/errors';
10
24
  import { navigationRoutes } from '../constants/navigationRoutes';
11
25
  import {
12
26
  BALANCE_MAX_DECIMALS,
13
27
  BALANCE_MIN_DECIMALS,
28
+ GAS_FEE_MAX_DECIMALS,
29
+ GAS_FEE_MIN_DECIMALS,
14
30
  PERCENTAGE_CHANGE_MAX_DECIMALS,
15
31
  PERCENTAGE_CHANGE_MIN_DECIMALS,
16
32
  TOKEN_AMOUNT_MAX_DECIMALS,
@@ -18,22 +34,29 @@ import {
18
34
  USD_VALUE_MAX_DECIMALS,
19
35
  USD_VALUE_MIN_DECIMALS,
20
36
  } from '../constants/routing';
21
- import { QuoteInfo } from '../containers/QuoteInfo';
22
37
  import { useSwapInput } from '../hooks/useSwapInput';
23
- import { useAppStore } from '../store/AppStore';
24
- import { useQuoteStore } from '../store/quote';
38
+ import { useBestRouteStore } from '../store/bestRoute';
39
+ import { useMetaStore } from '../store/meta';
25
40
  import { useUiStore } from '../store/ui';
26
41
  import { useWalletsStore } from '../store/wallets';
27
42
  import { ButtonState } from '../types';
28
- import { numberToString } from '../utils/numbers';
29
- import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
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';
30
51
  import {
31
52
  canComputePriceImpact,
32
53
  getOutputRatio,
33
54
  getPercentageChange,
34
55
  getSwapButtonState,
35
- hasHighValueLoss,
56
+ getTotalFeeInUsd,
36
57
  hasLimitError,
58
+ LimitErrorMessage,
59
+ outputRatioHasWarning,
37
60
  } from '../utils/swap';
38
61
  import { getBalanceFromWallet } from '../utils/wallets';
39
62
 
@@ -53,13 +76,27 @@ const InputsContainer = styled('div', {
53
76
  gap: 5,
54
77
  alignSelf: 'stretch',
55
78
  });
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
+
56
94
  export function Home() {
57
95
  const navigate = useNavigate();
58
96
  const {
59
- fetch: fetchQuote,
60
- loading: fetchingQuote,
61
- error: quoteError,
62
- warning: quoteWarning,
97
+ fetch: refetchBestRoute,
98
+ loading: fetchingBestRoute,
99
+ error: bestRouteError,
63
100
  } = useSwapInput();
64
101
  const {
65
102
  fromToken,
@@ -71,40 +108,51 @@ export function Home() {
71
108
  inputUsdValue,
72
109
  outputAmount,
73
110
  outputUsdValue,
74
- quote,
75
- resetQuoteWallets,
76
- setQuoteWarningsConfirmed,
77
- } = useQuoteStore();
111
+ bestRoute,
112
+ resetRouteWallets,
113
+ } = useBestRouteStore();
78
114
 
79
- const fetchMetaStatus = useAppStore().fetchStatus;
115
+ const {
116
+ meta: { tokens, blockchains },
117
+ loadingStatus: loadingMetaStatus,
118
+ } = useMetaStore();
80
119
 
81
120
  const connectedWallets = useWalletsStore.use.connectedWallets();
82
121
  const setCurrentPage = useUiStore.use.setCurrentPage();
83
- const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
122
+ const [openWarningModal, setOpenWarningModal] = useState(false);
123
+ const {
124
+ fromAmountRangeError,
125
+ swap: swapHasError,
126
+ recommendation,
127
+ } = LimitErrorMessage(bestRoute);
84
128
  const layoutRef = useRef<HTMLDivElement>(null);
85
129
 
130
+ const showBestRoute =
131
+ !!Number(inputAmount) &&
132
+ (!!bestRoute || fetchingBestRoute || !!bestRouteError);
133
+
86
134
  const needsToWarnEthOnPath = false;
87
135
 
88
136
  const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
89
- const highValueLoss = hasHighValueLoss(inputUsdValue, outToInRatio);
137
+ const highValueLoss = outputRatioHasWarning(inputUsdValue, outToInRatio);
90
138
 
91
139
  const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
92
- quote,
140
+ bestRoute,
93
141
  inputAmount,
94
142
  inputUsdValue
95
143
  );
96
144
 
97
145
  const priceImpactOutputCanNotBeComputed = !canComputePriceImpact(
98
- quote,
146
+ bestRoute,
99
147
  inputAmount,
100
148
  outputUsdValue
101
149
  );
102
150
  const swapButtonState = getSwapButtonState(
103
- fetchMetaStatus,
151
+ loadingMetaStatus,
104
152
  connectedWallets,
105
- fetchingQuote,
106
- quote,
107
- hasLimitError(quote),
153
+ fetchingBestRoute,
154
+ bestRoute,
155
+ hasLimitError(bestRoute),
108
156
  highValueLoss,
109
157
  priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed,
110
158
  needsToWarnEthOnPath,
@@ -145,7 +193,7 @@ export function Home() {
145
193
 
146
194
  useEffect(() => {
147
195
  setCurrentPage(navigationRoutes.home);
148
- resetQuoteWallets();
196
+ resetRouteWallets();
149
197
  return setCurrentPage.bind(null, '');
150
198
  }, []);
151
199
 
@@ -153,9 +201,83 @@ export function Home() {
153
201
  !inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
154
202
  ? null
155
203
  : getPercentageChange(
156
- inputUsdValue.toString(),
157
- outputUsdValue.toString()
204
+ inputUsdValue.toNumber(),
205
+ outputUsdValue.toNumber()
158
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);
280
+
159
281
  return (
160
282
  <Layout
161
283
  ref={layoutRef}
@@ -174,8 +296,8 @@ export function Home() {
174
296
  onClick={() => {
175
297
  if (swapButtonState.state === ButtonState.WAITFORCONNECTING) {
176
298
  navigate(navigationRoutes.wallets);
177
- } else if (quoteWarning) {
178
- setShowQuoteWarningModal(true);
299
+ } else if (swapButtonState.state === ButtonState.NEEDTOCONFIRM) {
300
+ setOpenWarningModal(true);
179
301
  } else {
180
302
  navigate(navigationRoutes.confirmSwap);
181
303
  }
@@ -189,7 +311,9 @@ export function Home() {
189
311
  suffix: (
190
312
  <HomeButtons
191
313
  layoutRef={layoutRef.current}
192
- onClickRefresh={!!quote || quoteError ? fetchQuote : undefined}
314
+ onClickRefresh={
315
+ !!bestRoute || bestRouteError ? refetchBestRoute : undefined
316
+ }
193
317
  onClickHistory={() => navigate(navigationRoutes.swaps)}
194
318
  onClickSettings={() => navigate(navigationRoutes.settings)}
195
319
  />
@@ -200,8 +324,6 @@ export function Home() {
200
324
  <FromContainer>
201
325
  <SwapInput
202
326
  label={i18n.t('From')}
203
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
204
- //@ts-ignore
205
327
  mode="From"
206
328
  onInputChange={setInputAmount}
207
329
  balance={tokenBalance}
@@ -227,8 +349,8 @@ export function Home() {
227
349
  ? errorMessages().unknownPriceError.impactTitle
228
350
  : undefined,
229
351
  }}
230
- disabled={fetchMetaStatus === 'failed'}
231
- loading={fetchMetaStatus === 'loading'}
352
+ disabled={loadingMetaStatus === 'failed'}
353
+ loading={loadingMetaStatus === 'loading'}
232
354
  onSelectMaxBalance={() => {
233
355
  if (tokenBalance !== '0') {
234
356
  setInputAmount(tokenBalanceReal.split(',').join(''));
@@ -238,7 +360,7 @@ export function Home() {
238
360
  <SwitchFromAndToButton />
239
361
  </FromContainer>
240
362
  <SwapInput
241
- sharpBottomStyle={!!quote?.result || fetchingQuote}
363
+ sharpBottomStyle={!!bestRoute?.result || fetchingBestRoute}
242
364
  label={i18n.t('To')}
243
365
  mode="To"
244
366
  chain={{
@@ -249,12 +371,18 @@ export function Home() {
249
371
  displayName: toToken?.symbol || '',
250
372
  image: toToken?.image || '',
251
373
  }}
252
- percentageChange={numberToString(
253
- getPriceImpact(inputUsdValue, outputUsdValue),
254
- PERCENTAGE_CHANGE_MIN_DECIMALS,
255
- PERCENTAGE_CHANGE_MAX_DECIMALS
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
256
385
  )}
257
- warningLevel={getPriceImpactLevel(percentageChange ?? 0)}
258
386
  price={{
259
387
  value: numberToString(
260
388
  outputAmount,
@@ -273,27 +401,88 @@ export function Home() {
273
401
  : undefined,
274
402
  }}
275
403
  onClickToken={() => navigate('to-swap')}
276
- disabled={fetchMetaStatus === 'failed'}
277
- loading={fetchMetaStatus === 'loading'}
404
+ disabled={loadingMetaStatus === 'failed'}
405
+ loading={loadingMetaStatus === 'loading'}
278
406
  />
279
407
  </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
- />
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}
296
471
  </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
+ />
297
486
  </Layout>
298
487
  );
299
488
  }
@@ -38,7 +38,7 @@ export function LanguagePage() {
38
38
  return (
39
39
  <Layout
40
40
  header={{
41
- onBack: () => navigateBackFrom(navigationRoutes.settings),
41
+ onBack: navigateBackFrom.bind(null, navigationRoutes.settings),
42
42
  title: i18n.t('Language'),
43
43
  }}>
44
44
  <SettingsContainer>
@@ -25,23 +25,30 @@ import {
25
25
  } from '../components/SettingsContainer';
26
26
  import { navigationRoutes } from '../constants/navigationRoutes';
27
27
  import { useNavigateBack } from '../hooks/useNavigateBack';
28
- import { useAppStore } from '../store/AppStore';
28
+ import { useMetaStore } from '../store/meta';
29
29
  import { useSettingsStore } from '../store/settings';
30
30
  import { containsText } from '../utils/numbers';
31
- import { getUniqueSwappersGroups } from '../utils/settings';
31
+ import {
32
+ getUniqueSwappersGroups,
33
+ sortLiquiditySourcesByGroupTitle,
34
+ } from '../utils/settings';
32
35
 
33
36
  interface PropTypes {
37
+ supportedSwappers?: string[];
34
38
  sourceType: 'Exchanges' | 'Bridges';
35
39
  }
36
40
 
37
- export function LiquiditySourcePage({ sourceType }: PropTypes) {
38
- const fetchStatus = useAppStore().fetchStatus;
39
- const swappers = useAppStore().swappers();
41
+ export function LiquiditySourcePage({
42
+ supportedSwappers,
43
+ sourceType,
44
+ }: PropTypes) {
40
45
  const [searchedFor, setSearchedFor] = useState<string>('');
41
46
  const toggleLiquiditySource = useSettingsStore.use.toggleLiquiditySource();
42
47
  const { navigateBackFrom } = useNavigateBack();
48
+ const loadingMetaStatus = useMetaStore.use.loadingStatus();
49
+
43
50
  const supportedUniqueSwappersGroups: Array<UniqueSwappersGroupType> =
44
- getUniqueSwappersGroups(swappers);
51
+ getUniqueSwappersGroups(supportedSwappers);
45
52
 
46
53
  const validTypes: Array<LiquiditySourceType> = [];
47
54
  if (sourceType === 'Exchanges') {
@@ -72,20 +79,22 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
72
79
  });
73
80
  };
74
81
 
75
- const list = liquiditySources.map((sourceItem) => {
76
- const { selected, groupTitle, logo } = sourceItem;
77
- return {
78
- start: <Image src={logo} size={22} type="circular" />,
79
- onClick: () => toggleLiquiditySource(groupTitle),
80
- end: <Checkbox checked={selected} />,
81
- title: (
82
- <Typography variant="title" size="xmedium">
83
- {i18n.t(groupTitle)}
84
- </Typography>
85
- ),
86
- ...sourceItem,
87
- };
88
- });
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
+ });
89
98
 
90
99
  const searchHandler = (event: React.ChangeEvent<HTMLInputElement>) => {
91
100
  const value = event.target.value;
@@ -102,7 +111,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
102
111
  return (
103
112
  <Layout
104
113
  header={{
105
- onBack: () => navigateBackFrom(navigationRoutes.settings),
114
+ onBack: navigateBackFrom.bind(null, navigationRoutes.settings),
106
115
  title: i18n.t(sourceType),
107
116
  suffix: (
108
117
  <LiquiditySourceSuffix>
@@ -122,7 +131,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
122
131
  placeholder={i18n.t('Search {sourceType}', { sourceType })}
123
132
  onChange={searchHandler}
124
133
  />
125
- {fetchStatus === 'loading' && <LoadingLiquiditySourceList />}
134
+ {loadingMetaStatus === 'loading' && <LoadingLiquiditySourceList />}
126
135
 
127
136
  {!filteredList.length && !!searchedFor ? (
128
137
  <NotFoundContainer>
@@ -132,7 +141,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
132
141
  />
133
142
  </NotFoundContainer>
134
143
  ) : (
135
- fetchStatus === 'success' && (
144
+ loadingMetaStatus === 'success' && (
136
145
  <LiquiditySourceList>
137
146
  {filteredList.map((sourceItem) => {
138
147
  return (
@@ -7,8 +7,9 @@ import { Layout } from '../components/Layout';
7
7
  import { SearchInput } from '../components/SearchInput';
8
8
  import { navigationRoutes } from '../constants/navigationRoutes';
9
9
  import { useNavigateBack } from '../hooks/useNavigateBack';
10
- import { useAppStore } from '../store/AppStore';
11
- import { useQuoteStore } from '../store/quote';
10
+ import { useAppStore } from '../store/app';
11
+ import { useBestRouteStore } from '../store/bestRoute';
12
+ import { useMetaStore } from '../store/meta';
12
13
 
13
14
  interface PropTypes {
14
15
  type: 'source' | 'destination';
@@ -19,9 +20,9 @@ export function SelectBlockchainPage(props: PropTypes) {
19
20
  const { navigateBackFrom } = useNavigateBack();
20
21
  const [searchedFor, setSearchedFor] = useState<string>('');
21
22
  const [blockchainCategory, setBlockchainCategory] = useState<string>('ALL');
22
- const setToBlockchain = useQuoteStore.use.setToBlockchain();
23
- const setFromBlockchain = useQuoteStore.use.setFromBlockchain();
24
- const fetchStatus = useAppStore().fetchStatus;
23
+ const setToBlockchain = useBestRouteStore.use.setToBlockchain();
24
+ const setFromBlockchain = useBestRouteStore.use.setFromBlockchain();
25
+ const { loadingStatus } = useMetaStore();
25
26
 
26
27
  const blockchains = useAppStore().blockchains({
27
28
  type: type,
@@ -41,7 +42,7 @@ export function SelectBlockchainPage(props: PropTypes) {
41
42
  setCategory={setBlockchainCategory}
42
43
  category={blockchainCategory}
43
44
  blockchains={blockchains}
44
- isLoading={fetchStatus === 'loading'}
45
+ isLoading={loadingStatus === 'loading'}
45
46
  />
46
47
  <Divider size={24} />
47
48
  <SearchInput
@@ -11,8 +11,8 @@ import { SearchInput } from '../components/SearchInput';
11
11
  import { TokenList } from '../components/TokenList/TokenList';
12
12
  import { navigationRoutes } from '../constants/navigationRoutes';
13
13
  import { useNavigateBack } from '../hooks/useNavigateBack';
14
- import { useAppStore } from '../store/AppStore';
15
- import { useQuoteStore } from '../store/quote';
14
+ import { useAppStore } from '../store/app';
15
+ import { useBestRouteStore } from '../store/bestRoute';
16
16
  import { useWalletsStore } from '../store/wallets';
17
17
  import { getTokensBalanceFromWalletAndSort } from '../utils/wallets';
18
18
 
@@ -31,7 +31,7 @@ export function SelectSwapItemsPage(props: PropTypes) {
31
31
  setToToken,
32
32
  setFromBlockchain,
33
33
  setToBlockchain,
34
- } = useQuoteStore();
34
+ } = useBestRouteStore();
35
35
  const { connectedWallets } = useWalletsStore();
36
36
  const [searchedFor, setSearchedFor] = useState<string>('');
37
37
 
@@ -63,9 +63,9 @@ export function SelectSwapItemsPage(props: PropTypes) {
63
63
 
64
64
  const updateToken = (token: Token) => {
65
65
  if (type === 'source') {
66
- setFromToken({ token, meta: { blockchains, tokens } });
66
+ setFromToken(token);
67
67
  } else {
68
- setToToken({ token, meta: { blockchains, tokens } });
68
+ setToToken(token);
69
69
  }
70
70
  };
71
71
 
@@ -19,22 +19,26 @@ import { Slippage } from '../components/Slippage';
19
19
  import { SlippageTooltipContainer as TooltipContainer } from '../components/Slippage/Slippage.styles';
20
20
  import { navigationRoutes } from '../constants/navigationRoutes';
21
21
  import { useNavigateBack } from '../hooks/useNavigateBack';
22
- import { useAppStore } from '../store/AppStore';
22
+ import { useMetaStore } from '../store/meta';
23
23
  import { useSettingsStore } from '../store/settings';
24
24
  import { getContainer } from '../utils/common';
25
25
  import { getUniqueSwappersGroups } from '../utils/settings';
26
26
 
27
- export function SettingsPage() {
27
+ interface PropTypes {
28
+ supportedSwappers?: string[];
29
+ singleTheme?: boolean;
30
+ }
31
+
32
+ export function SettingsPage({ supportedSwappers, singleTheme }: PropTypes) {
28
33
  const navigate = useNavigate();
29
- const { theme } = useAppStore().config;
30
- const fetchStatus = useAppStore().fetchStatus;
31
- const swappers = useAppStore().swappers();
32
34
  const { navigateBackFrom } = useNavigateBack();
33
35
 
34
36
  const infiniteApprove = useSettingsStore.use.infiniteApprove();
35
37
  const toggleInfiniteApprove = useSettingsStore.use.toggleInfiniteApprove();
38
+ const loadingMetaStatus = useMetaStore.use.loadingStatus();
36
39
 
37
- const supportedUniqueSwappersGroups = getUniqueSwappersGroups(swappers);
40
+ const supportedUniqueSwappersGroups =
41
+ getUniqueSwappersGroups(supportedSwappers);
38
42
 
39
43
  const bridgeSources = supportedUniqueSwappersGroups.filter(
40
44
  (uniqueItem) =>
@@ -54,7 +58,7 @@ export function SettingsPage() {
54
58
  ).length;
55
59
 
56
60
  const handleEndItem = (totalSelected: number, total: number) => {
57
- switch (fetchStatus) {
61
+ switch (loadingMetaStatus) {
58
62
  case 'loading':
59
63
  return <Skeleton variant="text" size="medium" width={50} />;
60
64
  case 'failed':
@@ -163,7 +167,7 @@ export function SettingsPage() {
163
167
  exchangeItem,
164
168
  // languageItem
165
169
  ];
166
- if (!theme?.singleTheme) {
170
+ if (!singleTheme) {
167
171
  settingItems.push(themeItem);
168
172
  }
169
173
  settingItems.push(infiniteApprovalItem);
@@ -171,7 +175,7 @@ export function SettingsPage() {
171
175
  return (
172
176
  <Layout
173
177
  header={{
174
- onBack: () => navigateBackFrom(navigationRoutes.settings),
178
+ onBack: navigateBackFrom.bind(null, navigationRoutes.settings),
175
179
  title: i18n.t('Setting'),
176
180
  }}>
177
181
  <SettingsContainer>