@lifi/widget 1.31.0 → 1.32.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 +4 -16
- package/AppDrawer.js +13 -7
- package/AppDrawer.style.d.ts +2 -2
- package/AppDrawer.style.js +1 -1
- package/AppProvider.js +2 -2
- package/AppRoutes.js +9 -0
- package/cjs/App.js +4 -16
- package/cjs/AppDrawer.js +13 -7
- package/cjs/AppDrawer.style.d.ts +2 -2
- package/cjs/AppDrawer.style.js +1 -1
- package/cjs/AppProvider.js +1 -1
- package/cjs/AppRoutes.js +9 -0
- package/cjs/components/ActiveSwaps/ActiveSwapItem.js +9 -7
- package/cjs/components/ActiveSwaps/ActiveSwaps.js +3 -3
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
- package/cjs/components/AppContainer.d.ts +2 -2
- package/cjs/components/AppContainer.js +1 -1
- package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/cjs/components/BottomSheet/BottomSheet.js +2 -2
- package/cjs/components/Card/Card.d.ts +2 -2
- package/cjs/components/Card/CardHeader.d.ts +1 -1
- package/cjs/components/Card/CardTitle.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/cjs/components/ChainSelect/ChainSelect.js +3 -4
- package/cjs/components/ChainSelect/ChainSelect.style.d.ts +3 -3
- package/cjs/components/ContractComponent/ContractComponent.js +1 -1
- package/cjs/components/Dialog.js +1 -1
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +13 -28
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +1 -1
- package/cjs/components/Header/Header.js +1 -1
- package/cjs/components/Header/Header.style.d.ts +3 -3
- package/cjs/components/Header/NavigationHeader.js +6 -2
- package/cjs/components/Header/WalletHeader.js +12 -22
- package/cjs/{pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts → components/ListItemButton.d.ts} +1 -2
- package/cjs/{pages/SelectWalletPage/SelectWalletPage.style.js → components/ListItemButton.js} +2 -8
- package/cjs/components/ListItemText.d.ts +2 -0
- package/cjs/{pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js → components/ListItemText.js} +1 -10
- package/cjs/components/NFT/NFT.js +2 -14
- package/cjs/components/NFT/NFT.style.d.ts +1 -1
- package/cjs/components/NotFound.js +2 -2
- package/cjs/components/PoweredBy/PoweredBy.js +2 -2
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +5 -17
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/cjs/components/Select.js +1 -0
- package/cjs/components/SelectChainAndToken.js +4 -4
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +2 -2
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWallet.js +9 -19
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWalletButton.js +5 -5
- package/cjs/components/SmallAvatar.d.ts +3 -3
- package/cjs/components/Step/CircularProgress.d.ts +0 -1
- package/cjs/components/Step/CircularProgress.js +2 -2
- package/cjs/components/Step/CircularProgress.style.d.ts +1 -1
- package/cjs/components/Step/DestinationWalletAddress.js +6 -7
- package/cjs/components/Step/GasStepProcess.js +8 -8
- package/cjs/components/Step/Step.js +4 -5
- package/cjs/components/Step/StepList.d.ts +0 -1
- package/cjs/components/Step/StepList.js +8 -4
- package/cjs/components/Step/StepProcess.js +3 -3
- package/cjs/components/Step/StepProcess.style.d.ts +2 -2
- package/cjs/components/Step/StepTimer.js +4 -8
- package/cjs/components/StepActions/StepActions.js +20 -37
- package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
- package/cjs/components/StepDivider/StepDivider.style.d.ts +1 -1
- package/cjs/components/SwapButton/SwapButton.js +5 -14
- package/cjs/components/SwapInput/FormPriceHelperText.js +6 -6
- package/cjs/components/SwapInput/SwapInput.js +4 -16
- package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
- package/cjs/components/SwapInput/SwapInputEndAdornment.js +2 -3
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +9 -25
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +2 -2
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +4 -16
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
- package/cjs/components/SwapRouteCard/utils.js +1 -1
- package/cjs/components/SwapRoutes/SwapRoutes.js +4 -4
- package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +5 -5
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +3 -3
- package/cjs/components/TextFitter/TextFitter.js +3 -3
- package/cjs/components/Token/Token.js +19 -33
- package/cjs/components/Token/Token.style.d.ts +3 -3
- package/cjs/components/TokenAvatar/TokenAvatar.js +6 -7
- package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
- package/cjs/components/TokenList/TokenList.js +3 -4
- package/cjs/components/TokenList/TokenList.style.d.ts +2 -2
- package/cjs/components/TokenList/TokenList.style.js +2 -6
- package/cjs/components/TokenList/TokenListItem.js +9 -9
- package/cjs/components/TokenList/TokenNotFound.js +4 -5
- package/cjs/components/TokenList/VirtualizedTokenList.js +10 -11
- package/cjs/components/TokenList/useTokenSelect.js +2 -2
- package/cjs/config/env.js +1 -1
- package/cjs/config/sentry.js +3 -12
- package/cjs/config/theme.js +44 -16
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChain.js +1 -1
- package/cjs/hooks/useChains.js +5 -14
- package/cjs/hooks/useContentHeight.js +1 -2
- package/cjs/hooks/useFeaturedTokens.js +1 -4
- package/cjs/hooks/useGasSufficiency.js +28 -34
- package/cjs/hooks/useProcessMessage.js +7 -11
- package/cjs/hooks/useRouteExecution.js +17 -28
- package/cjs/hooks/useSwapRoutes.js +16 -26
- package/cjs/hooks/useToken.js +2 -2
- package/cjs/hooks/useTokenAddressBalance.js +1 -2
- package/cjs/hooks/useTokenBalance.js +24 -27
- package/cjs/hooks/useTokenBalances.d.ts +1 -1
- package/cjs/hooks/useTokenBalances.js +8 -20
- package/cjs/hooks/useTokenSearch.d.ts +1 -1
- package/cjs/hooks/useTokenSearch.js +12 -21
- package/cjs/hooks/useTokens.d.ts +1 -1
- package/cjs/hooks/useTokens.js +36 -38
- package/cjs/hooks/useTools.d.ts +2 -11
- package/cjs/hooks/useTools.js +10 -19
- package/cjs/i18n/en.json +8 -4
- package/cjs/icons/LiFiFullLogo.js +1 -1
- package/cjs/icons/LiFiLogo.js +1 -1
- package/cjs/icons/LiFiToolLogo.js +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +3 -3
- package/cjs/pages/MainPage/MainPage.js +1 -1
- package/cjs/pages/MainPage/MainPage.style.d.ts +1 -1
- package/cjs/pages/MainPage/MainSwapButton.js +3 -12
- package/cjs/pages/SelectChainPage/SelectChainPage.js +6 -14
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.d.ts +4 -0
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +51 -0
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +20 -0
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +8 -0
- package/cjs/pages/SelectEnabledToolsPage/index.d.ts +1 -0
- package/cjs/pages/SelectEnabledToolsPage/index.js +17 -0
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +4 -3
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.js +4 -1
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -3
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +13 -19
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -3
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/EnabledToolsButton.d.ts +4 -0
- package/cjs/pages/SettingsPage/EnabledToolsButton.js +25 -0
- package/cjs/pages/{SelectChainPage/SelectChainPage.style.d.ts → SettingsPage/EnabledToolsButton.style.d.ts} +1 -1
- package/cjs/pages/{SelectChainPage/SelectChainPage.style.js → SettingsPage/EnabledToolsButton.style.js} +7 -10
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/cjs/pages/SettingsPage/GasPriceSelect.js +1 -1
- package/cjs/pages/SettingsPage/LanguageSelect.js +5 -6
- package/cjs/pages/SettingsPage/ResetSettingsButton.d.ts +2 -0
- package/cjs/pages/SettingsPage/ResetSettingsButton.js +27 -0
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +4 -4
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/cjs/pages/SettingsPage/SettingsPage.js +3 -2
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.js +3 -3
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/cjs/pages/SettingsPage/SlippageInput.js +3 -3
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +14 -22
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +1 -1
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +9 -7
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +21 -26
- package/cjs/pages/SwapPage/StartSwapButton.js +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.js +21 -19
- package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +2 -2
- package/cjs/pages/SwapPage/SwapPage.js +9 -21
- package/cjs/pages/SwapPage/SwapPage.style.d.ts +1 -1
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +8 -9
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +3 -3
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -1
- package/cjs/providers/I18nProvider/I18nProvider.js +7 -8
- package/cjs/providers/SDKProvider/SDKProvider.js +15 -4
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +12 -6
- package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.js +3 -12
- package/cjs/providers/TelemetryProvider/TelemetryProvider.js +1 -1
- package/cjs/providers/ThemeProvider/ThemeProvider.js +2 -2
- package/cjs/providers/WalletProvider/WalletProvider.js +30 -39
- package/cjs/providers/WidgetProvider/WidgetProvider.js +18 -23
- package/cjs/providers/WidgetProvider/utils.js +2 -3
- package/cjs/stores/StoreProvider.js +2 -2
- package/cjs/stores/chains/ChainOrderStore.js +2 -14
- package/cjs/stores/routes/RouteExecutionStore.js +2 -14
- package/cjs/stores/routes/createRouteExecutionStore.js +27 -16
- package/cjs/stores/routes/useExecutingRoutesIds.js +2 -5
- package/cjs/stores/routes/useSwapHistory.js +3 -6
- package/cjs/stores/routes/utils.js +4 -4
- package/cjs/stores/settings/SettingsStore.js +10 -20
- package/cjs/stores/settings/createSettingsStore.js +29 -25
- package/cjs/stores/settings/types.d.ts +6 -6
- package/cjs/utils/colors.js +1 -1
- package/cjs/utils/format.js +3 -3
- package/cjs/utils/index.d.ts +0 -1
- package/cjs/utils/index.js +0 -1
- package/cjs/utils/navigationRoutes.d.ts +2 -0
- package/cjs/utils/navigationRoutes.js +6 -0
- package/components/ActiveSwaps/ActiveSwapItem.js +9 -7
- package/components/ActiveSwaps/ActiveSwaps.js +3 -3
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
- package/components/AppContainer.d.ts +2 -2
- package/components/AppContainer.js +1 -1
- package/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/components/BottomSheet/BottomSheet.js +2 -2
- package/components/Card/Card.d.ts +2 -2
- package/components/Card/CardHeader.d.ts +1 -1
- package/components/Card/CardTitle.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/components/ChainSelect/ChainSelect.js +3 -4
- package/components/ChainSelect/ChainSelect.style.d.ts +3 -3
- package/components/ContractComponent/ContractComponent.js +1 -1
- package/components/Dialog.js +1 -1
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +13 -28
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +1 -1
- package/components/Header/Header.js +1 -1
- package/components/Header/Header.style.d.ts +3 -3
- package/components/Header/NavigationHeader.js +6 -2
- package/components/Header/WalletHeader.js +12 -22
- package/{pages/SelectChainPage/SelectChainPage.style.d.ts → components/ListItemButton.d.ts} +1 -2
- package/components/ListItemButton.js +11 -0
- package/components/ListItemText.d.ts +2 -0
- package/components/ListItemText.js +8 -0
- package/components/NFT/NFT.js +2 -14
- package/components/NFT/NFT.style.d.ts +1 -1
- package/components/NotFound.js +2 -2
- package/components/PoweredBy/PoweredBy.js +2 -2
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +5 -17
- package/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/Select.js +1 -0
- package/components/SelectChainAndToken.js +4 -4
- package/components/SelectTokenButton/SelectTokenButton.js +2 -2
- package/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
- package/components/SendToWallet/SendToWallet.js +9 -19
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/SendToWallet/SendToWalletButton.js +5 -5
- package/components/SmallAvatar.d.ts +3 -3
- package/components/Step/CircularProgress.d.ts +0 -1
- package/components/Step/CircularProgress.js +2 -2
- package/components/Step/CircularProgress.style.d.ts +1 -1
- package/components/Step/DestinationWalletAddress.js +6 -7
- package/components/Step/GasStepProcess.js +8 -8
- package/components/Step/Step.js +4 -5
- package/components/Step/StepList.d.ts +0 -1
- package/components/Step/StepList.js +8 -4
- package/components/Step/StepProcess.js +3 -3
- package/components/Step/StepProcess.style.d.ts +2 -2
- package/components/Step/StepTimer.js +4 -8
- package/components/StepActions/StepActions.js +20 -37
- package/components/StepActions/StepActions.style.d.ts +1 -1
- package/components/StepDivider/StepDivider.style.d.ts +1 -1
- package/components/SwapButton/SwapButton.js +5 -14
- package/components/SwapInput/FormPriceHelperText.js +6 -6
- package/components/SwapInput/SwapInput.js +4 -16
- package/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
- package/components/SwapInput/SwapInputEndAdornment.js +2 -3
- package/components/SwapRouteCard/SwapRouteCard.js +9 -25
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +2 -2
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +4 -16
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
- package/components/SwapRouteCard/utils.js +1 -1
- package/components/SwapRoutes/SwapRoutes.js +4 -4
- package/components/SwapRoutes/SwapRoutes.style.d.ts +5 -5
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/components/SwapRoutes/SwapRoutesExpanded.js +3 -3
- package/components/TextFitter/TextFitter.js +3 -3
- package/components/Token/Token.js +19 -33
- package/components/Token/Token.style.d.ts +3 -3
- package/components/TokenAvatar/TokenAvatar.js +6 -7
- package/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
- package/components/TokenList/TokenList.js +3 -4
- package/components/TokenList/TokenList.style.d.ts +2 -2
- package/components/TokenList/TokenList.style.js +3 -7
- package/components/TokenList/TokenListItem.js +9 -9
- package/components/TokenList/TokenNotFound.js +4 -5
- package/components/TokenList/VirtualizedTokenList.js +10 -11
- package/components/TokenList/useTokenSelect.js +2 -2
- package/config/env.js +1 -1
- package/config/sentry.js +3 -12
- package/config/theme.js +44 -16
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChain.js +1 -1
- package/hooks/useChains.js +5 -14
- package/hooks/useContentHeight.js +1 -2
- package/hooks/useFeaturedTokens.js +1 -4
- package/hooks/useGasSufficiency.js +28 -34
- package/hooks/useProcessMessage.js +7 -11
- package/hooks/useRouteExecution.js +17 -28
- package/hooks/useSwapRoutes.js +16 -26
- package/hooks/useToken.js +2 -2
- package/hooks/useTokenAddressBalance.js +1 -2
- package/hooks/useTokenBalance.js +24 -27
- package/hooks/useTokenBalances.d.ts +1 -1
- package/hooks/useTokenBalances.js +8 -20
- package/hooks/useTokenSearch.d.ts +1 -1
- package/hooks/useTokenSearch.js +12 -21
- package/hooks/useTokens.d.ts +1 -1
- package/hooks/useTokens.js +36 -38
- package/hooks/useTools.d.ts +2 -11
- package/hooks/useTools.js +10 -19
- package/i18n/en.json +8 -4
- package/icons/LiFiFullLogo.js +1 -1
- package/icons/LiFiLogo.js +1 -1
- package/icons/LiFiToolLogo.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/package.json +9 -9
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/pages/ActiveSwapsPage/ActiveSwapsPage.js +3 -3
- package/pages/MainPage/MainPage.js +1 -1
- package/pages/MainPage/MainPage.style.d.ts +1 -1
- package/pages/MainPage/MainSwapButton.js +3 -12
- package/pages/SelectChainPage/SelectChainPage.js +6 -14
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.d.ts +4 -0
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +47 -0
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +20 -0
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +5 -0
- package/pages/SelectEnabledToolsPage/index.d.ts +1 -0
- package/pages/SelectEnabledToolsPage/index.js +1 -0
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +4 -3
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/pages/SelectTokenPage/SearchTokenInput.js +4 -1
- package/pages/SelectTokenPage/SelectTokenPage.js +2 -3
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/pages/SelectWalletPage/SelectWalletPage.js +13 -19
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -3
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledToolsButton.d.ts +4 -0
- package/pages/SettingsPage/EnabledToolsButton.js +21 -0
- package/{cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts → pages/SettingsPage/EnabledToolsButton.style.d.ts} +1 -1
- package/pages/SettingsPage/EnabledToolsButton.style.js +14 -0
- package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/pages/SettingsPage/GasPriceSelect.js +1 -1
- package/pages/SettingsPage/LanguageSelect.js +5 -6
- package/pages/SettingsPage/ResetSettingsButton.d.ts +2 -0
- package/pages/SettingsPage/ResetSettingsButton.js +23 -0
- package/pages/SettingsPage/RoutePrioritySelect.js +4 -4
- package/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/pages/SettingsPage/SettingsPage.js +3 -2
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/pages/SettingsPage/ShowDestinationWallet.js +3 -3
- package/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/pages/SettingsPage/SlippageInput.js +3 -3
- package/pages/SwapDetailsPage/SwapDetailsPage.js +14 -22
- package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +1 -1
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
- package/pages/SwapHistoryPage/SwapHistoryItem.js +9 -7
- package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
- package/pages/SwapPage/ExchangeRateBottomSheet.js +21 -26
- package/pages/SwapPage/StartSwapButton.js +1 -1
- package/pages/SwapPage/StatusBottomSheet.js +21 -19
- package/pages/SwapPage/StatusBottomSheet.style.d.ts +2 -2
- package/pages/SwapPage/SwapPage.js +9 -21
- package/pages/SwapPage/SwapPage.style.d.ts +1 -1
- package/pages/SwapPage/TokenValueBottomSheet.js +8 -9
- package/pages/SwapRoutesPage/SwapRoutesPage.js +3 -3
- package/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -1
- package/providers/I18nProvider/I18nProvider.js +7 -8
- package/providers/SDKProvider/SDKProvider.js +15 -4
- package/providers/SwapFormProvider/SwapFormProvider.js +12 -6
- package/providers/SwapFormProvider/URLSearchParamsBuilder.js +3 -12
- package/providers/TelemetryProvider/TelemetryProvider.js +1 -1
- package/providers/ThemeProvider/ThemeProvider.js +2 -2
- package/providers/WalletProvider/WalletProvider.js +30 -39
- package/providers/WidgetProvider/WidgetProvider.js +18 -23
- package/providers/WidgetProvider/utils.js +2 -3
- package/stores/StoreProvider.js +2 -2
- package/stores/chains/ChainOrderStore.js +2 -14
- package/stores/routes/RouteExecutionStore.js +2 -14
- package/stores/routes/createRouteExecutionStore.js +27 -16
- package/stores/routes/useExecutingRoutesIds.js +2 -5
- package/stores/routes/useSwapHistory.js +3 -6
- package/stores/routes/utils.js +4 -4
- package/stores/settings/SettingsStore.js +10 -20
- package/stores/settings/createSettingsStore.js +29 -25
- package/stores/settings/types.d.ts +6 -6
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/utils/colors.js +1 -1
- package/utils/format.js +3 -3
- package/utils/index.d.ts +0 -1
- package/utils/index.js +0 -1
- package/utils/navigationRoutes.d.ts +2 -0
- package/utils/navigationRoutes.js +6 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -2
- package/cjs/pages/SettingsPage/AdvancedPreferences.js +0 -24
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.d.ts +0 -2
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +0 -24
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.d.ts +0 -2
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +0 -24
- package/cjs/utils/deepClone.d.ts +0 -1
- package/cjs/utils/deepClone.js +0 -7
- package/pages/SelectChainPage/SelectChainPage.style.js +0 -17
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +0 -21
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +0 -17
- package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +0 -21
- package/pages/SelectWalletPage/SelectWalletPage.style.js +0 -17
- package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -2
- package/pages/SettingsPage/AdvancedPreferences.js +0 -20
- package/pages/SettingsPage/EnabledBridgesSelect.d.ts +0 -2
- package/pages/SettingsPage/EnabledBridgesSelect.js +0 -20
- package/pages/SettingsPage/EnabledExchangesSelect.d.ts +0 -2
- package/pages/SettingsPage/EnabledExchangesSelect.js +0 -20
- package/utils/deepClone.d.ts +0 -1
- package/utils/deepClone.js +0 -3
package/hooks/useTokenBalance.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
11
2
|
import { useCallback, useMemo } from 'react';
|
|
12
3
|
import { useLiFi, useWallet } from '../providers';
|
|
@@ -16,17 +7,17 @@ export const useTokenBalance = (token, accountAddress) => {
|
|
|
16
7
|
const lifi = useLiFi();
|
|
17
8
|
const { account } = useWallet();
|
|
18
9
|
const queryClient = useQueryClient();
|
|
19
|
-
const walletAddress = accountAddress
|
|
20
|
-
const getTokenBalancesWithRetry = useCallback((accountAddress, tokens, depth = 0) =>
|
|
10
|
+
const walletAddress = accountAddress ?? account.address;
|
|
11
|
+
const getTokenBalancesWithRetry = useCallback(async (accountAddress, tokens, depth = 0) => {
|
|
21
12
|
try {
|
|
22
|
-
const tokenBalances =
|
|
13
|
+
const tokenBalances = await lifi.getTokenBalances(accountAddress, tokens);
|
|
23
14
|
if (!tokenBalances.every((token) => token.blockNumber)) {
|
|
24
15
|
if (depth > 10) {
|
|
25
16
|
console.warn('Token balance backoff depth exceeded.');
|
|
26
17
|
return undefined;
|
|
27
18
|
}
|
|
28
|
-
|
|
29
|
-
setTimeout(resolve,
|
|
19
|
+
await new Promise((resolve) => {
|
|
20
|
+
setTimeout(resolve, 1.5 ** depth * 100);
|
|
30
21
|
});
|
|
31
22
|
return getTokenBalancesWithRetry(accountAddress, tokens, depth + 1);
|
|
32
23
|
}
|
|
@@ -35,26 +26,26 @@ export const useTokenBalance = (token, accountAddress) => {
|
|
|
35
26
|
catch (error) {
|
|
36
27
|
//
|
|
37
28
|
}
|
|
38
|
-
}
|
|
39
|
-
const tokenBalanceQueryKey = useMemo(() => ['token-balance', walletAddress, token
|
|
40
|
-
const { data, isLoading, refetch } = useQuery(tokenBalanceQueryKey, ({ queryKey: [, accountAddress] }) =>
|
|
41
|
-
|
|
42
|
-
const cachedToken = (_a = queryClient
|
|
29
|
+
}, [lifi]);
|
|
30
|
+
const tokenBalanceQueryKey = useMemo(() => ['token-balance', walletAddress, token?.chainId, token?.address], [token?.address, token?.chainId, walletAddress]);
|
|
31
|
+
const { data, isLoading, refetch } = useQuery(tokenBalanceQueryKey, async ({ queryKey: [, accountAddress] }) => {
|
|
32
|
+
const cachedToken = queryClient
|
|
43
33
|
.getQueryData([
|
|
44
34
|
'token-balances',
|
|
45
35
|
accountAddress,
|
|
46
36
|
token.chainId,
|
|
47
|
-
])
|
|
37
|
+
])
|
|
38
|
+
?.find((t) => t.address === token.address);
|
|
48
39
|
if (cachedToken) {
|
|
49
40
|
return cachedToken;
|
|
50
41
|
}
|
|
51
|
-
const tokenBalances =
|
|
52
|
-
if (!
|
|
42
|
+
const tokenBalances = await getTokenBalancesWithRetry(accountAddress, [token]);
|
|
43
|
+
if (!tokenBalances?.length) {
|
|
53
44
|
throw Error('Could not get tokens balance.');
|
|
54
45
|
}
|
|
55
46
|
const cachedTokenAmount = queryClient.getQueryData(tokenBalanceQueryKey);
|
|
56
47
|
const formattedAmount = formatTokenAmount(tokenBalances[0].amount);
|
|
57
|
-
if (
|
|
48
|
+
if (cachedTokenAmount?.amount !== formattedAmount) {
|
|
58
49
|
queryClient.setQueryDefaults(tokenBalanceQueryKey, {
|
|
59
50
|
refetchInterval: defaultRefetchInterval,
|
|
60
51
|
staleTime: defaultRefetchInterval,
|
|
@@ -63,12 +54,18 @@ export const useTokenBalance = (token, accountAddress) => {
|
|
|
63
54
|
queryClient.setQueryData(['token-balances', accountAddress, token.chainId], (data) => {
|
|
64
55
|
if (data) {
|
|
65
56
|
const index = data.findIndex((dataToken) => dataToken.address === token.address);
|
|
66
|
-
data[index] =
|
|
57
|
+
data[index] = {
|
|
58
|
+
...data[index],
|
|
59
|
+
amount: formattedAmount,
|
|
60
|
+
};
|
|
67
61
|
}
|
|
68
62
|
return data;
|
|
69
63
|
});
|
|
70
|
-
return
|
|
71
|
-
|
|
64
|
+
return {
|
|
65
|
+
...tokenBalances[0],
|
|
66
|
+
amount: formattedAmount,
|
|
67
|
+
};
|
|
68
|
+
}, {
|
|
72
69
|
enabled: Boolean(walletAddress && token),
|
|
73
70
|
refetchInterval: defaultRefetchInterval,
|
|
74
71
|
staleTime: defaultRefetchInterval,
|
|
@@ -76,7 +73,7 @@ export const useTokenBalance = (token, accountAddress) => {
|
|
|
76
73
|
const refetchAllBalances = () => {
|
|
77
74
|
queryClient.refetchQueries([
|
|
78
75
|
'token-balances',
|
|
79
|
-
token
|
|
76
|
+
token?.chainId,
|
|
80
77
|
accountAddress,
|
|
81
78
|
]);
|
|
82
79
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Token } from '../types';
|
|
2
2
|
export declare const useTokenBalances: (selectedChainId?: number) => {
|
|
3
|
-
tokens: Token[]
|
|
3
|
+
tokens: Token[];
|
|
4
4
|
tokensWithBalance: Token[] | undefined;
|
|
5
5
|
featuredTokens: import("@lifi/types").Token[];
|
|
6
6
|
isLoading: boolean;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
/* eslint-disable consistent-return */
|
|
11
2
|
import { useQuery } from '@tanstack/react-query';
|
|
12
3
|
import { useState } from 'react';
|
|
@@ -23,11 +14,11 @@ export const useTokenBalances = (selectedChainId) => {
|
|
|
23
14
|
const { tokens, isLoading } = useTokens(selectedChainId);
|
|
24
15
|
const [refetchInterval, setRefetchInterval] = useState(defaultRefetchInterval);
|
|
25
16
|
const isBalanceLoadingEnabled = Boolean(account.address) &&
|
|
26
|
-
Boolean(tokens
|
|
17
|
+
Boolean(tokens?.length) &&
|
|
27
18
|
Boolean(selectedChainId);
|
|
28
|
-
const { data: tokensWithBalance, isLoading: isBalanceLoading, refetch, } = useQuery(['token-balances', account.address, selectedChainId, tokens
|
|
29
|
-
const tokenBalances =
|
|
30
|
-
if (!
|
|
19
|
+
const { data: tokensWithBalance, isLoading: isBalanceLoading, refetch, } = useQuery(['token-balances', account.address, selectedChainId, tokens?.length], async ({ queryKey: [, accountAddress] }) => {
|
|
20
|
+
const tokenBalances = await lifi.getTokenBalances(accountAddress, tokens);
|
|
21
|
+
if (!tokenBalances?.length) {
|
|
31
22
|
// Sometimes RPCs (e.g. Arbitrum) don't return balances on first call
|
|
32
23
|
// TODO: fix and remove backplane
|
|
33
24
|
setRefetchInterval((interval) => interval === defaultRefetchInterval
|
|
@@ -35,12 +26,9 @@ export const useTokenBalances = (selectedChainId) => {
|
|
|
35
26
|
: interval * 2);
|
|
36
27
|
throw Error('Could not get tokens balance.');
|
|
37
28
|
}
|
|
38
|
-
const featuredTokenAddresses = new Set(featuredTokens
|
|
39
|
-
const sortFn = (a, b) =>
|
|
40
|
-
|
|
41
|
-
return parseFloat((_a = b.amount) !== null && _a !== void 0 ? _a : '0') * parseFloat((_b = b.priceUSD) !== null && _b !== void 0 ? _b : '0') -
|
|
42
|
-
parseFloat((_c = a.amount) !== null && _c !== void 0 ? _c : '0') * parseFloat((_d = a.priceUSD) !== null && _d !== void 0 ? _d : '0');
|
|
43
|
-
};
|
|
29
|
+
const featuredTokenAddresses = new Set(featuredTokens?.map((token) => token.address));
|
|
30
|
+
const sortFn = (a, b) => parseFloat(b.amount ?? '0') * parseFloat(b.priceUSD ?? '0') -
|
|
31
|
+
parseFloat(a.amount ?? '0') * parseFloat(a.priceUSD ?? '0');
|
|
44
32
|
const formattedTokens = (tokenBalances.length === 0 ? tokens : tokenBalances).map((token) => {
|
|
45
33
|
token.amount = formatTokenAmount(token.amount);
|
|
46
34
|
return token;
|
|
@@ -57,7 +45,7 @@ export const useTokenBalances = (selectedChainId) => {
|
|
|
57
45
|
...formattedTokens.filter((token) => token.amount === '0' && !featuredTokenAddresses.has(token.address)),
|
|
58
46
|
];
|
|
59
47
|
return result;
|
|
60
|
-
}
|
|
48
|
+
}, {
|
|
61
49
|
enabled: isBalanceLoadingEnabled,
|
|
62
50
|
refetchInterval,
|
|
63
51
|
staleTime: refetchInterval,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Token } from '../types';
|
|
2
|
-
export declare const useTokenSearch: (chainId?: number,
|
|
2
|
+
export declare const useTokenSearch: (chainId?: number, tokenQuery?: string, enabled?: boolean) => {
|
|
3
3
|
token: Token | undefined;
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
};
|
package/hooks/useTokenSearch.js
CHANGED
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
11
2
|
import { useLiFi } from '../providers';
|
|
12
|
-
export const useTokenSearch = (chainId,
|
|
3
|
+
export const useTokenSearch = (chainId, tokenQuery, enabled) => {
|
|
13
4
|
const lifi = useLiFi();
|
|
14
5
|
const queryClient = useQueryClient();
|
|
15
|
-
const { data, isLoading } = useQuery(['token-search', chainId,
|
|
16
|
-
const
|
|
6
|
+
const { data, isLoading } = useQuery(['token-search', chainId, tokenQuery], async ({ queryKey: [, chainId, tokenQuery], signal }) => {
|
|
7
|
+
const token = await lifi.getToken(chainId, tokenQuery, {
|
|
17
8
|
signal,
|
|
18
9
|
});
|
|
19
|
-
if (
|
|
20
|
-
queryClient.setQueriesData(['tokens'
|
|
21
|
-
if (!
|
|
22
|
-
tokens
|
|
10
|
+
if (token) {
|
|
11
|
+
queryClient.setQueriesData(['tokens'], (data) => {
|
|
12
|
+
if (!data?.tokens[chainId].some((t) => t.address === token.address)) {
|
|
13
|
+
data?.tokens[chainId].push(token);
|
|
23
14
|
}
|
|
24
|
-
return
|
|
25
|
-
});
|
|
15
|
+
return data;
|
|
16
|
+
}, { updatedAt: Date.now() });
|
|
26
17
|
}
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
enabled: Boolean(chainId &&
|
|
18
|
+
return token;
|
|
19
|
+
}, {
|
|
20
|
+
enabled: Boolean(chainId && tokenQuery && enabled),
|
|
30
21
|
retry: false,
|
|
31
22
|
});
|
|
32
23
|
return {
|
package/hooks/useTokens.d.ts
CHANGED
package/hooks/useTokens.js
CHANGED
|
@@ -1,60 +1,58 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useMemo } from 'react';
|
|
11
3
|
import { isItemAllowed, useLiFi, useWidgetConfig } from '../providers';
|
|
12
4
|
import { useChains } from './useChains';
|
|
13
5
|
import { useFeaturedTokens } from './useFeaturedTokens';
|
|
14
6
|
export const useTokens = (selectedChainId) => {
|
|
15
|
-
var _a, _b, _c, _d;
|
|
16
7
|
const lifi = useLiFi();
|
|
8
|
+
const { data, isLoading, dataUpdatedAt } = useQuery(['tokens'], () => lifi.getTokens());
|
|
17
9
|
const { getChainById, isLoading: isSupportedChainsLoading } = useChains();
|
|
18
10
|
const featuredTokens = useFeaturedTokens(selectedChainId);
|
|
19
|
-
const { tokens, chains, disabledChains } = useWidgetConfig();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
(_a = tokens === null || tokens === void 0 ? void 0 : tokens.allow) === null || _a === void 0 ? void 0 : _a.length,
|
|
25
|
-
(_b = tokens === null || tokens === void 0 ? void 0 : tokens.deny) === null || _b === void 0 ? void 0 : _b.length,
|
|
26
|
-
(_c = chains === null || chains === void 0 ? void 0 : chains.allow) === null || _c === void 0 ? void 0 : _c.length,
|
|
27
|
-
(_d = chains === null || chains === void 0 ? void 0 : chains.deny) === null || _d === void 0 ? void 0 : _d.length,
|
|
28
|
-
], () => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
-
var _e, _f, _g, _h, _j;
|
|
11
|
+
const { tokens: configTokens, chains: configChains, disabledChains, } = useWidgetConfig();
|
|
12
|
+
const tokens = useMemo(() => {
|
|
13
|
+
if (isSupportedChainsLoading) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
30
16
|
const chainAllowed = selectedChainId &&
|
|
31
17
|
getChainById(selectedChainId) &&
|
|
32
|
-
isItemAllowed(selectedChainId,
|
|
18
|
+
isItemAllowed(selectedChainId, configChains, disabledChains);
|
|
33
19
|
if (!chainAllowed) {
|
|
34
20
|
return [];
|
|
35
21
|
}
|
|
36
|
-
let filteredTokens =
|
|
37
|
-
if (!
|
|
38
|
-
|
|
39
|
-
filteredTokens = (_f = data.tokens) === null || _f === void 0 ? void 0 : _f[selectedChainId];
|
|
22
|
+
let filteredTokens = configTokens?.allow?.filter((token) => token.chainId === selectedChainId);
|
|
23
|
+
if (!filteredTokens?.length) {
|
|
24
|
+
filteredTokens = data?.tokens[selectedChainId];
|
|
40
25
|
}
|
|
41
|
-
const deniedTokenAddresses =
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
const deniedTokenAddresses = configTokens?.deny
|
|
27
|
+
?.filter((token) => token.chainId === selectedChainId)
|
|
28
|
+
.map((token) => token.address);
|
|
29
|
+
if (deniedTokenAddresses?.length) {
|
|
30
|
+
filteredTokens = filteredTokens?.filter((token) => !deniedTokenAddresses.includes(token.address));
|
|
44
31
|
}
|
|
45
|
-
const featuredTokenAddresses = new Set(featuredTokens
|
|
46
|
-
|
|
47
|
-
...(
|
|
32
|
+
const featuredTokenAddresses = new Set(featuredTokens?.map((token) => token.address));
|
|
33
|
+
const tokens = [
|
|
34
|
+
...(featuredTokens?.map((token) => {
|
|
48
35
|
token.featured = true;
|
|
49
36
|
return token;
|
|
50
|
-
})
|
|
51
|
-
...(
|
|
37
|
+
}) ?? []),
|
|
38
|
+
...(filteredTokens?.filter((token) => !featuredTokenAddresses.has(token.address)) ?? []),
|
|
52
39
|
];
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
40
|
+
return tokens;
|
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
+
}, [
|
|
43
|
+
isSupportedChainsLoading,
|
|
44
|
+
selectedChainId,
|
|
45
|
+
getChainById,
|
|
46
|
+
configChains,
|
|
47
|
+
disabledChains,
|
|
48
|
+
configTokens?.allow,
|
|
49
|
+
configTokens?.deny,
|
|
50
|
+
featuredTokens,
|
|
51
|
+
data,
|
|
52
|
+
dataUpdatedAt,
|
|
53
|
+
]);
|
|
56
54
|
return {
|
|
57
|
-
tokens
|
|
55
|
+
tokens,
|
|
58
56
|
isLoading,
|
|
59
57
|
};
|
|
60
58
|
};
|
package/hooks/useTools.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
interface WidgetBridge extends Omit<Bridge, 'key'> {
|
|
3
|
-
key: string;
|
|
4
|
-
}
|
|
5
|
-
type FormattedTool<T, K extends keyof T> = Record<string, Pick<T, K>>;
|
|
1
|
+
import type { ToolsResponse } from '@lifi/sdk';
|
|
6
2
|
export declare const useTools: () => {
|
|
7
|
-
tools:
|
|
8
|
-
formattedTools: {
|
|
9
|
-
bridges: FormattedTool<WidgetBridge, "key" | "name" | "logoURI"> | undefined;
|
|
10
|
-
exchanges: FormattedTool<Exchange, "key" | "name" | "logoURI"> | undefined;
|
|
11
|
-
};
|
|
3
|
+
tools: ToolsResponse | undefined;
|
|
12
4
|
};
|
|
13
|
-
export {};
|
package/hooks/useTools.js
CHANGED
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
2
|
import { isItemAllowed, useLiFi, useWidgetConfig } from '../providers';
|
|
4
3
|
import { useSettingsStoreContext } from '../stores';
|
|
5
4
|
export const useTools = () => {
|
|
6
5
|
const lifi = useLiFi();
|
|
7
6
|
const { bridges, exchanges } = useWidgetConfig();
|
|
8
7
|
const settingsStoreContext = useSettingsStoreContext();
|
|
9
|
-
const { data } = useQuery(['tools'], () =>
|
|
8
|
+
const { data } = useQuery(['tools'], async () => {
|
|
9
|
+
const tools = await lifi.getTools();
|
|
10
|
+
return {
|
|
11
|
+
bridges: tools.bridges.filter((bridge) => isItemAllowed(bridge.key, bridges)),
|
|
12
|
+
exchanges: tools.exchanges.filter((exchange) => isItemAllowed(exchange.key, exchanges)),
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
10
15
|
onSuccess(data) {
|
|
11
16
|
const { initializeTools } = settingsStoreContext.getState();
|
|
12
|
-
initializeTools('Bridges', data.bridges
|
|
13
|
-
|
|
14
|
-
.map((bridge) => bridge.key));
|
|
15
|
-
initializeTools('Exchanges', data.exchanges
|
|
16
|
-
.filter((exchange) => isItemAllowed(exchange.key, exchanges))
|
|
17
|
-
.map((exchange) => exchange.key));
|
|
17
|
+
initializeTools('Bridges', data.bridges.map((bridge) => bridge.key));
|
|
18
|
+
initializeTools('Exchanges', data.exchanges.map((exchange) => exchange.key));
|
|
18
19
|
},
|
|
19
20
|
refetchInterval: 180000,
|
|
20
21
|
staleTime: 180000,
|
|
21
22
|
});
|
|
22
|
-
|
|
23
|
-
bridges: data === null || data === void 0 ? void 0 : data.bridges.reduce((bridges, bridge) => {
|
|
24
|
-
bridges[bridge.key] = bridge;
|
|
25
|
-
return bridges;
|
|
26
|
-
}, {}),
|
|
27
|
-
exchanges: data === null || data === void 0 ? void 0 : data.exchanges.reduce((exchanges, exchange) => {
|
|
28
|
-
exchanges[exchange.key] = exchange;
|
|
29
|
-
return exchanges;
|
|
30
|
-
}, {}),
|
|
31
|
-
}), [data === null || data === void 0 ? void 0 : data.bridges, data === null || data === void 0 ? void 0 : data.exchanges]);
|
|
32
|
-
return { tools: data, formattedTools };
|
|
23
|
+
return { tools: data };
|
|
33
24
|
};
|
package/i18n/en.json
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
"contactSupport": "Contact support",
|
|
7
7
|
"continue": "Continue",
|
|
8
8
|
"copyAddress": "Copy address",
|
|
9
|
-
"viewOnExplorer": "View on explorer",
|
|
10
9
|
"dark": "Dark",
|
|
11
10
|
"delete": "Delete",
|
|
12
11
|
"disconnect": "Disconnect",
|
|
@@ -19,6 +18,8 @@
|
|
|
19
18
|
"ok": "Ok",
|
|
20
19
|
"okay": "Okay",
|
|
21
20
|
"removeSwap": "Remove swap",
|
|
21
|
+
"reset": "Reset",
|
|
22
|
+
"resetSettings": "Reset settings",
|
|
22
23
|
"restartSwap": "Restart swap",
|
|
23
24
|
"reviewGasSwap": "Review gas swap",
|
|
24
25
|
"reviewSwap": "Review swap",
|
|
@@ -27,7 +28,8 @@
|
|
|
27
28
|
"startGasSwap": "Start gas swap",
|
|
28
29
|
"startSwap": "Start swap",
|
|
29
30
|
"swap": "Swap",
|
|
30
|
-
"tryAgain": "Try again"
|
|
31
|
+
"tryAgain": "Try again",
|
|
32
|
+
"viewOnExplorer": "View on explorer"
|
|
31
33
|
},
|
|
32
34
|
"format": {
|
|
33
35
|
"currency": "{{value, currency(currency: USD)}}",
|
|
@@ -201,7 +203,8 @@
|
|
|
201
203
|
"highValueLoss": "The value of the received tokens is significantly lower than the swapped tokens and transaction cost.",
|
|
202
204
|
"insufficientFunds": "You don't have enough funds to execute the swap.",
|
|
203
205
|
"insufficientGas": "You need to add at least:",
|
|
204
|
-
"rateChanged": "The exchange rate has changed. By continuing the swap, you'll accept the new rate."
|
|
206
|
+
"rateChanged": "The exchange rate has changed. By continuing the swap, you'll accept the new rate.",
|
|
207
|
+
"resetSettings": "This will reset your route priority, slippage, gas price, enabled bridges and exchanges."
|
|
205
208
|
},
|
|
206
209
|
"title": {
|
|
207
210
|
"deleteActiveSwaps": "Delete all active swaps?",
|
|
@@ -209,7 +212,8 @@
|
|
|
209
212
|
"deleteSwapHistory": "Delete swap history?",
|
|
210
213
|
"highValueLoss": "High value loss",
|
|
211
214
|
"insufficientGas": "Insufficient gas",
|
|
212
|
-
"rateChanged": "Rate changed"
|
|
215
|
+
"rateChanged": "Rate changed",
|
|
216
|
+
"resetSettings": "Reset settings?"
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
219
|
},
|
package/icons/LiFiFullLogo.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const LiFiFullLogo = (props) => (_jsxs("svg",
|
|
2
|
+
export const LiFiFullLogo = (props) => (_jsxs("svg", { width: "84", height: "32", viewBox: "0 0 84 32", fill: "inherit", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("path", { d: "M50.6689 20.5714H42.6849V8H39V24H50.6689V20.5714Z" }), _jsx("path", { d: "M53.0717 24H56.7566V8H53.0717V24Z" }), _jsx("path", { d: "M59.5088 24H63.0117V20.48H59.5088V24Z" }), _jsx("path", { d: "M69.4396 17.76H77.1506V14.6057H69.4396V11.2457H77.8103V8H65.7547V24H69.4396V17.76Z" }), _jsx("path", { d: "M80.3151 24H84V8H80.3151V24Z" }), _jsx("path", { d: "M14.6163 21.6947L5.1336 23.89C4.78772 23.9766 4.52832 24.3232 4.52832 24.6698V31.1978C4.52832 31.7467 4.96066 32.0933 5.50829 31.9777L18.7379 28.9159C19.2856 28.8004 19.5162 28.2805 19.2856 27.7894L16.8933 22.8501C16.5186 22.0702 16.8933 21.2614 17.7291 21.0881L26.376 19.0084C26.9813 18.864 27.5001 18.2285 27.5001 17.593V11.5561C27.5001 11.0073 27.0677 10.6318 26.5201 10.7762L14.0398 13.7514C13.2616 13.9247 12.9157 14.6757 13.2616 15.3978L15.4521 19.9327C15.8268 20.7126 15.4521 21.4925 14.6163 21.6947Z" }), _jsx("path", { d: "M8.36225 5.3748L10.841 10.4585C11.1581 11.1229 10.841 11.8161 10.1204 11.9606L5.53762 13.0293C4.96116 13.1737 4.5 13.7514 4.5 14.3291V19.7884C4.5 20.7127 5.24939 21.2904 6.1429 21.0882L10.4087 20.1061C10.9851 19.9906 11.4463 19.384 11.4463 18.8063L11.4751 13.2026C11.4751 12.4227 12.1092 11.6428 12.8586 11.4695L26.8376 8.11886C27.1835 8.03221 27.4429 7.68559 27.4429 7.33897V0.810981C27.4429 0.262168 27.0106 -0.113336 26.4629 0.0310883L8.90988 4.24829C8.36225 4.36383 8.13167 4.88375 8.36225 5.3748Z" })] }));
|
package/icons/LiFiLogo.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const LiFiLogo = (props) => (_jsxs("svg",
|
|
2
|
+
export const LiFiLogo = (props) => (_jsxs("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "inherit", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("path", { d: "M14.6163 21.6947L5.1336 23.89C4.78772 23.9766 4.52832 24.3232 4.52832 24.6698V31.1978C4.52832 31.7467 4.96066 32.0933 5.50829 31.9777L18.7379 28.9159C19.2856 28.8004 19.5162 28.2805 19.2856 27.7894L16.8933 22.8501C16.5186 22.0702 16.8933 21.2614 17.7291 21.0881L26.376 19.0084C26.9813 18.864 27.5001 18.2285 27.5001 17.593V11.5561C27.5001 11.0073 27.0677 10.6318 26.5201 10.7762L14.0398 13.7514C13.2616 13.9247 12.9157 14.6757 13.2616 15.3978L15.4521 19.9327C15.8268 20.7126 15.4521 21.4925 14.6163 21.6947Z" }), _jsx("path", { d: "M8.36225 5.3748L10.841 10.4585C11.1581 11.1229 10.841 11.8161 10.1204 11.9606L5.53762 13.0293C4.96116 13.1737 4.5 13.7514 4.5 14.3291V19.7884C4.5 20.7127 5.24939 21.2904 6.1429 21.0882L10.4087 20.1061C10.9851 19.9906 11.4463 19.384 11.4463 18.8063L11.4751 13.2026C11.4751 12.4227 12.1092 11.6428 12.8586 11.4695L26.8376 8.11886C27.1835 8.03221 27.4429 7.68559 27.4429 7.33897V0.810981C27.4429 0.262168 27.0106 -0.113336 26.4629 0.0310883L8.90988 4.24829C8.36225 4.36383 8.13167 4.88375 8.36225 5.3748Z" })] }));
|
package/icons/LiFiToolLogo.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const LiFiToolLogo = (props) => (_jsxs("svg",
|
|
2
|
+
export const LiFiToolLogo = (props) => (_jsxs("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("circle", { cx: "16", cy: "16", r: "16", fill: "#F5B5FF" }), _jsx("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" }), _jsx("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" })] }));
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import './fonts/inter.css';
|
|
3
3
|
export type { WidgetDrawer } from './AppDrawer';
|
|
4
4
|
export * from './components/NFT';
|
|
5
|
+
export * from './config/version';
|
|
5
6
|
export { useWidgetEvents, widgetEvents } from './hooks';
|
|
6
7
|
export { useWallet } from './providers/WalletProvider';
|
|
7
8
|
export * from './types';
|
package/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { App } from './App';
|
|
2
2
|
import { AppDrawer } from './AppDrawer';
|
|
3
|
+
// TODO: remove or make optional
|
|
3
4
|
import './fonts/inter.css';
|
|
4
5
|
export * from './components/NFT';
|
|
6
|
+
export * from './config/version';
|
|
5
7
|
export { useWidgetEvents, widgetEvents } from './hooks';
|
|
6
8
|
export { useWallet } from './providers/WalletProvider';
|
|
7
9
|
export * from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.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
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"@ethersproject/providers": "^5.7.2",
|
|
46
46
|
"@lifi/sdk": "^1.7.2",
|
|
47
47
|
"@lifi/wallet-management": "^1.2.7",
|
|
48
|
-
"@mui/icons-material": "^5.11.
|
|
49
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
50
|
-
"@mui/material": "^5.11.
|
|
48
|
+
"@mui/icons-material": "^5.11.9",
|
|
49
|
+
"@mui/lab": "^5.0.0-alpha.120",
|
|
50
|
+
"@mui/material": "^5.11.9",
|
|
51
51
|
"@sentry/integrations": "^7.36.0",
|
|
52
52
|
"@sentry/react": "^7.36.0",
|
|
53
53
|
"@sentry/tracing": "^7.36.0",
|
|
54
|
-
"@tanstack/react-query": "^4.24.
|
|
55
|
-
"@tanstack/react-virtual": "^3.0.0-beta.
|
|
54
|
+
"@tanstack/react-query": "^4.24.6",
|
|
55
|
+
"@tanstack/react-virtual": "^3.0.0-beta.48",
|
|
56
56
|
"big.js": "^6.2.1",
|
|
57
57
|
"i18next": "^22.4.9",
|
|
58
58
|
"i18next-browser-languagedetector": "^7.0.1",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"mitt": "^3.0.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
|
-
"react-hook-form": "^7.43.
|
|
63
|
+
"react-hook-form": "^7.43.1",
|
|
64
64
|
"react-i18next": "^12.1.5",
|
|
65
|
-
"react-router-dom": "^6.8.
|
|
65
|
+
"react-router-dom": "^6.8.1",
|
|
66
66
|
"react-timer-hook": "^3.0.5",
|
|
67
67
|
"uuid": "^9.0.0",
|
|
68
|
-
"zustand": "^4.3.
|
|
68
|
+
"zustand": "^4.3.3"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@types/react": "^18.0.0",
|
|
@@ -4,12 +4,12 @@ import { Container, Typography } from '@mui/material';
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
export const ActiveSwapsEmpty = () => {
|
|
6
6
|
const { t } = useTranslation();
|
|
7
|
-
return (_jsxs(Container,
|
|
7
|
+
return (_jsxs(Container, { sx: {
|
|
8
8
|
display: 'flex',
|
|
9
9
|
flex: 1,
|
|
10
10
|
flexDirection: 'column',
|
|
11
11
|
alignItems: 'center',
|
|
12
12
|
justifyContent: 'center',
|
|
13
13
|
paddingY: 12,
|
|
14
|
-
}
|
|
14
|
+
}, children: [_jsx(Typography, { fontSize: 48, children: _jsx(SwapHorizIcon, { fontSize: "inherit" }) }), _jsx(Typography, { fontSize: 18, fontWeight: 700, children: t('swap.info.title.emptyActiveSwaps') }), _jsx(Typography, { fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2, children: t('swap.info.message.emptyActiveSwaps') })] }));
|
|
15
15
|
};
|
|
@@ -21,14 +21,14 @@ export const ActiveSwapsPage = () => {
|
|
|
21
21
|
}, []);
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
if (executingRoutes.length) {
|
|
24
|
-
return useHeaderActionStore.getState().setAction(_jsx(IconButton,
|
|
24
|
+
return useHeaderActionStore.getState().setAction(_jsx(IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: _jsx(DeleteIcon, {}) }));
|
|
25
25
|
}
|
|
26
26
|
}, [executingRoutes.length, toggleDialog]);
|
|
27
27
|
if (!executingRoutes.length) {
|
|
28
28
|
return _jsx(ActiveSwapsEmpty, {});
|
|
29
29
|
}
|
|
30
|
-
return (_jsxs(Container,
|
|
30
|
+
return (_jsxs(Container, { disableGutters: true, children: [_jsx(List, { sx: {
|
|
31
31
|
paddingLeft: 1.5,
|
|
32
32
|
paddingRight: 1.5,
|
|
33
|
-
}
|
|
33
|
+
}, children: executingRoutes.map((routeId) => (_jsx(ActiveSwapItem, { routeId: routeId }, routeId))) }), _jsxs(Dialog, { open: open, onClose: toggleDialog, children: [_jsx(DialogTitle, { children: t('swap.warning.title.deleteActiveSwaps') }), _jsx(DialogContent, { children: _jsx(DialogContentText, { children: t('swap.warning.message.deleteActiveSwaps') }) }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: toggleDialog, children: t('button.cancel') }), _jsx(Button, { variant: "contained", onClick: () => deleteRoutes('active'), autoFocus: true, children: t('button.delete') })] })] })] }));
|
|
34
34
|
};
|
|
@@ -15,5 +15,5 @@ export const MainPage = () => {
|
|
|
15
15
|
const expandable = useExpandableVariant();
|
|
16
16
|
const { variant } = useWidgetConfig();
|
|
17
17
|
const nft = variant === 'nft';
|
|
18
|
-
return (_jsxs(FormContainer,
|
|
18
|
+
return (_jsxs(FormContainer, { disableGutters: true, children: [_jsx(ActiveSwaps, { mx: 3, mt: 1, mb: 2 }), nft ? _jsx(ContractComponent, { mx: 3, mt: 1, mb: 1 }) : null, _jsx(SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), !nft ? _jsx(SwapInput, { formType: "from", mx: 3, mb: 3 }) : null, !expandable ? _jsx(SwapRoutes, { mx: 3, mb: 3 }) : null, _jsx(GasSufficiencyMessage, { mx: 3, mb: 3 }), _jsxs(Box, { mx: 3, mb: 1, children: [_jsx(SendToWallet, { mb: 3 }), _jsxs(Box, { sx: { display: 'flex' }, children: [_jsx(MainSwapButton, {}), _jsx(SendToWalletButton, {})] })] })] }));
|
|
19
19
|
};
|
|
@@ -6,6 +6,6 @@ export declare const FormContainer: import("@emotion/styled").StyledComponent<{
|
|
|
6
6
|
fixed?: boolean | undefined;
|
|
7
7
|
maxWidth?: false | import("@mui/material").Breakpoint | undefined;
|
|
8
8
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<
|
|
9
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
10
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
11
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "maxWidth" | "fixed" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
2
|
import { useFormState } from 'react-hook-form';
|
|
12
3
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -19,14 +10,14 @@ export const MainSwapButton = () => {
|
|
|
19
10
|
const { isValid, isValidating } = useFormState();
|
|
20
11
|
const setExecutableRoute = useSetExecutableRoute();
|
|
21
12
|
const { routes: swapRoutes, isLoading, isFetching } = useSwapRoutes();
|
|
22
|
-
const currentRoute = swapRoutes
|
|
23
|
-
const handleClick = () =>
|
|
13
|
+
const currentRoute = swapRoutes?.[0];
|
|
14
|
+
const handleClick = async () => {
|
|
24
15
|
if (currentRoute) {
|
|
25
16
|
setExecutableRoute(currentRoute);
|
|
26
17
|
navigate(navigationRoutes.swapExecution, {
|
|
27
18
|
state: { routeId: currentRoute.id },
|
|
28
19
|
});
|
|
29
20
|
}
|
|
30
|
-
}
|
|
21
|
+
};
|
|
31
22
|
return (_jsx(SwapButton, { onClick: handleClick, currentRoute: currentRoute, disabled: currentRoute && (isLoading || isFetching || isValidating || !isValid) }));
|
|
32
23
|
};
|