@lifi/widget 1.10.4 → 1.11.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 (190) hide show
  1. package/App.js +5 -9
  2. package/AppDrawer.js +1 -1
  3. package/AppDrawer.style.d.ts +1 -1
  4. package/AppDrawer.style.js +0 -1
  5. package/AppProvider.d.ts +1 -0
  6. package/AppProvider.js +5 -2
  7. package/components/AppContainer.d.ts +10 -0
  8. package/components/AppContainer.js +3 -6
  9. package/components/Card/Card.d.ts +11 -5
  10. package/components/Card/Card.js +29 -5
  11. package/components/Card/index.d.ts +0 -1
  12. package/components/Card/index.js +0 -1
  13. package/components/Dialog.d.ts +3 -0
  14. package/components/Dialog.js +23 -0
  15. package/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +6 -0
  16. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +48 -0
  17. package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.d.ts → GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts} +0 -0
  18. package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.js → GasSufficiencyMessage/GasSufficiencyMessage.style.js} +1 -0
  19. package/components/GasSufficiencyMessage/index.d.ts +1 -0
  20. package/components/GasSufficiencyMessage/index.js +1 -0
  21. package/components/Header/Header.js +1 -1
  22. package/components/Header/Header.style.js +2 -1
  23. package/components/Header/NavigationHeader.js +15 -11
  24. package/components/Header/WalletHeader.js +1 -1
  25. package/components/Header/index.d.ts +1 -0
  26. package/components/Header/index.js +1 -0
  27. package/components/Header/types.d.ts +9 -0
  28. package/components/Header/types.js +1 -0
  29. package/components/Header/useHeaderActionStore.d.ts +6 -0
  30. package/components/Header/useHeaderActionStore.js +21 -0
  31. package/components/PoweredBy/PoweredBy.js +0 -1
  32. package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +14 -2
  33. package/components/ReverseTokensButton/ReverseTokensButton.js +5 -7
  34. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  35. package/components/ReverseTokensButton/ReverseTokensButton.style.js +4 -2
  36. package/components/SelectTokenButton/SelectTokenButton.js +5 -5
  37. package/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -10
  38. package/components/SelectTokenButton/SelectTokenButton.style.js +0 -7
  39. package/components/SmallAvatar.d.ts +16 -0
  40. package/components/SmallAvatar.js +8 -0
  41. package/{pages/SwapPage → components/Step}/CircularProgress.d.ts +0 -0
  42. package/{pages/SwapPage → components/Step}/CircularProgress.js +0 -0
  43. package/{pages/SwapPage → components/Step}/CircularProgress.style.d.ts +0 -0
  44. package/{pages/SwapPage → components/Step}/CircularProgress.style.js +0 -0
  45. package/components/Step/Step.d.ts +7 -0
  46. package/{pages/SwapPage/StepItem.js → components/Step/Step.js} +6 -6
  47. package/{pages/SwapPage/ExecutionItem.d.ts → components/Step/StepProcess.d.ts} +1 -1
  48. package/{pages/SwapPage/ExecutionItem.js → components/Step/StepProcess.js} +2 -2
  49. package/{pages/SwapPage/ExecutionItem.style.d.ts → components/Step/StepProcess.style.d.ts} +1 -1
  50. package/{pages/SwapPage/ExecutionItem.style.js → components/Step/StepProcess.style.js} +0 -0
  51. package/{pages/SwapPage → components/Step}/StepTimer.d.ts +0 -0
  52. package/{pages/SwapPage → components/Step}/StepTimer.js +0 -0
  53. package/components/Step/index.d.ts +1 -0
  54. package/components/Step/index.js +1 -0
  55. package/components/Step/utils.d.ts +6 -0
  56. package/components/Step/utils.js +89 -0
  57. package/components/StepActions/StepActions.js +14 -5
  58. package/components/StepActions/StepActions.style.js +2 -2
  59. package/{pages/SwapPage → components/StepDivider}/StepDivider.d.ts +0 -0
  60. package/{pages/SwapPage → components/StepDivider}/StepDivider.js +0 -0
  61. package/{pages/SwapPage → components/StepDivider}/StepDivider.style.d.ts +0 -0
  62. package/{pages/SwapPage → components/StepDivider}/StepDivider.style.js +0 -0
  63. package/components/StepDivider/index.d.ts +1 -0
  64. package/components/StepDivider/index.js +1 -0
  65. package/components/SwapButton/SwapButton.js +7 -10
  66. package/components/SwapButton/SwapButton.style.d.ts +1 -1
  67. package/components/SwapButton/SwapButton.style.js +0 -4
  68. package/components/SwapButton/types.d.ts +2 -0
  69. package/components/SwapInProgress/SwapInProgress.js +7 -4
  70. package/components/SwapInProgress/SwapInProgress.style.d.ts +9 -21
  71. package/components/SwapInProgress/SwapInProgress.style.js +5 -6
  72. package/components/SwapInput/SwapInput.js +3 -3
  73. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  74. package/components/SwapInput/SwapInputAdornment.style.js +0 -2
  75. package/components/SwapRouteCard/SwapRouteCard.js +15 -15
  76. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +0 -20
  77. package/components/SwapRouteCard/SwapRouteCard.style.js +7 -54
  78. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +6 -10
  79. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +3 -3
  80. package/components/SwapRouteCard/types.d.ts +0 -3
  81. package/components/{StepToken.d.ts → Token/Token.d.ts} +2 -1
  82. package/components/Token/Token.js +31 -0
  83. package/components/Token/Token.style.d.ts +24 -0
  84. package/components/Token/Token.style.js +31 -0
  85. package/components/Token/index.d.ts +2 -0
  86. package/components/Token/index.js +2 -0
  87. package/components/TokenAvatar/TokenAvatar.d.ts +7 -0
  88. package/components/TokenAvatar/TokenAvatar.js +8 -0
  89. package/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
  90. package/components/TokenAvatar/TokenAvatar.style.js +16 -0
  91. package/components/TokenAvatar/index.d.ts +2 -0
  92. package/components/TokenAvatar/index.js +2 -0
  93. package/components/TokenList/TokenList.js +2 -2
  94. package/components/TokenList/TokenListItem.d.ts +1 -0
  95. package/components/TokenList/TokenListItem.js +12 -6
  96. package/components/TokenList/types.d.ts +1 -0
  97. package/config/queryClient.d.ts +1 -1
  98. package/config/queryClient.js +1 -1
  99. package/config/theme.js +14 -1
  100. package/config/version.d.ts +1 -1
  101. package/config/version.js +1 -1
  102. package/hooks/index.d.ts +1 -1
  103. package/hooks/index.js +1 -1
  104. package/hooks/useChains.d.ts +8 -8
  105. package/hooks/useChains.js +1 -1
  106. package/hooks/useGasSufficiency.d.ts +15 -0
  107. package/hooks/useGasSufficiency.js +91 -0
  108. package/hooks/useRouteExecution.d.ts +3 -3
  109. package/hooks/useRouteExecution.js +22 -18
  110. package/hooks/useSwapRoutes.d.ts +1 -1
  111. package/hooks/useSwapRoutes.js +2 -14
  112. package/hooks/useTokenBalance.js +1 -1
  113. package/hooks/useTokenBalances.d.ts +2 -2
  114. package/hooks/useTokenBalances.js +7 -9
  115. package/hooks/useTokens.js +1 -1
  116. package/hooks/useTools.d.ts +10 -1
  117. package/hooks/useTools.js +13 -3
  118. package/i18n/en/translation.json +18 -9
  119. package/i18n/index.d.ts +12 -3
  120. package/icons/LiFiToolLogo.svg +6 -0
  121. package/package.json +8 -8
  122. package/pages/MainPage/MainPage.js +2 -3
  123. package/pages/MainPage/MainSwapButton.js +4 -5
  124. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.d.ts +0 -0
  125. package/pages/MainPage/SwapRoutes.js +36 -0
  126. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.d.ts +0 -0
  127. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.js +4 -0
  128. package/pages/SelectTokenPage/ChainSelect.js +2 -2
  129. package/pages/SelectTokenPage/SearchTokenInput.js +2 -2
  130. package/pages/SelectWalletPage/SelectWalletPage.js +4 -23
  131. package/pages/SettingsPage/AdvancedPreferences.js +1 -1
  132. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  133. package/pages/SettingsPage/EnabledBridgesSelect.js +7 -4
  134. package/pages/SettingsPage/EnabledExchangesSelect.js +7 -4
  135. package/pages/SettingsPage/GasPriceSelect.js +2 -2
  136. package/pages/SettingsPage/RoutePrioritySelect.js +2 -2
  137. package/pages/SettingsPage/SlippageInput.js +2 -2
  138. package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
  139. package/pages/SwapDetailsPage/SwapDetailsPage.js +63 -0
  140. package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
  141. package/pages/SwapDetailsPage/SwapDetailsPage.style.js +5 -0
  142. package/pages/SwapDetailsPage/index.d.ts +1 -0
  143. package/pages/SwapDetailsPage/index.js +1 -0
  144. package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
  145. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +14 -0
  146. package/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
  147. package/pages/SwapHistoryPage/SwapHistoryItem.js +23 -0
  148. package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
  149. package/pages/SwapHistoryPage/SwapHistoryPage.js +14 -0
  150. package/pages/SwapHistoryPage/index.d.ts +1 -0
  151. package/pages/SwapHistoryPage/index.js +1 -0
  152. package/pages/SwapPage/StatusBottomSheet.js +3 -4
  153. package/pages/SwapPage/SwapPage.js +9 -9
  154. package/pages/SwapPage/SwapPage.style.d.ts +0 -33
  155. package/pages/SwapPage/SwapPage.style.js +2 -9
  156. package/pages/SwapRoutesPage/SwapRoutesPage.js +9 -5
  157. package/pages/SwapRoutesPage/SwapRoutesPage.style.js +1 -1
  158. package/providers/WalletProvider/WalletProvider.js +7 -26
  159. package/providers/WalletProvider/types.d.ts +0 -1
  160. package/providers/WidgetProvider/WidgetProvider.js +1 -1
  161. package/stores/route/index.d.ts +1 -1
  162. package/stores/route/index.js +1 -1
  163. package/stores/route/types.d.ts +2 -4
  164. package/stores/route/useExecutingRoutes.d.ts +2 -1
  165. package/stores/route/useExecutingRoutes.js +4 -2
  166. package/stores/route/useRouteStore.d.ts +4 -1
  167. package/stores/route/useRouteStore.js +23 -24
  168. package/stores/route/useSwapHistory.d.ts +2 -0
  169. package/stores/route/useSwapHistory.js +11 -0
  170. package/stores/settings/useSettingsStore.d.ts +13 -0
  171. package/types/widget.d.ts +3 -4
  172. package/utils/navigationRoutes.d.ts +2 -0
  173. package/utils/navigationRoutes.js +8 -6
  174. package/components/Card/CardContainer.d.ts +0 -11
  175. package/components/Card/CardContainer.js +0 -16
  176. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.d.ts +0 -3
  177. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.js +0 -31
  178. package/components/InsufficientGasOrFundsMessage/index.d.ts +0 -1
  179. package/components/InsufficientGasOrFundsMessage/index.js +0 -1
  180. package/components/StepToken.js +0 -21
  181. package/components/SwapRoutes/SwapRoutes.js +0 -32
  182. package/components/SwapRoutes/SwapRoutesUpdateProgress.d.ts +0 -3
  183. package/components/SwapRoutes/SwapRoutesUpdateProgress.js +0 -24
  184. package/components/SwapRoutes/index.d.ts +0 -1
  185. package/components/SwapRoutes/index.js +0 -1
  186. package/hooks/useHasSufficientBalance.d.ts +0 -5
  187. package/hooks/useHasSufficientBalance.js +0 -72
  188. package/pages/SwapPage/StepItem.d.ts +0 -7
  189. package/stores/route/useCurrentRoute.d.ts +0 -2
  190. package/stores/route/useCurrentRoute.js +0 -5
