@rango-dev/widget-embedded 0.12.1-next.8 → 0.13.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 (279) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/Widget.d.ts.map +1 -1
  3. package/dist/components/AppRouter.d.ts +5 -2
  4. package/dist/components/AppRouter.d.ts.map +1 -1
  5. package/dist/components/AppRoutes.d.ts.map +1 -1
  6. package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -1
  7. package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -1
  8. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +14 -4
  9. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  10. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
  11. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +6 -1
  12. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  13. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -1
  14. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  15. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +94 -17
  16. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  17. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  18. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  19. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +18 -3
  20. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
  21. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +25 -284
  22. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  23. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +1 -0
  24. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  25. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  26. package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -1
  27. package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -1
  28. package/dist/components/Layout/Layout.d.ts.map +1 -1
  29. package/dist/components/Layout/Layout.styles.d.ts +18 -3
  30. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  31. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +6 -1
  32. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  33. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
  34. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
  35. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts +3 -0
  36. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -0
  37. package/dist/components/{SelectableCategoryList/SelectableCategoryList.styles.d.ts → LoadingSwapDetails/LoadingSwapDetails.styles.d.ts} +21 -6
  38. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -0
  39. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
  40. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
  41. package/dist/components/LoadingSwapDetails/index.d.ts +2 -0
  42. package/dist/components/LoadingSwapDetails/index.d.ts.map +1 -0
  43. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -1
  44. package/dist/components/NoRoutes/NoRoutes.styles.d.ts +18 -3
  45. package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -1
  46. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  47. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +24 -4
  48. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  49. package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -1
  50. package/dist/components/RouteErrors/RouteErrors.styles.d.ts +24 -4
  51. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -1
  52. package/dist/components/RouteErrors/RouteErrors.types.d.ts +3 -1
  53. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -1
  54. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -1
  55. package/dist/components/SearchInput/SearchInput.styles.d.ts +6 -1
  56. package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
  57. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +23 -151
  58. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  59. package/dist/components/SettingsContainer/index.d.ts +1 -1
  60. package/dist/components/SettingsContainer/index.d.ts.map +1 -1
  61. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  62. package/dist/components/Slippage/Slippage.styles.d.ts +24 -4
  63. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  64. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  65. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  66. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +2 -9
  67. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
  68. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +35 -153
  69. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  70. package/dist/components/SwapDetails/SwapDetails.types.d.ts +1 -1
  71. package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -1
  72. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +6 -1
  73. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
  74. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
  75. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
  76. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +1 -1
  77. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  78. package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
  79. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +6 -1
  80. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
  81. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +2 -1
  82. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
  83. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  84. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +24 -4
  85. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  86. package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
  87. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  88. package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
  89. package/dist/components/TokenList/TokenList.styles.d.ts +207 -9
  90. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  91. package/dist/components/TokenList/TokenList.types.d.ts +1 -1
  92. package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
  93. package/dist/components/UpdateUrl.d.ts +6 -1
  94. package/dist/components/UpdateUrl.d.ts.map +1 -1
  95. package/dist/components/WalletModal/WalletModalContent.styles.d.ts +24 -4
  96. package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
  97. package/dist/components/WidgetEvents.d.ts.map +1 -1
  98. package/dist/constants/errors.d.ts +2 -2
  99. package/dist/constants/routing.d.ts +12 -2
  100. package/dist/constants/routing.d.ts.map +1 -1
  101. package/dist/constants.d.ts +2 -0
  102. package/dist/constants.d.ts.map +1 -0
  103. package/dist/globalStyles.d.ts +1 -1
  104. package/dist/globalStyles.d.ts.map +1 -1
  105. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  106. package/dist/hooks/usePrepareBlockchainList.d.ts +18 -0
  107. package/dist/hooks/usePrepareBlockchainList.d.ts.map +1 -0
  108. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  109. package/dist/hooks/useSyncStoresWithConfig.d.ts +3 -0
  110. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -0
  111. package/dist/hooks/useTheme.d.ts +3 -6
  112. package/dist/hooks/useTheme.d.ts.map +1 -1
  113. package/dist/hooks/useWalletProviders.d.ts +3 -3
  114. package/dist/hooks/useWalletProviders.d.ts.map +1 -1
  115. package/dist/index.js +1 -1
  116. package/dist/index.js.map +4 -4
  117. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  118. package/dist/pages/Home.d.ts.map +1 -1
  119. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  120. package/dist/pages/SelectBlockchainPage.d.ts +1 -2
  121. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  122. package/dist/pages/SelectSwapItemsPage.d.ts +1 -5
  123. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  124. package/dist/pages/SettingsPage.d.ts.map +1 -1
  125. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  126. package/dist/pages/WalletsPage.d.ts.map +1 -1
  127. package/dist/services/httpService.d.ts +0 -1
  128. package/dist/services/httpService.d.ts.map +1 -1
  129. package/dist/store/app.d.ts +26 -0
  130. package/dist/store/app.d.ts.map +1 -0
  131. package/dist/store/bestRoute.d.ts +4 -8
  132. package/dist/store/bestRoute.d.ts.map +1 -1
  133. package/dist/store/meta.d.ts +0 -2
  134. package/dist/store/meta.d.ts.map +1 -1
  135. package/dist/store/slices/config.d.ts +8 -0
  136. package/dist/store/slices/config.d.ts.map +1 -0
  137. package/dist/store/slices/data.d.ts +26 -0
  138. package/dist/store/slices/data.d.ts.map +1 -0
  139. package/dist/store/wallets.d.ts.map +1 -1
  140. package/dist/types/config.d.ts +3 -0
  141. package/dist/types/config.d.ts.map +1 -1
  142. package/dist/utils/common.d.ts +1 -0
  143. package/dist/utils/common.d.ts.map +1 -1
  144. package/dist/utils/configs.d.ts +5 -0
  145. package/dist/utils/configs.d.ts.map +1 -1
  146. package/dist/utils/meta.d.ts +1 -0
  147. package/dist/utils/meta.d.ts.map +1 -1
  148. package/dist/utils/numbers.d.ts +3 -1
  149. package/dist/utils/numbers.d.ts.map +1 -1
  150. package/dist/utils/routing.d.ts +6 -3
  151. package/dist/utils/routing.d.ts.map +1 -1
  152. package/dist/utils/settings.d.ts +1 -0
  153. package/dist/utils/settings.d.ts.map +1 -1
  154. package/dist/utils/swap.d.ts +1 -1
  155. package/dist/utils/swap.d.ts.map +1 -1
  156. package/dist/utils/time.d.ts +2 -2
  157. package/dist/utils/time.d.ts.map +1 -1
  158. package/dist/utils/wallets.d.ts +1 -1
  159. package/dist/utils/wallets.d.ts.map +1 -1
  160. package/package.json +8 -8
  161. package/readme.md +2 -0
  162. package/src/Widget.tsx +22 -3
  163. package/src/components/AppRouter.tsx +38 -7
  164. package/src/components/AppRoutes.tsx +4 -28
  165. package/src/components/BlockchainList/BlockchainList.helpers.ts +1 -1
  166. package/src/components/BlockchainList/BlockchainList.styles.ts +6 -5
  167. package/src/components/BlockchainList/BlockchainList.tsx +6 -9
  168. package/src/components/BlockchainsSection/BlockchainsSection.tsx +29 -42
  169. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +33 -7
  170. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +48 -7
  171. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +59 -16
  172. package/src/components/ConfirmWalletsModal/WalletList.tsx +66 -22
  173. package/src/components/HeaderButtons/HeaderButtons.styles.ts +2 -2
  174. package/src/components/HeaderButtons/HeaderButtons.types.ts +1 -0
  175. package/src/components/HeaderButtons/HomeButtons.tsx +18 -5
  176. package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +1 -2
  177. package/src/components/HeaderButtons/WalletButton.tsx +4 -1
  178. package/src/components/Layout/Layout.styles.ts +5 -3
  179. package/src/components/Layout/Layout.tsx +5 -20
  180. package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
  181. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +78 -0
  182. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +53 -0
  183. package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
  184. package/src/components/LoadingSwapDetails/index.ts +1 -0
  185. package/src/components/NoRoutes/NoRoutes.helper.ts +4 -2
  186. package/src/components/NotificationContent/NotificationContent.tsx +3 -7
  187. package/src/components/RouteErrors/RouteErrors.styles.ts +2 -1
  188. package/src/components/RouteErrors/RouteErrors.tsx +37 -26
  189. package/src/components/RouteErrors/RouteErrors.types.ts +3 -1
  190. package/src/components/RouteErrors/RouteErrorsModal.tsx +42 -14
  191. package/src/components/SettingsContainer/SettingsContainer.style.ts +2 -7
  192. package/src/components/SettingsContainer/index.ts +0 -1
  193. package/src/components/Slippage/Slippage.tsx +6 -2
  194. package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
  195. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +52 -16
  196. package/src/components/SwapDetails/SwapDetails.helpers.tsx +19 -33
  197. package/src/components/SwapDetails/SwapDetails.styles.ts +10 -14
  198. package/src/components/SwapDetails/SwapDetails.tsx +143 -101
  199. package/src/components/SwapDetails/SwapDetails.types.ts +1 -1
  200. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +5 -4
  201. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +6 -7
  202. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +3 -0
  203. package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +2 -1
  204. package/src/components/SwapsGroup/SwapsGroup.tsx +3 -2
  205. package/src/components/SwitchFromAndTo.tsx +1 -35
  206. package/src/components/TokenList/TokenList.helpers.ts +6 -8
  207. package/src/components/TokenList/TokenList.styles.ts +7 -1
  208. package/src/components/TokenList/TokenList.tsx +29 -23
  209. package/src/components/TokenList/TokenList.types.ts +1 -1
  210. package/src/components/UpdateUrl.tsx +7 -1
  211. package/src/components/WidgetEvents.tsx +9 -3
  212. package/src/constants/errors.ts +2 -2
  213. package/src/constants/routing.ts +17 -2
  214. package/src/constants.ts +1 -0
  215. package/src/globalStyles.ts +1 -4
  216. package/src/hooks/useFetchBestRoute.ts +2 -2
  217. package/src/hooks/useNavigateBack.ts +10 -0
  218. package/src/hooks/usePrepareBlockchainList.ts +125 -0
  219. package/src/hooks/useSwapInput.ts +17 -3
  220. package/src/hooks/useSyncStoresWithConfig.ts +102 -0
  221. package/src/hooks/useTheme.ts +37 -75
  222. package/src/hooks/useWalletProviders.ts +7 -7
  223. package/src/pages/ConfirmSwapPage.tsx +65 -36
  224. package/src/pages/HistoryPage.tsx +2 -2
  225. package/src/pages/Home.tsx +114 -50
  226. package/src/pages/LanguagePage.tsx +1 -1
  227. package/src/pages/LiquiditySourcePage.tsx +22 -18
  228. package/src/pages/SelectBlockchainPage.tsx +19 -20
  229. package/src/pages/SelectSwapItemsPage.tsx +66 -88
  230. package/src/pages/SettingsPage.tsx +42 -15
  231. package/src/pages/SwapDetailsPage.tsx +9 -2
  232. package/src/pages/ThemePage.tsx +1 -1
  233. package/src/pages/WalletsPage.tsx +11 -5
  234. package/src/services/httpService.ts +4 -5
  235. package/src/store/app.ts +15 -0
  236. package/src/store/bestRoute.ts +45 -71
  237. package/src/store/meta.ts +11 -29
  238. package/src/store/slices/config.ts +26 -0
  239. package/src/store/slices/data.ts +203 -0
  240. package/src/store/wallets.ts +0 -27
  241. package/src/types/config.ts +3 -0
  242. package/src/utils/common.ts +3 -0
  243. package/src/utils/configs.ts +8 -2
  244. package/src/utils/meta.ts +7 -0
  245. package/src/utils/numbers.ts +3 -2
  246. package/src/utils/routing.ts +76 -14
  247. package/src/utils/settings.ts +15 -0
  248. package/src/utils/swap.ts +82 -26
  249. package/src/utils/time.ts +69 -36
  250. package/src/utils/wallets.ts +49 -29
  251. package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +0 -5
  252. package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +0 -1
  253. package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +0 -151
  254. package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +0 -1
  255. package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +0 -6
  256. package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +0 -1
  257. package/dist/components/BlockchainsChip/index.d.ts +0 -2
  258. package/dist/components/BlockchainsChip/index.d.ts.map +0 -1
  259. package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +0 -3
  260. package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +0 -1
  261. package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +0 -4
  262. package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +0 -1
  263. package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +0 -4
  264. package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +0 -1
  265. package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +0 -1
  266. package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +0 -12
  267. package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +0 -1
  268. package/dist/components/SelectableCategoryList/index.d.ts +0 -2
  269. package/dist/components/SelectableCategoryList/index.d.ts.map +0 -1
  270. package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +0 -30
  271. package/src/components/BlockchainsChip/BlockchainsChip.tsx +0 -15
  272. package/src/components/BlockchainsChip/BlockchainsChip.types.ts +0 -4
  273. package/src/components/BlockchainsChip/index.ts +0 -1
  274. package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +0 -20
  275. package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +0 -20
  276. package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +0 -21
  277. package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +0 -79
  278. package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +0 -12
  279. package/src/components/SelectableCategoryList/index.ts +0 -1
