@lifi/widget 3.0.2 → 3.1.1

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 (235) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/_esm/components/Card/CardIconButton.js +1 -0
  3. package/_esm/components/Card/CardIconButton.js.map +1 -1
  4. package/_esm/components/Card/CardLabel.d.ts +1 -1
  5. package/_esm/components/Card/CardLabel.js +8 -12
  6. package/_esm/components/Card/CardLabel.js.map +1 -1
  7. package/_esm/components/ChainSelect/ChainSelect.js +1 -1
  8. package/_esm/components/ChainSelect/ChainSelect.js.map +1 -1
  9. package/_esm/components/FeeBreakdownTooltip.d.ts +12 -0
  10. package/_esm/components/FeeBreakdownTooltip.js +13 -0
  11. package/_esm/components/FeeBreakdownTooltip.js.map +1 -0
  12. package/_esm/components/GasMessage/GasRefuelMessage.js +1 -1
  13. package/_esm/components/GasMessage/GasRefuelMessage.js.map +1 -1
  14. package/_esm/components/Header/CloseDrawerButton.js +1 -1
  15. package/_esm/components/Header/CloseDrawerButton.js.map +1 -1
  16. package/_esm/components/Header/SettingsButton.js +1 -1
  17. package/_esm/components/Header/SettingsButton.js.map +1 -1
  18. package/_esm/components/Header/TransactionHistoryButton.js +1 -1
  19. package/_esm/components/Header/TransactionHistoryButton.js.map +1 -1
  20. package/_esm/components/IconTypography.d.ts +3 -0
  21. package/_esm/components/IconTypography.js +8 -0
  22. package/_esm/components/IconTypography.js.map +1 -0
  23. package/_esm/components/PoweredBy/PoweredBy.js +1 -1
  24. package/_esm/components/PoweredBy/PoweredBy.js.map +1 -1
  25. package/_esm/components/ProgressToNextUpdate.js +1 -1
  26. package/_esm/components/ProgressToNextUpdate.js.map +1 -1
  27. package/_esm/components/RouteCard/RouteCard.js +7 -16
  28. package/_esm/components/RouteCard/RouteCard.js.map +1 -1
  29. package/_esm/components/RouteCard/RouteCard.style.d.ts +0 -3
  30. package/_esm/components/RouteCard/RouteCard.style.js +1 -7
  31. package/_esm/components/RouteCard/RouteCard.style.js.map +1 -1
  32. package/_esm/components/RouteCard/RouteCardEssentials.js +13 -14
  33. package/_esm/components/RouteCard/RouteCardEssentials.js.map +1 -1
  34. package/_esm/components/RouteCard/RouteCardEssentialsExpanded.js +4 -20
  35. package/_esm/components/RouteCard/RouteCardEssentialsExpanded.js.map +1 -1
  36. package/_esm/components/RouteCard/types.d.ts +1 -6
  37. package/_esm/components/Routes/RoutesExpanded.js +2 -4
  38. package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
  39. package/_esm/components/SendToWallet/SendToWalletExpandButton.js +1 -1
  40. package/_esm/components/SendToWallet/SendToWalletExpandButton.js.map +1 -1
  41. package/_esm/components/Step/Step.d.ts +1 -0
  42. package/_esm/components/Step/Step.js +2 -2
  43. package/_esm/components/Step/Step.js.map +1 -1
  44. package/_esm/components/Step/StepList.js +16 -7
  45. package/_esm/components/Step/StepList.js.map +1 -1
  46. package/_esm/components/Step/StepTimer.js +3 -3
  47. package/_esm/components/Step/StepTimer.js.map +1 -1
  48. package/_esm/components/StepActions/StepActions.js +5 -4
  49. package/_esm/components/StepActions/StepActions.js.map +1 -1
  50. package/_esm/components/StepActions/StepActions.style.js +4 -4
  51. package/_esm/components/StepActions/StepActions.style.js.map +1 -1
  52. package/_esm/components/Token/Token.d.ts +2 -0
  53. package/_esm/components/Token/Token.js +22 -8
  54. package/_esm/components/Token/Token.js.map +1 -1
  55. package/_esm/components/Token/Token.style.js +1 -0
  56. package/_esm/components/Token/Token.style.js.map +1 -1
  57. package/_esm/components/TokenRate.d.ts +7 -0
  58. package/_esm/components/TokenRate.js +41 -0
  59. package/_esm/components/TokenRate.js.map +1 -0
  60. package/_esm/components/TransactionDetails.d.ts +7 -0
  61. package/_esm/components/TransactionDetails.js +46 -0
  62. package/_esm/components/TransactionDetails.js.map +1 -0
  63. package/_esm/config/version.d.ts +1 -1
  64. package/_esm/config/version.js +1 -1
  65. package/_esm/hooks/timer/useInterval.d.ts +1 -0
  66. package/_esm/hooks/timer/useInterval.js +18 -0
  67. package/_esm/hooks/timer/useInterval.js.map +1 -0
  68. package/_esm/hooks/timer/useTimer.d.ts +18 -0
  69. package/_esm/hooks/timer/useTimer.js +61 -0
  70. package/_esm/hooks/timer/useTimer.js.map +1 -0
  71. package/_esm/hooks/timer/utils.d.ts +11 -0
  72. package/_esm/hooks/timer/utils.js +46 -0
  73. package/_esm/hooks/timer/utils.js.map +1 -0
  74. package/_esm/hooks/useAccount.js +4 -5
  75. package/_esm/hooks/useAccount.js.map +1 -1
  76. package/_esm/hooks/useAvailableChains.js +1 -0
  77. package/_esm/hooks/useAvailableChains.js.map +1 -1
  78. package/_esm/hooks/useGasRecommendation.js +1 -0
  79. package/_esm/hooks/useGasRecommendation.js.map +1 -1
  80. package/_esm/hooks/useProcessMessage.js +8 -0
  81. package/_esm/hooks/useProcessMessage.js.map +1 -1
  82. package/_esm/hooks/useRoutes.d.ts +4 -2
  83. package/_esm/hooks/useRoutes.js +17 -10
  84. package/_esm/hooks/useRoutes.js.map +1 -1
  85. package/_esm/hooks/useTokens.js +1 -0
  86. package/_esm/hooks/useTokens.js.map +1 -1
  87. package/_esm/hooks/useTools.js +1 -0
  88. package/_esm/hooks/useTools.js.map +1 -1
  89. package/_esm/hooks/useTransactionDetails.d.ts +1 -1
  90. package/_esm/hooks/useTransactionDetails.js +1 -1
  91. package/_esm/hooks/useTransactionDetails.js.map +1 -1
  92. package/_esm/hooks/useTransactionHistory.js.map +1 -1
  93. package/_esm/i18n/en.json +19 -21
  94. package/_esm/i18n/index.js +15 -15
  95. package/_esm/i18n/index.js.map +1 -1
  96. package/_esm/index.d.ts +2 -1
  97. package/_esm/index.js +1 -4
  98. package/_esm/index.js.map +1 -1
  99. package/_esm/pages/MainPage/ReviewButton.js +2 -4
  100. package/_esm/pages/MainPage/ReviewButton.js.map +1 -1
  101. package/_esm/pages/RoutesPage/RoutesPage.js +2 -4
  102. package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
  103. package/_esm/pages/SelectEnabledToolsPage.js +1 -1
  104. package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
  105. package/_esm/pages/SendToWallet/SendToWalletPage.js +1 -1
  106. package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
  107. package/_esm/pages/SettingsPage/ThemeSettings.js +1 -1
  108. package/_esm/pages/SettingsPage/ThemeSettings.js.map +1 -1
  109. package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +5 -7
  110. package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
  111. package/_esm/pages/TransactionHistoryPage/TransactionHistoryItem.js +2 -2
  112. package/_esm/pages/TransactionHistoryPage/TransactionHistoryItem.js.map +1 -1
  113. package/_esm/pages/TransactionPage/ExchangeRateBottomSheet.js +2 -2
  114. package/_esm/pages/TransactionPage/ExchangeRateBottomSheet.js.map +1 -1
  115. package/_esm/pages/TransactionPage/RouteTracker.d.ts +7 -0
  116. package/_esm/pages/TransactionPage/RouteTracker.js +39 -0
  117. package/_esm/pages/TransactionPage/RouteTracker.js.map +1 -0
  118. package/_esm/pages/TransactionPage/StartTransactionButton.d.ts +0 -1
  119. package/_esm/pages/TransactionPage/StartTransactionButton.js +0 -9
  120. package/_esm/pages/TransactionPage/StartTransactionButton.js.map +1 -1
  121. package/_esm/pages/TransactionPage/TransactionPage.js +10 -21
  122. package/_esm/pages/TransactionPage/TransactionPage.js.map +1 -1
  123. package/_esm/pages/TransactionPage/types.d.ts +0 -1
  124. package/_esm/providers/I18nProvider/I18nProvider.js +2 -0
  125. package/_esm/providers/I18nProvider/I18nProvider.js.map +1 -1
  126. package/_esm/providers/I18nProvider/currencyExtendedFormatter.d.ts +1 -0
  127. package/_esm/providers/I18nProvider/currencyExtendedFormatter.js +13 -0
  128. package/_esm/providers/I18nProvider/currencyExtendedFormatter.js.map +1 -0
  129. package/_esm/providers/WalletProvider/EVMBaseProvider.js +18 -12
  130. package/_esm/providers/WalletProvider/EVMBaseProvider.js.map +1 -1
  131. package/_esm/stores/routes/createRouteExecutionStore.js +2 -2
  132. package/_esm/stores/routes/createRouteExecutionStore.js.map +1 -1
  133. package/_esm/stores/routes/types.d.ts +1 -1
  134. package/_esm/stores/routes/useSetExecutableRoute.d.ts +1 -1
  135. package/_esm/themes/createTheme.js +6 -0
  136. package/_esm/themes/createTheme.js.map +1 -1
  137. package/_esm/types/widget.d.ts +1 -2
  138. package/_esm/utils/converters.js +5 -13
  139. package/_esm/utils/converters.js.map +1 -1
  140. package/_esm/utils/fees.d.ts +3 -3
  141. package/_esm/utils/fees.js +22 -14
  142. package/_esm/utils/fees.js.map +1 -1
  143. package/_esm/utils/format.d.ts +13 -4
  144. package/_esm/utils/format.js +51 -13
  145. package/_esm/utils/format.js.map +1 -1
  146. package/components/Card/CardIconButton.tsx +1 -0
  147. package/components/Card/CardLabel.tsx +13 -29
  148. package/components/ChainSelect/ChainSelect.tsx +1 -9
  149. package/components/FeeBreakdownTooltip.tsx +66 -0
  150. package/components/GasMessage/GasRefuelMessage.tsx +1 -1
  151. package/components/Header/CloseDrawerButton.tsx +1 -1
  152. package/components/Header/SettingsButton.tsx +1 -1
  153. package/components/Header/TransactionHistoryButton.tsx +1 -1
  154. package/components/IconTypography.ts +9 -0
  155. package/components/PoweredBy/PoweredBy.tsx +1 -1
  156. package/components/ProgressToNextUpdate.tsx +0 -3
  157. package/components/RouteCard/RouteCard.style.ts +1 -9
  158. package/components/RouteCard/RouteCard.tsx +15 -71
  159. package/components/RouteCard/RouteCardEssentials.tsx +52 -81
  160. package/components/RouteCard/RouteCardEssentialsExpanded.tsx +17 -107
  161. package/components/RouteCard/types.ts +1 -7
  162. package/components/Routes/RoutesExpanded.tsx +3 -4
  163. package/components/SendToWallet/SendToWalletExpandButton.tsx +1 -6
  164. package/components/Step/Step.tsx +11 -2
  165. package/components/Step/StepList.tsx +19 -10
  166. package/components/Step/StepTimer.tsx +9 -6
  167. package/components/StepActions/StepActions.style.tsx +4 -4
  168. package/components/StepActions/StepActions.tsx +11 -14
  169. package/components/Token/Token.style.tsx +1 -0
  170. package/components/Token/Token.tsx +49 -9
  171. package/components/TokenRate.tsx +79 -0
  172. package/components/TransactionDetails.tsx +182 -0
  173. package/config/version.ts +1 -1
  174. package/hooks/timer/useInterval.ts +21 -0
  175. package/hooks/timer/useTimer.ts +91 -0
  176. package/hooks/timer/utils.ts +54 -0
  177. package/hooks/useAccount.ts +8 -5
  178. package/hooks/useAvailableChains.ts +2 -1
  179. package/hooks/useGasRecommendation.ts +1 -0
  180. package/hooks/useProcessMessage.ts +8 -0
  181. package/hooks/useRoutes.ts +23 -13
  182. package/hooks/useTokens.ts +1 -0
  183. package/hooks/useTools.ts +2 -1
  184. package/hooks/useTransactionDetails.ts +3 -3
  185. package/hooks/useTransactionHistory.ts +1 -1
  186. package/i18n/en.json +19 -21
  187. package/i18n/index.ts +15 -15
  188. package/index.ts +2 -5
  189. package/package.json +18 -19
  190. package/pages/MainPage/ReviewButton.tsx +2 -4
  191. package/pages/RoutesPage/RoutesPage.tsx +3 -4
  192. package/pages/SelectEnabledToolsPage.tsx +1 -1
  193. package/pages/SendToWallet/SendToWalletPage.tsx +1 -1
  194. package/pages/SettingsPage/ThemeSettings.tsx +1 -1
  195. package/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +9 -20
  196. package/pages/TransactionHistoryPage/TransactionHistoryItem.tsx +3 -5
  197. package/pages/TransactionPage/ExchangeRateBottomSheet.tsx +0 -2
  198. package/pages/TransactionPage/RouteTracker.tsx +68 -0
  199. package/pages/TransactionPage/StartTransactionButton.tsx +0 -24
  200. package/pages/TransactionPage/TransactionPage.tsx +21 -48
  201. package/pages/TransactionPage/types.ts +0 -1
  202. package/providers/I18nProvider/I18nProvider.tsx +6 -0
  203. package/providers/I18nProvider/currencyExtendedFormatter.ts +15 -0
  204. package/providers/WalletProvider/EVMBaseProvider.tsx +13 -7
  205. package/stores/routes/createRouteExecutionStore.ts +2 -2
  206. package/stores/routes/types.ts +1 -1
  207. package/themes/createTheme.ts +6 -0
  208. package/types/widget.ts +1 -2
  209. package/utils/converters.ts +5 -13
  210. package/utils/fees.ts +30 -25
  211. package/utils/format.ts +67 -20
  212. package/_esm/components/Insurance/Insurance.d.ts +0 -2
  213. package/_esm/components/Insurance/Insurance.js +0 -8
  214. package/_esm/components/Insurance/Insurance.js.map +0 -1
  215. package/_esm/components/Insurance/InsuranceCard.d.ts +0 -2
  216. package/_esm/components/Insurance/InsuranceCard.js +0 -36
  217. package/_esm/components/Insurance/InsuranceCard.js.map +0 -1
  218. package/_esm/components/Insurance/InsuranceCollapsed.d.ts +0 -2
  219. package/_esm/components/Insurance/InsuranceCollapsed.js +0 -29
  220. package/_esm/components/Insurance/InsuranceCollapsed.js.map +0 -1
  221. package/_esm/components/Insurance/types.d.ts +0 -19
  222. package/_esm/components/Insurance/types.js +0 -2
  223. package/_esm/components/Insurance/types.js.map +0 -1
  224. package/_esm/components/StepActions/StepFeeBreakdown.d.ts +0 -4
  225. package/_esm/components/StepActions/StepFeeBreakdown.js +0 -42
  226. package/_esm/components/StepActions/StepFeeBreakdown.js.map +0 -1
  227. package/_esm/icons/InsuraceLogo.d.ts +0 -2
  228. package/_esm/icons/InsuraceLogo.js +0 -8
  229. package/_esm/icons/InsuraceLogo.js.map +0 -1
  230. package/components/Insurance/Insurance.tsx +0 -22
  231. package/components/Insurance/InsuranceCard.tsx +0 -119
  232. package/components/Insurance/InsuranceCollapsed.tsx +0 -59
  233. package/components/Insurance/types.ts +0 -24
  234. package/components/StepActions/StepFeeBreakdown.tsx +0 -108
  235. package/icons/InsuraceLogo.tsx +0 -46
