@lifi/widget 1.32.8 → 2.0.0-alpha.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 (305) hide show
  1. package/App.js +3 -3
  2. package/AppDrawer.js +4 -3
  3. package/AppDrawer.style.d.ts +5 -5
  4. package/cjs/App.js +3 -3
  5. package/cjs/AppDrawer.js +4 -3
  6. package/cjs/AppDrawer.style.d.ts +5 -5
  7. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
  8. package/cjs/components/Card/CardIconButton.d.ts +29 -0
  9. package/cjs/components/Card/CardIconButton.js +17 -0
  10. package/cjs/components/Card/CardLabel.d.ts +26 -0
  11. package/cjs/components/Card/CardLabel.js +45 -0
  12. package/cjs/components/Card/CardTitle.d.ts +2 -2
  13. package/cjs/components/Card/index.d.ts +2 -0
  14. package/cjs/components/Card/index.js +2 -0
  15. package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
  16. package/cjs/components/GasMessage/FundsSufficiencyMessage.js +16 -0
  17. package/cjs/components/{GasSufficiencyMessage/GasSufficiencyMessage.d.ts → GasMessage/GasMessage.d.ts} +4 -2
  18. package/cjs/components/GasMessage/GasMessage.js +19 -0
  19. package/cjs/components/GasMessage/GasMessage.style.d.ts +34 -0
  20. package/cjs/components/GasMessage/GasMessage.style.js +48 -0
  21. package/cjs/components/GasMessage/GasRefuelMessage.d.ts +3 -0
  22. package/cjs/components/GasMessage/GasRefuelMessage.js +26 -0
  23. package/cjs/components/GasMessage/GasSufficiencyMessage.d.ts +7 -0
  24. package/cjs/components/GasMessage/GasSufficiencyMessage.js +21 -0
  25. package/cjs/components/GasMessage/index.d.ts +2 -0
  26. package/cjs/components/GasMessage/index.js +18 -0
  27. package/cjs/components/Header/Header.style.d.ts +5 -5
  28. package/cjs/components/Header/NavigationHeader.js +4 -4
  29. package/cjs/components/Header/WalletHeader.js +5 -5
  30. package/cjs/components/Insurance/Insurance.d.ts +3 -0
  31. package/cjs/components/Insurance/Insurance.js +11 -0
  32. package/cjs/components/Insurance/InsuranceCard.d.ts +3 -0
  33. package/cjs/components/Insurance/InsuranceCard.js +20 -0
  34. package/cjs/components/Insurance/InsuranceCollapsed.d.ts +3 -0
  35. package/cjs/components/Insurance/InsuranceCollapsed.js +32 -0
  36. package/cjs/components/Insurance/index.d.ts +1 -0
  37. package/cjs/components/{GasSufficiencyMessage → Insurance}/index.js +1 -1
  38. package/cjs/components/Insurance/types.d.ts +14 -0
  39. package/cjs/components/Insurance/types.js +2 -0
  40. package/cjs/components/NFT/NFT.style.d.ts +1 -1
  41. package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  42. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
  43. package/cjs/components/SendToWallet/SendToWallet.js +31 -25
  44. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +2 -2
  45. package/cjs/components/SendToWallet/SendToWalletButton.js +3 -3
  46. package/cjs/components/SmallAvatar.d.ts +2 -2
  47. package/cjs/components/Step/CircularProgress.style.d.ts +1 -1
  48. package/cjs/components/Step/DestinationWalletAddress.js +2 -2
  49. package/cjs/components/Step/GasStepProcess.js +2 -2
  50. package/cjs/components/Step/Step.js +7 -5
  51. package/cjs/components/Step/StepList.d.ts +1 -1
  52. package/cjs/components/Step/StepProcess.style.d.ts +3 -3
  53. package/cjs/components/StepActions/StepActions.d.ts +5 -0
  54. package/cjs/components/StepActions/StepActions.js +55 -17
  55. package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
  56. package/cjs/components/SwapButton/SwapButton.js +2 -2
  57. package/cjs/components/SwapButton/types.d.ts +1 -2
  58. package/cjs/components/SwapInput/SwapInput.style.d.ts +2 -2
  59. package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +3 -3
  60. package/cjs/components/SwapInput/SwapInputEndAdornment.js +18 -1
  61. package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +1 -2
  62. package/cjs/components/SwapRouteCard/SwapRouteCard.js +10 -26
  63. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +4 -36
  64. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +7 -38
  65. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +3 -0
  66. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +27 -0
  67. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +5 -5
  68. package/cjs/components/SwapRouteCard/types.d.ts +2 -2
  69. package/cjs/components/SwapRouteCard/utils.d.ts +5 -0
  70. package/cjs/components/SwapRouteCard/utils.js +32 -2
  71. package/cjs/components/SwapRoutes/SwapRoutes.js +3 -12
  72. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +3 -5
  73. package/cjs/components/SwapRoutes/{SwapRoutes.style.d.ts → SwapRoutesExpanded.style.d.ts} +0 -9
  74. package/cjs/components/SwapRoutes/{SwapRoutes.style.js → SwapRoutesExpanded.style.js} +1 -12
  75. package/cjs/components/Switch.js +4 -4
  76. package/cjs/components/Token/Token.style.d.ts +2 -2
  77. package/cjs/config/theme.js +1 -1
  78. package/cjs/config/version.d.ts +1 -1
  79. package/cjs/config/version.js +1 -1
  80. package/cjs/hooks/index.d.ts +4 -0
  81. package/cjs/hooks/index.js +4 -0
  82. package/cjs/hooks/useChains.js +2 -2
  83. package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
  84. package/cjs/hooks/useFeaturedTokens.js +2 -2
  85. package/cjs/hooks/useFundsSufficiency.d.ts +5 -0
  86. package/cjs/hooks/useFundsSufficiency.js +73 -0
  87. package/cjs/hooks/useGasRecommendation.d.ts +2 -0
  88. package/cjs/hooks/useGasRecommendation.js +23 -0
  89. package/cjs/hooks/useGasRefuel.d.ts +7 -0
  90. package/cjs/hooks/useGasRefuel.js +61 -0
  91. package/cjs/hooks/useGasSufficiency.d.ts +2 -3
  92. package/cjs/hooks/useGasSufficiency.js +6 -37
  93. package/cjs/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
  94. package/cjs/hooks/useGetTokenBalancesWithRetry.js +33 -0
  95. package/cjs/hooks/useSwapRoutes.d.ts +7 -2
  96. package/cjs/hooks/useSwapRoutes.js +31 -11
  97. package/cjs/hooks/useTokenAddressBalance.js +4 -2
  98. package/cjs/hooks/useTokenBalance.js +4 -22
  99. package/cjs/hooks/useTokenBalances.d.ts +1 -1
  100. package/cjs/hooks/useTokenSearch.js +2 -2
  101. package/cjs/hooks/useTokens.js +2 -3
  102. package/cjs/i18n/en.json +14 -7
  103. package/cjs/i18n/it.json +6 -2
  104. package/cjs/i18n/pt.json +234 -0
  105. package/cjs/i18n/uk.json +5 -1
  106. package/cjs/icons/InsuraceLogo.d.ts +2 -0
  107. package/cjs/icons/InsuraceLogo.js +11 -0
  108. package/cjs/icons/index.d.ts +1 -0
  109. package/cjs/icons/index.js +1 -0
  110. package/cjs/index.d.ts +0 -6
  111. package/cjs/index.js +1 -6
  112. package/cjs/pages/MainPage/MainGasMessage.d.ts +3 -0
  113. package/cjs/pages/MainPage/MainGasMessage.js +12 -0
  114. package/cjs/pages/MainPage/MainPage.js +3 -2
  115. package/cjs/pages/MainPage/MainSwapButton.js +1 -1
  116. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  117. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  118. package/cjs/pages/SettingsPage/RoutePrioritySelect.js +1 -1
  119. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
  120. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
  121. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -14
  122. package/cjs/pages/SwapPage/StartSwapButton.d.ts +3 -2
  123. package/cjs/pages/SwapPage/StartSwapButton.js +14 -4
  124. package/cjs/pages/SwapPage/SwapPage.js +18 -7
  125. package/cjs/pages/SwapPage/types.d.ts +9 -0
  126. package/cjs/pages/SwapPage/types.js +2 -0
  127. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  128. package/cjs/providers/SDKProvider/SDKProvider.d.ts +2 -2
  129. package/cjs/providers/SDKProvider/SDKProvider.js +2 -1
  130. package/cjs/providers/SwapFormProvider/FormUpdater.js +2 -3
  131. package/cjs/providers/WidgetProvider/WidgetProvider.js +17 -4
  132. package/cjs/providers/WidgetProvider/utils.d.ts +1 -1
  133. package/cjs/providers/WidgetProvider/utils.js +2 -4
  134. package/cjs/stores/StoreProvider.js +1 -1
  135. package/cjs/stores/routes/createRouteExecutionStore.js +3 -2
  136. package/cjs/stores/routes/index.d.ts +0 -1
  137. package/cjs/stores/routes/index.js +0 -1
  138. package/cjs/stores/routes/types.d.ts +1 -5
  139. package/cjs/stores/routes/useSetExecutableRoute.d.ts +1 -1
  140. package/cjs/stores/settings/types.d.ts +1 -0
  141. package/cjs/stores/settings/useSettingsStore.js +1 -0
  142. package/cjs/types/widget.d.ts +5 -10
  143. package/cjs/utils/format.js +4 -1
  144. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
  145. package/components/Card/CardIconButton.d.ts +29 -0
  146. package/components/Card/CardIconButton.js +14 -0
  147. package/components/Card/CardLabel.d.ts +26 -0
  148. package/components/Card/CardLabel.js +42 -0
  149. package/components/Card/CardTitle.d.ts +2 -2
  150. package/components/Card/index.d.ts +2 -0
  151. package/components/Card/index.js +2 -0
  152. package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
  153. package/components/GasMessage/FundsSufficiencyMessage.js +12 -0
  154. package/components/{GasSufficiencyMessage/GasSufficiencyMessage.d.ts → GasMessage/GasMessage.d.ts} +4 -2
  155. package/components/GasMessage/GasMessage.js +15 -0
  156. package/components/GasMessage/GasMessage.style.d.ts +34 -0
  157. package/components/GasMessage/GasMessage.style.js +45 -0
  158. package/components/GasMessage/GasRefuelMessage.d.ts +3 -0
  159. package/components/GasMessage/GasRefuelMessage.js +22 -0
  160. package/components/GasMessage/GasSufficiencyMessage.d.ts +7 -0
  161. package/components/GasMessage/GasSufficiencyMessage.js +17 -0
  162. package/components/GasMessage/index.d.ts +2 -0
  163. package/components/GasMessage/index.js +2 -0
  164. package/components/Header/Header.style.d.ts +5 -5
  165. package/components/Header/NavigationHeader.js +4 -4
  166. package/components/Header/WalletHeader.js +6 -6
  167. package/components/Insurance/Insurance.d.ts +3 -0
  168. package/components/Insurance/Insurance.js +7 -0
  169. package/components/Insurance/InsuranceCard.d.ts +3 -0
  170. package/components/Insurance/InsuranceCard.js +16 -0
  171. package/components/Insurance/InsuranceCollapsed.d.ts +3 -0
  172. package/components/Insurance/InsuranceCollapsed.js +28 -0
  173. package/components/Insurance/index.d.ts +1 -0
  174. package/components/Insurance/index.js +1 -0
  175. package/components/Insurance/types.d.ts +14 -0
  176. package/components/Insurance/types.js +1 -0
  177. package/components/NFT/NFT.style.d.ts +1 -1
  178. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  179. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
  180. package/components/SendToWallet/SendToWallet.js +34 -28
  181. package/components/SendToWallet/SendToWallet.style.d.ts +2 -2
  182. package/components/SendToWallet/SendToWalletButton.js +4 -4
  183. package/components/SmallAvatar.d.ts +2 -2
  184. package/components/Step/CircularProgress.style.d.ts +1 -1
  185. package/components/Step/DestinationWalletAddress.js +2 -2
  186. package/components/Step/GasStepProcess.js +2 -2
  187. package/components/Step/Step.js +7 -5
  188. package/components/Step/StepList.d.ts +1 -1
  189. package/components/Step/StepProcess.style.d.ts +3 -3
  190. package/components/StepActions/StepActions.d.ts +5 -0
  191. package/components/StepActions/StepActions.js +52 -16
  192. package/components/StepActions/StepActions.style.d.ts +1 -1
  193. package/components/SwapButton/SwapButton.js +2 -2
  194. package/components/SwapButton/types.d.ts +1 -2
  195. package/components/SwapInput/SwapInput.style.d.ts +2 -2
  196. package/components/SwapInput/SwapInputAdornment.style.d.ts +3 -3
  197. package/components/SwapInput/SwapInputEndAdornment.js +19 -2
  198. package/components/SwapRouteCard/SwapRouteCard.d.ts +1 -2
  199. package/components/SwapRouteCard/SwapRouteCard.js +11 -26
  200. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +4 -36
  201. package/components/SwapRouteCard/SwapRouteCard.style.js +7 -38
  202. package/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +3 -0
  203. package/components/SwapRouteCard/SwapRouteCardEssentials.js +23 -0
  204. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +5 -5
  205. package/components/SwapRouteCard/types.d.ts +2 -2
  206. package/components/SwapRouteCard/utils.d.ts +5 -0
  207. package/components/SwapRouteCard/utils.js +30 -1
  208. package/components/SwapRoutes/SwapRoutes.js +5 -14
  209. package/components/SwapRoutes/SwapRoutesExpanded.js +2 -4
  210. package/components/SwapRoutes/{SwapRoutes.style.d.ts → SwapRoutesExpanded.style.d.ts} +0 -9
  211. package/components/SwapRoutes/{SwapRoutes.style.js → SwapRoutesExpanded.style.js} +1 -12
  212. package/components/Switch.js +5 -5
  213. package/components/Token/Token.style.d.ts +2 -2
  214. package/config/theme.js +1 -1
  215. package/config/version.d.ts +1 -1
  216. package/config/version.js +1 -1
  217. package/hooks/index.d.ts +4 -0
  218. package/hooks/index.js +4 -0
  219. package/hooks/useChains.js +2 -2
  220. package/hooks/useFeaturedTokens.d.ts +1 -1
  221. package/hooks/useFeaturedTokens.js +2 -2
  222. package/hooks/useFundsSufficiency.d.ts +5 -0
  223. package/hooks/useFundsSufficiency.js +69 -0
  224. package/hooks/useGasRecommendation.d.ts +2 -0
  225. package/hooks/useGasRecommendation.js +19 -0
  226. package/hooks/useGasRefuel.d.ts +7 -0
  227. package/hooks/useGasRefuel.js +57 -0
  228. package/hooks/useGasSufficiency.d.ts +2 -3
  229. package/hooks/useGasSufficiency.js +7 -38
  230. package/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
  231. package/hooks/useGetTokenBalancesWithRetry.js +29 -0
  232. package/hooks/useSwapRoutes.d.ts +7 -2
  233. package/hooks/useSwapRoutes.js +32 -12
  234. package/hooks/useTokenAddressBalance.js +4 -2
  235. package/hooks/useTokenBalance.js +5 -23
  236. package/hooks/useTokenBalances.d.ts +1 -1
  237. package/hooks/useTokenSearch.js +2 -2
  238. package/hooks/useTokens.js +2 -3
  239. package/i18n/en.json +14 -7
  240. package/i18n/it.json +6 -2
  241. package/i18n/pt.json +234 -0
  242. package/i18n/uk.json +5 -1
  243. package/icons/InsuraceLogo.d.ts +2 -0
  244. package/icons/InsuraceLogo.js +7 -0
  245. package/icons/index.d.ts +1 -0
  246. package/icons/index.js +1 -0
  247. package/index.d.ts +0 -6
  248. package/index.js +0 -5
  249. package/package.json +10 -10
  250. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +2 -2
  251. package/pages/MainPage/MainGasMessage.d.ts +3 -0
  252. package/pages/MainPage/MainGasMessage.js +8 -0
  253. package/pages/MainPage/MainPage.js +3 -2
  254. package/pages/MainPage/MainSwapButton.js +1 -1
  255. package/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  256. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  257. package/pages/SettingsPage/RoutePrioritySelect.js +1 -1
  258. package/pages/SwapDetailsPage/SwapDetailsPage.js +5 -4
  259. package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  260. package/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
  261. package/pages/SwapPage/ExchangeRateBottomSheet.js +0 -12
  262. package/pages/SwapPage/StartSwapButton.d.ts +3 -2
  263. package/pages/SwapPage/StartSwapButton.js +13 -4
  264. package/pages/SwapPage/SwapPage.js +21 -10
  265. package/pages/SwapPage/types.d.ts +9 -0
  266. package/pages/SwapPage/types.js +1 -0
  267. package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  268. package/providers/SDKProvider/SDKProvider.d.ts +2 -2
  269. package/providers/SDKProvider/SDKProvider.js +3 -2
  270. package/providers/SwapFormProvider/FormUpdater.js +2 -3
  271. package/providers/WidgetProvider/WidgetProvider.js +17 -4
  272. package/providers/WidgetProvider/utils.d.ts +1 -1
  273. package/providers/WidgetProvider/utils.js +2 -4
  274. package/stores/StoreProvider.js +2 -2
  275. package/stores/routes/createRouteExecutionStore.js +3 -2
  276. package/stores/routes/index.d.ts +0 -1
  277. package/stores/routes/index.js +0 -1
  278. package/stores/routes/types.d.ts +1 -5
  279. package/stores/routes/useSetExecutableRoute.d.ts +1 -1
  280. package/stores/settings/types.d.ts +1 -0
  281. package/stores/settings/useSettingsStore.js +1 -0
  282. package/tsconfig.cjs.tsbuildinfo +1 -1
  283. package/types/widget.d.ts +5 -10
  284. package/utils/format.js +4 -1
  285. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -31
  286. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
  287. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -14
  288. package/cjs/components/GasSufficiencyMessage/index.d.ts +0 -1
  289. package/cjs/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
  290. package/cjs/components/SwapRoutes/useSetRecommendedRoute.js +0 -13
  291. package/cjs/config/env.d.ts +0 -3
  292. package/cjs/config/env.js +0 -6
  293. package/cjs/stores/routes/useRecommendedRouteStore.d.ts +0 -10
  294. package/cjs/stores/routes/useRecommendedRouteStore.js +0 -39
  295. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -27
  296. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
  297. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -11
  298. package/components/GasSufficiencyMessage/index.d.ts +0 -1
  299. package/components/GasSufficiencyMessage/index.js +0 -1
  300. package/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
  301. package/components/SwapRoutes/useSetRecommendedRoute.js +0 -9
  302. package/config/env.d.ts +0 -3
  303. package/config/env.js +0 -3
  304. package/stores/routes/useRecommendedRouteStore.d.ts +0 -10
  305. package/stores/routes/useRecommendedRouteStore.js +0 -32
