@lifi/widget 3.0.2 → 3.1.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 (226) hide show
  1. package/CHANGELOG.md +16 -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/Header/CloseDrawerButton.js +1 -1
  13. package/_esm/components/Header/CloseDrawerButton.js.map +1 -1
  14. package/_esm/components/Header/SettingsButton.js +1 -1
  15. package/_esm/components/Header/SettingsButton.js.map +1 -1
  16. package/_esm/components/Header/TransactionHistoryButton.js +1 -1
  17. package/_esm/components/Header/TransactionHistoryButton.js.map +1 -1
  18. package/_esm/components/IconTypography.d.ts +3 -0
  19. package/_esm/components/IconTypography.js +8 -0
  20. package/_esm/components/IconTypography.js.map +1 -0
  21. package/_esm/components/PoweredBy/PoweredBy.js +1 -1
  22. package/_esm/components/PoweredBy/PoweredBy.js.map +1 -1
  23. package/_esm/components/ProgressToNextUpdate.js +1 -1
  24. package/_esm/components/ProgressToNextUpdate.js.map +1 -1
  25. package/_esm/components/RouteCard/RouteCard.js +7 -16
  26. package/_esm/components/RouteCard/RouteCard.js.map +1 -1
  27. package/_esm/components/RouteCard/RouteCard.style.d.ts +0 -3
  28. package/_esm/components/RouteCard/RouteCard.style.js +1 -7
  29. package/_esm/components/RouteCard/RouteCard.style.js.map +1 -1
  30. package/_esm/components/RouteCard/RouteCardEssentials.js +13 -14
  31. package/_esm/components/RouteCard/RouteCardEssentials.js.map +1 -1
  32. package/_esm/components/RouteCard/RouteCardEssentialsExpanded.js +4 -20
  33. package/_esm/components/RouteCard/RouteCardEssentialsExpanded.js.map +1 -1
  34. package/_esm/components/RouteCard/types.d.ts +1 -6
  35. package/_esm/components/Routes/RoutesExpanded.js +2 -4
  36. package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
  37. package/_esm/components/SendToWallet/SendToWalletExpandButton.js +1 -1
  38. package/_esm/components/SendToWallet/SendToWalletExpandButton.js.map +1 -1
  39. package/_esm/components/Step/Step.d.ts +1 -0
  40. package/_esm/components/Step/Step.js +2 -2
  41. package/_esm/components/Step/Step.js.map +1 -1
  42. package/_esm/components/Step/StepList.js +16 -7
  43. package/_esm/components/Step/StepList.js.map +1 -1
  44. package/_esm/components/Step/StepTimer.js +3 -3
  45. package/_esm/components/Step/StepTimer.js.map +1 -1
  46. package/_esm/components/StepActions/StepActions.js +5 -4
  47. package/_esm/components/StepActions/StepActions.js.map +1 -1
  48. package/_esm/components/Token/Token.d.ts +2 -0
  49. package/_esm/components/Token/Token.js +22 -8
  50. package/_esm/components/Token/Token.js.map +1 -1
  51. package/_esm/components/Token/Token.style.js +1 -0
  52. package/_esm/components/Token/Token.style.js.map +1 -1
  53. package/_esm/components/TokenRate.d.ts +7 -0
  54. package/_esm/components/TokenRate.js +41 -0
  55. package/_esm/components/TokenRate.js.map +1 -0
  56. package/_esm/components/TransactionDetails.d.ts +7 -0
  57. package/_esm/components/TransactionDetails.js +46 -0
  58. package/_esm/components/TransactionDetails.js.map +1 -0
  59. package/_esm/config/version.d.ts +1 -1
  60. package/_esm/config/version.js +1 -1
  61. package/_esm/hooks/timer/useInterval.d.ts +1 -0
  62. package/_esm/hooks/timer/useInterval.js +18 -0
  63. package/_esm/hooks/timer/useInterval.js.map +1 -0
  64. package/_esm/hooks/timer/useTimer.d.ts +18 -0
  65. package/_esm/hooks/timer/useTimer.js +61 -0
  66. package/_esm/hooks/timer/useTimer.js.map +1 -0
  67. package/_esm/hooks/timer/utils.d.ts +11 -0
  68. package/_esm/hooks/timer/utils.js +46 -0
  69. package/_esm/hooks/timer/utils.js.map +1 -0
  70. package/_esm/hooks/useAccount.js +4 -5
  71. package/_esm/hooks/useAccount.js.map +1 -1
  72. package/_esm/hooks/useAvailableChains.js +1 -0
  73. package/_esm/hooks/useAvailableChains.js.map +1 -1
  74. package/_esm/hooks/useGasRecommendation.js +1 -0
  75. package/_esm/hooks/useGasRecommendation.js.map +1 -1
  76. package/_esm/hooks/useRoutes.d.ts +4 -2
  77. package/_esm/hooks/useRoutes.js +17 -10
  78. package/_esm/hooks/useRoutes.js.map +1 -1
  79. package/_esm/hooks/useTokens.js +1 -0
  80. package/_esm/hooks/useTokens.js.map +1 -1
  81. package/_esm/hooks/useTools.js +1 -0
  82. package/_esm/hooks/useTools.js.map +1 -1
  83. package/_esm/hooks/useTransactionDetails.d.ts +1 -1
  84. package/_esm/hooks/useTransactionDetails.js +1 -1
  85. package/_esm/hooks/useTransactionDetails.js.map +1 -1
  86. package/_esm/hooks/useTransactionHistory.js.map +1 -1
  87. package/_esm/i18n/en.json +14 -20
  88. package/_esm/i18n/index.js +15 -15
  89. package/_esm/i18n/index.js.map +1 -1
  90. package/_esm/index.d.ts +2 -1
  91. package/_esm/index.js +1 -4
  92. package/_esm/index.js.map +1 -1
  93. package/_esm/pages/MainPage/ReviewButton.js +2 -4
  94. package/_esm/pages/MainPage/ReviewButton.js.map +1 -1
  95. package/_esm/pages/RoutesPage/RoutesPage.js +2 -4
  96. package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
  97. package/_esm/pages/SelectEnabledToolsPage.js +1 -1
  98. package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
  99. package/_esm/pages/SendToWallet/SendToWalletPage.js +1 -1
  100. package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
  101. package/_esm/pages/SettingsPage/ThemeSettings.js +1 -1
  102. package/_esm/pages/SettingsPage/ThemeSettings.js.map +1 -1
  103. package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +5 -7
  104. package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
  105. package/_esm/pages/TransactionHistoryPage/TransactionHistoryItem.js +2 -2
  106. package/_esm/pages/TransactionHistoryPage/TransactionHistoryItem.js.map +1 -1
  107. package/_esm/pages/TransactionPage/ExchangeRateBottomSheet.js +2 -2
  108. package/_esm/pages/TransactionPage/ExchangeRateBottomSheet.js.map +1 -1
  109. package/_esm/pages/TransactionPage/RouteTracker.d.ts +7 -0
  110. package/_esm/pages/TransactionPage/RouteTracker.js +39 -0
  111. package/_esm/pages/TransactionPage/RouteTracker.js.map +1 -0
  112. package/_esm/pages/TransactionPage/StartTransactionButton.d.ts +0 -1
  113. package/_esm/pages/TransactionPage/StartTransactionButton.js +0 -9
  114. package/_esm/pages/TransactionPage/StartTransactionButton.js.map +1 -1
  115. package/_esm/pages/TransactionPage/TransactionPage.js +10 -21
  116. package/_esm/pages/TransactionPage/TransactionPage.js.map +1 -1
  117. package/_esm/pages/TransactionPage/types.d.ts +0 -1
  118. package/_esm/providers/I18nProvider/I18nProvider.js +2 -0
  119. package/_esm/providers/I18nProvider/I18nProvider.js.map +1 -1
  120. package/_esm/providers/I18nProvider/currencyExtendedFormatter.d.ts +1 -0
  121. package/_esm/providers/I18nProvider/currencyExtendedFormatter.js +13 -0
  122. package/_esm/providers/I18nProvider/currencyExtendedFormatter.js.map +1 -0
  123. package/_esm/providers/WalletProvider/EVMBaseProvider.js +18 -12
  124. package/_esm/providers/WalletProvider/EVMBaseProvider.js.map +1 -1
  125. package/_esm/stores/routes/createRouteExecutionStore.js +2 -2
  126. package/_esm/stores/routes/createRouteExecutionStore.js.map +1 -1
  127. package/_esm/stores/routes/types.d.ts +1 -1
  128. package/_esm/stores/routes/useSetExecutableRoute.d.ts +1 -1
  129. package/_esm/themes/createTheme.js +6 -0
  130. package/_esm/themes/createTheme.js.map +1 -1
  131. package/_esm/types/widget.d.ts +1 -2
  132. package/_esm/utils/converters.js +5 -13
  133. package/_esm/utils/converters.js.map +1 -1
  134. package/_esm/utils/fees.d.ts +3 -3
  135. package/_esm/utils/fees.js +18 -13
  136. package/_esm/utils/fees.js.map +1 -1
  137. package/_esm/utils/format.d.ts +13 -4
  138. package/_esm/utils/format.js +51 -13
  139. package/_esm/utils/format.js.map +1 -1
  140. package/components/Card/CardIconButton.tsx +1 -0
  141. package/components/Card/CardLabel.tsx +13 -29
  142. package/components/ChainSelect/ChainSelect.tsx +1 -9
  143. package/components/FeeBreakdownTooltip.tsx +66 -0
  144. package/components/Header/CloseDrawerButton.tsx +1 -1
  145. package/components/Header/SettingsButton.tsx +1 -1
  146. package/components/Header/TransactionHistoryButton.tsx +1 -1
  147. package/components/IconTypography.ts +9 -0
  148. package/components/PoweredBy/PoweredBy.tsx +1 -1
  149. package/components/ProgressToNextUpdate.tsx +0 -3
  150. package/components/RouteCard/RouteCard.style.ts +1 -9
  151. package/components/RouteCard/RouteCard.tsx +15 -71
  152. package/components/RouteCard/RouteCardEssentials.tsx +52 -81
  153. package/components/RouteCard/RouteCardEssentialsExpanded.tsx +17 -107
  154. package/components/RouteCard/types.ts +1 -7
  155. package/components/Routes/RoutesExpanded.tsx +3 -4
  156. package/components/SendToWallet/SendToWalletExpandButton.tsx +1 -6
  157. package/components/Step/Step.tsx +11 -2
  158. package/components/Step/StepList.tsx +19 -10
  159. package/components/Step/StepTimer.tsx +9 -6
  160. package/components/StepActions/StepActions.tsx +11 -14
  161. package/components/Token/Token.style.tsx +1 -0
  162. package/components/Token/Token.tsx +49 -9
  163. package/components/TokenRate.tsx +79 -0
  164. package/components/TransactionDetails.tsx +182 -0
  165. package/config/version.ts +1 -1
  166. package/hooks/timer/useInterval.ts +21 -0
  167. package/hooks/timer/useTimer.ts +91 -0
  168. package/hooks/timer/utils.ts +54 -0
  169. package/hooks/useAccount.ts +8 -5
  170. package/hooks/useAvailableChains.ts +2 -1
  171. package/hooks/useGasRecommendation.ts +1 -0
  172. package/hooks/useRoutes.ts +23 -13
  173. package/hooks/useTokens.ts +1 -0
  174. package/hooks/useTools.ts +2 -1
  175. package/hooks/useTransactionDetails.ts +3 -3
  176. package/hooks/useTransactionHistory.ts +1 -1
  177. package/i18n/en.json +14 -20
  178. package/i18n/index.ts +15 -15
  179. package/index.ts +2 -5
  180. package/package.json +15 -16
  181. package/pages/MainPage/ReviewButton.tsx +2 -4
  182. package/pages/RoutesPage/RoutesPage.tsx +3 -4
  183. package/pages/SelectEnabledToolsPage.tsx +1 -1
  184. package/pages/SendToWallet/SendToWalletPage.tsx +1 -1
  185. package/pages/SettingsPage/ThemeSettings.tsx +1 -1
  186. package/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +9 -20
  187. package/pages/TransactionHistoryPage/TransactionHistoryItem.tsx +3 -5
  188. package/pages/TransactionPage/ExchangeRateBottomSheet.tsx +0 -2
  189. package/pages/TransactionPage/RouteTracker.tsx +68 -0
  190. package/pages/TransactionPage/StartTransactionButton.tsx +0 -24
  191. package/pages/TransactionPage/TransactionPage.tsx +21 -48
  192. package/pages/TransactionPage/types.ts +0 -1
  193. package/providers/I18nProvider/I18nProvider.tsx +6 -0
  194. package/providers/I18nProvider/currencyExtendedFormatter.ts +15 -0
  195. package/providers/WalletProvider/EVMBaseProvider.tsx +13 -7
  196. package/stores/routes/createRouteExecutionStore.ts +2 -2
  197. package/stores/routes/types.ts +1 -1
  198. package/themes/createTheme.ts +6 -0
  199. package/types/widget.ts +1 -2
  200. package/utils/converters.ts +5 -13
  201. package/utils/fees.ts +23 -24
  202. package/utils/format.ts +67 -20
  203. package/_esm/components/Insurance/Insurance.d.ts +0 -2
  204. package/_esm/components/Insurance/Insurance.js +0 -8
  205. package/_esm/components/Insurance/Insurance.js.map +0 -1
  206. package/_esm/components/Insurance/InsuranceCard.d.ts +0 -2
  207. package/_esm/components/Insurance/InsuranceCard.js +0 -36
  208. package/_esm/components/Insurance/InsuranceCard.js.map +0 -1
  209. package/_esm/components/Insurance/InsuranceCollapsed.d.ts +0 -2
  210. package/_esm/components/Insurance/InsuranceCollapsed.js +0 -29
  211. package/_esm/components/Insurance/InsuranceCollapsed.js.map +0 -1
  212. package/_esm/components/Insurance/types.d.ts +0 -19
  213. package/_esm/components/Insurance/types.js +0 -2
  214. package/_esm/components/Insurance/types.js.map +0 -1
  215. package/_esm/components/StepActions/StepFeeBreakdown.d.ts +0 -4
  216. package/_esm/components/StepActions/StepFeeBreakdown.js +0 -42
  217. package/_esm/components/StepActions/StepFeeBreakdown.js.map +0 -1
  218. package/_esm/icons/InsuraceLogo.d.ts +0 -2
  219. package/_esm/icons/InsuraceLogo.js +0 -8
  220. package/_esm/icons/InsuraceLogo.js.map +0 -1
  221. package/components/Insurance/Insurance.tsx +0 -22
  222. package/components/Insurance/InsuranceCard.tsx +0 -119
  223. package/components/Insurance/InsuranceCollapsed.tsx +0 -59
  224. package/components/Insurance/types.ts +0 -24
  225. package/components/StepActions/StepFeeBreakdown.tsx +0 -108
  226. package/icons/InsuraceLogo.tsx +0 -46
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Collapse } from '@mui/material';
3
- import { useRoutes } from '../../hooks/useRoutes.js';
4
- import { useRouteExecutionStore } from '../../stores/routes/RouteExecutionStore.js';
5
- import { RouteExecutionStatus } from '../../stores/routes/types.js';
6
- import { useSetExecutableRoute } from '../../stores/routes/useSetExecutableRoute.js';
7
- import { formatTokenAmount } from '../../utils/format.js';
8
- import { InsuranceCard } from './InsuranceCard.js';
9
- export const InsuranceCollapsed = ({ status, insurableRouteId, onChange, ...props }) => {
10
- const setExecutableRoute = useSetExecutableRoute();
11
- const routeExecution = useRouteExecutionStore((state) => state.routes[insurableRouteId]);
12
- const { routes } = useRoutes({
13
- insurableRoute: routeExecution?.route,
14
- });
15
- const insuredRoute = routes?.[0];
16
- const toggleInsurance = (checked) => {
17
- if (insuredRoute) {
18
- if (checked) {
19
- setExecutableRoute(insuredRoute, insurableRouteId);
20
- }
21
- onChange?.(checked ? insuredRoute.id : insurableRouteId);
22
- }
23
- };
24
- if (!insuredRoute) {
25
- return null;
26
- }
27
- return (_jsx(Collapse, { timeout: 225, in: insuredRoute.insurance.state === 'INSURED', unmountOnExit: true, mountOnEnter: true, appear: status === RouteExecutionStatus.Idle, children: _jsx(InsuranceCard, { ...props, status: status, insuredAmount: formatTokenAmount(BigInt(insuredRoute.toAmountMin), insuredRoute.toToken.decimals), insuredTokenSymbol: insuredRoute.toToken.symbol, onChange: toggleInsurance }) }));
28
- };
29
- //# sourceMappingURL=InsuranceCollapsed.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InsuranceCollapsed.js","sourceRoot":"","sources":["../../../components/Insurance/InsuranceCollapsed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,MAAM,kBAAkB,GAA6B,CAAC,EAC3D,MAAM,EACN,gBAAgB,EAChB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,kBAAkB,GAAG,qBAAqB,EAAE,CAAC;IACnD,MAAM,cAAc,GAAG,sBAAsB,CAC3C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAC1C,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QAC3B,cAAc,EAAE,cAAc,EAAE,KAAK;KACtC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAEjC,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE;QAC3C,IAAI,YAAY,EAAE,CAAC;YACjB,IAAI,OAAO,EAAE,CAAC;gBACZ,kBAAkB,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;YACrD,CAAC;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,QAAQ,IACP,OAAO,EAAE,GAAG,EACZ,EAAE,EAAE,YAAY,CAAC,SAAS,CAAC,KAAK,KAAK,SAAS,EAC9C,aAAa,QACb,YAAY,QACZ,MAAM,EAAE,MAAM,KAAK,oBAAoB,CAAC,IAAI,YAE5C,KAAC,aAAa,OACR,KAAK,EACT,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,iBAAiB,CAC9B,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,EAChC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAC9B,EACD,kBAAkB,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,EAC/C,QAAQ,EAAE,eAAe,GACzB,GACO,CACZ,CAAC;AACJ,CAAC,CAAC"}
@@ -1,19 +0,0 @@
1
- import type { CardProps } from '@mui/material';
2
- import type { RouteExecutionStatus } from '../../stores/routes/types.js';
3
- export interface InsuredAmount {
4
- insuredAmount: string;
5
- insuredTokenSymbol: string;
6
- }
7
- interface Insurance extends InsuredAmount {
8
- feeAmountUsd: string;
9
- insuranceCoverageId?: string;
10
- status?: RouteExecutionStatus;
11
- }
12
- export interface InsuranceProps extends Insurance, Omit<CardProps, 'onChange'> {
13
- insurableRouteId: string;
14
- onChange?: (routeId: string) => void;
15
- }
16
- export interface InsuranceCardProps extends Insurance, Omit<CardProps, 'onChange'> {
17
- onChange?: (checked: boolean) => void;
18
- }
19
- export {};
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../components/Insurance/types.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import type { LiFiStepExtended } from '@lifi/sdk';
2
- export declare const StepFeeBreakdown: React.FC<{
3
- step: LiFiStepExtended;
4
- }>;
@@ -1,42 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { MonetizationOn } from '@mui/icons-material';
3
- import { Box, Typography } from '@mui/material';
4
- import { useTranslation } from 'react-i18next';
5
- import { formatUnits } from 'viem';
6
- import { getStepFeeCostsBreakdown } from '../../utils/fees.js';
7
- import { IconTypography } from './StepActions.style.js';
8
- export const StepFeeBreakdown = ({ step }) => {
9
- const { t } = useTranslation();
10
- let fees = 0;
11
- const feeComponents = [];
12
- const isDone = step.execution?.status === 'DONE';
13
- const gasCosts = step.execution?.gasCosts ?? step.estimate.gasCosts;
14
- const feeCosts = step.execution?.feeCosts ?? step.estimate.feeCosts;
15
- if (gasCosts) {
16
- const { token, amount, amountUSD } = getStepFeeCostsBreakdown(gasCosts);
17
- const formattedGasAmount = token
18
- ? parseFloat(formatUnits(amount, token.decimals))?.toFixed(9)
19
- : 0;
20
- fees += amountUSD;
21
- feeComponents.push(_jsxs(Box, { ml: 7, children: [_jsx(Typography, { fontSize: 12, lineHeight: 2, color: "text.secondary", fontWeight: "500", children: isDone
22
- ? t('main.fees.networkPaid')
23
- : t('main.fees.networkEstimated') }), _jsxs(Typography, { fontSize: 12, lineHeight: 1, fontWeight: "500", color: "text.secondary", children: [t(`format.currency`, { value: amountUSD }), " (", formattedGasAmount, ' ', token.symbol, ")"] })] }, "network"));
24
- }
25
- if (feeCosts) {
26
- const filteredfeeCosts = feeCosts?.filter((fee) => !fee.included);
27
- if (filteredfeeCosts?.length) {
28
- const { token, amount, amountUSD } = getStepFeeCostsBreakdown(filteredfeeCosts);
29
- const formattedFeeAmount = token
30
- ? parseFloat(formatUnits(amount, token.decimals))?.toFixed(9)
31
- : 0;
32
- fees += amountUSD;
33
- feeComponents.push(_jsxs(Box, { mt: feeComponents.length ? 0.5 : 0, ml: 7, children: [_jsx(Typography, { fontSize: 12, lineHeight: 2, color: "text.secondary", fontWeight: "500", children: isDone
34
- ? t('main.fees.providerPaid')
35
- : t('main.fees.providerEstimated') }), _jsxs(Typography, { fontSize: 12, lineHeight: 1, fontWeight: "500", color: "text.secondary", children: [t(`format.currency`, { value: amountUSD }), " (", formattedFeeAmount, ' ', token.symbol, ")"] })] }, "bridge"));
36
- }
37
- }
38
- return (_jsxs(Box, { mt: 1.5, children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(IconTypography, { ml: 1, mr: 3, height: 24, children: _jsx(MonetizationOn, {}) }), _jsx(Typography, { fontSize: 16, color: "text.primary", fontWeight: "600", lineHeight: 1.125, children: t(`format.currency`, {
39
- value: fees,
40
- }) })] }), feeComponents] }));
41
- };
42
- //# sourceMappingURL=StepFeeBreakdown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StepFeeBreakdown.js","sourceRoot":"","sources":["../../../components/StepActions/StepFeeBreakdown.tsx"],"names":[],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- import type { SVGProps } from 'react';
2
- export declare const InsuraceLogo: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useTheme } from '@mui/material';
3
- export const InsuraceLogo = (props) => {
4
- const theme = useTheme();
5
- const insurColor = theme.palette.mode === 'light' ? '#1C4332' : theme.palette.common.white;
6
- return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "58", height: "20", fill: "none", ...props, children: [_jsx("path", { fill: insurColor, fillRule: "evenodd", d: "M42.887 3.894a2.104 2.104 0 0 0-1.304.405 1.259 1.259 0 0 0-.544 1.046c0 .683.509 1.15 1.527 1.401.483.12.817.236 1 .345.184.11.276.234.276.373a.36.36 0 0 1-.227.331 1.25 1.25 0 0 1-.568.115c-.66 0-1.292-.25-1.896-.753V8.23c.473.418 1.082.637 1.826.656h.055c.46.01.912-.12 1.297-.37a1.19 1.19 0 0 0 .558-1.053c0-.734-.51-1.229-1.527-1.485a.532.532 0 0 1-.084-.02l-.097-.022a5.483 5.483 0 0 1-.826-.258c-.18-.079-.269-.192-.269-.341a.38.38 0 0 1 .23-.341c.178-.09.374-.133.572-.126.303.006.602.061.886.164a4 4 0 0 1 .906.443V4.41a3.55 3.55 0 0 0-1.791-.516Zm-11.621.056h1.052v4.88h-1.052V3.95Zm5.014 0 1.638 3.876V3.95h1.025v4.88h-1.625l-1.687-4.002V8.83h-1.025V3.95h1.674Zm10.56.007h1.053v2.9c-.007.28.102.55.3.746a.972.972 0 0 0 .711.3.982.982 0 0 0 .715-.3c.2-.196.31-.466.303-.746v-2.9h1.046v2.9c.013.543-.2 1.067-.59 1.447a2.158 2.158 0 0 1-2.941.007 1.934 1.934 0 0 1-.596-1.454v-2.9Zm9.283 1.653a.714.714 0 0 1-.718.71h-1.179V4.891h1.178a.7.7 0 0 1 .51.206.68.68 0 0 1 .209.505v.008ZM53.18 3.95v4.88h1.045V7.226h.823l.969 1.604h1.185l-1.046-1.736c.29-.114.538-.316.708-.578.176-.26.27-.565.268-.879a1.617 1.617 0 0 0-.505-1.185 1.673 1.673 0 0 0-1.224-.502h-2.223Z", clipRule: "evenodd" }), _jsx("path", { fill: "#28DA98", fillRule: "evenodd", d: "M32.366 13.05a1.27 1.27 0 0 0 .37.914c.238.252.57.391.917.383a1.317 1.317 0 0 0 1.296-1.296 1.267 1.267 0 0 0-.383-.913 1.233 1.233 0 0 0-.913-.393 1.216 1.216 0 0 0-.918.388c-.24.245-.373.575-.37.918Zm-.53-1.78a2.274 2.274 0 0 1 1.69-.721c.49-.01.966.166 1.332.493v-.411h1.324v4.838h-1.324v-.401c-.37.318-.845.488-1.333.475a2.252 2.252 0 0 1-1.684-.74 2.45 2.45 0 0 1-.708-1.752 2.471 2.471 0 0 1 .704-1.78v-.001Zm7.093 0c.461-.47 1.095-.73 1.753-.721.5-.006.99.148 1.397.438.408.284.72.685.895 1.15l-1.205.347a1.274 1.274 0 0 0-.434-.543 1.095 1.095 0 0 0-.652-.206 1.174 1.174 0 0 0-.895.393 1.31 1.31 0 0 0-.365.922c-.005.342.127.672.365.918.228.252.554.393.895.388.235.004.466-.068.657-.206a1.3 1.3 0 0 0 .429-.534l1.205.347c-.176.46-.486.858-.89 1.141a2.36 2.36 0 0 1-1.401.439 2.388 2.388 0 0 1-1.767-.736 2.501 2.501 0 0 1 .014-3.537Zm9.495 1.269h-2.346a1.16 1.16 0 0 1 .425-.585c.217-.16.482-.244.753-.237a1.195 1.195 0 0 1 1.168.822Zm.411-1.424a2.477 2.477 0 0 0-3.323.155 2.501 2.501 0 0 0-.013 3.537c.46.48 1.1.747 1.766.735a2.89 2.89 0 0 0 1.351-.342 2.08 2.08 0 0 0 .94-.908l-1.15-.33c-.313.28-.722.428-1.141.412a1.327 1.327 0 0 1-.758-.215 1.043 1.043 0 0 1-.429-.616h3.633c.037-.156.056-.315.055-.475a2.338 2.338 0 0 0-.064-.53 2.467 2.467 0 0 0-.867-1.423Z", clipRule: "evenodd" }), _jsx("path", { fill: "#28DA98", d: "M16.951 10a2.139 2.139 0 0 0-2.139-2.139l1.908-1.907c0 1.18.958 2.139 2.139 2.139L16.95 10ZM12.905 5.954a2.139 2.139 0 0 0-2.14-2.139l1.908-1.907c0 1.18.958 2.138 2.139 2.138l-1.907 1.908Z" }), _jsx("path", { fill: insurColor, d: "M16.951 18.093a2.139 2.139 0 0 0-2.138-2.14l1.907-1.907c0 1.181.958 2.139 2.139 2.139l-1.908 1.908ZM12.905 14.046a2.139 2.139 0 0 0-2.14-2.138L12.674 10c0 1.181.958 2.139 2.139 2.139l-1.907 1.907ZM16.938 2.147c.008-.078.013-.158.013-.24l-.014.24Z" }), _jsx("path", { fill: "#28DA98", d: "M20.207 8.651a1.907 1.907 0 0 0-2.698 0 1.901 1.901 0 0 0-.558 1.35c-.001 1.181-.958 2.138-2.14 2.138h.001c-.488 0-.976.186-1.349.559a1.9 1.9 0 0 0-.558 1.35c-.001 1.18-.957 2.135-2.136 2.137h-.004a2.139 2.139 0 0 1-2.138-2.138c0-.489-.186-.977-.559-1.35a1.901 1.901 0 0 0-1.349-.558 2.139 2.139 0 0 1-2.138-2.137v-.004c0-1.18.957-2.136 2.137-2.137.488 0 .977-.185 1.35-.558.373-.373.559-.861.559-1.35 0-1.18.958-2.138 2.139-2.138a1.907 1.907 0 1 0-1.907-1.907A2.139 2.139 0 0 1 6.72 4.046c-.488 0-.977.186-1.35.56-.372.372-.558.86-.558 1.348a2.139 2.139 0 0 1-2.138 2.139 1.907 1.907 0 1 0 .001 3.815 2.139 2.139 0 0 1 2.137 2.136c0 .489.185.978.559 1.351a1.9 1.9 0 0 0 1.354.559 2.139 2.139 0 0 1 2.133 2.139 1.908 1.908 0 0 0 3.815 0c0-1.182.958-2.14 2.139-2.14.488 0 .976-.185 1.349-.558.374-.374.56-.864.558-1.354a2.139 2.139 0 0 1 2.137-2.133 1.908 1.908 0 0 0 1.35-3.256Z" }), _jsx("path", { fill: insurColor, d: "M28.3 8.651a1.901 1.901 0 0 0-1.348-.558 2.139 2.139 0 0 1-2.139-2.139 1.9 1.9 0 0 0-.559-1.349 1.901 1.901 0 0 0-1.349-.559 2.139 2.139 0 0 1-2.138-2.135 1.907 1.907 0 1 0-3.815-.003c0 .082-.005.164-.014.244v-.005a2.13 2.13 0 0 1-.999 1.579l-.002.001a2.112 2.112 0 0 1-.16.09l-.012.006a2.11 2.11 0 0 1-.163.072l-.018.008c-.055.02-.11.04-.167.056l-.02.006c-.057.016-.115.03-.174.042l-.02.003c-.06.011-.12.02-.182.026l-.013.001c-.064.006-.129.01-.194.01-.06 0-.118.002-.176.008h-.007a1.909 1.909 0 0 0-.526.128l-.01.003a1.92 1.92 0 0 0-.166.077l-.003.002c-.046.024-.09.051-.135.08l-.027.016c-.045.029-.087.061-.13.095-.008.006-.017.011-.025.018a1.912 1.912 0 0 0-.39.43l-.046.08c-.016.027-.034.054-.05.083-.011.023-.02.047-.032.07-.015.033-.032.066-.046.1-.01.025-.018.053-.028.08-.01.03-.023.062-.033.094-.01.036-.018.073-.027.11-.005.023-.012.046-.016.068a1.9 1.9 0 0 0-.02.137l-.007.045a1.935 1.935 0 0 0-.007.154l-.001.029a2.139 2.139 0 0 1-2.138 2.139A1.907 1.907 0 1 0 12.675 10c0-1.18.956-2.138 2.136-2.139.243 0 .485-.045.713-.137l.006-.002c.052-.02.102-.045.152-.07l.018-.009c.045-.023.089-.05.132-.078l.03-.018c.042-.027.083-.058.123-.09l.032-.023a1.953 1.953 0 0 0 .276-.277c.01-.01.017-.023.026-.034.03-.04.06-.08.088-.12l.017-.03c.028-.044.055-.088.079-.133l.009-.02c.025-.049.049-.1.07-.15l.003-.01c.09-.227.136-.468.136-.71l.013-.236a2.139 2.139 0 0 1 4.264.237c0 .49.186.978.559 1.352.373.373.862.559 1.35.558a2.139 2.139 0 0 1-.001 4.278c-.488 0-.977.186-1.35.559-.372.373-.558.862-.558 1.35a2.139 2.139 0 0 1-2.136 2.137 1.908 1.908 0 0 0-1.352 3.256 1.908 1.908 0 0 0 3.257-1.349c0-1.18.958-2.138 2.139-2.138.488 0 .976-.186 1.349-.559.372-.372.558-.86.558-1.35 0-1.18.957-2.136 2.137-2.137a1.907 1.907 0 0 0 1.35-3.256Z" })] }));
7
- };
8
- //# sourceMappingURL=InsuraceLogo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InsuraceLogo.js","sourceRoot":"","sources":["../../icons/InsuraceLogo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAA8B,EAAE,EAAE;IAC7D,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,UAAU,GACd,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IAC1E,OAAO,CACL,eACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,IAAI,EAAC,MAAM,KACP,KAAK,aAET,eACE,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,opCAAopC,EACtpC,QAAQ,EAAC,SAAS,GAClB,EACF,eACE,IAAI,EAAC,SAAS,EACd,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,2vCAA2vC,EAC7vC,QAAQ,EAAC,SAAS,GAClB,EACF,eACE,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,8LAA8L,GAChM,EACF,eACE,IAAI,EAAE,UAAU,EAChB,CAAC,EAAC,wPAAwP,GAC1P,EACF,eACE,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,g3BAAg3B,GACl3B,EACF,eACE,IAAI,EAAE,UAAU,EAChB,CAAC,EAAC,4sDAA4sD,GAC9sD,IACE,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,22 +0,0 @@
1
- import { RouteExecutionStatus } from '../../stores/routes/types.js';
2
- import { InsuranceCard } from './InsuranceCard.js';
3
- import { InsuranceCollapsed } from './InsuranceCollapsed.js';
4
- import type { InsuranceProps } from './types.js';
5
-
6
- export const Insurance: React.FC<InsuranceProps> = ({
7
- status,
8
- insurableRouteId,
9
- onChange,
10
- ...props
11
- }) => {
12
- return status === RouteExecutionStatus.Idle ? (
13
- <InsuranceCollapsed
14
- status={status}
15
- insurableRouteId={insurableRouteId}
16
- onChange={onChange}
17
- {...props}
18
- />
19
- ) : (
20
- <InsuranceCard status={status} {...props} />
21
- );
22
- };
@@ -1,119 +0,0 @@
1
- import { VerifiedUser } from '@mui/icons-material';
2
- import { Box, Collapse, Link, Typography } from '@mui/material';
3
- import type { ChangeEvent } from 'react';
4
- import { useState } from 'react';
5
- import { Trans, useTranslation } from 'react-i18next';
6
- import { InsuraceLogo } from '../../icons/InsuraceLogo.js';
7
- import { RouteExecutionStatus } from '../../stores/routes/types.js';
8
- import { Card } from '../Card/Card.js';
9
- import { CardLabel, CardLabelTypography } from '../Card/CardLabel.js';
10
- import { Switch } from '../Switch.js';
11
- import type { InsuranceCardProps } from './types.js';
12
-
13
- export const InsuranceCard: React.FC<InsuranceCardProps> = ({
14
- status,
15
- feeAmountUsd,
16
- insuredAmount,
17
- insuredTokenSymbol,
18
- insuranceCoverageId,
19
- onChange,
20
- ...props
21
- }) => {
22
- const { t } = useTranslation();
23
- const [enabled, setEnabled] = useState(false);
24
-
25
- const handleSwitch = (_: ChangeEvent<HTMLInputElement>, checked: boolean) => {
26
- setEnabled(checked);
27
- onChange?.(checked);
28
- };
29
-
30
- return (
31
- <Card selectionColor="secondary" indented {...props}>
32
- <Box display="flex" alignItems="center" justifyContent="space-between">
33
- <CardLabel type={'insurance'}>
34
- <VerifiedUser fontSize="inherit" />
35
- <CardLabelTypography type="icon">
36
- {status === RouteExecutionStatus.Idle
37
- ? t('main.tags.insurance')
38
- : t('main.tags.insured')}
39
- </CardLabelTypography>
40
- </CardLabel>
41
- <Switch onChange={handleSwitch} value={enabled} />
42
- </Box>
43
- <Collapse timeout={225} in={enabled} mountOnEnter unmountOnExit>
44
- <Box mt={2}>
45
- <Box
46
- display="flex"
47
- alignItems="center"
48
- justifyContent="space-between"
49
- mb={2}
50
- >
51
- <Typography fontSize={24} fontWeight={700} lineHeight={1}>
52
- {t('format.currency', {
53
- value: feeAmountUsd,
54
- })}
55
- </Typography>
56
- <InsuraceLogo />
57
- </Box>
58
- <Box>
59
- <Typography fontSize={14}>
60
- <Trans
61
- i18nKey={
62
- status === RouteExecutionStatus.Idle
63
- ? 'insurance.insure'
64
- : 'insurance.insured'
65
- }
66
- values={{
67
- amount: insuredAmount,
68
- tokenSymbol: insuredTokenSymbol,
69
- }}
70
- components={[<strong />]}
71
- />
72
- </Typography>
73
- <Collapse
74
- timeout={225}
75
- in={enabled || status !== RouteExecutionStatus.Idle}
76
- mountOnEnter
77
- unmountOnExit
78
- >
79
- <Box
80
- sx={{
81
- listStyleType: 'disc',
82
- pl: 2,
83
- }}
84
- >
85
- <Typography fontSize={14} display="list-item">
86
- {t('insurance.bridgeExploits')}
87
- </Typography>
88
- <Typography fontSize={14} display="list-item">
89
- {t('insurance.slippageError')}
90
- </Typography>
91
- </Box>
92
- </Collapse>
93
- <Link
94
- href={
95
- status === RouteExecutionStatus.Idle
96
- ? 'https://docs.insurace.io/landing-page/documentation/cover-products/bridge-cover/li.fi'
97
- : `https://app.insurace.io/bridge-cover?search=${insuranceCoverageId}`
98
- }
99
- target="_blank"
100
- underline="none"
101
- color="text.primary"
102
- >
103
- <Typography
104
- pt={0.5}
105
- color="primary"
106
- fontSize={14}
107
- fontWeight={600}
108
- >
109
- {status === RouteExecutionStatus.Idle
110
- ? t('button.learnMore')
111
- : t('button.viewCoverage')}
112
- </Typography>
113
- </Link>
114
- </Box>
115
- </Box>
116
- </Collapse>
117
- </Card>
118
- );
119
- };
@@ -1,59 +0,0 @@
1
- import { Collapse } from '@mui/material';
2
- import { useRoutes } from '../../hooks/useRoutes.js';
3
- import { useRouteExecutionStore } from '../../stores/routes/RouteExecutionStore.js';
4
- import { RouteExecutionStatus } from '../../stores/routes/types.js';
5
- import { useSetExecutableRoute } from '../../stores/routes/useSetExecutableRoute.js';
6
- import { formatTokenAmount } from '../../utils/format.js';
7
- import { InsuranceCard } from './InsuranceCard.js';
8
- import type { InsuranceProps } from './types.js';
9
-
10
- export const InsuranceCollapsed: React.FC<InsuranceProps> = ({
11
- status,
12
- insurableRouteId,
13
- onChange,
14
- ...props
15
- }) => {
16
- const setExecutableRoute = useSetExecutableRoute();
17
- const routeExecution = useRouteExecutionStore(
18
- (state) => state.routes[insurableRouteId],
19
- );
20
- const { routes } = useRoutes({
21
- insurableRoute: routeExecution?.route,
22
- });
23
-
24
- const insuredRoute = routes?.[0];
25
-
26
- const toggleInsurance = (checked: boolean) => {
27
- if (insuredRoute) {
28
- if (checked) {
29
- setExecutableRoute(insuredRoute, insurableRouteId);
30
- }
31
- onChange?.(checked ? insuredRoute.id : insurableRouteId);
32
- }
33
- };
34
-
35
- if (!insuredRoute) {
36
- return null;
37
- }
38
-
39
- return (
40
- <Collapse
41
- timeout={225}
42
- in={insuredRoute.insurance.state === 'INSURED'}
43
- unmountOnExit
44
- mountOnEnter
45
- appear={status === RouteExecutionStatus.Idle}
46
- >
47
- <InsuranceCard
48
- {...props}
49
- status={status}
50
- insuredAmount={formatTokenAmount(
51
- BigInt(insuredRoute.toAmountMin),
52
- insuredRoute.toToken.decimals,
53
- )}
54
- insuredTokenSymbol={insuredRoute.toToken.symbol}
55
- onChange={toggleInsurance}
56
- />
57
- </Collapse>
58
- );
59
- };
@@ -1,24 +0,0 @@
1
- import type { CardProps } from '@mui/material';
2
- import type { RouteExecutionStatus } from '../../stores/routes/types.js';
3
-
4
- export interface InsuredAmount {
5
- insuredAmount: string;
6
- insuredTokenSymbol: string;
7
- }
8
-
9
- interface Insurance extends InsuredAmount {
10
- feeAmountUsd: string;
11
- insuranceCoverageId?: string;
12
- status?: RouteExecutionStatus;
13
- }
14
-
15
- export interface InsuranceProps extends Insurance, Omit<CardProps, 'onChange'> {
16
- insurableRouteId: string;
17
- onChange?: (routeId: string) => void;
18
- }
19
-
20
- export interface InsuranceCardProps
21
- extends Insurance,
22
- Omit<CardProps, 'onChange'> {
23
- onChange?: (checked: boolean) => void;
24
- }
@@ -1,108 +0,0 @@
1
- import type { LiFiStepExtended } from '@lifi/sdk';
2
- import { MonetizationOn } from '@mui/icons-material';
3
- import { Box, Typography } from '@mui/material';
4
- import type { ReactNode } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
- import { formatUnits } from 'viem';
7
- import { getStepFeeCostsBreakdown } from '../../utils/fees.js';
8
- import { IconTypography } from './StepActions.style.js';
9
-
10
- export const StepFeeBreakdown: React.FC<{
11
- step: LiFiStepExtended;
12
- }> = ({ step }) => {
13
- const { t } = useTranslation();
14
-
15
- let fees = 0;
16
- const feeComponents: ReactNode[] = [];
17
- const isDone = step.execution?.status === 'DONE';
18
-
19
- const gasCosts = step.execution?.gasCosts ?? step.estimate.gasCosts;
20
- const feeCosts = step.execution?.feeCosts ?? step.estimate.feeCosts;
21
-
22
- if (gasCosts) {
23
- const { token, amount, amountUSD } = getStepFeeCostsBreakdown(gasCosts);
24
- const formattedGasAmount = token
25
- ? parseFloat(formatUnits(amount, token.decimals))?.toFixed(9)
26
- : 0;
27
- fees += amountUSD;
28
- feeComponents.push(
29
- <Box ml={7} key="network">
30
- <Typography
31
- fontSize={12}
32
- lineHeight={2}
33
- color="text.secondary"
34
- fontWeight="500"
35
- >
36
- {isDone
37
- ? t('main.fees.networkPaid')
38
- : t('main.fees.networkEstimated')}
39
- </Typography>
40
- <Typography
41
- fontSize={12}
42
- lineHeight={1}
43
- fontWeight="500"
44
- color="text.secondary"
45
- >
46
- {t(`format.currency`, { value: amountUSD })} ({formattedGasAmount}{' '}
47
- {token.symbol})
48
- </Typography>
49
- </Box>,
50
- );
51
- }
52
-
53
- if (feeCosts) {
54
- const filteredfeeCosts = feeCosts?.filter((fee) => !fee.included);
55
- if (filteredfeeCosts?.length) {
56
- const { token, amount, amountUSD } =
57
- getStepFeeCostsBreakdown(filteredfeeCosts);
58
- const formattedFeeAmount = token
59
- ? parseFloat(formatUnits(amount, token.decimals))?.toFixed(9)
60
- : 0;
61
- fees += amountUSD;
62
- feeComponents.push(
63
- <Box mt={feeComponents.length ? 0.5 : 0} ml={7} key="bridge">
64
- <Typography
65
- fontSize={12}
66
- lineHeight={2}
67
- color="text.secondary"
68
- fontWeight="500"
69
- >
70
- {isDone
71
- ? t('main.fees.providerPaid')
72
- : t('main.fees.providerEstimated')}
73
- </Typography>
74
- <Typography
75
- fontSize={12}
76
- lineHeight={1}
77
- fontWeight="500"
78
- color="text.secondary"
79
- >
80
- {t(`format.currency`, { value: amountUSD })} ({formattedFeeAmount}{' '}
81
- {token.symbol})
82
- </Typography>
83
- </Box>,
84
- );
85
- }
86
- }
87
-
88
- return (
89
- <Box mt={1.5}>
90
- <Box display="flex" alignItems="center">
91
- <IconTypography ml={1} mr={3} height={24}>
92
- <MonetizationOn />
93
- </IconTypography>
94
- <Typography
95
- fontSize={16}
96
- color="text.primary"
97
- fontWeight="600"
98
- lineHeight={1.125}
99
- >
100
- {t(`format.currency`, {
101
- value: fees,
102
- })}
103
- </Typography>
104
- </Box>
105
- {feeComponents}
106
- </Box>
107
- );
108
- };
@@ -1,46 +0,0 @@
1
- import { useTheme } from '@mui/material';
2
- import type { SVGProps } from 'react';
3
-
4
- export const InsuraceLogo = (props: SVGProps<SVGSVGElement>) => {
5
- const theme = useTheme();
6
- const insurColor =
7
- theme.palette.mode === 'light' ? '#1C4332' : theme.palette.common.white;
8
- return (
9
- <svg
10
- xmlns="http://www.w3.org/2000/svg"
11
- width="58"
12
- height="20"
13
- fill="none"
14
- {...props}
15
- >
16
- <path
17
- fill={insurColor}
18
- fillRule="evenodd"
19
- d="M42.887 3.894a2.104 2.104 0 0 0-1.304.405 1.259 1.259 0 0 0-.544 1.046c0 .683.509 1.15 1.527 1.401.483.12.817.236 1 .345.184.11.276.234.276.373a.36.36 0 0 1-.227.331 1.25 1.25 0 0 1-.568.115c-.66 0-1.292-.25-1.896-.753V8.23c.473.418 1.082.637 1.826.656h.055c.46.01.912-.12 1.297-.37a1.19 1.19 0 0 0 .558-1.053c0-.734-.51-1.229-1.527-1.485a.532.532 0 0 1-.084-.02l-.097-.022a5.483 5.483 0 0 1-.826-.258c-.18-.079-.269-.192-.269-.341a.38.38 0 0 1 .23-.341c.178-.09.374-.133.572-.126.303.006.602.061.886.164a4 4 0 0 1 .906.443V4.41a3.55 3.55 0 0 0-1.791-.516Zm-11.621.056h1.052v4.88h-1.052V3.95Zm5.014 0 1.638 3.876V3.95h1.025v4.88h-1.625l-1.687-4.002V8.83h-1.025V3.95h1.674Zm10.56.007h1.053v2.9c-.007.28.102.55.3.746a.972.972 0 0 0 .711.3.982.982 0 0 0 .715-.3c.2-.196.31-.466.303-.746v-2.9h1.046v2.9c.013.543-.2 1.067-.59 1.447a2.158 2.158 0 0 1-2.941.007 1.934 1.934 0 0 1-.596-1.454v-2.9Zm9.283 1.653a.714.714 0 0 1-.718.71h-1.179V4.891h1.178a.7.7 0 0 1 .51.206.68.68 0 0 1 .209.505v.008ZM53.18 3.95v4.88h1.045V7.226h.823l.969 1.604h1.185l-1.046-1.736c.29-.114.538-.316.708-.578.176-.26.27-.565.268-.879a1.617 1.617 0 0 0-.505-1.185 1.673 1.673 0 0 0-1.224-.502h-2.223Z"
20
- clipRule="evenodd"
21
- />
22
- <path
23
- fill="#28DA98"
24
- fillRule="evenodd"
25
- d="M32.366 13.05a1.27 1.27 0 0 0 .37.914c.238.252.57.391.917.383a1.317 1.317 0 0 0 1.296-1.296 1.267 1.267 0 0 0-.383-.913 1.233 1.233 0 0 0-.913-.393 1.216 1.216 0 0 0-.918.388c-.24.245-.373.575-.37.918Zm-.53-1.78a2.274 2.274 0 0 1 1.69-.721c.49-.01.966.166 1.332.493v-.411h1.324v4.838h-1.324v-.401c-.37.318-.845.488-1.333.475a2.252 2.252 0 0 1-1.684-.74 2.45 2.45 0 0 1-.708-1.752 2.471 2.471 0 0 1 .704-1.78v-.001Zm7.093 0c.461-.47 1.095-.73 1.753-.721.5-.006.99.148 1.397.438.408.284.72.685.895 1.15l-1.205.347a1.274 1.274 0 0 0-.434-.543 1.095 1.095 0 0 0-.652-.206 1.174 1.174 0 0 0-.895.393 1.31 1.31 0 0 0-.365.922c-.005.342.127.672.365.918.228.252.554.393.895.388.235.004.466-.068.657-.206a1.3 1.3 0 0 0 .429-.534l1.205.347c-.176.46-.486.858-.89 1.141a2.36 2.36 0 0 1-1.401.439 2.388 2.388 0 0 1-1.767-.736 2.501 2.501 0 0 1 .014-3.537Zm9.495 1.269h-2.346a1.16 1.16 0 0 1 .425-.585c.217-.16.482-.244.753-.237a1.195 1.195 0 0 1 1.168.822Zm.411-1.424a2.477 2.477 0 0 0-3.323.155 2.501 2.501 0 0 0-.013 3.537c.46.48 1.1.747 1.766.735a2.89 2.89 0 0 0 1.351-.342 2.08 2.08 0 0 0 .94-.908l-1.15-.33c-.313.28-.722.428-1.141.412a1.327 1.327 0 0 1-.758-.215 1.043 1.043 0 0 1-.429-.616h3.633c.037-.156.056-.315.055-.475a2.338 2.338 0 0 0-.064-.53 2.467 2.467 0 0 0-.867-1.423Z"
26
- clipRule="evenodd"
27
- />
28
- <path
29
- fill="#28DA98"
30
- d="M16.951 10a2.139 2.139 0 0 0-2.139-2.139l1.908-1.907c0 1.18.958 2.139 2.139 2.139L16.95 10ZM12.905 5.954a2.139 2.139 0 0 0-2.14-2.139l1.908-1.907c0 1.18.958 2.138 2.139 2.138l-1.907 1.908Z"
31
- />
32
- <path
33
- fill={insurColor}
34
- d="M16.951 18.093a2.139 2.139 0 0 0-2.138-2.14l1.907-1.907c0 1.181.958 2.139 2.139 2.139l-1.908 1.908ZM12.905 14.046a2.139 2.139 0 0 0-2.14-2.138L12.674 10c0 1.181.958 2.139 2.139 2.139l-1.907 1.907ZM16.938 2.147c.008-.078.013-.158.013-.24l-.014.24Z"
35
- />
36
- <path
37
- fill="#28DA98"
38
- d="M20.207 8.651a1.907 1.907 0 0 0-2.698 0 1.901 1.901 0 0 0-.558 1.35c-.001 1.181-.958 2.138-2.14 2.138h.001c-.488 0-.976.186-1.349.559a1.9 1.9 0 0 0-.558 1.35c-.001 1.18-.957 2.135-2.136 2.137h-.004a2.139 2.139 0 0 1-2.138-2.138c0-.489-.186-.977-.559-1.35a1.901 1.901 0 0 0-1.349-.558 2.139 2.139 0 0 1-2.138-2.137v-.004c0-1.18.957-2.136 2.137-2.137.488 0 .977-.185 1.35-.558.373-.373.559-.861.559-1.35 0-1.18.958-2.138 2.139-2.138a1.907 1.907 0 1 0-1.907-1.907A2.139 2.139 0 0 1 6.72 4.046c-.488 0-.977.186-1.35.56-.372.372-.558.86-.558 1.348a2.139 2.139 0 0 1-2.138 2.139 1.907 1.907 0 1 0 .001 3.815 2.139 2.139 0 0 1 2.137 2.136c0 .489.185.978.559 1.351a1.9 1.9 0 0 0 1.354.559 2.139 2.139 0 0 1 2.133 2.139 1.908 1.908 0 0 0 3.815 0c0-1.182.958-2.14 2.139-2.14.488 0 .976-.185 1.349-.558.374-.374.56-.864.558-1.354a2.139 2.139 0 0 1 2.137-2.133 1.908 1.908 0 0 0 1.35-3.256Z"
39
- />
40
- <path
41
- fill={insurColor}
42
- d="M28.3 8.651a1.901 1.901 0 0 0-1.348-.558 2.139 2.139 0 0 1-2.139-2.139 1.9 1.9 0 0 0-.559-1.349 1.901 1.901 0 0 0-1.349-.559 2.139 2.139 0 0 1-2.138-2.135 1.907 1.907 0 1 0-3.815-.003c0 .082-.005.164-.014.244v-.005a2.13 2.13 0 0 1-.999 1.579l-.002.001a2.112 2.112 0 0 1-.16.09l-.012.006a2.11 2.11 0 0 1-.163.072l-.018.008c-.055.02-.11.04-.167.056l-.02.006c-.057.016-.115.03-.174.042l-.02.003c-.06.011-.12.02-.182.026l-.013.001c-.064.006-.129.01-.194.01-.06 0-.118.002-.176.008h-.007a1.909 1.909 0 0 0-.526.128l-.01.003a1.92 1.92 0 0 0-.166.077l-.003.002c-.046.024-.09.051-.135.08l-.027.016c-.045.029-.087.061-.13.095-.008.006-.017.011-.025.018a1.912 1.912 0 0 0-.39.43l-.046.08c-.016.027-.034.054-.05.083-.011.023-.02.047-.032.07-.015.033-.032.066-.046.1-.01.025-.018.053-.028.08-.01.03-.023.062-.033.094-.01.036-.018.073-.027.11-.005.023-.012.046-.016.068a1.9 1.9 0 0 0-.02.137l-.007.045a1.935 1.935 0 0 0-.007.154l-.001.029a2.139 2.139 0 0 1-2.138 2.139A1.907 1.907 0 1 0 12.675 10c0-1.18.956-2.138 2.136-2.139.243 0 .485-.045.713-.137l.006-.002c.052-.02.102-.045.152-.07l.018-.009c.045-.023.089-.05.132-.078l.03-.018c.042-.027.083-.058.123-.09l.032-.023a1.953 1.953 0 0 0 .276-.277c.01-.01.017-.023.026-.034.03-.04.06-.08.088-.12l.017-.03c.028-.044.055-.088.079-.133l.009-.02c.025-.049.049-.1.07-.15l.003-.01c.09-.227.136-.468.136-.71l.013-.236a2.139 2.139 0 0 1 4.264.237c0 .49.186.978.559 1.352.373.373.862.559 1.35.558a2.139 2.139 0 0 1-.001 4.278c-.488 0-.977.186-1.35.559-.372.373-.558.862-.558 1.35a2.139 2.139 0 0 1-2.136 2.137 1.908 1.908 0 0 0-1.352 3.256 1.908 1.908 0 0 0 3.257-1.349c0-1.18.958-2.138 2.139-2.138.488 0 .976-.186 1.349-.559.372-.372.558-.86.558-1.35 0-1.18.957-2.136 2.137-2.137a1.907 1.907 0 0 0 1.35-3.256Z"
43
- />
44
- </svg>
45
- );
46
- };