@@ -1,22 +1,26 @@
1
1
  import { formatUnits } from 'viem';
2
+ const subscriptMap = ['₀', '₁', '₂', '₃', '₄', '₅', '₆', '₇', '₈', '₉'];
3
+ export const precisionFormatter = new Intl.NumberFormat('en', {
4
+ notation: 'standard',
5
+ roundingPriority: 'morePrecision',
6
+ maximumSignificantDigits: 4,
7
+ maximumFractionDigits: 4,
8
+ useGrouping: false,
9
+ });
2
10
  /**
3
11
  * Format token amount to at least 4 decimals.
4
12
  * @param amount amount to format.
5
13
  * @returns formatted amount.
6
14
  */
7
- export const formatTokenAmount = (amount = 0n, decimals, decimalPlaces = 3) => {
15
+ export function formatTokenAmount(amount = 0n, decimals) {
8
16
  const formattedAmount = amount ? formatUnits(amount, decimals) : '0';
9
17
  const parsedAmount = parseFloat(formattedAmount);
10
18
  if (parsedAmount === 0 || isNaN(Number(formattedAmount))) {
11
19
  return '0';
12
20
  }
13
- const absAmount = Math.abs(parsedAmount);
14
- while (absAmount < 1 / 10 ** decimalPlaces) {
15
- decimalPlaces++;
16
- }
17
- return parsedAmount.toFixed(decimalPlaces + 1);
18
- };
19
- export const formatSlippage = (slippage = '', defaultValue = '', returnInitial = false) => {
21
+ return precisionFormatter.format(parsedAmount);
22
+ }
23
+ export function formatSlippage(slippage = '', defaultValue = '', returnInitial = false) {
20
24
  if (!slippage) {
21
25
  return slippage;
22
26
  }
@@ -37,8 +41,8 @@ export const formatSlippage = (slippage = '', defaultValue = '', returnInitial =
37
41
  return slippage;
38
42
  }
39
43
  return parsedSlippage.toString();
40
- };
41
- export const formatInputAmount = (amount, decimals = null, returnInitial = false) => {
44
+ }
45
+ export function formatInputAmount(amount, decimals = null, returnInitial = false) {
42
46
  if (!amount) {
43
47
  return amount;
44
48
  }
@@ -63,8 +67,8 @@ export const formatInputAmount = (amount, decimals = null, returnInitial = false
63
67
  integer = integer.replace(/^0+|-/, '');
64
68
  fraction = fraction.replace(/(0+)$/, '');
65
69
  return `${integer || (fraction ? '0' : '')}${fraction ? `.${fraction}` : ''}`;
66
- };
67
- export const formatTokenPrice = (amount, price) => {
70
+ }
71
+ export function formatTokenPrice(amount, price) {
68
72
  if (!amount || !price) {
69
73
  return 0;
70
74
  }
@@ -72,5 +76,39 @@ export const formatTokenPrice = (amount, price) => {
72
76
  return 0;
73
77
  }
74
78
  return parseFloat(amount) * parseFloat(price);
75
- };
79
+ }
80
+ /**
81
+ * Converts a number to a subscript format if it contains leading zeros in the fractional part.
82
+ *
83
+ * @param {number} value - The number to be converted.
84
+ * @param {Intl.NumberFormatOptions} options An object that contains one or more properties that specify comparison options.
85
+ * @returns {string} - The number formatted as a string, with subscripts for leading zeros if applicable.
86
+ */
87
+ export function convertToSubscriptFormat(value, options) {
88
+ let formattedValue;
89
+ if (options) {
90
+ formattedValue = value.toLocaleString('en', options);
91
+ }
92
+ else {
93
+ formattedValue = precisionFormatter.format(value);
94
+ }
95
+ // Calculate the number of zeros after the decimal point
96
+ const d = Math.ceil(Math.log10(Math.abs(value)));
97
+ // If the value does not have significant leading zeros in the fractional part, return the formatted value as is
98
+ if (d > -3 || !value) {
99
+ return formattedValue;
100
+ }
101
+ // Calculate the number of leading zeros in the fractional part
102
+ const leadingZeros = Math.abs(d);
103
+ const fractionalPartExtractor = value > 0 ? 2 : 3;
104
+ // Extract the fractional part of the formatted value, excluding the leading zeros and "0." or "-0."
105
+ const fractionalPart = formattedValue.slice(leadingZeros + fractionalPartExtractor);
106
+ // Convert the number of leading zeros to their corresponding Unicode subscript characters
107
+ const subscript = leadingZeros
108
+ .toString()
109
+ .split('')
110
+ .map((digit) => subscriptMap[digit])
111
+ .join('');
112
+ return `${value > 0 ? '' : '-'}0.0${subscript}${fractionalPart}`;
113
+ }
76
114
  //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../../utils/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,SAAiB,EAAE,EACnB,QAAgB,EAChB,gBAAwB,CAAC,EACzB,EAAE;IACF,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACrE,MAAM,YAAY,GAAG,UAAU,CAA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C,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAY,CAAC,CAAC;SAC1C,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;AACnE,CAAC"}
@@ -8,5 +8,6 @@ export const CardIconButton = styled(MuiIconButton)(({ theme }) => {
8
8
  '&:hover': {
9
9
  backgroundColor: getContrastAlphaColor(theme, 0.08),
10
10
  },
11
+ fontSize: '1rem',
11
12
  };
12
13
  });