@@ -18,9 +18,9 @@ export declare const useChains: () => {
18
18
  isPreviousData: boolean;
19
19
  isRefetching: boolean;
20
20
  isStale: boolean;
21
- refetch: <TPageData>(options?: (import("react-query").RefetchOptions & import("react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("react-query").QueryObserverResult<import("@lifi/types").EVMChain[], unknown>>;
21
+ refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@lifi/types").EVMChain[], unknown>>;
22
22
  remove: () => void;
23
- fetchStatus: import("react-query").FetchStatus;
23
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
24
24
  chains: import("@lifi/types").EVMChain[] | undefined;
25
25
  getChainById: (chainId: number) => import("@lifi/types").EVMChain | undefined;
26
26
  } | {
@@ -43,9 +43,9 @@ export declare const useChains: () => {
43
43
  isPreviousData: boolean;
44
44
  isRefetching: boolean;
45
45
  isStale: boolean;
46
- refetch: <TPageData>(options?: (import("react-query").RefetchOptions & import("react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("react-query").QueryObserverResult<import("@lifi/types").EVMChain[], unknown>>;
46
+ refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@lifi/types").EVMChain[], unknown>>;
47
47
  remove: () => void;
48
- fetchStatus: import("react-query").FetchStatus;
48
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
49
49
  chains: import("@lifi/types").EVMChain[] | undefined;
50
50
  getChainById: (chainId: number) => import("@lifi/types").EVMChain | undefined;
51
51
  } | {
@@ -68,9 +68,9 @@ export declare const useChains: () => {
68
68
  isPreviousData: boolean;
69
69
  isRefetching: boolean;
70
70
  isStale: boolean;
71
- refetch: <TPageData>(options?: (import("react-query").RefetchOptions & import("react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("react-query").QueryObserverResult<import("@lifi/types").EVMChain[], unknown>>;
71
+ refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@lifi/types").EVMChain[], unknown>>;
72
72
  remove: () => void;
73
- fetchStatus: import("react-query").FetchStatus;
73
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
74
74
  chains: import("@lifi/types").EVMChain[] | undefined;
75
75
  getChainById: (chainId: number) => import("@lifi/types").EVMChain | undefined;
76
76
  } | {
@@ -93,9 +93,9 @@ export declare const useChains: () => {
93
93
  isPreviousData: boolean;
94
94
  isRefetching: boolean;
95
95
  isStale: boolean;
96
- refetch: <TPageData>(options?: (import("react-query").RefetchOptions & import("react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("react-query").QueryObserverResult<import("@lifi/types").EVMChain[], unknown>>;
96
+ refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@lifi/types").EVMChain[], unknown>>;
97
97
  remove: () => void;
98
- fetchStatus: import("react-query").FetchStatus;
98
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
99
99
  chains: import("@lifi/types").EVMChain[] | undefined;
100
100
  getChainById: (chainId: number) => import("@lifi/types").EVMChain | undefined;
101
101
  };
@@ -18,8 +18,8 @@ var __rest = (this && this.__rest) || function (s, e) {
18
18
  }
19
19
  return t;
20
20
  };
21
+ import { useQuery } from '@tanstack/react-query';
21
22
  import { useCallback } from 'react';
22
- import { useQuery } from 'react-query';
23
23
  import { LiFi } from '../config/lifi';
24
24
  import { useWidgetConfig } from '../providers/WidgetProvider';
25
25
  export const useChains = () => {
@@ -0,0 +1,15 @@
1
+ import { EVMChain, Route, Token } from '@lifi/sdk';
2
+ import Big from 'big.js';
3
+ interface GasSufficiency {
4
+ gasAmount: Big;
5
+ tokenAmount?: Big;
6
+ insufficientAmount?: Big;
7
+ insufficient?: boolean;
8
+ token: Token;
9
+ chain?: EVMChain;
10
+ }
11
+ export declare const useGasSufficiency: (route?: Route) => {
12
+ insufficientGas: GasSufficiency[];
13
+ insufficientFunds: boolean;
14
+ };
15
+ export {};
@@ -0,0 +1,91 @@
1
+ import Big from 'big.js';
2
+ import { useMemo } from 'react';
3
+ import { useWatch } from 'react-hook-form';
4
+ import { useChains, useDebouncedWatch } from '.';
5
+ import { SwapFormKey, SwapFormKeyHelper } from '../providers/SwapFormProvider';
6
+ import { useWallet } from '../providers/WalletProvider';
7
+ import { useTokenBalances } from './useTokenBalances';
8
+ export const useGasSufficiency = (route) => {
9
+ const { account } = useWallet();
10
+ const [fromChainId, toChainId, fromToken] = useWatch({
11
+ name: [
12
+ SwapFormKeyHelper.getChainKey('from'),
13
+ SwapFormKeyHelper.getChainKey('to'),
14
+ SwapFormKey.FromToken,
15
+ ],
16
+ });
17
+ const fromAmount = useDebouncedWatch(SwapFormKey.FromAmount, 250);
18
+ const { tokens: fromChainTokenBalances } = useTokenBalances(fromChainId);
19
+ const { tokens: toChainTokenBalances } = useTokenBalances(toChainId);
20
+ const { getChainById } = useChains();
21
+ const insufficientGas = useMemo(() => {
22
+ var _a;
23
+ if (!account.isActive || !route || !fromAmount) {
24
+ return [];
25
+ }
26
+ const tokenBalancesByChain = {
27
+ [fromChainId]: fromChainTokenBalances,
28
+ [toChainId]: toChainTokenBalances,
29
+ };
30
+ const gasCosts = route.steps.reduce((groupedGasCosts, step) => {
31
+ if (step.estimate.gasCosts) {
32
+ const { token } = step.estimate.gasCosts[0];
33
+ const gasCostAmount = step.estimate.gasCosts
34
+ .reduce((amount, gasCost) => amount.plus(Big(gasCost.amount || 0)), Big(0))
35
+ .div(Math.pow(10, token.decimals));
36
+ const groupedGasCost = groupedGasCosts[token.chainId];
37
+ const gasAmount = groupedGasCost
38
+ ? groupedGasCost.gasAmount.plus(gasCostAmount)
39
+ : gasCostAmount;
40
+ groupedGasCosts[token.chainId] = {
41
+ gasAmount,
42
+ tokenAmount: gasAmount,
43
+ token,
44
+ chain: getChainById(token.chainId),
45
+ };
46
+ return groupedGasCosts;
47
+ }
48
+ return groupedGasCosts;
49
+ }, {});
50
+ if (gasCosts[fromChainId] &&
51
+ route.fromToken.address === gasCosts[fromChainId].token.address) {
52
+ gasCosts[fromChainId].tokenAmount = (_a = gasCosts[fromChainId]) === null || _a === void 0 ? void 0 : _a.gasAmount.plus(Big(fromAmount));
53
+ }
54
+ [fromChainId, toChainId].forEach((chainId) => {
55
+ var _a, _b, _c, _d, _e, _f, _g;
56
+ if (gasCosts[chainId]) {
57
+ const gasTokenBalance = Big((_c = (_b = (_a = tokenBalancesByChain[chainId]) === null || _a === void 0 ? void 0 : _a.find((t) => t.address === gasCosts[chainId].token.address)) === null || _b === void 0 ? void 0 : _b.amount) !== null && _c !== void 0 ? _c : 0);
58
+ const insufficientFromChainGas = gasTokenBalance.lte(0) ||
59
+ gasTokenBalance.lt((_d = gasCosts[chainId].gasAmount) !== null && _d !== void 0 ? _d : Big(0)) ||
60
+ gasTokenBalance.lt((_e = gasCosts[chainId].tokenAmount) !== null && _e !== void 0 ? _e : Big(0));
61
+ const insufficientFromChainGasAmount = insufficientFromChainGas
62
+ ? (_g = (_f = gasCosts[chainId].tokenAmount) === null || _f === void 0 ? void 0 : _f.minus(gasTokenBalance)) !== null && _g !== void 0 ? _g : gasCosts[chainId].gasAmount.minus(gasTokenBalance)
63
+ : undefined;
64
+ gasCosts[chainId] = Object.assign(Object.assign({}, gasCosts[chainId]), { insufficient: insufficientFromChainGas, insufficientAmount: insufficientFromChainGasAmount });
65
+ }
66
+ });
67
+ const gasCostResult = Object.values(gasCosts).filter((gasCost) => gasCost.insufficient);
68
+ return gasCostResult;
69
+ }, [
70
+ account.isActive,
71
+ fromAmount,
72
+ fromChainId,
73
+ fromChainTokenBalances,
74
+ getChainById,
75
+ route,
76
+ toChainId,
77
+ toChainTokenBalances,
78
+ ]);
79
+ const insufficientFunds = useMemo(() => {
80
+ var _a, _b;
81
+ if (!account.isActive || !fromToken || !fromAmount) {
82
+ return false;
83
+ }
84
+ const balance = Big((_b = (_a = fromChainTokenBalances === null || fromChainTokenBalances === void 0 ? void 0 : fromChainTokenBalances.find((t) => t.address === fromToken)) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
85
+ return Big(fromAmount).gte(balance);
86
+ }, [account.isActive, fromAmount, fromChainTokenBalances, fromToken]);
87
+ return {
88
+ insufficientGas,
89
+ insufficientFunds,
90
+ };
91
+ };
@@ -2,7 +2,7 @@ import { Route } from '@lifi/sdk';
2
2
  export declare const useRouteExecution: (routeId: string) => {
3
3
  executeRoute: () => void;
4
4
  restartRoute: () => void;
5
- removeRoute: () => void;
6
- route: Route;
7
- status: import("../stores").RouteExecutionStatus;
5
+ deleteRoute: () => void;
6
+ route: Route | undefined;
7
+ status: import("../stores").RouteExecutionStatus | undefined;
8
8
  };
@@ -7,8 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { useMutation } from '@tanstack/react-query';
10
11
  import { useCallback, useEffect, useRef } from 'react';
11
- import { useMutation } from 'react-query';
12
12
  import shallow from 'zustand/shallow';
13
13
  import { LiFi } from '../config/lifi';
14
14
  import { useWallet } from '../providers/WalletProvider';
@@ -17,8 +17,8 @@ import { deepClone } from '../utils';
17
17
  export const useRouteExecution = (routeId) => {
18
18
  const { account, switchChain } = useWallet();
19
19
  const resumedAfterMount = useRef(false);
20
- const { route, status } = useRouteStore((state) => state.routes[routeId]);
21
- const [updateRoute, restartRoute, removeRoute] = useRouteStore((state) => [state.updateRoute, state.restartRoute, state.removeRoute], shallow);
20
+ const routeExecution = useRouteStore((state) => state.routes[routeId]);
21
+ const [updateRoute, restartRoute, deleteRoute] = useRouteStore((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow);
22
22
  const updateCallback = (updatedRoute) => {
23
23
  console.log('Route updated.', updatedRoute);
24
24
  updateRoute(deepClone(updatedRoute));
@@ -39,10 +39,10 @@ export const useRouteExecution = (routeId) => {
39
39
  if (!account.signer) {
40
40
  throw Error('Account signer not found.');
41
41
  }
42
- if (!route) {
42
+ if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
43
43
  throw Error('Execution route not found.');
44
44
  }
45
- return LiFi.executeRoute(account.signer, route, {
45
+ return LiFi.executeRoute(account.signer, routeExecution.route, {
46
46
  updateCallback,
47
47
  switchChainHook,
48
48
  infiniteApproval: false,
@@ -62,10 +62,10 @@ export const useRouteExecution = (routeId) => {
62
62
  if (!account.signer) {
63
63
  throw Error('Account signer not found.');
64
64
  }
65
- if (!route) {
65
+ if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
66
66
  throw Error('Execution route not found.');
67
67
  }
68
- return LiFi.resumeRoute(account.signer, resumedRoute !== null && resumedRoute !== void 0 ? resumedRoute : route, {
68
+ return LiFi.resumeRoute(account.signer, resumedRoute !== null && resumedRoute !== void 0 ? resumedRoute : routeExecution.route, {
69
69
  updateCallback,
70
70
  switchChainHook,
71
71
  infiniteApproval: false,
@@ -105,18 +105,18 @@ export const useRouteExecution = (routeId) => {
105
105
  }, [resumeRouteMutation, routeId]);
106
106
  const restartRouteMutation = useCallback(() => {
107
107
  restartRoute(routeId);
108
- resumeRoute(route);
108
+ resumeRoute(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route);
109
109
  // eslint-disable-next-line react-hooks/exhaustive-deps
110
- }, [resumeRoute, route, routeId]);
111
- const removeRouteMutation = useCallback(() => {
112
- removeRoute(routeId);
110
+ }, [resumeRoute, routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route, routeId]);
111
+ const deleteRouteMutation = useCallback(() => {
112
+ deleteRoute(routeId);
113
113
  // eslint-disable-next-line react-hooks/exhaustive-deps
114
114
  }, [routeId]);
115
115
  useEffect(() => {
116
116
  // check if route is eligible for automatic resuming
117
- const isDone = route.steps.every((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE'; });
118
- const isFailed = route.steps.some((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
119
- const alreadyStarted = route.steps.some((step) => step.execution);
117
+ const isDone = routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.steps.every((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE'; });
118
+ const isFailed = routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.steps.some((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
119
+ const alreadyStarted = routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.steps.some((step) => step.execution);
120
120
  if (!isDone &&
121
121
  !isFailed &&
122
122
  alreadyStarted &&
@@ -125,14 +125,18 @@ export const useRouteExecution = (routeId) => {
125
125
  resumedAfterMount.current = true;
126
126
  resumeRoute();
127
127
  }
128
- return () => LiFi.moveExecutionToBackground(route);
128
+ return () => {
129
+ if (routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route) {
130
+ LiFi.moveExecutionToBackground(routeExecution.route);
131
+ }
132
+ };
129
133
  // eslint-disable-next-line react-hooks/exhaustive-deps
130
134
  }, [account.signer]);
131
135
  return {
132
136
  executeRoute,
133
137
  restartRoute: restartRouteMutation,
134
- removeRoute: removeRouteMutation,
135
- route,
136
- status,
138
+ deleteRoute: deleteRouteMutation,
139
+ route: routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route,
140
+ status: routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.status,
137
141
  };
138
142
  };
@@ -5,5 +5,5 @@ export declare const useSwapRoutes: () => {
5
5
  isFetched: boolean;
6
6
  dataUpdatedAt: number;
7
7
  refetchTime: number;
8
- refetch: <TPageData>(options?: (import("react-query").RefetchOptions & import("react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("react-query").QueryObserverResult<import("@lifi/types").RoutesResponse, unknown>>;
8
+ refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@lifi/types").RoutesResponse, unknown>>;
9
9
  };
@@ -7,21 +7,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { useQuery, useQueryClient } from '@tanstack/react-query';
10
11
  import Big from 'big.js';
11
- import { useEffect } from 'react';
12
12
  import { useWatch } from 'react-hook-form';
13
- import { useQuery, useQueryClient } from 'react-query';
14
13
  import { useDebouncedWatch, useToken } from '.';
15
14
  import { LiFi } from '../config/lifi';
16
15
  import { SwapFormKey } from '../providers/SwapFormProvider';
17
16
  import { useWallet } from '../providers/WalletProvider';
18
- import { useCurrentRoute, useSettings } from '../stores';
17
+ import { useSettings } from '../stores';
19
18
  const refetchTime = 60000;
20
19
  export const useSwapRoutes = () => {
21
20
  var _a;
22
21
  const { account } = useWallet();
23
22
  const queryClient = useQueryClient();
24
- const [currentRoute, setCurrentRoute] = useCurrentRoute();
25
23
  const { slippage, enabledBridges, enabledExchanges, routePriority } = useSettings([
26
24
  'slippage',
27
25
  'routePriority',
@@ -92,16 +90,6 @@ export const useSwapRoutes = () => {
92
90
  staleTime: refetchTime,
93
91
  cacheTime: refetchTime,
94
92
  });
95
- useEffect(() => {
96
- // check that the current route is selected from existing routes
97
- const isCurrentRouteInSet = data === null || data === void 0 ? void 0 : data.routes.some((route) => route.id === (currentRoute === null || currentRoute === void 0 ? void 0 : currentRoute.id));
98
- const recommendedRoute = data === null || data === void 0 ? void 0 : data.routes[0];
99
- // we don't want to set the current route again on mount if it's already selected from existing routes
100
- if (!isCurrentRouteInSet) {
101
- setCurrentRoute(recommendedRoute);
102
- }
103
- // eslint-disable-next-line react-hooks/exhaustive-deps
104
- }, [data === null || data === void 0 ? void 0 : data.routes, setCurrentRoute]);
105
93
  return {
106
94
  routes: data === null || data === void 0 ? void 0 : data.routes,
107
95
  isLoading: isEnabled && isLoading,
@@ -7,8 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { useQuery, useQueryClient } from '@tanstack/react-query';
10
11
  import { useCallback } from 'react';
11
- import { useQuery, useQueryClient } from 'react-query';
12
12
  import { LiFi } from '../config/lifi';
13
13
  import { useWallet } from '../providers/WalletProvider';
14
14
  import { formatTokenAmount } from '../utils';
@@ -2,6 +2,6 @@ import { TokenAmount } from '@lifi/sdk';
2
2
  export declare const useTokenBalances: (selectedChainId: number) => {
3
3
  tokens: TokenAmount[] | undefined;
4
4
  isLoading: boolean;
5
- isFetching: boolean;
6
- updateBalances: <TPageData>(options?: (import("react-query").RefetchOptions & import("react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("react-query").QueryObserverResult<TokenAmount[], unknown>>;
5
+ isBalanceLoading: boolean;
6
+ updateBalances: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<TokenAmount[], unknown>>;
7
7
  };
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { useQuery } from 'react-query';
10
+ import { useQuery } from '@tanstack/react-query';
11
11
  import { LiFi } from '../config/lifi';
12
12
  import { useWallet } from '../providers/WalletProvider';
13
13
  import { formatTokenAmount } from '../utils';
@@ -16,9 +16,9 @@ import { useTokens } from './useTokens';
16
16
  export const useTokenBalances = (selectedChainId) => {
17
17
  const { account } = useWallet();
18
18
  const { chains, isLoading: isChainsLoading } = useChains();
19
- const { tokens, isLoading, isFetching } = useTokens(selectedChainId);
20
- const isBalancesLoadingEnabled = Boolean(account.address) && Boolean(tokens) && Boolean(chains);
21
- const { data: tokensWithBalance, isLoading: isBalancesLoading, isFetching: isBalancesFetching, refetch, } = useQuery(['token-balances', selectedChainId, account.address], ({ queryKey: [_, chainId, account] }) => __awaiter(void 0, void 0, void 0, function* () {
19
+ const { tokens, isLoading } = useTokens(selectedChainId);
20
+ const isBalanceLoadingEnabled = Boolean(account.address) && Boolean(tokens) && Boolean(chains);
21
+ const { data: tokensWithBalance, isLoading: isBalanceLoading, refetch, } = useQuery(['token-balances', selectedChainId, account.address], ({ queryKey: [_, chainId, account] }) => __awaiter(void 0, void 0, void 0, function* () {
22
22
  if (!account || !tokens) {
23
23
  return [];
24
24
  }
@@ -38,17 +38,15 @@ export const useTokenBalances = (selectedChainId) => {
38
38
  ...formatedTokens.filter((token) => token.amount === '0'),
39
39
  ];
40
40
  }), {
41
- enabled: isBalancesLoadingEnabled,
41
+ enabled: isBalanceLoadingEnabled,
42
42
  refetchIntervalInBackground: true,
43
43
  refetchInterval: 60000,
44
44
  staleTime: 60000,
45
45
  });
46
46
  return {
47
47
  tokens: tokensWithBalance !== null && tokensWithBalance !== void 0 ? tokensWithBalance : tokens,
48
- isLoading: (isBalancesLoading && isBalancesLoadingEnabled) ||
49
- (isLoading && isFetching) ||
50
- isChainsLoading,
51
- isFetching: isBalancesFetching,
48
+ isLoading: isLoading || isChainsLoading,
49
+ isBalanceLoading: isBalanceLoading && isBalanceLoadingEnabled,
52
50
  updateBalances: refetch,
53
51
  };
54
52
  };
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { useQuery } from 'react-query';
10
+ import { useQuery } from '@tanstack/react-query';
11
11
  import { LiFi } from '../config/lifi';
12
12
  export const useTokens = (selectedChainId) => {
13
13
  const { data: tokens, isLoading, isFetching, } = useQuery(['tokens', selectedChainId], () => __awaiter(void 0, void 0, void 0, function* () {
@@ -1 +1,10 @@
1
- export declare const useTools: () => import("@lifi/types").ToolsResponse | undefined;
1
+ import { Bridge, Exchange } from '@lifi/sdk';
2
+ declare type FormattedTool<T, K extends keyof T> = Record<string, Pick<T, K>>;
3
+ export declare const useTools: () => {
4
+ tools: import("@lifi/sdk").ToolsResponse | undefined;
5
+ formattedTools: {
6
+ bridges: FormattedTool<Bridge, "key" | "name" | "logoURI"> | undefined;
7
+ exchanges: FormattedTool<Exchange, "key" | "name" | "logoURI"> | undefined;
8
+ };
9
+ };
10
+ export {};
package/hooks/useTools.js CHANGED
@@ -1,5 +1,5 @@
1
- /* eslint-disable no-underscore-dangle */
2
- import { useQuery } from 'react-query';
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { useMemo } from 'react';
3
3
  import { LiFi } from '../config/lifi';
4
4
  import { useSettingsStore } from '../stores';
5
5
  export const useTools = () => {
@@ -10,5 +10,15 @@ export const useTools = () => {
10
10
  initializeTools('Exchanges', data.exchanges.map((exchange) => exchange.key));
11
11
  },
12
12
  });
13
- return data;
13
+ const formattedTools = useMemo(() => ({
14
+ bridges: data === null || data === void 0 ? void 0 : data.bridges.reduce((bridges, bridge) => {
15
+ bridges[bridge.key] = bridge;
16
+ return bridges;
17
+ }, {}),
18
+ exchanges: data === null || data === void 0 ? void 0 : data.exchanges.reduce((exchanges, exchange) => {
19
+ exchanges[exchange.key] = exchange;
20
+ return exchanges;
21
+ }, {}),
22
+ }), [data === null || data === void 0 ? void 0 : data.bridges, data === null || data === void 0 ? void 0 : data.exchanges]);
23
+ return { tools: data, formattedTools };
14
24
  };
@@ -7,13 +7,15 @@
7
7
  "from": "Swap from",
8
8
  "to": "Swap to",
9
9
  "settings": "Settings",
10
- "routes": "You get"
10
+ "routes": "You get",
11
+ "swapHistory": "Swap history",
12
+ "swapDetails": "Swap details"
11
13
  },
12
14
  "button": {
13
- "swap": "Swap",
14
15
  "connectWallet": "Connect wallet",
15
16
  "switchChain": "Switch chain",
16
- "startSwap": "Start the swap",
17
+ "reviewSwap": "Review swap",
18
+ "startSwap": "Start swap",
17
19
  "restartSwap": "Restart swap",
18
20
  "removeSwap": "Remove swap",
19
21
  "done": "Done",
@@ -24,8 +26,11 @@
24
26
  "dark": "Dark",
25
27
  "auto": "Auto",
26
28
  "ok": "Ok",
29
+ "cancel": "Cancel",
30
+ "delete": "Delete",
27
31
  "hide": "Hide",
28
32
  "max": "max",
33
+ "contactSupport": "Contact support",
29
34
  "lifiSwap": "LI.FI Swap"
30
35
  },
31
36
  "swap": {
@@ -51,8 +56,11 @@
51
56
  "stepSwapAndBridge": "Swap and bridge",
52
57
  "estimatedTime": "~{{value}} min.",
53
58
  "networkIsBusy": "Network is busy...",
54
- "crossStepDetails": "Bridge {{from}} to {{to}} via {{tool}}",
59
+ "crossStepDetails": "Bridge from {{from}} to {{to}} via {{tool}}",
55
60
  "swapStepDetails": "Swap on {{chain}} via {{tool}}",
61
+ "tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
62
+ "tokenOnChainAmount": "{{amount}} {{tokenSymbol}} on {{chainName}}",
63
+ "routeId": "Route ID",
56
64
  "tags": {
57
65
  "recommended": "Recommended",
58
66
  "fastest": "Fast",
@@ -73,17 +81,18 @@
73
81
  "routeNotFound": "No routes available"
74
82
  },
75
83
  "message": {
76
- "routeNotFound": "Try another \"from\" and \"to\" token combination."
84
+ "routeNotFound": "Try another token combination."
77
85
  }
78
86
  },
79
87
  "warning": {
80
88
  "title": {
81
- "insufficientGas": "Insufficient gas"
89
+ "insufficientGas": "Insufficient gas",
90
+ "deleteSwap": "Delete this swap?"
82
91
  },
83
92
  "message": {
84
- "insufficientFunds": "You don't have enough funds for this transaction on the start \"from\" chain.",
85
- "insufficientGasOnStartChain": "You need to have enough gas to pay for this transaction on the start \"from\" chain.",
86
- "insufficientGasOnDestinationChain": "You need to have enough gas to pay for this transaction on the destination \"to\" chain."
93
+ "insufficientFunds": "You don't have enough funds to execute the swap.",
94
+ "insufficientGas": "You need to add at least:",
95
+ "deleteSwap": "Swap history is only stored locally and can't be recovered if you delete it."
87
96
  }
88
97
  },
89
98
  "error": {
package/i18n/index.d.ts CHANGED
@@ -11,11 +11,13 @@ export declare const resources: {
11
11
  to: string;
12
12
  settings: string;
13
13
  routes: string;
14
+ swapHistory: string;
15
+ swapDetails: string;
14
16
  };
15
17
  button: {
16
- swap: string;
17
18
  connectWallet: string;
18
19
  switchChain: string;
20
+ reviewSwap: string;
19
21
  startSwap: string;
20
22
  restartSwap: string;
21
23
  removeSwap: string;
@@ -27,8 +29,11 @@ export declare const resources: {
27
29
  dark: string;
28
30
  auto: string;
29
31
  ok: string;
32
+ cancel: string;
33
+ delete: string;
30
34
  hide: string;
31
35
  max: string;
36
+ contactSupport: string;
32
37
  lifiSwap: string;
33
38
  };
34
39
  swap: {
@@ -56,6 +61,9 @@ export declare const resources: {
56
61
  networkIsBusy: string;
57
62
  crossStepDetails: string;
58
63
  swapStepDetails: string;
64
+ tokenOnChain: string;
65
+ tokenOnChainAmount: string;
66
+ routeId: string;
59
67
  tags: {
60
68
  recommended: string;
61
69
  fastest: string;
@@ -82,11 +90,12 @@ export declare const resources: {
82
90
  warning: {
83
91
  title: {
84
92
  insufficientGas: string;
93
+ deleteSwap: string;
85
94
  };
86
95
  message: {
87
96
  insufficientFunds: string;
88
- insufficientGasOnStartChain: string;
89
- insufficientGasOnDestinationChain: string;
97
+ insufficientGas: string;
98
+ deleteSwap: string;
90
99
  };
91
100
  };
92
101
  error: {
@@ -0,0 +1,6 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <circle cx="16" cy="16" r="16" fill="#F5B5FF"/>
4
+ <path d="M15.5031 19.2031L10.1691 20.4379C9.97453 20.4867 9.82861 20.6816 9.82861 20.8766V24.5486C9.82861 24.8573 10.0718 25.0523 10.3798 24.9873L17.8215 23.265C18.1296 23.2 18.2593 22.9076 18.1296 22.6314L16.7839 19.853C16.5731 19.4143 16.7839 18.9594 17.2541 18.8619L22.1179 17.692C22.4584 17.6108 22.7502 17.2534 22.7502 16.8959V13.5001C22.7502 13.1914 22.507 12.9802 22.199 13.0614L15.1788 14.735C14.7411 14.8324 14.5465 15.2549 14.7411 15.6611L15.9733 18.212C16.184 18.6507 15.9733 19.0893 15.5031 19.2031Z" fill="black"/>
5
+ <path d="M11.985 10.0233L13.3793 12.8829C13.5577 13.2566 13.3793 13.6466 12.974 13.7278L10.3962 14.329C10.0719 14.4102 9.8125 14.7352 9.8125 15.0601V18.1309C9.8125 18.6509 10.234 18.9758 10.7366 18.8621L13.1361 18.3097C13.4604 18.2447 13.7198 17.9035 13.7198 17.5785L13.736 14.4265C13.736 13.9878 14.0927 13.5491 14.5142 13.4516L22.3774 11.5669C22.572 11.5181 22.7179 11.3231 22.7179 11.1282V7.45618C22.7179 7.14747 22.4747 6.93625 22.1666 7.01749L12.2931 9.38966C11.985 9.45465 11.8553 9.74711 11.985 10.0233Z" fill="black"/>
6
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "1.10.4",
3
+ "version": "1.11.0",
4
4
  "description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
5
5
  "sideEffects": false,
6
6
  "main": "./index.js",
@@ -44,11 +44,12 @@
44
44
  "@lifi/sdk": "^1.0.2",
45
45
  "@lifi/wallet-management": "^1.1.2",
46
46
  "@mui/icons-material": "^5.8.4",
47
- "@mui/lab": "^5.0.0-alpha.90",
48
- "@mui/material": "^5.9.0",
49
- "@sentry/integrations": "^7.6.0",
50
- "@sentry/react": "^7.6.0",
51
- "@sentry/tracing": "^7.6.0",
47
+ "@mui/lab": "^5.0.0-alpha.92",
48
+ "@mui/material": "^5.9.2",
49
+ "@sentry/integrations": "^7.7.0",
50
+ "@sentry/react": "^7.7.0",
51
+ "@sentry/tracing": "^7.7.0",
52
+ "@tanstack/react-query": "^4.0.10",
52
53
  "big.js": "^6.2.1",
53
54
  "i18next": "^21.8.14",
54
55
  "immer": "^9.0.15",
@@ -56,12 +57,11 @@
56
57
  "react-dom": "^18.2.0",
57
58
  "react-hook-form": "^7.33.1",
58
59
  "react-i18next": "^11.18.1",
59
- "react-query": "^4.0.0-beta.23",
60
60
  "react-resize-detector": "^7.1.2",
61
61
  "react-router-dom": "^6.3.0",
62
62
  "react-timer-hook": "^3.0.5",
63
63
  "react-virtual": "^2.10.4",
64
- "zustand": "^4.0.0-rc.1"
64
+ "zustand": "^4.0.0"
65
65
  },
66
66
  "eslintConfig": {
67
67
  "extends": "../../.eslintrc"
@@ -1,12 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box } from '@mui/material';
3
- import { InsufficientGasOrFundsMessage } from '../../components/InsufficientGasOrFundsMessage';
4
3
  import { SelectChainAndToken } from '../../components/SelectChainAndToken';
5
4
  import { SwapInProgress } from '../../components/SwapInProgress';
6
5
  import { SwapInput } from '../../components/SwapInput';
7
- import { SwapRoutes } from '../../components/SwapRoutes';
8
6
  import { FormContainer } from './MainPage.style';
9
7
  import { MainSwapButton } from './MainSwapButton';
8
+ import { SwapRoutes } from './SwapRoutes';
10
9
  export const MainPage = () => {
11
- return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(SwapInProgress, { mx: 3, mt: 2, mb: 1 }), _jsx(SelectChainAndToken, { mt: 2, mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 3 }, { children: _jsx(SwapInput, { formType: "from" }) })), _jsx(SwapRoutes, { mx: 3, mb: 3 }), _jsx(InsufficientGasOrFundsMessage, { mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 1 }, { children: _jsx(MainSwapButton, {}) }))] })));
10
+ return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(SwapInProgress, { mx: 3, mt: 1, mb: 2 }), _jsx(SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 3 }, { children: _jsx(SwapInput, { formType: "from" }) })), _jsx(SwapRoutes, { mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 1 }, { children: _jsx(MainSwapButton, {}) }))] })));
12
11
  };