@@ -1,11 +1,41 @@
1
- import React, { Fragment, PropsWithChildren } from 'react';
2
- import { MemoryRouter, useInRouterContext } from 'react-router';
1
+ import type { WidgetConfig } from '../types';
2
+ import type { WalletType } from '@rango-dev/wallets-shared';
3
+ import type { PropsWithChildren } from 'react';
4
+
3
5
  import { useQueueManager } from '@rango-dev/queue-manager-rango-preset';
4
- import { WalletType } from '@rango-dev/wallets-shared';
5
- import { UpdateUrl } from './UpdateUrl';
6
- import { useMetaStore } from '../store/meta';
7
6
  import { useWallets } from '@rango-dev/wallets-react';
8
7
  import { isEvmBlockchain } from 'rango-types';
8
+ import React, { useEffect, useRef } from 'react';
9
+ import { MemoryRouter, useInRouterContext } from 'react-router';
10
+ import { useLocation, useNavigate } from 'react-router-dom';
11
+
12
+ import { navigationRoutes } from '../constants/navigationRoutes';
13
+ import { Home } from '../pages/Home';
14
+ import { useMetaStore } from '../store/meta';
15
+
16
+ import { UpdateUrl } from './UpdateUrl';
17
+
18
+ function Route(props: PropsWithChildren) {
19
+ const location = useLocation();
20
+ const navigate = useNavigate();
21
+ const firstRender = useRef(true);
22
+ const paths = location.pathname.split('/');
23
+ const pathMatched = paths[paths.length - 1] === navigationRoutes.confirmSwap;
24
+ const shouldRedirectToMainPage = pathMatched && firstRender.current;
25
+
26
+ useEffect(() => {
27
+ if (shouldRedirectToMainPage) {
28
+ navigate('.');
29
+ }
30
+ firstRender.current = false;
31
+ }, []);
32
+
33
+ if (shouldRedirectToMainPage) {
34
+ return <Home />;
35
+ }
36
+
37
+ return <> {props.children}</>;
38
+ }
9
39
 