@@ -1,15 +1,9 @@
1
- import {
2
- Box,
3
- Typography,
4
- getContrastRatio,
5
- lighten,
6
- styled,
7
- } from '@mui/material';
1
+ import { Box, Typography, getContrastRatio, styled } from '@mui/material';
8
2
  import { blend } from '../../utils/colors.js';
9
3
 
10
4
  export const CardLabel = styled(Box, {
11
5
  shouldForwardProp: (prop) => prop !== 'type',
12
- })<{ type?: 'active' | 'insurance' | 'insurance-icon' }>(({ theme, type }) => {
6
+ })<{ type?: 'active' }>(({ theme, type }) => {
13
7
  const backgroundColor =
14
8
  type === 'active'
15
9
  ? theme.palette.mode === 'light'
@@ -19,35 +13,25 @@ export const CardLabel = styled(Box, {
19
13
  theme.palette.secondary.main,
20
14
  0.8,
21
15
  )
22
- : type?.includes('insurance')
16
+ : theme.palette.mode === 'light'
23
17
  ? blend(
24
18
  theme.palette.background.paper,
25
- theme.palette.success.main,
26
- theme.palette.mode === 'light' ? 0.12 : 0.24,
19
+ theme.palette.common.black,
20
+ 0.12,
27
21
  )
28
- : theme.palette.mode === 'light'
29
- ? blend(
30
- theme.palette.background.paper,
31
- theme.palette.common.black,
32
- 0.12,
33
- )
34
- : blend(
35
- theme.palette.background.paper,
36
- theme.palette.common.white,
37
- 0.16,
38
- );
22
+ : blend(
23
+ theme.palette.background.paper,
24
+ theme.palette.common.white,
25
+ 0.16,
26
+ );
39
27
  return {
40
28
  backgroundColor,
41
29
  borderRadius: theme.shape.borderRadius,
42
- color: type?.includes('insurance')
43
- ? lighten(
44
- theme.palette.success.main,
45
- theme.palette.mode === 'light' ? 0 : 0.24,
46
- )
47
- : getContrastRatio(theme.palette.common.white, backgroundColor) >= 3
30
+ color:
31
+ getContrastRatio(theme.palette.common.white, backgroundColor) >= 3
48
32
  ? theme.palette.common.white
49
33
  : theme.palette.common.black,
50
- padding: type === 'insurance' ? theme.spacing(0, 1.5) : 0,
34
+ padding: 0,
51
35
  display: 'flex',
52
36
  alignItems: 'center',
53
37
  justifyContent: 'center',
@@ -64,15 +64,7 @@ export const ChainSelect = ({ formType }: FormTypeProps) => {
64
64
  />
65
65
  ))
66
66
  : chainsToShow?.map((chain: EVMChain) => (
67
- <Tooltip
68
- key={chain.id}
69
- title={chain.name}
70
- placement="top"
71
- enterDelay={400}
72
- enterNextDelay={100}
73
- disableInteractive
74
- arrow
75
- >
67
+ <Tooltip key={chain.id} title={chain.name} enterNextDelay={100}>
76
68
  <ChainCard
77
69
  component="button"
78
70
  onClick={() => setCurrentChain(chain.id)}
@@ -0,0 +1,66 @@
1
+ import type { Route } from '@lifi/sdk';
2
+ import { Box, Tooltip, Typography } from '@mui/material';
3
+ import type { TFunction } from 'i18next';
4
+ import type { ReactElement } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { formatUnits } from 'viem';
7
+ import type { FeesBreakdown } from '../utils/fees.js';
8
+ import { getFeeCostsBreakdown, getGasCostsBreakdown } from '../utils/fees.js';
9
+
10
+ export interface FeeBreakdownTooltipProps {
11
+ route: Route;
12
+ gasCosts?: FeesBreakdown[];
13
+ feeCosts?: FeesBreakdown[];
14
+ children: ReactElement<any, any>;
15
+ }
16
+
17
+ export const FeeBreakdownTooltip: React.FC<FeeBreakdownTooltipProps> = ({
18
+ route,
19
+ gasCosts,
20
+ feeCosts,
21
+ children,
22
+ }) => {
23
+ const { t } = useTranslation();
24
+ const _gasCosts = gasCosts ?? getGasCostsBreakdown(route);
25
+ const _feeCosts = feeCosts ?? getFeeCostsBreakdown(route, false);
26
+ return (
27
+ <Tooltip
28
+ title={
29
+ <Box>
30
+ {_gasCosts.length ? (
31
+ <Box>
32
+ {t('main.fees.network')}
33
+ {getFeeBreakdownTypography(_gasCosts, t)}
34
+ </Box>
35
+ ) : null}
36
+ {_feeCosts.length ? (
37
+ <Box mt={0.5}>
38
+ {t('main.fees.provider')}
39
+ {getFeeBreakdownTypography(_feeCosts, t)}
40
+ </Box>
41
+ ) : null}
42
+ </Box>
43
+ }
44
+ sx={{ cursor: 'help' }}
45
+ >
46
+ {children}
47
+ </Tooltip>
48
+ );
49
+ };
50
+
51
+ export const getFeeBreakdownTypography = (
52
+ fees: FeesBreakdown[],
53
+ t: TFunction,
54
+ ) =>
55
+ fees.map((fee, index) => (
56
+ <Typography
57
+ fontSize={12}
58
+ fontWeight="500"
59
+ color="inherit"
60
+ key={`${fee.token.address}${index}`}
61
+ >
62
+ {t(`format.currency`, { value: fee.amountUSD })} (
63
+ {parseFloat(formatUnits(fee.amount, fee.token.decimals))?.toFixed(9)}{' '}
64
+ {fee.token.symbol})
65
+ </Typography>
66
+ ));
@@ -39,7 +39,7 @@ export const GasRefuelMessage: React.FC<BoxProps> = (props) => {
39
39
  flexGrow={1}
40
40
  >
41
41
  <Typography variant="body2" fontWeight={700}>
42
- {t(`info.title.autoRefuel`)}
42
+ {t(`info.title.autoRefuel`, { chainName: chain?.name ?? '' })}
43
43
  </Typography>
44
44
  <InfoMessageSwitch
45
45
  checked={enabledAutoRefuel}
@@ -21,7 +21,7 @@ export const CloseDrawerButton = ({ header }: CloseDrawerButtonProps) => {
21
21
  const showInWalletHeader = header === 'wallet' && subvariant !== 'split';
22
22
 
23
23
  return showInNavigationHeader || showInWalletHeader ? (
24
- <Tooltip title={t('button.close')} enterDelay={400} arrow>
24
+ <Tooltip title={t('button.close')}>
25
25
  <IconButton size="medium" onClick={closeDrawer}>
26
26
  <CloseRounded />
27
27
  </IconButton>
@@ -27,7 +27,7 @@ export const SettingsButton = () => {
27
27
  : t(`header.settings`);
28
28
 
29
29
  return (
30
- <Tooltip title={tooltipMessage} enterDelay={400} arrow>
30
+ <Tooltip title={tooltipMessage}>
31
31
  <SettingsIconButton
32
32
  size="medium"
33
33
  onClick={() => navigate(navigationRoutes.settings)}
@@ -9,7 +9,7 @@ export const TransactionHistoryButton = () => {
9
9
  const { navigate } = useNavigateBack();
10
10
 
11
11
  return (
12
- <Tooltip title={t(`header.transactionHistory`)} enterDelay={400} arrow>
12
+ <Tooltip title={t(`header.transactionHistory`)}>
13
13
  <IconButton
14
14
  size="medium"
15
15
  onClick={() => navigate(navigationRoutes.transactionHistory)}
@@ -0,0 +1,9 @@
1
+ import { Typography, alpha, styled } from '@mui/material';
2
+
3
+ export const IconTypography = styled(Typography)(({ theme }) => ({
4
+ color:
5
+ theme.palette.mode === 'light'
6
+ ? alpha(theme.palette.common.black, 0.32)
7
+ : alpha(theme.palette.common.white, 0.4),
8
+ lineHeight: 0,
9
+ }));
@@ -14,7 +14,7 @@ export const PoweredBy: React.FC = () => {
14
14
  justifyContent: 'flex-end',
15
15
  }}
16
16
  >
17
- <Tooltip title={`v${version}`} placement="top" enterDelay={1000} arrow>
17
+ <Tooltip title={`v${version}`} enterDelay={1000}>
18
18
  <Link
19
19
  href="https://li.fi"
20
20
  target="_blank"
@@ -52,9 +52,6 @@ export const ProgressToNextUpdate: React.FC<
52
52
  components={[<br />]}
53
53
  />
54
54
  }
55
- placement="top"
56
- enterDelay={400}
57
- arrow
58
55
  >
59
56
  <Box
60
57
  sx={{
@@ -1,12 +1,4 @@
1
- import { Box, Typography, alpha, styled } from '@mui/material';
2
-
3
- export const IconTypography = styled(Typography)(({ theme }) => ({
4
- color:
5
- theme.palette.mode === 'light'
6
- ? alpha(theme.palette.common.black, 0.32)
7
- : alpha(theme.palette.common.white, 0.4),
8
- lineHeight: 0,
9
- }));
1
+ import { Box, styled } from '@mui/material';
10
2
 
11
3
  export const TokenContainer = styled(Box)(({ theme }) => ({
12
4
  display: 'flex',
@@ -1,17 +1,14 @@
1
1
  import type { TokenAmount } from '@lifi/sdk';
2
- import { ExpandLess, ExpandMore, VerifiedUser } from '@mui/icons-material';
3
- import type { TooltipProps } from '@mui/material';
4
- import { Box, Collapse, Tooltip, Typography } from '@mui/material';
2
+ import { ExpandLess, ExpandMore } from '@mui/icons-material';
3
+ import { Box, Collapse } from '@mui/material';
5
4
  import type { MouseEventHandler } from 'react';
6
5
  import { useState } from 'react';
7
- import { Trans, useTranslation } from 'react-i18next';
6
+ import { useTranslation } from 'react-i18next';
8
7
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
9
- import { formatTokenAmount } from '../../utils/format.js';
10
8
  import type { CardProps } from '../Card/Card.js';
11
9
  import { Card } from '../Card/Card.js';
12
10
  import { CardIconButton } from '../Card/CardIconButton.js';
13
11
  import { CardLabel, CardLabelTypography } from '../Card/CardLabel.js';
14
- import type { InsuredAmount } from '../Insurance/types.js';
15
12
  import { StepActions } from '../StepActions/StepActions.js';
16
13
  import { Token } from '../Token/Token.js';
17
14
  import { TokenContainer } from './RouteCard.style.js';
@@ -37,12 +34,14 @@ export const RouteCard: React.FC<
37
34
  setCardExpanded((expanded) => !expanded);
38
35
  };
39
36
 
40
- const insurable = route.insurance?.state === 'INSURABLE';
41
-
42
37
  const token: TokenAmount =
43
38
  subvariant === 'custom'
44
39
  ? { ...route.fromToken, amount: BigInt(route.fromAmount) }
45
40
  : { ...route.toToken, amount: BigInt(route.toAmount) };
41
+ const impactToken: TokenAmount | undefined =
42
+ subvariant !== 'custom'
43
+ ? { ...route.fromToken, amount: BigInt(route.fromAmount) }
44
+ : undefined;
46
45
 
47
46
  const tags = route.tags?.filter(
48
47
  (tag) => tag === 'CHEAPEST' || tag === 'FASTEST',
@@ -50,7 +49,7 @@ export const RouteCard: React.FC<
50
49
 
51
50
  const cardContent = (
52
51
  <Box flex={1}>
53
- {subvariant !== 'refuel' && (insurable || route.tags?.length) ? (
52
+ {subvariant !== 'refuel' && route.tags?.length ? (
54
53
  <Box display="flex" alignItems="center" mb={2}>
55
54
  {tags?.length ? (
56
55
  <CardLabel type={active ? 'active' : undefined}>
@@ -59,33 +58,22 @@ export const RouteCard: React.FC<
59
58
  </CardLabelTypography>
60
59
  </CardLabel>
61
60
  ) : null}
62
- {insurable ? (
63
- <InsuranceTooltip
64
- insuredAmount={formatTokenAmount(
65
- BigInt(route.toAmountMin),
66
- route.toToken.decimals,
67
- )}
68
- insuredTokenSymbol={route.toToken.symbol}
69
- >
70
- <CardLabel type={'insurance'}>
71
- <VerifiedUser fontSize="inherit" />
72
- <CardLabelTypography type="icon">
73
- {t(`main.tags.insurable`)}
74
- </CardLabelTypography>
75
- </CardLabel>
76
- </InsuranceTooltip>
77
- ) : null}
78
61
  </Box>
79
62
  ) : null}
80
63
  <TokenContainer>
81
64
  <Token
82
65
  token={token}
66
+ impactToken={impactToken}
83
67
  step={route.steps[0]}
84
68
  stepVisible={!cardExpanded}
85
69
  />
86
70
  {!defaulExpanded ? (
87
71
  <CardIconButton onClick={handleExpand} size="small">
88
- {cardExpanded ? <ExpandLess /> : <ExpandMore />}
72
+ {cardExpanded ? (
73
+ <ExpandLess fontSize="inherit" />
74
+ ) : (
75
+ <ExpandMore fontSize="inherit" />
76
+ )}
89
77
  </CardIconButton>
90
78
  ) : null}
91
79
  </TokenContainer>
@@ -95,9 +83,7 @@ export const RouteCard: React.FC<
95
83
  ))}
96
84
  <RouteCardEssentialsExpanded route={route} />
97
85
  </Collapse>
98
- <Collapse timeout={225} in={!cardExpanded} mountOnEnter unmountOnExit>
99
- <RouteCardEssentials route={route} />
100
- </Collapse>
86
+ <RouteCardEssentials route={route} />
101
87
  </Box>
102
88
  );
103
89
 
@@ -114,45 +100,3 @@ export const RouteCard: React.FC<
114
100
  </Card>
115
101
  );
116
102
  };
117
-
118
- const InsuranceTooltip: React.FC<
119
- InsuredAmount & Pick<TooltipProps, 'children'>
120
- > = ({ insuredAmount, insuredTokenSymbol, children }) => {
121
- const { t } = useTranslation();
122
- return (
123
- <Tooltip
124
- title={
125
- <Box component="span">
126
- <Typography fontSize={12} fontWeight="500">
127
- <Trans
128
- i18nKey="insurance.insure"
129
- values={{
130
- amount: insuredAmount,
131
- tokenSymbol: insuredTokenSymbol,
132
- }}
133
- components={[<strong />]}
134
- />
135
- </Typography>
136
- <Box
137
- sx={{
138
- listStyleType: 'disc',
139
- pl: 2,
140
- }}
141
- >
142
- <Typography fontSize={12} fontWeight="500" display="list-item">
143
- {t('insurance.bridgeExploits')}
144
- </Typography>
145
- <Typography fontSize={12} fontWeight="500" display="list-item">
146
- {t('insurance.slippageError')}
147
- </Typography>
148
- </Box>
149
- </Box>
150
- }
151
- placement="top"
152
- enterDelay={400}
153
- arrow
154
- >
155
- {children}
156
- </Tooltip>
157
- );
158
- };
@@ -1,14 +1,11 @@
1
- import { AccessTimeFilled, MonetizationOn } from '@mui/icons-material';
1
+ import { AccessTimeFilled, LocalGasStationRounded } from '@mui/icons-material';
2
2
  import { Box, Tooltip, Typography } from '@mui/material';
3
- import type { TFunction } from 'i18next';
4
3
  import { useTranslation } from 'react-i18next';
5
- import { formatUnits } from 'viem';
6
- import {
7
- getFeeCostsBreakdown,
8
- getGasCostsBreakdown,
9
- } from '../../utils/fees.js';
10
- import { IconTypography } from './RouteCard.style.js';
11
- import type { FeesBreakdown, RouteCardEssentialsProps } from './types.js';
4
+ import { getFeeCostsBreakdown } from '../../utils/fees.js';
5
+ import { FeeBreakdownTooltip } from '../FeeBreakdownTooltip.js';
6
+ import { IconTypography } from '../IconTypography.js';
7
+ import { TokenRate } from '../TokenRate.js';
8
+ import type { RouteCardEssentialsProps } from './types.js';
12
9
 
13
10
  export const RouteCardEssentials: React.FC<RouteCardEssentialsProps> = ({
14
11
  route,
@@ -19,83 +16,57 @@ export const RouteCardEssentials: React.FC<RouteCardEssentialsProps> = ({
19
16
  .map((step) => step.estimate.executionDuration)
20
17
  .reduce((duration, x) => duration + x, 0) / 60,
21
18
  );
22
- const gasCostUSD = parseFloat(route.gasCostUSD ?? '') || 0.01;
23
- const gasCosts = getGasCostsBreakdown(route);
19
+ const gasCostUSD = parseFloat(route.gasCostUSD || '0');
24
20
  const feeCosts = getFeeCostsBreakdown(route, false);
25
21
  const fees =
26
22
  gasCostUSD + feeCosts.reduce((sum, feeCost) => sum + feeCost.amountUSD, 0);
27
23
  return (
28
- <Box display="flex" justifyContent={'space-between'} flex={1} mt={2}>
29
- <Tooltip
30
- title={
31
- <Box component="span">
32
- {t('main.fees.networkEstimated')}
33
- {getFeeBreakdownTypography(gasCosts, t)}
34
- {feeCosts.length ? (
35
- <Box mt={1}>
36
- {t('main.fees.providerEstimated')}
37
- {getFeeBreakdownTypography(feeCosts, t)}
38
- </Box>
39
- ) : null}
24
+ <Box
25
+ display="flex"
26
+ alignItems="center"
27
+ justifyContent={'space-between'}
28
+ flex={1}
29
+ mt={2}
30
+ >
31
+ <TokenRate route={route} />
32
+ <Box display="flex" alignItems="center">
33
+ <FeeBreakdownTooltip route={route} feeCosts={feeCosts}>
34
+ <Box display="flex" mr={1.5} alignItems="center">
35
+ <IconTypography mr={0.5} fontSize={16}>
36
+ <LocalGasStationRounded fontSize="inherit" />
37
+ </IconTypography>
38
+ <Typography
39
+ fontSize={14}
40
+ color="text.primary"
41
+ fontWeight="500"
42
+ lineHeight={1}
43
+ >
44
+ {t(`format.currency`, {
45
+ value: fees,
46
+ })}
47
+ </Typography>
48
+ </Box>
49
+ </FeeBreakdownTooltip>
50
+ <Tooltip title={t(`tooltip.estimatedTime`)} sx={{ cursor: 'help' }}>
51
+ <Box display="flex" alignItems="center">
52
+ <IconTypography mr={0.5} fontSize={16}>
53
+ <AccessTimeFilled fontSize="inherit" />
54
+ </IconTypography>
55
+ <Typography
56
+ fontSize={14}
57
+ color="text.primary"
58
+ fontWeight="500"
59
+ lineHeight={1}
60
+ >
61
+ {executionTimeMinutes.toLocaleString(i18n.language, {
62
+ style: 'unit',
63
+ unit: 'minute',
64
+ unitDisplay: 'narrow',
65
+ })}
66
+ </Typography>
40
67
  </Box>
41
- }
42
- placement="top"
43
- enterDelay={400}
44
- arrow
45
- >
46
- <Box display="flex" alignItems="center">
47
- <IconTypography mr={0.5}>
48
- <MonetizationOn fontSize="small" />
49
- </IconTypography>
50
- <Typography
51
- fontSize={14}
52
- color="text.primary"
53
- fontWeight="500"
54
- lineHeight={1}
55
- >
56
- {t(`format.currency`, {
57
- value: fees,
58
- })}
59
- </Typography>
60
- </Box>
61
- </Tooltip>
62
- <Tooltip
63
- title={t(`tooltip.estimatedTime`)}
64
- placement="top"
65
- enterDelay={400}
66
- arrow
67
- >
68
- <Box display="flex" alignItems="center">
69
- <IconTypography mr={0.5}>
70
- <AccessTimeFilled fontSize="small" />
71
- </IconTypography>
72
- <Typography
73
- fontSize={14}
74
- color="text.primary"
75
- fontWeight="500"
76
- lineHeight={1}
77
- >
78
- {new Intl.NumberFormat(i18n.language, {
79
- style: 'unit',
80
- unit: 'minute',
81
- unitDisplay: 'narrow',
82
- }).format(executionTimeMinutes)}
83
- </Typography>
84
- </Box>
85
- </Tooltip>
68
+ </Tooltip>
69
+ </Box>
86
70
  </Box>
87
71
  );
88
72
  };
89
-
90
- const getFeeBreakdownTypography = (fees: FeesBreakdown[], t: TFunction) =>
91
- fees.map((fee, index) => (
92
- <Typography
93
- fontSize={12}
94
- fontWeight="500"
95
- key={`${fee.token.address}${index}`}
96
- >
97
- {t(`format.currency`, { value: fee.amountUSD })} (
98
- {parseFloat(formatUnits(fee.amount, fee.token.decimals))?.toFixed(9)}{' '}
99
- {fee.token.symbol})
100
- </Typography>
101
- ));