@lifi/widget 1.15.1 → 1.17.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.
- package/App.js +21 -0
- package/AppProvider.d.ts +0 -4
- package/AppProvider.js +2 -10
- package/README.md +1 -1
- package/cjs/App.js +21 -0
- package/cjs/AppProvider.d.ts +0 -4
- package/cjs/AppProvider.js +3 -12
- package/cjs/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
- package/cjs/components/ActiveSwaps/ActiveSwapItem.js +45 -0
- package/cjs/components/{SwapsInProgress/SwapsInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
- package/cjs/components/ActiveSwaps/ActiveSwaps.js +30 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +40 -0
- package/cjs/components/ActiveSwaps/index.d.ts +2 -0
- package/cjs/components/ActiveSwaps/index.js +18 -0
- package/cjs/components/AppContainer.js +2 -2
- package/cjs/components/Card/Card.d.ts +7 -4
- package/cjs/components/Card/Card.js +38 -28
- package/cjs/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +0 -0
- package/cjs/components/ChainSelect/ChainSelect.js +35 -0
- package/cjs/components/{SwapsInProgress/SwapsInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
- package/cjs/components/ChainSelect/ChainSelect.style.js +19 -0
- package/cjs/components/ChainSelect/index.d.ts +2 -0
- package/cjs/components/ChainSelect/index.js +18 -0
- package/cjs/components/ChainSelect/useChainSelect.d.ts +8 -0
- package/cjs/components/ChainSelect/useChainSelect.js +33 -0
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +3 -3
- package/cjs/components/Header/Header.js +1 -9
- package/cjs/components/Header/NavigationHeader.js +6 -11
- package/cjs/components/Header/useHeaderActionStore.d.ts +0 -2
- package/cjs/components/Header/useHeaderActionStore.js +1 -5
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.style.js +1 -0
- package/cjs/components/SelectChainAndToken.js +5 -5
- package/cjs/components/SendToWallet/SendToWallet.js +6 -6
- package/cjs/components/Step/CircularProgress.js +1 -1
- package/cjs/components/Step/CircularProgress.style.js +1 -1
- package/cjs/components/Step/StepProcess.js +1 -5
- package/cjs/components/Step/StepProcess.style.d.ts +1 -1
- package/cjs/components/Step/StepTimer.d.ts +1 -0
- package/cjs/components/Step/StepTimer.js +6 -6
- package/cjs/components/SwapButton/SwapButton.js +5 -32
- package/cjs/components/SwapButton/types.d.ts +2 -2
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/cjs/components/TokenList/TokenList.js +7 -3
- package/cjs/components/TokenList/TokenList.style.js +4 -3
- package/cjs/components/TokenList/TokenListItem.js +1 -1
- package/cjs/components/TokenList/TokenNotFound.d.ts +2 -1
- package/cjs/components/TokenList/TokenNotFound.js +12 -2
- package/cjs/components/TokenList/types.d.ts +2 -2
- package/cjs/config/theme.js +24 -23
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +2 -0
- package/cjs/hooks/index.js +2 -0
- package/cjs/hooks/useChains.d.ts +1 -97
- package/cjs/hooks/useChains.js +26 -20
- package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
- package/cjs/hooks/useFeaturedTokens.js +6 -3
- package/cjs/hooks/useGasSufficiency.d.ts +1 -1
- package/cjs/hooks/useGasSufficiency.js +36 -28
- package/cjs/hooks/useInitializer.js +6 -0
- package/cjs/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
- package/cjs/{components/Step/utils.js → hooks/useProcessMessage.js} +16 -10
- package/cjs/hooks/useRouteExecution.d.ts +1 -1
- package/cjs/hooks/useRouteExecution.js +26 -35
- package/cjs/hooks/useSwapRoutes.js +10 -11
- package/cjs/hooks/useToken.d.ts +0 -1
- package/cjs/hooks/useToken.js +1 -2
- package/cjs/hooks/useTokenBalances.d.ts +1 -2
- package/cjs/hooks/useTokenBalances.js +5 -6
- package/cjs/hooks/useTokenSearch.js +3 -2
- package/cjs/hooks/useTokens.d.ts +1 -2
- package/cjs/hooks/useTokens.js +32 -9
- package/cjs/hooks/useTools.js +11 -5
- package/cjs/hooks/useWidgetEvents.d.ts +3 -0
- package/cjs/hooks/useWidgetEvents.js +13 -0
- package/cjs/i18n/en/translation.json +14 -10
- package/cjs/i18n/index.d.ts +11 -7
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +18 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +21 -0
- package/cjs/pages/ActiveSwapsPage/index.d.ts +1 -0
- package/cjs/{components/SwapsInProgress → pages/ActiveSwapsPage}/index.js +1 -1
- package/cjs/pages/MainPage/MainPage.js +2 -3
- package/cjs/pages/MainPage/MainSwapButton.js +3 -1
- package/cjs/pages/MainPage/SwapRoutes.js +4 -1
- package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.js +33 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.style.js +20 -0
- package/cjs/pages/SelectChainPage/index.d.ts +1 -0
- package/cjs/pages/SelectChainPage/index.js +17 -0
- package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -2
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +4 -4
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- package/cjs/pages/SettingsPage/AdvancedPreferences.js +1 -1
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +3 -6
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +3 -5
- package/cjs/pages/SettingsPage/GasPriceSelect.js +1 -1
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +6 -2
- package/cjs/pages/SettingsPage/ShowDestinationWallet.js +1 -1
- package/cjs/pages/SettingsPage/SlippageInput.js +1 -1
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +3 -4
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -3
- package/cjs/pages/SwapPage/StatusBottomSheet.js +25 -36
- package/cjs/pages/SwapPage/SwapPage.js +16 -3
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +4 -3
- package/cjs/providers/SDKProvider/SDKProvider.d.ts +4 -0
- package/cjs/providers/SDKProvider/SDKProvider.js +27 -0
- package/cjs/providers/SDKProvider/index.d.ts +1 -0
- package/cjs/providers/SDKProvider/index.js +17 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +4 -30
- package/cjs/providers/SwapFormProvider/types.d.ts +5 -5
- package/cjs/providers/TelemetryProvider/TelemetryProvider.d.ts +4 -0
- package/cjs/providers/TelemetryProvider/TelemetryProvider.js +11 -0
- package/cjs/providers/TelemetryProvider/index.d.ts +1 -0
- package/cjs/providers/TelemetryProvider/index.js +17 -0
- package/cjs/providers/WalletProvider/WalletProvider.d.ts +1 -4
- package/cjs/providers/WalletProvider/WalletProvider.js +59 -1
- package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -16
- package/cjs/providers/WidgetProvider/index.d.ts +1 -0
- package/cjs/providers/WidgetProvider/index.js +1 -0
- package/cjs/providers/WidgetProvider/utils.d.ts +4 -0
- package/cjs/providers/WidgetProvider/utils.js +13 -0
- package/cjs/providers/index.d.ts +2 -0
- package/cjs/providers/index.js +2 -0
- package/cjs/stores/chains/index.d.ts +3 -0
- package/cjs/stores/chains/index.js +19 -0
- package/cjs/stores/chains/types.d.ts +8 -0
- package/cjs/stores/chains/types.js +2 -0
- package/cjs/stores/chains/useChainOrder.d.ts +1 -0
- package/cjs/stores/chains/useChainOrder.js +12 -0
- package/cjs/stores/chains/useChainOrderStore.d.ts +19 -0
- package/cjs/stores/chains/useChainOrderStore.js +45 -0
- package/cjs/stores/route/index.d.ts +2 -1
- package/cjs/stores/route/index.js +2 -1
- package/cjs/stores/route/useExecutingRoutesIds.d.ts +1 -0
- package/cjs/stores/route/useExecutingRoutesIds.js +20 -0
- package/cjs/stores/route/useRouteStore.js +5 -4
- package/cjs/stores/route/utils.d.ts +4 -0
- package/cjs/stores/route/utils.js +21 -0
- package/cjs/stores/settings/index.d.ts +0 -1
- package/cjs/stores/settings/index.js +0 -1
- package/cjs/stores/settings/useAppearance.js +3 -1
- package/cjs/stores/settings/useSettingsStore.js +5 -2
- package/cjs/types/events.d.ts +5 -0
- package/cjs/types/events.js +9 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/widget.d.ts +31 -23
- package/cjs/utils/colors.d.ts +1 -1
- package/cjs/utils/navigationRoutes.d.ts +5 -0
- package/cjs/utils/navigationRoutes.js +31 -4
- package/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
- package/components/ActiveSwaps/ActiveSwapItem.js +41 -0
- package/components/{SwapsInProgress/SwapsInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
- package/components/ActiveSwaps/ActiveSwaps.js +26 -0
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
- package/components/ActiveSwaps/ActiveSwaps.style.js +37 -0
- package/components/ActiveSwaps/index.d.ts +2 -0
- package/components/ActiveSwaps/index.js +2 -0
- package/components/AppContainer.js +1 -1
- package/components/Card/Card.d.ts +7 -4
- package/components/Card/Card.js +39 -29
- package/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +0 -0
- package/components/ChainSelect/ChainSelect.js +31 -0
- package/components/{SwapsInProgress/SwapsInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
- package/components/ChainSelect/ChainSelect.style.js +16 -0
- package/components/ChainSelect/index.d.ts +2 -0
- package/components/ChainSelect/index.js +2 -0
- package/components/ChainSelect/useChainSelect.d.ts +8 -0
- package/components/ChainSelect/useChainSelect.js +29 -0
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +3 -3
- package/components/Header/Header.js +1 -9
- package/components/Header/NavigationHeader.js +6 -11
- package/components/Header/useHeaderActionStore.d.ts +0 -2
- package/components/Header/useHeaderActionStore.js +0 -3
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.style.js +1 -0
- package/components/SelectChainAndToken.js +1 -1
- package/components/SendToWallet/SendToWallet.js +6 -6
- package/components/Step/CircularProgress.js +3 -3
- package/components/Step/CircularProgress.style.js +1 -1
- package/components/Step/StepProcess.js +2 -6
- package/components/Step/StepProcess.style.d.ts +1 -1
- package/components/Step/StepTimer.d.ts +1 -0
- package/components/Step/StepTimer.js +6 -6
- package/components/SwapButton/SwapButton.js +7 -34
- package/components/SwapButton/types.d.ts +2 -2
- package/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/components/TokenList/TokenList.js +7 -3
- package/components/TokenList/TokenList.style.js +4 -3
- package/components/TokenList/TokenListItem.js +1 -1
- package/components/TokenList/TokenNotFound.d.ts +2 -1
- package/components/TokenList/TokenNotFound.js +12 -2
- package/components/TokenList/types.d.ts +2 -2
- package/config/theme.js +24 -23
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +2 -0
- package/hooks/useChains.d.ts +1 -97
- package/hooks/useChains.js +26 -20
- package/hooks/useFeaturedTokens.d.ts +1 -1
- package/hooks/useFeaturedTokens.js +6 -3
- package/hooks/useGasSufficiency.d.ts +1 -1
- package/hooks/useGasSufficiency.js +32 -24
- package/hooks/useInitializer.js +6 -0
- package/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
- package/{pages/SwapPage/utils.js → hooks/useProcessMessage.js} +15 -10
- package/hooks/useRouteExecution.d.ts +1 -1
- package/hooks/useRouteExecution.js +26 -35
- package/hooks/useSwapRoutes.js +3 -4
- package/hooks/useToken.d.ts +0 -1
- package/hooks/useToken.js +1 -2
- package/hooks/useTokenBalances.d.ts +1 -2
- package/hooks/useTokenBalances.js +4 -5
- package/hooks/useTokenSearch.js +3 -2
- package/hooks/useTokens.d.ts +1 -2
- package/hooks/useTokens.js +32 -9
- package/hooks/useTools.js +11 -5
- package/hooks/useWidgetEvents.d.ts +3 -0
- package/hooks/useWidgetEvents.js +6 -0
- package/i18n/en/translation.json +14 -10
- package/i18n/index.d.ts +11 -7
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +15 -14
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +14 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.js +17 -0
- package/pages/ActiveSwapsPage/index.d.ts +1 -0
- package/pages/ActiveSwapsPage/index.js +1 -0
- package/pages/MainPage/MainPage.js +2 -3
- package/pages/MainPage/MainSwapButton.js +3 -1
- package/pages/MainPage/SwapRoutes.js +4 -1
- package/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
- package/pages/SelectChainPage/SelectChainPage.js +29 -0
- package/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
- package/pages/SelectChainPage/SelectChainPage.style.js +17 -0
- package/pages/SelectChainPage/index.d.ts +1 -0
- package/pages/SelectChainPage/index.js +1 -0
- package/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
- package/pages/SelectTokenPage/SelectTokenPage.js +2 -2
- package/pages/SelectWalletPage/SelectWalletPage.js +5 -5
- package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- package/pages/SettingsPage/AdvancedPreferences.js +2 -2
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledBridgesSelect.js +4 -7
- package/pages/SettingsPage/EnabledExchangesSelect.js +4 -6
- package/pages/SettingsPage/GasPriceSelect.js +2 -2
- package/pages/SettingsPage/RoutePrioritySelect.js +7 -3
- package/pages/SettingsPage/ShowDestinationWallet.js +2 -2
- package/pages/SettingsPage/SlippageInput.js +2 -2
- package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -5
- package/pages/SwapHistoryPage/SwapHistoryPage.js +3 -4
- package/pages/SwapPage/StatusBottomSheet.js +27 -38
- package/pages/SwapPage/SwapPage.js +16 -3
- package/pages/SwapRoutesPage/SwapRoutesPage.js +5 -4
- package/providers/SDKProvider/SDKProvider.d.ts +4 -0
- package/providers/SDKProvider/SDKProvider.js +19 -0
- package/providers/SDKProvider/index.d.ts +1 -0
- package/providers/SDKProvider/index.js +1 -0
- package/providers/SwapFormProvider/SwapFormProvider.js +4 -30
- package/providers/SwapFormProvider/types.d.ts +5 -5
- package/providers/TelemetryProvider/TelemetryProvider.d.ts +4 -0
- package/providers/TelemetryProvider/TelemetryProvider.js +7 -0
- package/providers/TelemetryProvider/index.d.ts +1 -0
- package/providers/TelemetryProvider/index.js +1 -0
- package/providers/WalletProvider/WalletProvider.d.ts +1 -4
- package/providers/WalletProvider/WalletProvider.js +59 -1
- package/providers/WidgetProvider/WidgetProvider.js +3 -18
- package/providers/WidgetProvider/index.d.ts +1 -0
- package/providers/WidgetProvider/index.js +1 -0
- package/providers/WidgetProvider/utils.d.ts +4 -0
- package/providers/WidgetProvider/utils.js +9 -0
- package/providers/index.d.ts +2 -0
- package/providers/index.js +2 -0
- package/stores/chains/index.d.ts +3 -0
- package/stores/chains/index.js +3 -0
- package/stores/chains/types.d.ts +8 -0
- package/stores/chains/types.js +1 -0
- package/stores/chains/useChainOrder.d.ts +1 -0
- package/stores/chains/useChainOrder.js +5 -0
- package/stores/chains/useChainOrderStore.d.ts +19 -0
- package/stores/chains/useChainOrderStore.js +39 -0
- package/stores/route/index.d.ts +2 -1
- package/stores/route/index.js +2 -1
- package/stores/route/useExecutingRoutesIds.d.ts +1 -0
- package/stores/route/useExecutingRoutesIds.js +13 -0
- package/stores/route/useRouteStore.js +5 -4
- package/stores/route/utils.d.ts +4 -0
- package/stores/route/utils.js +15 -0
- package/stores/settings/index.d.ts +0 -1
- package/stores/settings/index.js +0 -1
- package/stores/settings/useAppearance.js +3 -1
- package/stores/settings/useSettingsStore.js +5 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/events.d.ts +5 -0
- package/types/events.js +6 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/widget.d.ts +31 -23
- package/utils/colors.d.ts +1 -1
- package/utils/navigationRoutes.d.ts +5 -0
- package/utils/navigationRoutes.js +30 -3
- package/cjs/components/SwapButton/SwapButton.style.d.ts +0 -65
- package/cjs/components/SwapButton/SwapButton.style.js +0 -15
- package/cjs/components/SwapsInProgress/SwapsInProgress.js +0 -29
- package/cjs/components/SwapsInProgress/SwapsInProgress.style.js +0 -17
- package/cjs/components/SwapsInProgress/index.d.ts +0 -1
- package/cjs/config/lifi.d.ts +0 -4
- package/cjs/config/lifi.js +0 -14
- package/cjs/pages/SelectTokenPage/ChainSelect.js +0 -31
- package/cjs/pages/SwapPage/utils.d.ts +0 -6
- package/cjs/pages/SwapPage/utils.js +0 -93
- package/cjs/stores/route/useExecutingRoutes.d.ts +0 -2
- package/cjs/stores/route/useExecutingRoutes.js +0 -13
- package/cjs/stores/settings/useSetSettings.d.ts +0 -5
- package/cjs/stores/settings/useSetSettings.js +0 -12
- package/components/Step/utils.js +0 -89
- package/components/SwapButton/SwapButton.style.d.ts +0 -65
- package/components/SwapButton/SwapButton.style.js +0 -12
- package/components/SwapsInProgress/SwapsInProgress.js +0 -25
- package/components/SwapsInProgress/SwapsInProgress.style.js +0 -14
- package/components/SwapsInProgress/index.d.ts +0 -1
- package/components/SwapsInProgress/index.js +0 -1
- package/config/lifi.d.ts +0 -4
- package/config/lifi.js +0 -7
- package/pages/SelectTokenPage/ChainSelect.js +0 -27
- package/pages/SwapPage/utils.d.ts +0 -6
- package/stores/route/useExecutingRoutes.d.ts +0 -2
- package/stores/route/useExecutingRoutes.js +0 -6
- package/stores/settings/useSetSettings.d.ts +0 -5
- package/stores/settings/useSetSettings.js +0 -5
|
@@ -16,19 +16,28 @@ exports.useRouteExecution = void 0;
|
|
|
16
16
|
const react_query_1 = require("@tanstack/react-query");
|
|
17
17
|
const react_1 = require("react");
|
|
18
18
|
const shallow_1 = __importDefault(require("zustand/shallow"));
|
|
19
|
-
const
|
|
20
|
-
const WalletProvider_1 = require("../providers/WalletProvider");
|
|
19
|
+
const providers_1 = require("../providers");
|
|
21
20
|
const stores_1 = require("../stores");
|
|
21
|
+
const events_1 = require("../types/events");
|
|
22
22
|
const utils_1 = require("../utils");
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const useWidgetEvents_1 = require("./useWidgetEvents");
|
|
24
|
+
const useRouteExecution = (routeId, executeInBackground) => {
|
|
25
|
+
const lifi = (0, providers_1.useLiFi)();
|
|
26
|
+
const { account, switchChain } = (0, providers_1.useWallet)();
|
|
25
27
|
const resumedAfterMount = (0, react_1.useRef)(false);
|
|
28
|
+
const emitter = (0, useWidgetEvents_1.useWidgetEvents)();
|
|
26
29
|
const routeExecution = (0, stores_1.useRouteStore)((state) => state.routes[routeId]);
|
|
27
30
|
const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.useRouteStore)((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow_1.default);
|
|
28
31
|
const updateCallback = (updatedRoute) => {
|
|
29
32
|
const clonedUpdatedRoute = (0, utils_1.deepClone)(updatedRoute);
|
|
30
33
|
console.log('Route updated.', clonedUpdatedRoute);
|
|
31
34
|
updateRoute(clonedUpdatedRoute);
|
|
35
|
+
if ((0, stores_1.isRouteCompleted)(clonedUpdatedRoute)) {
|
|
36
|
+
emitter.emit(events_1.WidgetEvent.SwapCompleted);
|
|
37
|
+
}
|
|
38
|
+
if ((0, stores_1.isRouteFailed)(clonedUpdatedRoute)) {
|
|
39
|
+
emitter.emit(events_1.WidgetEvent.SwapFailed);
|
|
40
|
+
}
|
|
32
41
|
};
|
|
33
42
|
const switchChainHook = (requiredChainId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
43
|
if (!account.isActive || !account.signer) {
|
|
@@ -50,20 +59,16 @@ const useRouteExecution = (routeId) => {
|
|
|
50
59
|
if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
|
|
51
60
|
throw Error('Execution route not found.');
|
|
52
61
|
}
|
|
53
|
-
return
|
|
62
|
+
return lifi.executeRoute(account.signer, routeExecution.route, {
|
|
54
63
|
updateCallback,
|
|
55
64
|
switchChainHook,
|
|
56
65
|
infiniteApproval: false,
|
|
66
|
+
executeInBackground,
|
|
57
67
|
});
|
|
58
68
|
}, {
|
|
59
69
|
onMutate: () => {
|
|
60
70
|
console.log('Execution started.', routeId);
|
|
61
|
-
|
|
62
|
-
onError: () => {
|
|
63
|
-
console.warn('Execution failed.', routeId);
|
|
64
|
-
},
|
|
65
|
-
onSuccess: (route) => {
|
|
66
|
-
console.log('Executed successfully.', routeId);
|
|
71
|
+
emitter.emit(events_1.WidgetEvent.SwapStarted);
|
|
67
72
|
},
|
|
68
73
|
});
|
|
69
74
|
const resumeRouteMutation = (0, react_query_1.useMutation)((resumedRoute) => {
|
|
@@ -73,30 +78,25 @@ const useRouteExecution = (routeId) => {
|
|
|
73
78
|
if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
|
|
74
79
|
throw Error('Execution route not found.');
|
|
75
80
|
}
|
|
76
|
-
return
|
|
81
|
+
return lifi.resumeRoute(account.signer, resumedRoute !== null && resumedRoute !== void 0 ? resumedRoute : routeExecution.route, {
|
|
77
82
|
updateCallback,
|
|
78
83
|
switchChainHook,
|
|
79
84
|
infiniteApproval: false,
|
|
85
|
+
executeInBackground,
|
|
80
86
|
});
|
|
81
87
|
}, {
|
|
82
88
|
onMutate: () => {
|
|
83
89
|
console.log('Resumed to execution.', routeId);
|
|
84
90
|
},
|
|
85
|
-
onError: () => {
|
|
86
|
-
console.warn('Resumed execution failed.', routeId);
|
|
87
|
-
},
|
|
88
|
-
onSuccess: (route) => {
|
|
89
|
-
console.log('Resumed execution successful.', route);
|
|
90
|
-
},
|
|
91
91
|
});
|
|
92
92
|
const executeRoute = (0, react_1.useCallback)(() => {
|
|
93
93
|
executeRouteMutation.mutateAsync(undefined, {
|
|
94
94
|
onError: () => {
|
|
95
|
-
console.warn('
|
|
95
|
+
console.warn('Execution failed!', routeId);
|
|
96
96
|
// Notification.showNotification(NotificationType.SwapExecution_ERROR);
|
|
97
97
|
},
|
|
98
98
|
onSuccess: (route) => {
|
|
99
|
-
console.log('
|
|
99
|
+
console.log('Executed successfully!', route);
|
|
100
100
|
// Notification.showNotification(NotificationType.TRANSACTION_SUCCESSFULL);
|
|
101
101
|
},
|
|
102
102
|
});
|
|
@@ -104,10 +104,10 @@ const useRouteExecution = (routeId) => {
|
|
|
104
104
|
const resumeRoute = (0, react_1.useCallback)((route) => {
|
|
105
105
|
resumeRouteMutation.mutateAsync(route, {
|
|
106
106
|
onError: () => {
|
|
107
|
-
console.warn('
|
|
107
|
+
console.warn('Resumed execution failed.', routeId);
|
|
108
108
|
},
|
|
109
109
|
onSuccess: (route) => {
|
|
110
|
-
console.log('
|
|
110
|
+
console.log('Resumed execution successful.', route);
|
|
111
111
|
},
|
|
112
112
|
});
|
|
113
113
|
}, [resumeRouteMutation, routeId]);
|
|
@@ -123,7 +123,7 @@ const useRouteExecution = (routeId) => {
|
|
|
123
123
|
// Resume route execution after page reload
|
|
124
124
|
(0, react_1.useEffect)(() => {
|
|
125
125
|
// Check if route is eligible for automatic resuming
|
|
126
|
-
if (
|
|
126
|
+
if ((0, stores_1.isRouteActive)(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route) &&
|
|
127
127
|
account.isActive &&
|
|
128
128
|
!resumedAfterMount.current) {
|
|
129
129
|
resumedAfterMount.current = true;
|
|
@@ -135,14 +135,14 @@ const useRouteExecution = (routeId) => {
|
|
|
135
135
|
return () => {
|
|
136
136
|
var _a;
|
|
137
137
|
const route = (_a = stores_1.useRouteStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
|
|
138
|
-
if (!route || !
|
|
138
|
+
if (!route || !(0, stores_1.isRouteActive)(route)) {
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
lifi.updateRouteExecution(route, { executeInBackground: true });
|
|
142
142
|
console.log('Move route execution to background.', routeId);
|
|
143
143
|
resumedAfterMount.current = false;
|
|
144
144
|
};
|
|
145
|
-
}, [routeId]);
|
|
145
|
+
}, [lifi, routeId]);
|
|
146
146
|
return {
|
|
147
147
|
executeRoute,
|
|
148
148
|
restartRoute: restartRouteMutation,
|
|
@@ -152,12 +152,3 @@ const useRouteExecution = (routeId) => {
|
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
154
|
exports.useRouteExecution = useRouteExecution;
|
|
155
|
-
const isActiveRoute = (route) => {
|
|
156
|
-
if (!route) {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
const allDone = route.steps.every((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE'; });
|
|
160
|
-
const isFailed = route.steps.some((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
|
|
161
|
-
const alreadyStarted = route.steps.some((step) => step.execution);
|
|
162
|
-
return !allDone && !isFailed && alreadyStarted;
|
|
163
|
-
};
|
|
@@ -18,14 +18,13 @@ const react_query_1 = require("@tanstack/react-query");
|
|
|
18
18
|
const big_js_1 = __importDefault(require("big.js"));
|
|
19
19
|
const react_hook_form_1 = require("react-hook-form");
|
|
20
20
|
const _1 = require(".");
|
|
21
|
-
const
|
|
22
|
-
const SwapFormProvider_1 = require("../providers/SwapFormProvider");
|
|
23
|
-
const WalletProvider_1 = require("../providers/WalletProvider");
|
|
21
|
+
const providers_1 = require("../providers");
|
|
24
22
|
const stores_1 = require("../stores");
|
|
25
23
|
const refetchTime = 60000;
|
|
26
24
|
const useSwapRoutes = () => {
|
|
27
25
|
var _a;
|
|
28
|
-
const
|
|
26
|
+
const lifi = (0, providers_1.useLiFi)();
|
|
27
|
+
const { account, provider } = (0, providers_1.useWallet)();
|
|
29
28
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
30
29
|
const { slippage, enabledBridges, enabledExchanges, routePriority } = (0, stores_1.useSettings)([
|
|
31
30
|
'slippage',
|
|
@@ -35,14 +34,14 @@ const useSwapRoutes = () => {
|
|
|
35
34
|
]);
|
|
36
35
|
const [fromChainId, fromTokenAddress, toChainId, toTokenAddress, toAddress] = (0, react_hook_form_1.useWatch)({
|
|
37
36
|
name: [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
providers_1.SwapFormKey.FromChain,
|
|
38
|
+
providers_1.SwapFormKey.FromToken,
|
|
39
|
+
providers_1.SwapFormKey.ToChain,
|
|
40
|
+
providers_1.SwapFormKey.ToToken,
|
|
41
|
+
providers_1.SwapFormKey.ToAddress,
|
|
43
42
|
],
|
|
44
43
|
});
|
|
45
|
-
const [fromTokenAmount] = (0, _1.useDebouncedWatch)([
|
|
44
|
+
const [fromTokenAmount] = (0, _1.useDebouncedWatch)([providers_1.SwapFormKey.FromAmount], 250);
|
|
46
45
|
const { token } = (0, _1.useToken)(fromChainId, fromTokenAddress);
|
|
47
46
|
const isEnabled =
|
|
48
47
|
// Boolean(account.address) &&
|
|
@@ -81,7 +80,7 @@ const useSwapRoutes = () => {
|
|
|
81
80
|
catch (_d) {
|
|
82
81
|
toWalletAddress = (0, address_1.isAddress)(toAddress) ? toAddress : fromAddress;
|
|
83
82
|
}
|
|
84
|
-
return
|
|
83
|
+
return lifi.getRoutes({
|
|
85
84
|
fromChainId,
|
|
86
85
|
fromAmount: (0, big_js_1.default)(Number(fromTokenAmount) * Math.pow(10, ((_c = token === null || token === void 0 ? void 0 : token.decimals) !== null && _c !== void 0 ? _c : 0))).toString(),
|
|
87
86
|
fromTokenAddress,
|
package/cjs/hooks/useToken.d.ts
CHANGED
package/cjs/hooks/useToken.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.useToken = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useTokens_1 = require("./useTokens");
|
|
6
6
|
const useToken = (chainId, tokenAddress) => {
|
|
7
|
-
const { tokens, isLoading
|
|
7
|
+
const { tokens, isLoading } = (0, useTokens_1.useTokens)(chainId);
|
|
8
8
|
const token = (0, react_1.useMemo)(() => {
|
|
9
9
|
const token = tokens === null || tokens === void 0 ? void 0 : tokens.find((token) => token.address === tokenAddress && token.chainId === chainId);
|
|
10
10
|
return token;
|
|
@@ -12,7 +12,6 @@ const useToken = (chainId, tokenAddress) => {
|
|
|
12
12
|
return {
|
|
13
13
|
token,
|
|
14
14
|
isLoading,
|
|
15
|
-
isFetching,
|
|
16
15
|
};
|
|
17
16
|
};
|
|
18
17
|
exports.useToken = useToken;
|
|
@@ -2,9 +2,8 @@ import type { Token } from '../types';
|
|
|
2
2
|
export declare const useTokenBalances: (selectedChainId: number) => {
|
|
3
3
|
tokens: Token[] | undefined;
|
|
4
4
|
tokensWithBalance: Token[] | undefined;
|
|
5
|
-
featuredTokens: import("@lifi/types").Token[]
|
|
5
|
+
featuredTokens: import("@lifi/types").Token[];
|
|
6
6
|
isLoading: boolean;
|
|
7
7
|
isBalanceLoading: boolean;
|
|
8
|
-
isBalanceFetched: boolean;
|
|
9
8
|
refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<Token[] | undefined, unknown>>;
|
|
10
9
|
};
|
|
@@ -13,24 +13,24 @@ exports.useTokenBalances = void 0;
|
|
|
13
13
|
/* eslint-disable consistent-return */
|
|
14
14
|
const react_query_1 = require("@tanstack/react-query");
|
|
15
15
|
const react_1 = require("react");
|
|
16
|
-
const
|
|
17
|
-
const WalletProvider_1 = require("../providers/WalletProvider");
|
|
16
|
+
const providers_1 = require("../providers");
|
|
18
17
|
const utils_1 = require("../utils");
|
|
19
18
|
const useFeaturedTokens_1 = require("./useFeaturedTokens");
|
|
20
19
|
const useTokens_1 = require("./useTokens");
|
|
21
20
|
const defaultRefetchInterval = 60000;
|
|
22
21
|
const minRefetchInterval = 1000;
|
|
23
22
|
const useTokenBalances = (selectedChainId) => {
|
|
24
|
-
const
|
|
23
|
+
const lifi = (0, providers_1.useLiFi)();
|
|
24
|
+
const { account } = (0, providers_1.useWallet)();
|
|
25
25
|
const featuredTokens = (0, useFeaturedTokens_1.useFeaturedTokens)(selectedChainId);
|
|
26
26
|
const { tokens, isLoading } = (0, useTokens_1.useTokens)(selectedChainId);
|
|
27
27
|
const [refetchInterval, setRefetchInterval] = (0, react_1.useState)(defaultRefetchInterval);
|
|
28
28
|
const isBalanceLoadingEnabled = Boolean(account.address) && Boolean(tokens === null || tokens === void 0 ? void 0 : tokens.length);
|
|
29
|
-
const { data: tokensWithBalance, isLoading: isBalanceLoading,
|
|
29
|
+
const { data: tokensWithBalance, isLoading: isBalanceLoading, refetch, } = (0, react_query_1.useQuery)(['token-balances', account.address, selectedChainId, tokens === null || tokens === void 0 ? void 0 : tokens.length], ({ queryKey: [, accountAddress] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
30
|
if (!accountAddress || !tokens) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
const tokenBalances = yield
|
|
33
|
+
const tokenBalances = yield lifi.getTokenBalances(accountAddress, tokens);
|
|
34
34
|
if (!(tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length)) {
|
|
35
35
|
// Sometimes RPCs (e.g. Arbitrum) don't return balances on first call
|
|
36
36
|
// TODO: fix and remove backplane
|
|
@@ -73,7 +73,6 @@ const useTokenBalances = (selectedChainId) => {
|
|
|
73
73
|
featuredTokens,
|
|
74
74
|
isLoading,
|
|
75
75
|
isBalanceLoading: isBalanceLoading && isBalanceLoadingEnabled,
|
|
76
|
-
isBalanceFetched,
|
|
77
76
|
refetch,
|
|
78
77
|
};
|
|
79
78
|
};
|
|
@@ -11,11 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.useTokenSearch = void 0;
|
|
13
13
|
const react_query_1 = require("@tanstack/react-query");
|
|
14
|
-
const
|
|
14
|
+
const providers_1 = require("../providers");
|
|
15
15
|
const useTokenSearch = (token, chainId, enabled) => {
|
|
16
|
+
const lifi = (0, providers_1.useLiFi)();
|
|
16
17
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
17
18
|
const { data, isLoading, isFetching, isFetched } = (0, react_query_1.useQuery)(['token-search', chainId, token], ({ queryKey: [, chainId, token], signal }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
const data = yield
|
|
19
|
+
const data = yield lifi.getToken(chainId, token, {
|
|
19
20
|
signal,
|
|
20
21
|
});
|
|
21
22
|
if (data) {
|
package/cjs/hooks/useTokens.d.ts
CHANGED
package/cjs/hooks/useTokens.js
CHANGED
|
@@ -11,26 +11,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.useTokens = void 0;
|
|
13
13
|
const react_query_1 = require("@tanstack/react-query");
|
|
14
|
-
const
|
|
14
|
+
const providers_1 = require("../providers");
|
|
15
15
|
const useFeaturedTokens_1 = require("./useFeaturedTokens");
|
|
16
16
|
const useTokens = (selectedChainId) => {
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
|
+
const lifi = (0, providers_1.useLiFi)();
|
|
17
19
|
const featuredTokens = (0, useFeaturedTokens_1.useFeaturedTokens)(selectedChainId);
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const { tokens, chains, disabledChains } = (0, providers_1.useWidgetConfig)();
|
|
21
|
+
const { data, isLoading } = (0, react_query_1.useQuery)([
|
|
22
|
+
'tokens',
|
|
23
|
+
selectedChainId,
|
|
24
|
+
featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.length,
|
|
25
|
+
(_a = tokens === null || tokens === void 0 ? void 0 : tokens.allow) === null || _a === void 0 ? void 0 : _a.length,
|
|
26
|
+
(_b = tokens === null || tokens === void 0 ? void 0 : tokens.deny) === null || _b === void 0 ? void 0 : _b.length,
|
|
27
|
+
(_c = chains === null || chains === void 0 ? void 0 : chains.allow) === null || _c === void 0 ? void 0 : _c.length,
|
|
28
|
+
(_d = chains === null || chains === void 0 ? void 0 : chains.deny) === null || _d === void 0 ? void 0 : _d.length,
|
|
29
|
+
], () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
var _e, _f, _g, _h, _j;
|
|
31
|
+
const chainAllowed = selectedChainId &&
|
|
32
|
+
(0, providers_1.isItemAllowed)(selectedChainId, chains, disabledChains);
|
|
33
|
+
if (!chainAllowed) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
let filteredTokens = (_e = tokens === null || tokens === void 0 ? void 0 : tokens.allow) === null || _e === void 0 ? void 0 : _e.filter((token) => token.chainId === selectedChainId);
|
|
37
|
+
if (!(filteredTokens === null || filteredTokens === void 0 ? void 0 : filteredTokens.length)) {
|
|
38
|
+
const data = yield lifi.getTokens({ chains: [selectedChainId] });
|
|
39
|
+
filteredTokens = (_f = data.tokens) === null || _f === void 0 ? void 0 : _f[selectedChainId];
|
|
40
|
+
}
|
|
41
|
+
const deniedTokenAddresses = (_g = tokens === null || tokens === void 0 ? void 0 : tokens.deny) === null || _g === void 0 ? void 0 : _g.filter((token) => token.chainId === selectedChainId).map((token) => token.address);
|
|
42
|
+
if (deniedTokenAddresses === null || deniedTokenAddresses === void 0 ? void 0 : deniedTokenAddresses.length) {
|
|
43
|
+
filteredTokens = filteredTokens === null || filteredTokens === void 0 ? void 0 : filteredTokens.filter((token) => !deniedTokenAddresses.includes(token.address));
|
|
44
|
+
}
|
|
21
45
|
const featuredTokenAddresses = new Set(featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.map((token) => token.address));
|
|
22
46
|
return [
|
|
23
|
-
...((
|
|
47
|
+
...((_h = featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.map((token) => {
|
|
24
48
|
token.featured = true;
|
|
25
49
|
return token;
|
|
26
|
-
})) !== null &&
|
|
27
|
-
...((
|
|
50
|
+
})) !== null && _h !== void 0 ? _h : []),
|
|
51
|
+
...((_j = filteredTokens === null || filteredTokens === void 0 ? void 0 : filteredTokens.filter((token) => !featuredTokenAddresses.has(token.address))) !== null && _j !== void 0 ? _j : []),
|
|
28
52
|
];
|
|
29
53
|
}));
|
|
30
54
|
return {
|
|
31
|
-
tokens,
|
|
55
|
+
tokens: data,
|
|
32
56
|
isLoading,
|
|
33
|
-
isFetching,
|
|
34
57
|
};
|
|
35
58
|
};
|
|
36
59
|
exports.useTokens = useTokens;
|
package/cjs/hooks/useTools.js
CHANGED
|
@@ -3,14 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useTools = void 0;
|
|
4
4
|
const react_query_1 = require("@tanstack/react-query");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const providers_1 = require("../providers");
|
|
7
7
|
const stores_1 = require("../stores");
|
|
8
8
|
const useTools = () => {
|
|
9
|
-
const
|
|
10
|
-
const {
|
|
9
|
+
const lifi = (0, providers_1.useLiFi)();
|
|
10
|
+
const { bridges, exchanges } = (0, providers_1.useWidgetConfig)();
|
|
11
|
+
const { data } = (0, react_query_1.useQuery)(['tools'], ({ signal }) => lifi.getTools(undefined, { signal }), {
|
|
11
12
|
onSuccess(data) {
|
|
12
|
-
initializeTools
|
|
13
|
-
initializeTools('
|
|
13
|
+
const { initializeTools } = stores_1.useSettingsStore.getState();
|
|
14
|
+
initializeTools('Bridges', data.bridges
|
|
15
|
+
.filter((bridge) => (0, providers_1.isItemAllowed)(bridge.key, bridges))
|
|
16
|
+
.map((bridge) => bridge.key));
|
|
17
|
+
initializeTools('Exchanges', data.exchanges
|
|
18
|
+
.filter((exchange) => (0, providers_1.isItemAllowed)(exchange.key, exchanges))
|
|
19
|
+
.map((exchange) => exchange.key));
|
|
14
20
|
},
|
|
15
21
|
});
|
|
16
22
|
const formattedTools = (0, react_1.useMemo)(() => ({
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useWidgetEvents = void 0;
|
|
7
|
+
const events_1 = require("events");
|
|
8
|
+
const zustand_1 = __importDefault(require("zustand"));
|
|
9
|
+
const emitterStore = (0, zustand_1.default)()(() => new events_1.EventEmitter());
|
|
10
|
+
const useWidgetEvents = () => {
|
|
11
|
+
return emitterStore();
|
|
12
|
+
};
|
|
13
|
+
exports.useWidgetEvents = useWidgetEvents;
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
"swap": "Swap",
|
|
7
7
|
"from": "Swap from",
|
|
8
8
|
"to": "Swap to",
|
|
9
|
+
"selectChain": "Select chain",
|
|
9
10
|
"settings": "Settings",
|
|
10
11
|
"routes": "You get",
|
|
11
12
|
"swapHistory": "Swap history",
|
|
12
|
-
"swapDetails": "Swap details"
|
|
13
|
+
"swapDetails": "Swap details",
|
|
14
|
+
"activeSwaps": "Active swaps"
|
|
13
15
|
},
|
|
14
16
|
"button": {
|
|
15
17
|
"connectWallet": "Connect wallet",
|
|
16
|
-
"switchChain": "Switch chain",
|
|
17
18
|
"swap": "Swap",
|
|
18
19
|
"reviewSwap": "Review swap",
|
|
19
20
|
"startSwap": "Start swap",
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
"delete": "Delete",
|
|
32
33
|
"hide": "Hide",
|
|
33
34
|
"max": "max",
|
|
35
|
+
"showAll": "Show all",
|
|
34
36
|
"contactSupport": "Contact support",
|
|
35
37
|
"lifiSwap": "LI.FI Swap"
|
|
36
38
|
},
|
|
@@ -53,8 +55,6 @@
|
|
|
53
55
|
"featuredTokens": "Featured tokens",
|
|
54
56
|
"otherTokens": "Other tokens",
|
|
55
57
|
"inProgress": "in progress",
|
|
56
|
-
"activeTransfers": "Active transfers",
|
|
57
|
-
"couldntFindTokens": "We couldn't find tokens on this chain or you don't have any.",
|
|
58
58
|
"stepSwap": "Swap",
|
|
59
59
|
"stepBridge": "Bridge",
|
|
60
60
|
"stepSwapAndBridge": "Swap and bridge",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"swapStepDetails": "Swap on {{chain}} via {{tool}}",
|
|
64
64
|
"tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
|
|
65
65
|
"tokenOnChainAmount": "{{amount}} {{tokenSymbol}} on {{chainName}}",
|
|
66
|
-
"
|
|
66
|
+
"supportId": "Support ID",
|
|
67
67
|
"sendToWallet": "Send to a different wallet",
|
|
68
68
|
"walletAddressOrEns": "Wallet address or ENS name",
|
|
69
69
|
"tags": {
|
|
@@ -84,11 +84,14 @@
|
|
|
84
84
|
"info": {
|
|
85
85
|
"title": {
|
|
86
86
|
"routeNotFound": "No routes available",
|
|
87
|
-
"emptySwapHistory": "No recent swaps"
|
|
87
|
+
"emptySwapHistory": "No recent swaps",
|
|
88
|
+
"emptyActiveSwaps": "No active swaps"
|
|
88
89
|
},
|
|
89
90
|
"message": {
|
|
90
91
|
"routeNotFound": "Try another token combination.",
|
|
91
|
-
"emptySwapHistory": "Swap history is only stored locally and will be deleted if you clear your browser data."
|
|
92
|
+
"emptySwapHistory": "Swap history is only stored locally and will be deleted if you clear your browser data.",
|
|
93
|
+
"emptyActiveSwaps": "Swaps in progress will appear here. Once completed, find them in swap history.",
|
|
94
|
+
"emptyTokenList": "We couldn't find tokens on {{chainName}} chain or you don't have any. Please try search again or choose another chain."
|
|
92
95
|
}
|
|
93
96
|
},
|
|
94
97
|
"warning": {
|
|
@@ -105,18 +108,19 @@
|
|
|
105
108
|
},
|
|
106
109
|
"error": {
|
|
107
110
|
"title": {
|
|
111
|
+
"failed": "Swap failed.",
|
|
108
112
|
"chainSwitch": "Chain switch required.",
|
|
109
113
|
"transactionFailed": "Transaction has failed.",
|
|
110
114
|
"transactionUnderpriced": "Transaction is underpriced.",
|
|
111
115
|
"transactionUnprepared": "Unable to prepare transaction.",
|
|
116
|
+
"transactionRejected": "Signature required.",
|
|
112
117
|
"unknown": "Something went wrong.",
|
|
113
|
-
"userRejectedSignatureRequest": "Signature required.",
|
|
114
118
|
"slippageTooLarge": "Slippage too large.",
|
|
115
119
|
"walletAddressInvalid": "Wallet address is invalid.",
|
|
116
120
|
"walletEnsAddressInvalid": "Wallet address is invalid or network doesn't support ENS."
|
|
117
121
|
},
|
|
118
122
|
"message": {
|
|
119
|
-
"
|
|
123
|
+
"transactionRejected": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
|
|
120
124
|
"transactionFailed": "Please check the block explorer for more information.",
|
|
121
125
|
"transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}}).",
|
|
122
126
|
"slippageTooLarge": "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote."
|
|
@@ -129,7 +133,7 @@
|
|
|
129
133
|
"done": "Token allowance approved."
|
|
130
134
|
},
|
|
131
135
|
"switchChain": {
|
|
132
|
-
"
|
|
136
|
+
"actionRequired": "Chain switch required.",
|
|
133
137
|
"done": "Chain switched successfully."
|
|
134
138
|
},
|
|
135
139
|
"swap": {
|
package/cjs/i18n/index.d.ts
CHANGED
|
@@ -9,14 +9,15 @@ export declare const resources: {
|
|
|
9
9
|
swap: string;
|
|
10
10
|
from: string;
|
|
11
11
|
to: string;
|
|
12
|
+
selectChain: string;
|
|
12
13
|
settings: string;
|
|
13
14
|
routes: string;
|
|
14
15
|
swapHistory: string;
|
|
15
16
|
swapDetails: string;
|
|
17
|
+
activeSwaps: string;
|
|
16
18
|
};
|
|
17
19
|
button: {
|
|
18
20
|
connectWallet: string;
|
|
19
|
-
switchChain: string;
|
|
20
21
|
swap: string;
|
|
21
22
|
reviewSwap: string;
|
|
22
23
|
startSwap: string;
|
|
@@ -34,6 +35,7 @@ export declare const resources: {
|
|
|
34
35
|
delete: string;
|
|
35
36
|
hide: string;
|
|
36
37
|
max: string;
|
|
38
|
+
showAll: string;
|
|
37
39
|
contactSupport: string;
|
|
38
40
|
lifiSwap: string;
|
|
39
41
|
};
|
|
@@ -56,8 +58,6 @@ export declare const resources: {
|
|
|
56
58
|
featuredTokens: string;
|
|
57
59
|
otherTokens: string;
|
|
58
60
|
inProgress: string;
|
|
59
|
-
activeTransfers: string;
|
|
60
|
-
couldntFindTokens: string;
|
|
61
61
|
stepSwap: string;
|
|
62
62
|
stepBridge: string;
|
|
63
63
|
stepSwapAndBridge: string;
|
|
@@ -66,7 +66,7 @@ export declare const resources: {
|
|
|
66
66
|
swapStepDetails: string;
|
|
67
67
|
tokenOnChain: string;
|
|
68
68
|
tokenOnChainAmount: string;
|
|
69
|
-
|
|
69
|
+
supportId: string;
|
|
70
70
|
sendToWallet: string;
|
|
71
71
|
walletAddressOrEns: string;
|
|
72
72
|
tags: {
|
|
@@ -88,10 +88,13 @@ export declare const resources: {
|
|
|
88
88
|
title: {
|
|
89
89
|
routeNotFound: string;
|
|
90
90
|
emptySwapHistory: string;
|
|
91
|
+
emptyActiveSwaps: string;
|
|
91
92
|
};
|
|
92
93
|
message: {
|
|
93
94
|
routeNotFound: string;
|
|
94
95
|
emptySwapHistory: string;
|
|
96
|
+
emptyActiveSwaps: string;
|
|
97
|
+
emptyTokenList: string;
|
|
95
98
|
};
|
|
96
99
|
};
|
|
97
100
|
warning: {
|
|
@@ -108,18 +111,19 @@ export declare const resources: {
|
|
|
108
111
|
};
|
|
109
112
|
error: {
|
|
110
113
|
title: {
|
|
114
|
+
failed: string;
|
|
111
115
|
chainSwitch: string;
|
|
112
116
|
transactionFailed: string;
|
|
113
117
|
transactionUnderpriced: string;
|
|
114
118
|
transactionUnprepared: string;
|
|
119
|
+
transactionRejected: string;
|
|
115
120
|
unknown: string;
|
|
116
|
-
userRejectedSignatureRequest: string;
|
|
117
121
|
slippageTooLarge: string;
|
|
118
122
|
walletAddressInvalid: string;
|
|
119
123
|
walletEnsAddressInvalid: string;
|
|
120
124
|
};
|
|
121
125
|
message: {
|
|
122
|
-
|
|
126
|
+
transactionRejected: string;
|
|
123
127
|
transactionFailed: string;
|
|
124
128
|
transactionNotSent: string;
|
|
125
129
|
slippageTooLarge: string;
|
|
@@ -132,7 +136,7 @@ export declare const resources: {
|
|
|
132
136
|
done: string;
|
|
133
137
|
};
|
|
134
138
|
switchChain: {
|
|
135
|
-
|
|
139
|
+
actionRequired: string;
|
|
136
140
|
done: string;
|
|
137
141
|
};
|
|
138
142
|
swap: {
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './fonts/inter.css';
|
|
3
|
+
export { useWidgetEvents } from './hooks';
|
|
3
4
|
export * from './types';
|
|
4
5
|
export declare const LiFiWidget: import("react").FC<import("./AppProvider").AppProps>;
|
|
5
6
|
export declare const LiFiWidgetDrawer: import("react").ForwardRefExoticComponent<Pick<import("./AppDrawer").AppDrawerProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "transitionDuration" | "variant" | "open" | "anchor" | "elementRef" | "components" | "componentsProps" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "config" | "elevation" | "ModalProps" | "PaperProps" | "SlideProps"> & import("react").RefAttributes<import("./AppDrawer").AppDrawerBase>>;
|
package/cjs/index.js
CHANGED
|
@@ -14,11 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.LiFiWidgetDrawer = exports.LiFiWidget = void 0;
|
|
17
|
+
exports.LiFiWidgetDrawer = exports.LiFiWidget = exports.useWidgetEvents = void 0;
|
|
18
18
|
const App_1 = require("./App");
|
|
19
19
|
const AppDrawer_1 = require("./AppDrawer");
|
|
20
20
|
require("./fonts/inter.css");
|
|
21
21
|
const i18n_1 = require("./i18n");
|
|
22
|
+
var hooks_1 = require("./hooks");
|
|
23
|
+
Object.defineProperty(exports, "useWidgetEvents", { enumerable: true, get: function () { return hooks_1.useWidgetEvents; } });
|
|
22
24
|
__exportStar(require("./types"), exports);
|
|
23
25
|
(0, i18n_1.configureReactI18next)();
|
|
24
26
|
// ClassNameGenerator.configure((componentName) =>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActiveSwapsEmpty = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_i18next_1 = require("react-i18next");
|
|
8
|
+
const ActiveSwapsEmpty = () => {
|
|
9
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Container, Object.assign({ sx: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flex: 1,
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 48 }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.SwapHoriz, { fontSize: "inherit" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: 700 }, { children: t('swap.info.title.emptyActiveSwaps') })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2 }, { children: t('swap.info.message.emptyActiveSwaps') }))] })));
|
|
17
|
+
};
|
|
18
|
+
exports.ActiveSwapsEmpty = ActiveSwapsEmpty;
|