10
40
  export function AppRouter({
11
41
  children,
@@ -14,9 +44,10 @@ export function AppRouter({
14
44
  lastConnectedWallet: string;
15
45
  disconnectedWallet: WalletType | undefined;
16
46
  clearDisconnectedWallet: () => void;
47
+ config: WidgetConfig | undefined;
17
48
  }) {
18
49
  const isRouterInContext = useInRouterContext();
19
- const Router = isRouterInContext ? Fragment : MemoryRouter;
50
+ const Router = isRouterInContext ? Route : MemoryRouter;
20
51
  const { blockchains } = useMetaStore.use.meta();
21
52
  const { canSwitchNetworkTo } = useWallets();
22
53
 
@@ -33,7 +64,7 @@ export function AppRouter({
33
64
  return (
34
65
  <>
35
66
  <Router>{children}</Router>
36
- {isRouterInContext && <UpdateUrl />}
67
+ {isRouterInContext && <UpdateUrl config={props.config} />}
37
68
  </>
38
69
  );
39
70
  }
@@ -32,43 +32,19 @@ export function AppRoutes(props: PropTypes) {
32
32
  },
33
33
  {
34
34
  path: navigationRoutes.fromSwap,
35
- element: (
36
- <SelectSwapItemsPage
37
- type="from"
38
- supportedBlockchains={config?.from?.blockchains}
39
- supportedTokens={config?.from?.tokens}
40
- pinnedTokens={config?.pinnedTokens}
41
- />
42
- ),
35
+ element: <SelectSwapItemsPage type="source" />,
43
36
  },
44
37
  {
45
38
  path: navigationRoutes.toSwap,
46
- element: (
47
- <SelectSwapItemsPage
48
- type="to"
49
- supportedBlockchains={config?.to?.blockchains}
50
- supportedTokens={config?.to?.tokens}
51
- pinnedTokens={config?.pinnedTokens}
52
- />
53
- ),
39
+ element: <SelectSwapItemsPage type="destination" />,
54
40
  },
55
41
  {
56
42
  path: navigationRoutes.fromBlockchain,
57
- element: (
58
- <SelectBlockchainPage
59
- type="from"
60
- supportedBlockchains={config?.to?.blockchains}
61
- />
62
- ),
43
+ element: <SelectBlockchainPage type="source" />,
63
44
  },
64
45
  {
65
46
  path: navigationRoutes.toBlockchain,
66
- element: (
67
- <SelectBlockchainPage
68
- type="to"
69
- supportedBlockchains={config?.to?.blockchains}
70
- />
71
- ),
47
+ element: <SelectBlockchainPage type="destination" />,
72
48
  },
73
49
  {
74
50
  path: navigationRoutes.settings,
@@ -1,7 +1,7 @@
1
+ import { BlockchainCategories } from '@rango-dev/ui';
1
2
  import { type BlockchainMeta, TransactionType } from 'rango-sdk';
2
3
 
3
4
  import { containsText } from '../../utils/common';
4
- import { BlockchainCategories } from '../SelectableCategoryList/SelectableCategoryList.types';
5
5
 
6
6
  export const filterByType = (
7
7
  blockchain: BlockchainMeta,
@@ -1,10 +1,15 @@
1
1
  import { styled } from '@rango-dev/ui';
2
2
 
3
+ export const Container = styled('div', {
4
+ display: 'flex',
5
+ flexDirection: 'column',
6
+ overflow: 'hidden',
7
+ });
8
+
3
9
  export const List = styled('ul', {
4
10
  padding: 0,
5
11
  margin: 0,
6
12
  listStyle: 'none',
7
- height: 355,
8
13
  overflowY: 'auto',
9
14
  paddingRight: '$5',
10
15
  '.image-container': {
@@ -12,7 +17,3 @@ export const List = styled('ul', {
12
17
  overflow: 'hidden',
13
18
  },
14
19
  });
15
-
16
- export const Content = styled('div', {
17
- minHeight: 325,
18
- });
@@ -14,7 +14,7 @@ import React, { useEffect, useState } from 'react';
14
14
  import { useMetaStore } from '../../store/meta';
15
15
 
16
16
  import { filterBlockchains } from './BlockchainList.helpers';
17
- import { Content, List } from './BlockchainList.styles';
17
+ import { Container, List } from './BlockchainList.styles';
18
18
  import { LoadingBlockchainList } from './LoadingBlockchainList';
19
19
 
20
20
  export function BlockchainList(props: PropTypes) {
@@ -41,7 +41,7 @@ export function BlockchainList(props: PropTypes) {
41
41
  );
42
42
  }
43
43
  return (
44
- <List>
44
+ <List key={`${blockchainCategory}-${searchedFor}`}>
45
45
  {blockchains.map((item) => (
46
46
  <ListItemButton
47
47
  key={`${item.name}-${item.chainId}`}
@@ -61,16 +61,13 @@ export function BlockchainList(props: PropTypes) {
61
61
  };
62
62
 
63
63
  return (
64
- <div>
64
+ <Container>
65
65
  <Typography variant="label" size="large">
66
66
  {i18n.t('Select Blockchain')}
67
67
  </Typography>
68
68
  <Divider size={4} />
69
-
70
- <Content>
71
- {loadingStatus === 'loading' && <LoadingBlockchainList />}
72
- {loadingStatus === 'success' && renderList()}
73
- </Content>
74
- </div>
69
+ {loadingStatus === 'loading' && <LoadingBlockchainList />}
70
+ {loadingStatus === 'success' && renderList()}
71
+ </Container>
75
72
  );
76
73
  }
@@ -2,41 +2,37 @@
2
2
  import type { PropTypes } from './BlockchainsSection.types';
3
3
 
4
4
  import { i18n } from '@lingui/core';
5
- import { Divider, Image, Skeleton, Typography } from '@rango-dev/ui';
6
- import { type BlockchainMeta } from 'rango-sdk';
7
- import React, { useEffect, useState } from 'react';
5
+ import {
6
+ BlockchainsChip,
7
+ Divider,
8
+ Image,
9
+ Skeleton,
10
+ Typography,
11
+ } from '@rango-dev/ui';
12
+ import React from 'react';
8
13
 
14
+ import { usePrepareBlockchainList } from '../../hooks/usePrepareBlockchainList';
9
15
  import { useBestRouteStore } from '../../store/bestRoute';
10
16
  import { useMetaStore } from '../../store/meta';
11
- import { BlockchainsChip } from '../BlockchainsChip';
12
17
 
13
- import { sortBlockchains } from './BlockchainSection.helpers';
14
18
  import { Container } from './BlockchainsSection.styles';
15
19
 
16
- const MIN = 9;
17
- const MAX = 10;
20
+ const LIST_SIZE = 10;
21
+ const MAX_ITEMS = LIST_SIZE + 1;
18
22
  const NUMBER_OF_LOADING = 12;
23
+
19
24
  export function BlockchainsSection(props: PropTypes) {
20
25
  const { blockchains, type, blockchain, onChange, onMoreClick } = props;
21
- const sortedBlockchains = sortBlockchains(blockchains);
22
- const [selectFromMoreBlockchain, setSelectFromMoreBlockchain] =
23
- useState<BlockchainMeta | null>(null);
26
+ const blockchainsList = usePrepareBlockchainList(blockchains, {
27
+ limit: blockchains.length === MAX_ITEMS ? MAX_ITEMS : LIST_SIZE,
28
+ selected: blockchain?.name,
29
+ });
30
+
24
31
  const loadingStatus = useMetaStore.use.loadingStatus();
25
32
  const resetToBlockchain = useBestRouteStore.use.resetToBlockchain();
26
33
  const resetFromBlockchain = useBestRouteStore.use.resetFromBlockchain();
27
- const COUNT_BLOCKCHAINS = !!selectFromMoreBlockchain ? MIN : MAX;
28
-
29
- useEffect(() => {
30
- const selectBlockchainFromMore = sortedBlockchains
31
- .slice(MAX, sortedBlockchains.length)
32
- .find(
33
- (item) =>
34
- item.chainId === blockchain?.chainId && item.name === blockchain?.name
35
- );
36
- if (!!selectBlockchainFromMore) {
37
- setSelectFromMoreBlockchain(selectBlockchainFromMore);
38
- }
39
- }, [blockchain]);
34
+ const showMoreButton =
35
+ blockchains.length !== MAX_ITEMS && blockchainsList.more.length;
40
36
 
41
37
  return (
42
38
  <div>
@@ -65,18 +61,7 @@ export function BlockchainsSection(props: PropTypes) {
65
61
  {i18n.t('All')}
66
62
  </Typography>
67
63
  </BlockchainsChip>
68
- {!!selectFromMoreBlockchain && (
69
- <BlockchainsChip
70
- selected={
71
- !!selectFromMoreBlockchain &&
72
- selectFromMoreBlockchain.chainId === blockchain?.chainId
73
- }
74
- key={selectFromMoreBlockchain.chainId}
75
- onClick={() => onChange(selectFromMoreBlockchain)}>
76
- <Image src={selectFromMoreBlockchain.logo} size={30} />
77
- </BlockchainsChip>
78
- )}
79
- {sortedBlockchains.slice(0, COUNT_BLOCKCHAINS).map((item) => (
64
+ {blockchainsList.list.map((item) => (
80
65
  <BlockchainsChip
81
66
  key={item.chainId}
82
67
  selected={!!blockchain && blockchain.chainId === item.chainId}
@@ -85,13 +70,15 @@ export function BlockchainsSection(props: PropTypes) {
85
70
  </BlockchainsChip>
86
71
  ))}
87
72
 
88
- <BlockchainsChip onClick={onMoreClick}>
89
- <Typography variant="body" size="xsmall" color="secondary500">
90
- {i18n._('More +{count}', {
91
- count: sortedBlockchains.length - MAX,
92
- })}
93
- </Typography>
94
- </BlockchainsChip>
73
+ {showMoreButton ? (
74
+ <BlockchainsChip onClick={onMoreClick}>
75
+ <Typography variant="body" size="xsmall" color="secondary500">
76
+ {i18n._('More +{count}', {
77
+ count: blockchainsList.more.length,
78
+ })}
79
+ </Typography>
80
+ </BlockchainsChip>
81
+ ) : null}
95
82
  </>
96
83
  )}
97
84
  </Container>
@@ -2,10 +2,18 @@
2
2
  import type { Step } from '@rango-dev/ui/dist/widget/ui/src/components/BestRoute/BestRoute.types';
3
3
  import type { BestRouteResponse, BlockchainMeta } from 'rango-sdk';
4
4
 
5
+ import {
6
+ TOKEN_AMOUNT_MAX_DECIMALS,
7
+ TOKEN_AMOUNT_MIN_DECIMALS,
8
+ USD_VALUE_MAX_DECIMALS,
9
+ USD_VALUE_MIN_DECIMALS,
10
+ } from '../../constants/routing';
11
+ import { getBlockchainShortNameFor } from '../../utils/meta';
5
12
  import { numberToString } from '../../utils/numbers';
6
13
 
7
14
  export function formatBestRoute(
8
- bestRoute: BestRouteResponse
15
+ bestRoute: BestRouteResponse,
16
+ blockchains: BlockchainMeta[]
9
17
  ): Step[] | undefined {
10
18
  return bestRoute.result?.swaps.map((swap) => {
11
19
  return {
@@ -13,23 +21,41 @@ export function formatBestRoute(
13
21
  from: {
14
22
  token: { displayName: swap.from.symbol, image: swap.from.logo },
15
23
  chain: {
16
- displayName: swap.from.blockchain,
24
+ displayName:
25
+ getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
17
26
  image: swap.from.blockchainLogo,
18
27
  },
19
28
  price: {
20
- value: numberToString(swap.fromAmount, 6, 6),
21
- usdValue: numberToString(swap.from.usdPrice?.toString(), 6, 6),
29
+ value: numberToString(
30
+ swap.fromAmount,
31
+ TOKEN_AMOUNT_MIN_DECIMALS,
32
+ TOKEN_AMOUNT_MAX_DECIMALS
33
+ ),
34
+ usdValue: numberToString(
35
+ swap.from.usdPrice?.toString(),
36
+ USD_VALUE_MIN_DECIMALS,
37
+ USD_VALUE_MAX_DECIMALS
38
+ ),
22
39
  },
23
40
  },
24
41
  to: {
25
42
  token: { displayName: swap.to.symbol, image: swap.to.logo },
26
43
  chain: {
27
- displayName: swap.to.blockchain,
44
+ displayName:
45
+ getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
28
46
  image: swap.to.blockchainLogo,
29
47
  },
30
48
  price: {
31
- value: numberToString(swap.toAmount, 6, 6),
32
- usdValue: numberToString(swap.to.usdPrice?.toString(), 6, 6),
49
+ value: numberToString(
50
+ swap.toAmount,
51
+ TOKEN_AMOUNT_MIN_DECIMALS,
52
+ TOKEN_AMOUNT_MAX_DECIMALS
53
+ ),
54
+ usdValue: numberToString(
55
+ swap.to.usdPrice?.toString(),
56
+ USD_VALUE_MIN_DECIMALS,
57
+ USD_VALUE_MAX_DECIMALS
58
+ ),
33
59
  },
34
60
  },
35
61
  };
@@ -1,12 +1,15 @@
1
1
  import * as Collapsible from '@radix-ui/react-collapsible';
2
2
  import {
3
3
  Button,
4
+ darkTheme,
4
5
  IconButton,
5
6
  keyframes,
6
7
  styled,
7
8
  TextField,
8
9
  } from '@rango-dev/ui';
9
10
 
11
+ export const EXPANDABLE_TRANSITION_DURATION = 300;
12
+
10
13
  const slideDown = keyframes({
11
14
  from: {
12
15
  height: 0,
@@ -45,14 +48,31 @@ export const WalletButton = styled('button', {
45
48
  border: '0',
46
49
  display: 'flex',
47
50
  justifyContent: 'center',
48
- backgroundColor: '$neutral100',
51
+ $$color: '$colors$neutral100',
52
+ [`.${darkTheme} &`]: {
53
+ $$color: '$colors$neutral300',
54
+ },
55
+ backgroundColor: '$$color',
49
56
  alignItems: 'center',
50
57
  cursor: 'pointer',
51
58
  width: 110,
52
59
  position: 'relative',
60
+
53
61
  '&:hover': {
54
- backgroundColor: '$surface600',
55
- opacity: '0.8',
62
+ $$color: '$colors$info100',
63
+ [`.${darkTheme} &`]: {
64
+ $$color: '$colors$neutral100',
65
+ },
66
+ backgroundColor: '$$color',
67
+ },
68
+
69
+ '&:focus-visible': {
70
+ $$color: '$colors$info100',
71
+ [`.${darkTheme} &`]: {
72
+ $$color: '$colors$info700',
73
+ },
74
+ backgroundColor: '$$color',
75
+ outline: 0,
56
76
  },
57
77
  variants: {
58
78
  selected: {
@@ -70,6 +90,7 @@ export const Trigger = styled(Collapsible.Trigger, {
70
90
  outline: 'none',
71
91
  width: '100%',
72
92
  backgroundColor: 'transparent',
93
+ fontFamily: 'inherit',
73
94
  });
74
95
 
75
96
  export const ShowMoreHeader = styled('div', {
@@ -117,7 +138,27 @@ export const CustomDestinationButton = styled(Button, {
117
138
  padding: '$15 !important',
118
139
  justifyContent: 'space-between',
119
140
  alignItems: 'center',
120
- backgroundColor: '$neutral100 !important',
141
+ $$color: '$colors$neutral100',
142
+ [`.${darkTheme} &`]: {
143
+ $$color: '$colors$neutral300',
144
+ },
145
+ backgroundColor: '$$color',
146
+
147
+ '&:hover': {
148
+ $$color: '$colors$info100',
149
+ [`.${darkTheme} &`]: {
150
+ $$color: '$colors$neutral100',
151
+ },
152
+ backgroundColor: '$$color',
153
+ },
154
+ '&:focus-visible': {
155
+ $$background: '$colors$info100',
156
+ [`.${darkTheme} &`]: {
157
+ $$background: '$colors$info700',
158
+ },
159
+ backgroundColor: '$$background',
160
+ outline: 0,
161
+ },
121
162
  });
122
163
 
123
164
  export const CustomDestination = styled('div', {
@@ -131,7 +172,7 @@ export const CustomDestination = styled('div', {
131
172
  });
132
173
 
133
174
  export const ExpandedIcon = styled('div', {
134
- transition: 'all 300ms ease',
175
+ transition: `all ${EXPANDABLE_TRANSITION_DURATION}ms ease`,
135
176
  variants: {
136
177
  orientation: {
137
178
  down: {
@@ -157,10 +198,10 @@ export const CollapsibleContent = styled(Collapsible.Content, {
157
198
  variants: {
158
199
  open: {
159
200
  true: {
160
- animation: `${slideDown} 300ms ease-out`,
201
+ animation: `${slideDown} ${EXPANDABLE_TRANSITION_DURATION}ms ease-out`,
161
202
  },
162
203
  false: {
163
- animation: `${slideUp} 300ms ease-out`,
204
+ animation: `${slideUp} ${EXPANDABLE_TRANSITION_DURATION}ms ease-out`,
164
205
  },
165
206
  },
166
207
  },
@@ -2,6 +2,7 @@ import type { PropTypes } from './ConfirmWalletsModal.types';
2
2
  import type { ConnectedWallet } from '../../store/wallets';
3
3
  import type { ConfirmSwapWarnings, Wallet } from '../../types';
4
4
 
5
+ import { i18n } from '@lingui/core';
5
6
  import {
6
7
  Alert,
7
8
  BalanceErrors,
@@ -14,9 +15,11 @@ import {
14
15
  Typography,
15
16
  WalletIcon,
16
17
  } from '@rango-dev/ui';
17
- import React, { useEffect, useState } from 'react';
18
+ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
19
+ import { useNavigate } from 'react-router-dom';
18
20
 
19
21
  import { getConfirmSwapErrorMessage } from '../../constants/errors';
22
+ import { navigationRoutes } from '../../constants/navigationRoutes';
20
23
  import { getRouteWarningMessage } from '../../constants/warnings';
21
24
  import { useBestRouteStore } from '../../store/bestRoute';
22
25
  import { useMetaStore } from '../../store/meta';
@@ -30,6 +33,7 @@ import {
30
33
  ConfirmButton,
31
34
  CustomDestination,
32
35
  CustomDestinationButton,
36
+ EXPANDABLE_TRANSITION_DURATION,
33
37
  ExpandedIcon,
34
38
  ListContainer,
35
39
  NavigateBack,
@@ -51,6 +55,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
51
55
  const {
52
56
  bestRoute,
53
57
  setSelectedWallets: selectRouteWallets,
58
+ routeWalletsConfirmed,
54
59
  setRouteWalletConfirmed,
55
60
  customDestination,
56
61
  setCustomDestination,
@@ -67,6 +72,8 @@ export function ConfirmWalletsModal(props: PropTypes) {
67
72
  const [showCustomDestination, setShowCustomDestination] = useState(
68
73
  !!customDestination
69
74
  );
75
+ const customDestinationRef = useRef<HTMLDivElement | null>(null);
76
+
70
77
  const requiredWallets = getRequiredWallets(bestRoute);
71
78
  const customDestinationEnabled =
72
79
  typeof config?.customDestination === 'undefined'
@@ -227,12 +234,26 @@ export function ConfirmWalletsModal(props: PropTypes) {
227
234
  );
228
235
  }, [connectedWallets.length]);
229
236
 
237
+ useLayoutEffect(() => {
238
+ if (showCustomDestination && customDestinationRef.current) {
239
+ setTimeout(() => {
240
+ customDestinationRef?.current?.scrollIntoView({ behavior: 'smooth' });
241
+ }, EXPANDABLE_TRANSITION_DURATION);
242
+ }
243
+ }, [showCustomDestination]);
244
+
230
245
  const modalContainer = document.querySelector('#swap-box') as HTMLDivElement;
231
246
 
247
+ const navigate = useNavigate();
232
248
  return (
233
249
  <Modal
234
250
  open={open}
235
- onClose={onClose}
251
+ onClose={() => {
252
+ if (!routeWalletsConfirmed) {
253
+ navigate(navigationRoutes.home, { replace: true });
254
+ }
255
+ onClose();
256
+ }}
236
257
  dismissible={!showMoreWalletFor}
237
258
  container={modalContainer}
238
259
  {...(!showMoreWalletFor && {
@@ -267,9 +288,13 @@ export function ConfirmWalletsModal(props: PropTypes) {
267
288
  onClick={setShowMoreWalletFor.bind(null, '')}>
268
289
  <ChevronLeftIcon size={16} />
269
290
  </NavigateBack>
270
- <Typography
271
- variant="headline"
272
- size="small">{`Your ${showMoreWalletFor} wallets`}</Typography>
291
+ <Typography variant="headline" size="small">
292
+ {i18n.t({
293
+ id: 'yourWallets',
294
+ message: 'Your {blockchainName} wallets',
295
+ values: { blockchainName: showMoreWalletFor },
296
+ })}
297
+ </Typography>
273
298
  </ShowMoreHeader>
274
299
  ),
275
300
  })}
@@ -279,7 +304,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
279
304
  onClose={setBalanceWarnings.bind(null, [])}
280
305
  container={modalContainer}>
281
306
  <MessageBox
282
- title="Insufficient account balance"
307
+ title={i18n.t('Insufficient account balance')}
283
308
  type="error"
284
309
  description={<BalanceErrors messages={balanceWarnings ?? []} />}>
285
310
  <Button
@@ -288,7 +313,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
288
313
  type="primary"
289
314
  fullWidth
290
315
  onClick={onConfirmBalance}>
291
- Proceed anyway
316
+ {i18n.t('Proceed anyway')}
292
317
  </Button>
293
318
  </MessageBox>
294
319
  </Modal>
@@ -311,7 +336,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
311
336
  <>
312
337
  {error && (
313
338
  <>
314
- <Alert variant="alarm" type="error" title={error} />
339
+ <Alert variant="alarm" type="error" title={i18n.t(error)} />
315
340
  <Divider size={12} />
316
341
  </>
317
342
  )}
@@ -332,18 +357,29 @@ export function ConfirmWalletsModal(props: PropTypes) {
332
357
  );
333
358
 
334
359
  const key = `wallet-${index}`;
335
- const isLastWallet = index !== requiredWallets.length - 1;
360
+ const isLastWallet = index === requiredWallets.length - 1;
336
361
 
337
362
  return (
338
363
  <div key={key}>
339
364
  <Title>
340
- <Typography
341
- variant="title"
342
- size="xmedium">{`Your ${blockchain?.displayName} wallets`}</Typography>
365
+ <Typography variant="title" size="xmedium">
366
+ {i18n.t({
367
+ id: 'yourWallets',
368
+ message: 'Your {blockchainName} wallets',
369
+ values: { blockchainName: blockchain?.displayName },
370
+ })}
371
+ </Typography>
343
372
  <Typography
344
373
  variant="label"
345
374
  color="$neutral900"
346
- size="medium">{`You need to connect a ${blockchain?.displayName} wallet.`}</Typography>
375
+ size="medium">
376
+ {i18n.t({
377
+ id: 'needConnect',
378
+ message:
379
+ 'You need to connect a {blockchainName} wallet.',
380
+ values: { blockchainName: blockchain?.displayName },
381
+ })}
382
+ </Typography>
347
383
  </Title>
348
384
  <Divider size={24} />
349
385
  <ListContainer>
@@ -364,6 +400,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
364
400
  {isLastWallet && customDestinationEnabled && (
365
401
  <CustomDestination>
366
402
  <CollapsibleRoot
403
+ ref={customDestinationRef}
367
404
  selected={showCustomDestination}
368
405
  open={showCustomDestination}
369
406
  onOpenChange={(checked) => {
@@ -398,6 +435,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
398
435
  }>
399
436
  <CustomDestinationButton
400
437
  fullWidth
438
+ variant="default"
401
439
  suffix={
402
440
  <ExpandedIcon
403
441
  orientation={
@@ -410,7 +448,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
410
448
  <WalletIcon size={18} color="info" />
411
449
  <Divider size={4} direction="horizontal" />
412
450
  <Typography variant="label" size="medium">
413
- Send to a different address
451
+ {i18n.t('Send to a different address')}
414
452
  </Typography>
415
453
  </div>
416
454
  </CustomDestinationButton>
@@ -420,7 +458,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
420
458
  <Divider size={4} />
421
459
  <StyledTextField
422
460
  autoFocus
423
- placeholder="Your destination address"
461
+ placeholder={i18n.t('Your destination address')}
424
462
  value={destination}
425
463
  onChange={(e) => {
426
464
  setDestination(e.target.value);
@@ -434,7 +472,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
434
472
  <Alert
435
473
  variant="alarm"
436
474
  type="error"
437
- title={`Address '${destination}' doesn't match the blockchain address pattern.`}
475
+ title={i18n.t({
476
+ id: 'addressMatch',
477
+ values: { destination },
478
+ message:
479
+ "Address {destination} doesn't match the blockchain address pattern.",
480
+ })}
438
481
  />
439
482
  </div>
440
483
  )}