@@ -1,26 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import AccessTimeIcon from '@mui/icons-material/AccessTime';
3
- import EvStationOutlinedIcon from '@mui/icons-material/EvStationOutlined';
4
2
  import ExpandLessIcon from '@mui/icons-material/ExpandLess';
5
3
  import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
6
- import LayersOutlinedIcon from '@mui/icons-material/LayersOutlined';
7
- import { Box, Collapse, Tooltip, Typography } from '@mui/material';
4
+ import VerifiedUserIcon from '@mui/icons-material/VerifiedUser';
5
+ import { Box, Collapse } from '@mui/material';
8
6
  import { useState } from 'react';
9
7
  import { useTranslation } from 'react-i18next';
10
8
  import { useWidgetConfig } from '../../providers';
11
- import { Card } from '../Card';
9
+ import { Card, CardIconButton, CardLabel, CardLabelTypography } from '../Card';
12
10
  import { StepActions } from '../StepActions';
13
11
  import { Token } from '../Token';
14
- import { IconButton, Label } from './SwapRouteCard.style';
15
- import { getGasCostsBreakdown } from './utils';
12
+ import { SwapRouteCardEssentials } from './SwapRouteCardEssentials';
16
13
  export const SwapRouteCard = ({ route, active, variant = 'default', expanded, ...other }) => {
17
14
  const { t } = useTranslation();
18
- const { variant: widgetVariant, useRecommendedRoute } = useWidgetConfig();
19
- const [cardExpanded, setCardExpanded] = useState(variant === 'default' || expanded);
20
- const alternativeTag = t(`swap.tags.ALTERNATIVE`);
21
- const label = route.tags?.length
22
- ? t(`swap.tags.${route.tags[0]}`)
23
- : alternativeTag;
15
+ const { variant: widgetVariant } = useWidgetConfig();
16
+ const [cardExpanded, setCardExpanded] = useState(expanded);
17
+ const insurable = route.insurance?.state === 'INSURABLE';
24
18
  const handleExpand = (e) => {
25
19
  e.stopPropagation();
26
20
  setCardExpanded((expanded) => !expanded);
@@ -28,17 +22,8 @@ export const SwapRouteCard = ({ route, active, variant = 'default', expanded, ..
28
22
  const token = widgetVariant === 'nft'
29
23
  ? { ...route.fromToken, amount: route.fromAmount }
30
24
  : { ...route.toToken, amount: route.toAmount };
31
- const cardContent = (_jsxs(Box, { flex: 1, children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2, children: [_jsx(Label, { active: active ?? label !== alternativeTag, children: label }), variant === 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route })) : null] })) : null, _jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [_jsx(Token, { token: token, step: variant === 'stretched' ? route.steps[0] : undefined, disableDescription: variant === 'dense' && widgetVariant !== 'refuel' }), variant === 'stretched' && !expanded ? (_jsx(IconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) })) : null] }), _jsx(Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: route.steps.map((step) => (_jsx(StepActions, { step: step, mt: 2 }, step.id))) }), variant !== 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route, dense: true })) : null] }));
32
- return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, { variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true, ...other, children: cardContent }));
33
- };
34
- export const SwapRouteCardEssentials = ({ route, dense }) => {
35
- const { t } = useTranslation();
36
- const executionTimeMinutes = Math.ceil(route.steps
37
- .map((step) => step.estimate.executionDuration)
38
- .reduce((duration, x) => duration + x, 0) / 60);
39
- const gasCostUSD = parseFloat(route.gasCostUSD ?? '') || 0.01;
40
- const gasCosts = getGasCostsBreakdown(route);
41
- return (_jsxs(Box, { display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0, children: [_jsx(Tooltip, { title: _jsxs(Box, { component: "span", children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas) => (_jsxs(Typography, { fontSize: 11, children: [gas.amount?.toFixed(6), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }, `${gas.token.address}${gas.token.symbol}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [_jsx(Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: _jsx(EvStationOutlinedIcon, { fontSize: dense ? 'medium' : 'small' }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, { value: gasCostUSD }) })] }) }), _jsx(Tooltip, { title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [_jsx(Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: _jsx(AccessTimeIcon, { fontSize: dense ? 'medium' : 'small' }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t('swap.estimatedTime', {
42
- value: executionTimeMinutes,
43
- }) })] }) }), !dense ? (_jsx(Tooltip, { title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: _jsx(LayersOutlinedIcon, { fontSize: dense ? 'medium' : 'small' }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: route.steps.length })] }) })) : null] }));
25
+ const cardContent = (_jsxs(Box, { flex: 1, children: [widgetVariant !== 'refuel' && (insurable || route.tags?.length) ? (_jsxs(Box, { display: "flex", alignItems: "center", mb: 2, children: [insurable ? (_jsxs(CardLabel, { type: route.tags?.length && !cardExpanded
26
+ ? 'insurance-icon'
27
+ : 'insurance', children: [_jsx(VerifiedUserIcon, { fontSize: "inherit" }), cardExpanded || !route.tags?.length ? (_jsx(CardLabelTypography, { type: "icon", children: t(`swap.tags.insurable`) })) : null] })) : null, route.tags?.length ? (_jsx(CardLabel, { type: active ? 'active' : undefined, children: _jsx(CardLabelTypography, { children: t(`swap.tags.${route.tags[0].toLowerCase()}`) }) })) : null] })) : null, _jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "start", children: [_jsx(Token, { token: token, step: !cardExpanded ? route.steps[0] : undefined }), !expanded ? (_jsx(CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) })) : null] }), _jsx(Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: route.steps.map((step) => (_jsx(StepActions, { step: step, mt: 2 }, step.id))) }), _jsx(SwapRouteCardEssentials, { route: route })] }));
28
+ return widgetVariant === 'refuel' || variant === 'cardless' ? (cardContent) : (_jsx(Card, { variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true, ...other, children: cardContent }));
44
29
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
2
+ export declare const IconTypography: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
3
  align?: "center" | "left" | "right" | "inherit" | "justify" | undefined;
4
4
  children?: import("react").ReactNode;
5
5
  classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
@@ -7,40 +7,8 @@ export declare const Label: import("@emotion/styled").StyledComponent<import("@m
7
7
  noWrap?: boolean | undefined;
8
8
  paragraph?: boolean | undefined;
9
9
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
10
- variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
11
- variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)", string>> | undefined;
10
+ variant?: import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides> | undefined;
11
+ variantMapping?: Partial<Record<import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides>, string>> | undefined;
12
12
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
13
13
  ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
14
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
15
- active?: boolean | undefined;
16
- }, {}, {}>;
17
- export declare const IconButton: import("@emotion/styled").StyledComponent<{
18
- children?: import("react").ReactNode;
19
- classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
20
- color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
21
- disabled?: boolean | undefined;
22
- disableFocusRipple?: boolean | undefined;
23
- edge?: false | "end" | "start" | undefined;
24
- size?: "small" | "medium" | "large" | undefined;
25
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
26
- } & Omit<{
27
- action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
28
- centerRipple?: boolean | undefined;
29
- children?: import("react").ReactNode;
30
- classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
31
- disabled?: boolean | undefined;
32
- disableRipple?: boolean | undefined;
33
- disableTouchRipple?: boolean | undefined;
34
- focusRipple?: boolean | undefined;
35
- focusVisibleClassName?: string | undefined;
36
- LinkComponent?: import("react").ElementType<any> | undefined;
37
- onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
38
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
39
- tabIndex?: number | undefined;
40
- TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
41
- touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
42
- }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
43
- ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
44
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "size" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
45
- active?: boolean | undefined;
46
- }, {}, {}>;
14
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,40 +1,9 @@
1
- import { IconButton as MuiIconButton, Typography } from '@mui/material';
1
+ import { Typography } from '@mui/material';
2
2
  import { alpha, styled } from '@mui/material/styles';
3
- import { getContrastTextColor } from '../../utils';
4
- export const Label = styled(Typography, {
5
- shouldForwardProp: (prop) => prop !== 'active',
6
- })(({ theme, active }) => ({
7
- backgroundColor: active ? theme.palette.secondary.main : 'transparent',
8
- border: '1px solid',
9
- borderColor: active
10
- ? theme.palette.secondary.main
11
- : theme.palette.mode === 'light'
12
- ? theme.palette.grey[300]
13
- : theme.palette.grey[800],
14
- borderRadius: theme.shape.borderRadiusSecondary,
15
- color: active
16
- ? getContrastTextColor(theme, theme.palette.secondary.main)
17
- : theme.palette.text.secondary,
18
- padding: theme.spacing(0.75),
19
- fontSize: 12,
20
- lineHeight: 1,
21
- fontWeight: '600',
22
- height: 24,
23
- letterSpacing: '0.05rem',
24
- textTransform: 'uppercase',
25
- display: 'inline-flex',
26
- userSelect: 'none',
3
+ export const IconTypography = styled(Typography)(({ theme }) => ({
4
+ color: theme.palette.mode === 'light'
5
+ ? alpha(theme.palette.common.black, 0.24)
6
+ : alpha(theme.palette.common.white, 0.32),
7
+ lineHeight: 0,
8
+ marginRight: theme.spacing(0.5),
27
9
  }));
28
- export const IconButton = styled(MuiIconButton, {
29
- shouldForwardProp: (prop) => prop !== 'active',
30
- })(({ theme, active }) => {
31
- const backgroundColor = theme.palette.mode === 'light'
32
- ? theme.palette.common.black
33
- : theme.palette.common.white;
34
- return {
35
- backgroundColor: alpha(backgroundColor, 0.04),
36
- '&:hover': {
37
- backgroundColor: alpha(backgroundColor, 0.08),
38
- },
39
- };
40
- });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { SwapRouteCardEssentialsProps } from './types';
3
+ export declare const SwapRouteCardEssentials: React.FC<SwapRouteCardEssentialsProps>;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import AccessTimeIcon from '@mui/icons-material/AccessTimeFilled';
3
+ import EvStationIcon from '@mui/icons-material/EvStation';
4
+ import LayersIcon from '@mui/icons-material/Layers';
5
+ import MonetizationOnIcon from '@mui/icons-material/MonetizationOn';
6
+ import { Box, Tooltip, Typography } from '@mui/material';
7
+ import { useTranslation } from 'react-i18next';
8
+ import { IconTypography } from './SwapRouteCard.style';
9
+ import { getFeeCostsBreakdown, getGasCostsBreakdown } from './utils';
10
+ export const SwapRouteCardEssentials = ({ route, dense }) => {
11
+ const { t } = useTranslation();
12
+ const executionTimeMinutes = Math.ceil(route.steps
13
+ .map((step) => step.estimate.executionDuration)
14
+ .reduce((duration, x) => duration + x, 0) / 60);
15
+ const gasCostUSD = parseFloat(route.gasCostUSD ?? '') || 0.01;
16
+ const gasCosts = getGasCostsBreakdown(route);
17
+ const feeCosts = getFeeCostsBreakdown(route, false);
18
+ return (_jsxs(Box, { display: "flex", justifyContent: 'space-between', flex: 1, mt: 2, children: [_jsx(Tooltip, { title: _jsxs(Box, { component: "span", children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas, index) => (_jsxs(Typography, { fontSize: 11, children: [gas.amount?.toFixed(9), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }, `${gas.token.address}${index}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [_jsx(IconTypography, { children: _jsx(EvStationIcon, { fontSize: "small" }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, { value: gasCostUSD }) })] }) }), _jsx(Tooltip, { title: _jsxs(Box, { component: "span", children: [t(`tooltip.additionalProviderFee`), feeCosts.map((fee, index) => (_jsxs(Typography, { fontSize: 11, children: [fee.amount?.toFixed(9), " ", fee.token.symbol, " (", t(`format.currency`, { value: fee.amountUSD }), ")"] }, `${fee.token.address}${index}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [_jsx(IconTypography, { children: _jsx(MonetizationOnIcon, { fontSize: "small" }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, {
19
+ value: feeCosts.reduce((sum, feeCost) => sum + feeCost.amountUSD, 0),
20
+ }) })] }) }), _jsx(Tooltip, { title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [_jsx(IconTypography, { children: _jsx(AccessTimeIcon, { fontSize: "small" }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t('swap.estimatedTime', {
21
+ value: executionTimeMinutes,
22
+ }) })] }) }), _jsx(Tooltip, { title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(IconTypography, { children: _jsx(LayersIcon, { fontSize: "small" }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: route.steps.length })] }) })] }));
23
+ };
@@ -3,9 +3,9 @@ import { Box, Skeleton } from '@mui/material';
3
3
  import { useWidgetConfig } from '../../providers';
4
4
  import { Card } from '../Card';
5
5
  export const SwapRouteCardSkeleton = ({ variant, ...other }) => {
6
- const { variant: widgetVariant, useRecommendedRoute } = useWidgetConfig();
7
- const cardContent = (_jsxs(Box, { flex: 1, children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2, children: [_jsx(Skeleton, { variant: "rectangular", width: 118, height: 24, sx: (theme) => ({
8
- borderRadius: `${theme.shape.borderRadiusSecondary}px`,
9
- }) }), variant === 'stretched' ? (_jsxs(Box, { display: "flex", children: [_jsx(Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 32, height: 24 })] })) : null] })) : null, _jsxs(Box, { children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Box, { mr: 2, children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) }), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] }), _jsxs(Box, { ml: 6, display: "flex", alignItems: "center", children: [_jsx(Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsx(Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] })] }), variant !== 'stretched' ? (_jsxs(Box, { mt: 2, display: "flex", justifyContent: "space-between", children: [_jsx(Skeleton, { variant: "text", width: 48, height: 24 }), _jsx(Skeleton, { variant: "text", width: 48, height: 24 })] })) : null] }));
10
- return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, { indented: true, ...other, children: cardContent }));
6
+ const { variant: widgetVariant } = useWidgetConfig();
7
+ const cardContent = (_jsxs(Box, { flex: 1, children: [widgetVariant !== 'refuel' ? (_jsx(Box, { display: "flex", alignItems: "center", mb: 2, children: _jsx(Skeleton, { variant: "rectangular", width: 112, height: 24, sx: (theme) => ({
8
+ borderRadius: `${theme.shape.borderRadius}px`,
9
+ }) }) })) : null, _jsxs(Box, { children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Box, { mr: 2, children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) }), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] }), _jsxs(Box, { ml: 6, display: "flex", alignItems: "center", children: [_jsx(Skeleton, { variant: "text", width: 102, height: 16 }), _jsx(Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })] })] }), _jsxs(Box, { mt: 2, display: "flex", justifyContent: "space-between", children: [_jsx(Skeleton, { variant: "text", width: 64, height: 20 }), _jsx(Skeleton, { variant: "text", width: 64, height: 20 }), _jsx(Skeleton, { variant: "text", width: 48, height: 20 }), _jsx(Skeleton, { variant: "text", width: 32, height: 20 })] })] }));
10
+ return widgetVariant === 'refuel' || variant === 'cardless' ? (cardContent) : (_jsx(Card, { indented: true, ...other, children: cardContent }));
11
11
  };
@@ -1,7 +1,7 @@
1
1
  import type { Route } from '@lifi/sdk';
2
2
  export interface SwapRouteCardProps {
3
3
  route: Route;
4
- variant?: 'default' | 'stretched' | 'dense';
4
+ variant?: 'default' | 'cardless';
5
5
  active?: boolean;
6
6
  expanded?: boolean;
7
7
  }
@@ -10,5 +10,5 @@ export interface SwapRouteCardEssentialsProps {
10
10
  dense?: boolean;
11
11
  }
12
12
  export interface SwapRouteCardSkeletonProps {
13
- variant?: 'default' | 'stretched' | 'dense';
13
+ variant?: 'default' | 'cardless';
14
14
  }
@@ -5,3 +5,8 @@ export declare const getGasCostsBreakdown: (route: Route) => {
5
5
  amountUSD: number;
6
6
  token: Token;
7
7
  }[];
8
+ export declare const getFeeCostsBreakdown: (route: Route, included?: boolean) => {
9
+ amount: Big;
10
+ amountUSD: number;
11
+ token: Token;
12
+ }[];
@@ -1,7 +1,7 @@
1
1
  import Big from 'big.js';
2
2
  export const getGasCostsBreakdown = (route) => {
3
3
  return Object.values(route.steps.reduce((groupedGasCosts, step) => {
4
- if (step.estimate.gasCosts) {
4
+ if (step.estimate.gasCosts?.length) {
5
5
  const { token } = step.estimate.gasCosts[0];
6
6
  const gasCostAmount = step.estimate.gasCosts
7
7
  .reduce((amount, gasCost) => amount.plus(Big(gasCost.amount || 0)), Big(0))
@@ -24,3 +24,32 @@ export const getGasCostsBreakdown = (route) => {
24
24
  return groupedGasCosts;
25
25
  }, {}));
26
26
  };
27
+ export const getFeeCostsBreakdown = (route, included) => {
28
+ return Object.values(route.steps.reduce((groupedFeeCosts, step) => {
29
+ let feeCosts = step.estimate.feeCosts;
30
+ if (typeof included === 'boolean') {
31
+ feeCosts = feeCosts?.filter((feeCost) => feeCost.included === included);
32
+ }
33
+ if (feeCosts?.length) {
34
+ const { token } = feeCosts[0];
35
+ const feeCostAmount = feeCosts
36
+ .reduce((amount, feeCost) => amount.plus(Big(feeCost.amount || 0)), Big(0))
37
+ .div(10 ** token.decimals);
38
+ const feeCostAmountUSD = feeCosts.reduce((amount, feeCost) => amount + parseFloat(feeCost.amountUSD || '0'), 0);
39
+ const groupedFeeCost = groupedFeeCosts[token.chainId];
40
+ const amount = groupedFeeCost
41
+ ? groupedFeeCost.amount.plus(feeCostAmount)
42
+ : feeCostAmount;
43
+ const amountUSD = groupedFeeCost
44
+ ? groupedFeeCost.amountUSD + feeCostAmountUSD
45
+ : feeCostAmountUSD;
46
+ groupedFeeCosts[token.chainId] = {
47
+ amount,
48
+ amountUSD,
49
+ token,
50
+ };
51
+ return groupedFeeCosts;
52
+ }
53
+ return groupedFeeCosts;
54
+ }, {}));
55
+ };
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
3
- import { Box, IconButton } from '@mui/material';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Button, Collapse } from '@mui/material';
4
3
  import { useFormState } from 'react-hook-form';
5
4
  import { useTranslation } from 'react-i18next';
6
5
  import { useNavigate } from 'react-router-dom';
@@ -10,16 +9,13 @@ import { SwapRouteCard, SwapRouteCardSkeleton, SwapRouteNotFoundCard, } from '..
10
9
  import { useSwapRoutes } from '../../hooks';
11
10
  import { useWidgetConfig } from '../../providers';
12
11
  import { navigationRoutes } from '../../utils';
13
- import { Stack } from './SwapRoutes.style';
14
- import { useSetRecommendedRoute } from './useSetRecommendedRoute';
15
12
  export const SwapRoutes = (props) => {
16
13
  const { t } = useTranslation();
17
- const { variant, useRecommendedRoute } = useWidgetConfig();
18
14
  const navigate = useNavigate();
15
+ const { variant, useRecommendedRoute } = useWidgetConfig();
19
16
  const { isValid, isValidating } = useFormState();
20
17
  const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
21
18
  const currentRoute = routes?.[0];
22
- useSetRecommendedRoute(currentRoute, isFetching);
23
19
  if (!currentRoute && !isLoading && !isFetching && !isFetched) {
24
20
  return null;
25
21
  }
@@ -28,15 +24,10 @@ export const SwapRoutes = (props) => {
28
24
  };
29
25
  const routeNotFound = !currentRoute && !isLoading && !isFetching;
30
26
  const onlyRecommendedRoute = variant === 'refuel' || useRecommendedRoute;
27
+ const showAll = !onlyRecommendedRoute && !routeNotFound && (routes?.length ?? 0) > 1;
31
28
  return (_jsxs(Card, { ...props, children: [_jsx(CardTitle, { children: t('swap.routes') }), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
32
29
  position: 'absolute',
33
30
  top: 8,
34
31
  right: 8,
35
- } }), _jsxs(Box, { sx: { display: 'flex' }, children: [_jsx(Stack, { direction: "row", spacing: 2, my: 2, ml: 2, mr: onlyRecommendedRoute || routeNotFound ? 2 : 1, sx: {
36
- borderRightWidth: !onlyRecommendedRoute &&
37
- !routeNotFound &&
38
- (isFetching || (routes && routes.length > 1))
39
- ? 1
40
- : 0,
41
- }, children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(SwapRouteCardSkeleton, { minWidth: !onlyRecommendedRoute ? '80%' : '100%', variant: "dense" }), !onlyRecommendedRoute ? (_jsx(SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" })) : null] })) : !currentRoute ? (_jsx(SwapRouteNotFoundCard, {})) : (_jsxs(_Fragment, { children: [_jsx(SwapRouteCard, { minWidth: !onlyRecommendedRoute && routes.length > 1 ? '80%' : '100%', route: currentRoute, variant: "dense", active: true }), !onlyRecommendedRoute && routes.length > 1 ? (_jsx(SwapRouteCard, { minWidth: "80%", route: routes[1], variant: "dense", pointerEvents: "none" })) : null] })) }), _jsx(Box, { sx: { display: 'flex', alignItems: 'center' }, children: !onlyRecommendedRoute && !routeNotFound ? (_jsx(Box, { py: 1, pr: 1, children: _jsx(IconButton, { onClick: handleCardClick, size: "medium", disabled: isValidating || !isValid, children: _jsx(KeyboardArrowRightIcon, {}) }) })) : null })] })] }));
32
+ } }), _jsxs(Box, { p: 2, children: [isLoading ? (_jsx(SwapRouteCardSkeleton, { variant: "cardless" })) : !currentRoute ? (_jsx(SwapRouteNotFoundCard, {})) : (_jsx(SwapRouteCard, { route: currentRoute, variant: "cardless", active: true })), _jsx(Collapse, { timeout: 225, in: showAll, unmountOnExit: true, mountOnEnter: true, appear: true, children: _jsx(Box, { mt: 2, children: _jsx(Button, { onClick: handleCardClick, disabled: isValidating || !isValid, fullWidth: true, children: t('button.showAll') }) }) })] })] }));
42
33
  };
@@ -9,8 +9,7 @@ import { useSetExecutableRoute } from '../../stores';
9
9
  import { navigationRoutes } from '../../utils';
10
10
  import { ProgressToNextUpdate } from '../ProgressToNextUpdate';
11
11
  import { SwapRouteCard, SwapRouteCardSkeleton, SwapRouteNotFoundCard, } from '../SwapRouteCard';
12
- import { CollapseContainer, Container, Header, ScrollableContainer, } from './SwapRoutes.style';
13
- import { useSetRecommendedRoute } from './useSetRecommendedRoute';
12
+ import { CollapseContainer, Container, Header, ScrollableContainer, } from './SwapRoutesExpanded.style';
14
13
  const timeout = { enter: 225, exit: 225, appear: 0 };
15
14
  export const SwapRoutesExpanded = () => {
16
15
  const element = useRoutes([
@@ -29,7 +28,6 @@ export const SwapRoutesExpandedElement = () => {
29
28
  const { isValid, isValidating } = useFormState();
30
29
  const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
31
30
  const currentRoute = routes?.[0];
32
- useSetRecommendedRoute(currentRoute, isFetching);
33
31
  const handleRouteClick = (route) => {
34
32
  if (isValid && !isValidating) {
35
33
  setExecutableRoute(route);
@@ -40,5 +38,5 @@ export const SwapRoutesExpandedElement = () => {
40
38
  };
41
39
  const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched);
42
40
  const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
43
- return (_jsx(Collapse, { timeout: timeout.enter, in: expanded, orientation: "horizontal", children: _jsx(Grow, { timeout: timeout.enter, in: expanded, mountOnEnter: true, unmountOnExit: true, children: _jsx(Container, { sx: containerStyle, enableColorScheme: true, children: _jsxs(ScrollableContainer, { children: [_jsxs(Header, { children: [_jsx(Typography, { fontSize: 18, fontWeight: "700", flex: 1, noWrap: true, children: t('swap.routes') }), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), _jsx(Stack, { direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3, children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, { variant: "stretched" }, index)))) : (routes?.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "stretched", expanded: routes?.length <= 2 }, route.id)))) })] }) }) }) }));
41
+ return (_jsx(Collapse, { timeout: timeout.enter, in: expanded, orientation: "horizontal", children: _jsx(Grow, { timeout: timeout.enter, in: expanded, mountOnEnter: true, unmountOnExit: true, children: _jsx(Container, { sx: containerStyle, enableColorScheme: true, children: _jsxs(ScrollableContainer, { children: [_jsxs(Header, { children: [_jsx(Typography, { fontSize: 18, fontWeight: "700", flex: 1, noWrap: true, children: t('swap.routes') }), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), _jsx(Stack, { direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3, children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading || (isFetching && !routes?.length) ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, {}, index)))) : (routes?.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, expanded: routes?.length <= 2 }, route.id)))) })] }) }) }) }));
44
42
  };
@@ -31,12 +31,3 @@ export declare const Header: import("@emotion/styled").StyledComponent<import("@
31
31
  } & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
32
32
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
33
33
  }, "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
34
- export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
35
- children?: import("react").ReactNode;
36
- direction?: import("@mui/system").ResponsiveStyleValue<"column" | "column-reverse" | "row" | "row-reverse"> | undefined;
37
- spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
38
- divider?: import("react").ReactNode;
39
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
40
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
41
- ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
42
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,4 +1,4 @@
1
- import { Box, ScopedCssBaseline, Stack as MuiStack } from '@mui/material';
1
+ import { Box, ScopedCssBaseline } from '@mui/material';
2
2
  import { alpha, styled } from '@mui/material/styles';
3
3
  import { maxHeight } from '../AppContainer';
4
4
  export const CollapseContainer = styled(Box)(({ theme }) => ({
@@ -32,14 +32,3 @@ export const Header = styled(Box)(({ theme }) => ({
32
32
  top: 0,
33
33
  zIndex: 1200,
34
34
  }));
35
- export const Stack = styled(MuiStack)(({ theme }) => ({
36
- alignItems: 'stretch',
37
- display: 'flex',
38
- flex: 1,
39
- flexWrap: 'nowrap',
40
- overflow: 'hidden',
41
- borderRight: `solid ${theme.palette.mode === 'light'
42
- ? theme.palette.grey[300]
43
- : theme.palette.grey[800]}`,
44
- width: 'calc(100% - 48px)',
45
- }));
@@ -1,5 +1,5 @@
1
1
  import { Switch as MuiSwitch } from '@mui/material';
2
- import { styled } from '@mui/material/styles';
2
+ import { alpha, styled } from '@mui/material/styles';
3
3
  import { switchClasses } from '@mui/material/Switch';
4
4
  export const Switch = styled(MuiSwitch)(({ theme }) => ({
5
5
  width: 42,
@@ -28,8 +28,8 @@ export const Switch = styled(MuiSwitch)(({ theme }) => ({
28
28
  },
29
29
  [`&.${switchClasses.disabled} .${switchClasses.thumb}`]: {
30
30
  color: theme.palette.mode === 'light'
31
- ? theme.palette.grey[100]
32
- : theme.palette.grey[600],
31
+ ? alpha(theme.palette.common.black, 0.12)
32
+ : alpha(theme.palette.common.white, 0.12),
33
33
  },
34
34
  [`&.${switchClasses.disabled} + .${switchClasses.track}`]: {
35
35
  opacity: theme.palette.mode === 'light' ? 0.7 : 0.3,
@@ -43,8 +43,8 @@ export const Switch = styled(MuiSwitch)(({ theme }) => ({
43
43
  [`.${switchClasses.track}`]: {
44
44
  borderRadius: 24 / 2,
45
45
  backgroundColor: theme.palette.mode === 'light'
46
- ? theme.palette.grey[300]
47
- : theme.palette.grey[800],
46
+ ? alpha(theme.palette.common.black, 0.16)
47
+ : alpha(theme.palette.common.white, 0.16),
48
48
  opacity: 1,
49
49
  transition: theme.transitions.create(['background-color'], {
50
50
  duration: theme.transitions.duration.standard,
@@ -17,8 +17,8 @@ export declare const TextSecondary: import("@emotion/styled").StyledComponent<im
17
17
  noWrap?: boolean | undefined;
18
18
  paragraph?: boolean | undefined;
19
19
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
20
- variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
21
- variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)", string>> | undefined;
20
+ variant?: import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides> | undefined;
21
+ variantMapping?: Partial<Record<import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides>, string>> | undefined;
22
22
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
23
23
  ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
24
24
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
package/config/theme.js CHANGED
@@ -19,7 +19,7 @@ const palette = {
19
19
  main: '#0AA65B',
20
20
  },
21
21
  warning: {
22
- main: '#FFE668',
22
+ main: '#FFCC00',
23
23
  },
24
24
  error: {
25
25
  main: '#E5452F',
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.32.8";
2
+ export declare const version = "2.0.0-alpha.0";
package/config/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget';
2
- export const version = '1.32.8';
2
+ export const version = '2.0.0-alpha.0';
package/hooks/index.d.ts CHANGED
@@ -5,7 +5,11 @@ export * from './useDebouncedWatch';
5
5
  export * from './useDefaultElementId';
6
6
  export * from './useExpandableVariant';
7
7
  export * from './useFeaturedTokens';
8
+ export * from './useFundsSufficiency';
9
+ export * from './useGasRecommendation';
10
+ export * from './useGasRefuel';
8
11
  export * from './useGasSufficiency';
12
+ export * from './useGetTokenBalancesWithRetry';
9
13
  export * from './useInitializer';
10
14
  export * from './useNavigateBack';
11
15
  export * from './useProcessMessage';
package/hooks/index.js CHANGED
@@ -5,7 +5,11 @@ export * from './useDebouncedWatch';
5
5
  export * from './useDefaultElementId';
6
6
  export * from './useExpandableVariant';
7
7
  export * from './useFeaturedTokens';
8
+ export * from './useFundsSufficiency';
9
+ export * from './useGasRecommendation';
10
+ export * from './useGasRefuel';
8
11
  export * from './useGasSufficiency';
12
+ export * from './useGetTokenBalancesWithRetry';
9
13
  export * from './useInitializer';
10
14
  export * from './useNavigateBack';
11
15
  export * from './useProcessMessage';
@@ -4,13 +4,13 @@ import { useFormContext } from 'react-hook-form';
4
4
  import { isItemAllowed, SwapFormKey, useLiFi, useWidgetConfig, } from '../providers';
5
5
  import { useChainOrderStore } from '../stores';
6
6
  export const useChains = () => {
7
- const { disabledChains, chains } = useWidgetConfig();
7
+ const { chains } = useWidgetConfig();
8
8
  const lifi = useLiFi();
9
9
  const { getValues, setValue } = useFormContext();
10
10
  const initializeChains = useChainOrderStore((state) => state.initializeChains);
11
11
  const { data, isLoading } = useQuery(['chains'], async () => {
12
12
  const availableChains = await lifi.getChains();
13
- const filteredChains = availableChains.filter((chain) => isItemAllowed(chain.id, chains, disabledChains));
13
+ const filteredChains = availableChains.filter((chain) => isItemAllowed(chain.id, chains));
14
14
  const chainOrder = initializeChains(filteredChains.map((chain) => chain.id));
15
15
  const [fromChainValue, toChainValue] = getValues([
16
16
  SwapFormKey.FromChain,
@@ -1 +1 @@
1
- export declare const useFeaturedTokens: (selectedChainId?: number) => import("@lifi/types").Token[];
1
+ export declare const useFeaturedTokens: (selectedChainId?: number) => import("@lifi/types").Token[] | undefined;
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useWidgetConfig } from '../providers';
3
3
  export const useFeaturedTokens = (selectedChainId) => {
4
- const { featuredTokens, tokens } = useWidgetConfig();
5
- return useMemo(() => [...(tokens?.featured ?? []), ...(featuredTokens ?? [])].filter((token) => token.chainId === selectedChainId), [featuredTokens, selectedChainId, tokens?.featured]);
4
+ const { tokens } = useWidgetConfig();
5
+ return useMemo(() => tokens?.featured?.filter((token) => token.chainId === selectedChainId), [selectedChainId, tokens?.featured]);
6
6
  };
@@ -0,0 +1,5 @@
1
+ import type { Route } from '@lifi/sdk';
2
+ export declare const useFundsSufficiency: (route?: Route) => {
3
+ insufficientFunds: boolean | undefined;
4
+ isInitialLoading: boolean;
5
+ };