@lifi/widget 1.31.1 → 1.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +4 -16
- package/AppDrawer.js +13 -7
- package/AppDrawer.style.d.ts +3 -3
- package/AppDrawer.style.js +1 -1
- package/AppProvider.js +1 -1
- package/AppRoutes.js +9 -0
- package/cjs/App.js +4 -16
- package/cjs/AppDrawer.js +13 -7
- package/cjs/AppDrawer.style.d.ts +3 -3
- 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 +5 -5
- 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 +4 -4
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +2 -2
- 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 +3 -3
- 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 +3 -3
- 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 +16 -26
- 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 +11 -21
- package/cjs/i18n/en.json +8 -8
- package/cjs/i18n/uk.json +8 -8
- 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 +2 -2
- 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 +20 -27
- package/cjs/providers/WidgetProvider/utils.js +2 -3
- package/cjs/stores/StoreProvider.js +1 -7
- package/cjs/stores/chains/index.d.ts +1 -2
- package/cjs/stores/chains/index.js +1 -2
- package/cjs/stores/chains/useChainOrder.js +2 -2
- package/cjs/stores/chains/useChainOrderStore.d.ts +3 -0
- package/cjs/stores/chains/{createChainOrderStore.js → useChainOrderStore.js} +3 -4
- package/cjs/stores/routes/RouteExecutionStore.js +2 -14
- package/cjs/stores/routes/createRouteExecutionStore.js +27 -16
- package/cjs/stores/routes/types.d.ts +1 -1
- package/cjs/stores/routes/useExecutingRoutesIds.js +2 -5
- package/cjs/stores/routes/useRecommendedRouteStore.d.ts +10 -2
- package/cjs/stores/routes/useRecommendedRouteStore.js +30 -2
- package/cjs/stores/routes/useSwapHistory.js +3 -6
- package/cjs/stores/routes/utils.js +4 -4
- package/cjs/stores/settings/index.d.ts +1 -1
- package/cjs/stores/settings/index.js +1 -1
- package/cjs/stores/settings/types.d.ts +6 -6
- package/cjs/stores/settings/useAppearance.js +2 -2
- package/cjs/stores/settings/useSettings.js +2 -2
- package/cjs/stores/settings/useSettingsStore.d.ts +6 -0
- package/cjs/stores/settings/{createSettingsStore.js → useSettingsStore.js} +48 -28
- package/cjs/utils/colors.js +1 -1
- package/cjs/utils/format.js +3 -3
- 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 +5 -5
- 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 +4 -4
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- package/components/SwapInput/SwapInputAdornment.style.d.ts +2 -2
- 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 +3 -3
- 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 +3 -3
- 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 +16 -26
- 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 +12 -22
- package/i18n/en.json +8 -8
- package/i18n/uk.json +8 -8
- 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 +7 -7
- 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 +2 -2
- 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 +22 -29
- package/providers/WidgetProvider/utils.js +2 -3
- package/stores/StoreProvider.js +2 -8
- package/stores/chains/index.d.ts +1 -2
- package/stores/chains/index.js +1 -2
- package/stores/chains/useChainOrder.js +1 -1
- package/stores/chains/useChainOrderStore.d.ts +3 -0
- package/stores/chains/{createChainOrderStore.js → useChainOrderStore.js} +2 -2
- package/stores/routes/RouteExecutionStore.js +2 -14
- package/stores/routes/createRouteExecutionStore.js +27 -16
- package/stores/routes/types.d.ts +1 -1
- package/stores/routes/useExecutingRoutesIds.js +2 -5
- package/stores/routes/useRecommendedRouteStore.d.ts +10 -2
- package/stores/routes/useRecommendedRouteStore.js +25 -1
- package/stores/routes/useSwapHistory.js +3 -6
- package/stores/routes/utils.js +4 -4
- package/stores/settings/index.d.ts +1 -1
- package/stores/settings/index.js +1 -1
- package/stores/settings/types.d.ts +6 -6
- package/stores/settings/useAppearance.js +1 -1
- package/stores/settings/useSettings.js +1 -1
- package/stores/settings/useSettingsStore.d.ts +6 -0
- package/stores/settings/{createSettingsStore.js → useSettingsStore.js} +46 -26
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/utils/colors.js +1 -1
- package/utils/format.js +3 -3
- 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/stores/chains/ChainOrderStore.d.ts +0 -9
- package/cjs/stores/chains/ChainOrderStore.js +0 -44
- package/cjs/stores/chains/createChainOrderStore.d.ts +0 -4
- package/cjs/stores/settings/SettingsStore.d.ts +0 -11
- package/cjs/stores/settings/SettingsStore.js +0 -58
- package/cjs/stores/settings/createSettingsStore.d.ts +0 -5
- 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/stores/chains/ChainOrderStore.d.ts +0 -9
- package/stores/chains/ChainOrderStore.js +0 -38
- package/stores/chains/createChainOrderStore.d.ts +0 -4
- package/stores/settings/SettingsStore.d.ts +0 -11
- package/stores/settings/SettingsStore.js +0 -51
- package/stores/settings/createSettingsStore.d.ts +0 -5
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SettingsPage = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
|
-
const AdvancedPreferences_1 = require("./AdvancedPreferences");
|
|
7
6
|
const ColorSchemeButtonGroup_1 = require("./ColorSchemeButtonGroup");
|
|
7
|
+
const EnabledToolsButton_1 = require("./EnabledToolsButton");
|
|
8
8
|
const GasPriceSelect_1 = require("./GasPriceSelect");
|
|
9
9
|
const LanguageSelect_1 = require("./LanguageSelect");
|
|
10
|
+
const ResetSettingsButton_1 = require("./ResetSettingsButton");
|
|
10
11
|
const RoutePrioritySelect_1 = require("./RoutePrioritySelect");
|
|
11
12
|
const ShowDestinationWallet_1 = require("./ShowDestinationWallet");
|
|
12
13
|
const SlippageInput_1 = require("./SlippageInput");
|
|
13
14
|
const SettingsPage = () => {
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Container,
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Container, { disableGutters: true, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { px: 3, pt: 1, children: [(0, jsx_runtime_1.jsx)(ColorSchemeButtonGroup_1.ColorSchemeButtonGroup, {}), (0, jsx_runtime_1.jsx)(LanguageSelect_1.LanguageSelect, {}), (0, jsx_runtime_1.jsx)(RoutePrioritySelect_1.RoutePrioritySelect, {}), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: 'flex', alignItems: 'center' }, mt: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { pr: 2, flex: 1, children: (0, jsx_runtime_1.jsx)(SlippageInput_1.SlippageInput, {}) }), (0, jsx_runtime_1.jsx)(GasPriceSelect_1.GasPriceSelect, {})] })] }), (0, jsx_runtime_1.jsx)(ShowDestinationWallet_1.ShowDestinationWallet, {}), (0, jsx_runtime_1.jsxs)(material_1.Box, { px: 1.5, children: [(0, jsx_runtime_1.jsx)(EnabledToolsButton_1.EnabledToolsButton, { type: "Bridges" }), (0, jsx_runtime_1.jsx)(EnabledToolsButton_1.EnabledToolsButton, { type: "Exchanges" })] }), (0, jsx_runtime_1.jsx)(ResetSettingsButton_1.ResetSettingsButton, {})] }));
|
|
15
16
|
};
|
|
16
17
|
exports.SettingsPage = SettingsPage;
|
|
@@ -14,17 +14,17 @@ const ShowDestinationWallet = () => {
|
|
|
14
14
|
const setSendToWallet = (0, stores_1.useSendToWalletStore)((state) => state.setSendToWallet);
|
|
15
15
|
const setValue = (0, stores_1.useSettingsStore)((state) => state.setValue);
|
|
16
16
|
const { showDestinationWallet } = (0, stores_1.useSettings)(['showDestinationWallet']);
|
|
17
|
-
if (hiddenUI
|
|
17
|
+
if (hiddenUI?.includes(types_1.HiddenUI.ToAddress)) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
const onChange = (_, checked) => {
|
|
21
21
|
setValue('showDestinationWallet', checked);
|
|
22
22
|
setSendToWallet(false);
|
|
23
23
|
};
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Box,
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { px: 3, pt: 2, pb: 1.5, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
25
25
|
display: 'flex',
|
|
26
26
|
justifyContent: 'space-between',
|
|
27
27
|
alignItems: 'center',
|
|
28
|
-
}
|
|
28
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: 'flex', alignItems: 'center' }, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle1", color: "text.primary", lineHeight: "normal", children: t(`settings.showDestinationWallet`) }) }), (0, jsx_runtime_1.jsx)(Switch_1.Switch, { checked: showDestinationWallet, onChange: onChange })] }) }));
|
|
29
29
|
};
|
|
30
30
|
exports.ShowDestinationWallet = ShowDestinationWallet;
|
|
@@ -22,9 +22,9 @@ const SlippageInput = () => {
|
|
|
22
22
|
const { value } = event.target;
|
|
23
23
|
setValue('slippage', (0, utils_1.formatSlippage)(value, defaultValue.current));
|
|
24
24
|
};
|
|
25
|
-
const value = slippage
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.slippage`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl,
|
|
25
|
+
const value = slippage ?? '';
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.slippage`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, children: (0, jsx_runtime_1.jsx)(Input_1.Input, { size: "small", placeholder: t(`settings.slippage`), endAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", children: "%" }), autoComplete: "off", inputProps: {
|
|
27
27
|
inputMode: 'decimal',
|
|
28
|
-
}, onChange: handleChange, onBlur: handleBlur, value: value }) })
|
|
28
|
+
}, onChange: handleChange, onBlur: handleBlur, value: value }) })] }));
|
|
29
29
|
};
|
|
30
30
|
exports.SlippageInput = SlippageInput;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.SwapDetailsPage = void 0;
|
|
13
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -25,11 +16,10 @@ const hooks_1 = require("../../hooks");
|
|
|
25
16
|
const stores_1 = require("../../stores");
|
|
26
17
|
const SwapDetailsPage_style_1 = require("./SwapDetailsPage.style");
|
|
27
18
|
const SwapDetailsPage = () => {
|
|
28
|
-
var _a, _b, _c, _d, _e, _f;
|
|
29
19
|
const { t, i18n } = (0, react_i18next_1.useTranslation)();
|
|
30
20
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
31
21
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
32
|
-
const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state
|
|
22
|
+
const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state?.routeId], store.deleteRoute], shallow_1.shallow);
|
|
33
23
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
34
24
|
const toggleDialog = (0, react_1.useCallback)(() => {
|
|
35
25
|
setOpen((open) => !open);
|
|
@@ -40,26 +30,28 @@ const SwapDetailsPage = () => {
|
|
|
40
30
|
deleteRoute(routeExecution.route.id);
|
|
41
31
|
}
|
|
42
32
|
};
|
|
43
|
-
let supportId =
|
|
33
|
+
let supportId = routeExecution?.route.steps[0].execution?.process.find((process) => process.txHash)?.txHash ??
|
|
34
|
+
routeExecution?.route.id ??
|
|
35
|
+
'';
|
|
44
36
|
if (process.env.NODE_ENV === 'development') {
|
|
45
|
-
supportId += `_${routeExecution
|
|
37
|
+
supportId += `_${routeExecution?.route.id}`;
|
|
46
38
|
}
|
|
47
|
-
const copySupportId = () =>
|
|
48
|
-
|
|
49
|
-
}
|
|
39
|
+
const copySupportId = async () => {
|
|
40
|
+
await navigator.clipboard.writeText(supportId);
|
|
41
|
+
};
|
|
50
42
|
(0, react_1.useEffect)(() => {
|
|
51
|
-
return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton,
|
|
43
|
+
return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(icons_material_1.DeleteOutline, {}) }));
|
|
52
44
|
}, [toggleDialog]);
|
|
53
|
-
const startedAt = new Date(
|
|
54
|
-
return ((0, jsx_runtime_1.jsxs)(SwapDetailsPage_style_1.Container, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box,
|
|
45
|
+
const startedAt = new Date(routeExecution?.route.steps[0].execution?.process[0].startedAt ?? 0);
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)(SwapDetailsPage_style_1.Container, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
55
47
|
display: 'flex',
|
|
56
48
|
flex: 1,
|
|
57
49
|
justifyContent: 'space-between',
|
|
58
|
-
}, pb: 1
|
|
50
|
+
}, pb: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, {
|
|
59
51
|
timeStyle: 'short',
|
|
60
|
-
}).format(startedAt) })
|
|
52
|
+
}).format(startedAt) })] }), (0, Step_1.getStepList)(routeExecution?.route), (0, jsx_runtime_1.jsxs)(Card_1.Card, { mt: 2, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
61
53
|
display: 'flex',
|
|
62
54
|
flex: 1,
|
|
63
|
-
}
|
|
55
|
+
}, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { flex: 1, children: t('swap.supportId') }), (0, jsx_runtime_1.jsx)(material_1.Box, { mr: 1, mt: 1, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: copySupportId, children: (0, jsx_runtime_1.jsx)(icons_material_1.ContentCopy, { fontSize: "small" }) }) })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", pt: 1, pb: 2, px: 2, sx: { wordBreak: 'break-all' }, children: supportId })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsx)(material_1.Button, { href: "https://discord.com/channels/849912621360218112/863689862514343946", target: "_blank", rel: "nofollow noreferrer", fullWidth: true, children: t('button.contactSupport') }) }), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { open: open, onClose: toggleDialog, children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('swap.warning.title.deleteSwap') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('swap.warning.message.deleteSwapHistory') }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: toggleDialog, children: t('button.cancel') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: handleDeleteRoute, autoFocus: true, children: t('button.delete') })] })] })] }));
|
|
64
56
|
};
|
|
65
57
|
exports.SwapDetailsPage = SwapDetailsPage;
|
|
@@ -6,6 +6,6 @@ export declare const Container: 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>, {}, {}>;
|
|
@@ -7,13 +7,13 @@ const material_1 = require("@mui/material");
|
|
|
7
7
|
const react_i18next_1 = require("react-i18next");
|
|
8
8
|
const SwapHistoryEmpty = () => {
|
|
9
9
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
10
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Container,
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Container, { sx: {
|
|
11
11
|
display: 'flex',
|
|
12
12
|
flex: 1,
|
|
13
13
|
flexDirection: 'column',
|
|
14
14
|
alignItems: 'center',
|
|
15
15
|
justifyContent: 'center',
|
|
16
16
|
paddingY: 12,
|
|
17
|
-
}
|
|
17
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 48, children: (0, jsx_runtime_1.jsx)(icons_material_1.ReceiptLongRounded, { fontSize: "inherit" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 18, fontWeight: 700, children: t('swap.info.title.emptySwapHistory') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2, children: t('swap.info.message.emptySwapHistory') })] }));
|
|
18
18
|
};
|
|
19
19
|
exports.SwapHistoryEmpty = SwapHistoryEmpty;
|
|
@@ -9,7 +9,6 @@ const Card_1 = require("../../components/Card");
|
|
|
9
9
|
const Token_1 = require("../../components/Token");
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const SwapHistoryItem = ({ route }) => {
|
|
12
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
13
12
|
const { i18n } = (0, react_i18next_1.useTranslation)();
|
|
14
13
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
15
14
|
const handleClick = () => {
|
|
@@ -17,15 +16,18 @@ const SwapHistoryItem = ({ route }) => {
|
|
|
17
16
|
state: { routeId: route.id },
|
|
18
17
|
});
|
|
19
18
|
};
|
|
20
|
-
const startedAt = new Date(
|
|
21
|
-
const fromToken =
|
|
22
|
-
const toToken =
|
|
23
|
-
|
|
19
|
+
const startedAt = new Date(route.steps[0].execution?.process[0].startedAt ?? 0);
|
|
20
|
+
const fromToken = { ...route.fromToken, amount: route.fromAmount };
|
|
21
|
+
const toToken = {
|
|
22
|
+
...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
|
|
23
|
+
amount: route.steps.at(-1)?.execution?.toAmount ?? route.toAmount,
|
|
24
|
+
};
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { onClick: handleClick, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
24
26
|
display: 'flex',
|
|
25
27
|
flex: 1,
|
|
26
28
|
justifyContent: 'space-between',
|
|
27
|
-
}, pt: 1.75, px: 2
|
|
29
|
+
}, pt: 1.75, px: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, {
|
|
28
30
|
timeStyle: 'short',
|
|
29
|
-
}).format(startedAt) })
|
|
31
|
+
}).format(startedAt) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { py: 1, children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: fromToken, px: 2, pt: 1, connected: true }), (0, jsx_runtime_1.jsx)(Token_1.TokenDivider, {}), (0, jsx_runtime_1.jsx)(Token_1.Token, { token: toToken, px: 2, pt: 0.5, pb: 1 })] })] }));
|
|
30
32
|
};
|
|
31
33
|
exports.SwapHistoryItem = SwapHistoryItem;
|
|
@@ -25,12 +25,12 @@ const SwapHistoryPage = () => {
|
|
|
25
25
|
}, []);
|
|
26
26
|
(0, react_1.useEffect)(() => {
|
|
27
27
|
if (swaps.length) {
|
|
28
|
-
return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton,
|
|
28
|
+
return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(icons_material_1.DeleteOutline, {}) }));
|
|
29
29
|
}
|
|
30
30
|
}, [swaps.length, toggleDialog]);
|
|
31
31
|
if (!swaps.length) {
|
|
32
32
|
return (0, jsx_runtime_1.jsx)(SwapHistoryEmpty_1.SwapHistoryEmpty, {});
|
|
33
33
|
}
|
|
34
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Container, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack,
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Container, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, { spacing: 2, mt: 1, children: swaps.length ? (swaps.map(({ route }) => ((0, jsx_runtime_1.jsx)(SwapHistoryItem_1.SwapHistoryItem, { route: route }, route.id)))) : ((0, jsx_runtime_1.jsx)(SwapHistoryEmpty_1.SwapHistoryEmpty, {})) }), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { open: open, onClose: toggleDialog, children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('swap.warning.title.deleteSwapHistory') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('swap.warning.message.deleteSwapHistory') }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: toggleDialog, children: t('button.cancel') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => deleteRoutes('completed'), autoFocus: true, children: t('button.delete') })] })] })] }));
|
|
35
35
|
};
|
|
36
36
|
exports.SwapHistoryPage = SwapHistoryPage;
|
|
@@ -16,60 +16,55 @@ exports.ExchangeRateBottomSheet = (0, react_1.forwardRef)(({ onContinue, onCance
|
|
|
16
16
|
const bottomSheetRef = (0, react_1.useRef)(null);
|
|
17
17
|
const resolverRef = (0, react_1.useRef)();
|
|
18
18
|
const handleContinue = () => {
|
|
19
|
-
|
|
20
|
-
(
|
|
21
|
-
onContinue === null || onContinue === void 0 ? void 0 : onContinue();
|
|
19
|
+
ref.current?.close(true);
|
|
20
|
+
onContinue?.();
|
|
22
21
|
};
|
|
23
22
|
const handleCancel = (0, react_1.useCallback)(() => {
|
|
24
|
-
|
|
25
|
-
(
|
|
26
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
23
|
+
ref.current?.close(false);
|
|
24
|
+
onCancel?.();
|
|
27
25
|
}, [onCancel, ref]);
|
|
28
26
|
const handleClose = (0, react_1.useCallback)(() => {
|
|
29
|
-
|
|
30
|
-
(
|
|
31
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
27
|
+
ref.current?.close(false, false);
|
|
28
|
+
onCancel?.();
|
|
32
29
|
}, [onCancel, ref]);
|
|
33
30
|
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
34
|
-
isOpen: () =>
|
|
31
|
+
isOpen: () => bottomSheetRef.current?.isOpen(),
|
|
35
32
|
open: (resolver, data) => {
|
|
36
|
-
var _a;
|
|
37
33
|
setData(data);
|
|
38
34
|
resolverRef.current = resolver;
|
|
39
|
-
|
|
35
|
+
bottomSheetRef.current?.open();
|
|
40
36
|
},
|
|
41
37
|
close: (value = false, bottomSheetClose = true) => {
|
|
42
|
-
|
|
43
|
-
(_a = resolverRef.current) === null || _a === void 0 ? void 0 : _a.call(resolverRef, value);
|
|
38
|
+
resolverRef.current?.(value);
|
|
44
39
|
if (bottomSheetClose) {
|
|
45
|
-
|
|
40
|
+
bottomSheetRef.current?.close();
|
|
46
41
|
}
|
|
47
42
|
},
|
|
48
43
|
}), []);
|
|
49
|
-
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet,
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, { ref: bottomSheetRef, onClose: handleClose, children: (0, jsx_runtime_1.jsx)(ExchangeRateBottomSheetContent, { data: data, onContinue: handleContinue, onCancel: handleCancel }) }));
|
|
50
45
|
});
|
|
51
46
|
const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
|
|
52
47
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
53
48
|
const ref = (0, react_1.useRef)();
|
|
54
49
|
(0, hooks_1.useSetContentHeight)(ref);
|
|
55
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box,
|
|
56
|
-
value: (0, utils_1.formatTokenAmount)(data
|
|
57
|
-
}), ' ', data
|
|
58
|
-
value: (0, utils_1.formatTokenAmount)(data
|
|
59
|
-
}), ' ', data
|
|
60
|
-
.div((0, big_js_1.default)(
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, ref: ref, children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.IconCircle, { status: "warning", mb: 1, children: (0, jsx_runtime_1.jsx)(icons_material_1.WarningRounded, { color: "warning" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.rateChanged') })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: t('swap.warning.message.rateChanged') }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.quotedAmount') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { fontWeight: 600, children: [t('format.number', {
|
|
51
|
+
value: (0, utils_1.formatTokenAmount)(data?.oldToAmount, data?.toToken.decimals, 5),
|
|
52
|
+
}), ' ', data?.toToken.symbol] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.currentAmount') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { fontWeight: 600, children: [t('format.number', {
|
|
53
|
+
value: (0, utils_1.formatTokenAmount)(data?.newToAmount, data?.toToken.decimals, 5),
|
|
54
|
+
}), ' ', data?.toToken.symbol] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.rateChange') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { fontWeight: 600, children: [(0, big_js_1.default)(data?.newToAmount || 0)
|
|
55
|
+
.div((0, big_js_1.default)(data?.oldToAmount || 0))
|
|
61
56
|
.minus(1)
|
|
62
57
|
.mul(100)
|
|
63
58
|
.round(2, big_js_1.default.roundUp)
|
|
64
|
-
.toString(), "%"] })
|
|
59
|
+
.toString(), "%"] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", mt: 3, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "text", onClick: onCancel, fullWidth: true, children: t('button.cancel') }), (0, jsx_runtime_1.jsx)(material_1.Box, { display: "flex", p: 1 }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: onContinue, fullWidth: true, children: t('button.continue') })] })] }));
|
|
65
60
|
};
|
|
66
61
|
const getTokenValueLossThreshold = (route) => {
|
|
67
62
|
if (!route) {
|
|
68
63
|
return false;
|
|
69
64
|
}
|
|
70
|
-
const fromAmountUSD = (0, big_js_1.default)(
|
|
71
|
-
const toAmountUSD = (0, big_js_1.default)(
|
|
72
|
-
const gasCostUSD = (0, big_js_1.default)(
|
|
65
|
+
const fromAmountUSD = (0, big_js_1.default)(route?.fromAmountUSD || 0);
|
|
66
|
+
const toAmountUSD = (0, big_js_1.default)(route?.toAmountUSD || 0);
|
|
67
|
+
const gasCostUSD = (0, big_js_1.default)(route?.gasCostUSD || 0);
|
|
73
68
|
if (fromAmountUSD.eq(0) && toAmountUSD.eq(0)) {
|
|
74
69
|
return false;
|
|
75
70
|
}
|
|
@@ -6,6 +6,6 @@ const SwapButton_1 = require("../../components/SwapButton");
|
|
|
6
6
|
const hooks_1 = require("../../hooks");
|
|
7
7
|
const StartSwapButton = ({ onClick, currentRoute, text, }) => {
|
|
8
8
|
const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = (0, hooks_1.useGasSufficiency)(currentRoute);
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { onClick: onClick, text: text, currentRoute: currentRoute, disabled: insufficientFunds || !!
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { onClick: onClick, text: text, currentRoute: currentRoute, disabled: insufficientFunds || !!insufficientGas?.length, loading: isGasSufficiencyLoading }));
|
|
10
10
|
};
|
|
11
11
|
exports.StartSwapButton = StartSwapButton;
|
|
@@ -16,13 +16,17 @@ const stores_1 = require("../../stores");
|
|
|
16
16
|
const utils_1 = require("../../utils");
|
|
17
17
|
const StatusBottomSheet_style_1 = require("./StatusBottomSheet.style");
|
|
18
18
|
const StatusBottomSheet = ({ status, route, }) => {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
20
19
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
21
20
|
const { navigateBack, navigate } = (0, hooks_1.useNavigateBack)();
|
|
22
21
|
const ref = (0, react_1.useRef)(null);
|
|
23
22
|
const { getChainById } = (0, hooks_1.useChains)();
|
|
24
23
|
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
25
|
-
const toToken =
|
|
24
|
+
const toToken = {
|
|
25
|
+
...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
|
|
26
|
+
amount: route.steps.at(-1)?.execution?.toAmount ??
|
|
27
|
+
route.steps.at(-1)?.estimate.toAmount ??
|
|
28
|
+
route.toAmount,
|
|
29
|
+
};
|
|
26
30
|
const { token, refetch, refetchNewBalance, refetchAllBalances } = (0, hooks_1.useTokenBalance)(toToken, route.toAddress);
|
|
27
31
|
const clearFromAmount = () => {
|
|
28
32
|
refetchAllBalances();
|
|
@@ -49,9 +53,8 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
49
53
|
navigateBack();
|
|
50
54
|
};
|
|
51
55
|
const handleClose = () => {
|
|
52
|
-
var _a;
|
|
53
56
|
clearFromAmount();
|
|
54
|
-
|
|
57
|
+
ref.current?.close();
|
|
55
58
|
};
|
|
56
59
|
const handleSeeDetails = () => {
|
|
57
60
|
handleClose();
|
|
@@ -71,7 +74,7 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
71
74
|
primaryMessage = t('swap.success.message.swapSuccessful', {
|
|
72
75
|
amount: token.amount,
|
|
73
76
|
tokenSymbol: token.symbol,
|
|
74
|
-
chainName:
|
|
77
|
+
chainName: getChainById(token.chainId)?.name,
|
|
75
78
|
walletAddress: (0, utils_1.shortenWalletAddress)(route.toAddress),
|
|
76
79
|
});
|
|
77
80
|
}
|
|
@@ -81,14 +84,14 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
81
84
|
case stores_1.RouteExecutionStatus.Done | stores_1.RouteExecutionStatus.Partial: {
|
|
82
85
|
title = t('swap.success.title.swapPartiallySuccessful');
|
|
83
86
|
primaryMessage = t('swap.success.message.swapPartiallySuccessful', {
|
|
84
|
-
tool:
|
|
85
|
-
tokenSymbol:
|
|
87
|
+
tool: route.steps.at(-1)?.toolDetails.name,
|
|
88
|
+
tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
|
|
86
89
|
});
|
|
87
90
|
if (token) {
|
|
88
91
|
secondaryMessage = t('swap.success.message.swapSuccessful', {
|
|
89
92
|
amount: token.amount,
|
|
90
93
|
tokenSymbol: token.symbol,
|
|
91
|
-
chainName:
|
|
94
|
+
chainName: getChainById(token.chainId)?.name,
|
|
92
95
|
walletAddress: (0, utils_1.shortenWalletAddress)(route.toAddress),
|
|
93
96
|
});
|
|
94
97
|
}
|
|
@@ -98,22 +101,22 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
98
101
|
case stores_1.RouteExecutionStatus.Done | stores_1.RouteExecutionStatus.Refunded: {
|
|
99
102
|
title = t('swap.success.title.refundIssued');
|
|
100
103
|
primaryMessage = t('swap.success.message.swapPartiallySuccessful', {
|
|
101
|
-
tool:
|
|
102
|
-
tokenSymbol:
|
|
104
|
+
tool: route.steps.at(-1)?.toolDetails.name,
|
|
105
|
+
tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
|
|
103
106
|
});
|
|
104
107
|
if (token) {
|
|
105
108
|
secondaryMessage = t('swap.success.message.swapSuccessful', {
|
|
106
109
|
amount: token.amount,
|
|
107
110
|
tokenSymbol: token.symbol,
|
|
108
|
-
chainName:
|
|
111
|
+
chainName: getChainById(token.chainId)?.name,
|
|
109
112
|
walletAddress: (0, utils_1.shortenWalletAddress)(route.toAddress),
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
break;
|
|
113
116
|
}
|
|
114
117
|
case stores_1.RouteExecutionStatus.Failed: {
|
|
115
|
-
const step = route.steps.find((step) =>
|
|
116
|
-
const process =
|
|
118
|
+
const step = route.steps.find((step) => step.execution?.status === 'FAILED');
|
|
119
|
+
const process = step?.execution?.process.find((process) => process.status === 'FAILED');
|
|
117
120
|
if (!step || !process) {
|
|
118
121
|
break;
|
|
119
122
|
}
|
|
@@ -127,22 +130,21 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
127
130
|
break;
|
|
128
131
|
}
|
|
129
132
|
(0, react_1.useEffect)(() => {
|
|
130
|
-
var _a, _b;
|
|
131
133
|
const hasSuccessFlag = (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done);
|
|
132
134
|
if ((hasSuccessFlag || (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Failed)) &&
|
|
133
|
-
!
|
|
135
|
+
!ref.current?.isOpen()) {
|
|
134
136
|
if (hasSuccessFlag) {
|
|
135
137
|
refetchNewBalance();
|
|
136
138
|
refetch();
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
ref.current?.open();
|
|
139
141
|
}
|
|
140
142
|
}, [refetch, refetchNewBalance, status]);
|
|
141
|
-
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet,
|
|
142
|
-
(0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Refunded) ? ((0, jsx_runtime_1.jsx)(icons_material_1.WarningRounded, { color: "warning" })) : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Failed) ? ((0, jsx_runtime_1.jsx)(icons_material_1.ErrorRounded, { color: "error" })) : null] })
|
|
143
|
+
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, { ref: ref, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconCircle, { status: status, mb: 1, children: [status === stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsx)(icons_material_1.InfoRounded, { color: "primary" })) : null, status === stores_1.RouteExecutionStatus.Done ? ((0, jsx_runtime_1.jsx)(icons_material_1.Done, { color: "success" })) : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Partial) ||
|
|
144
|
+
(0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Refunded) ? ((0, jsx_runtime_1.jsx)(icons_material_1.WarningRounded, { color: "warning" })) : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Failed) ? ((0, jsx_runtime_1.jsx)(icons_material_1.ErrorRounded, { color: "error" })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }), (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done) ? ((0, jsx_runtime_1.jsx)(Token_1.Token, { token: toToken, py: 1, disableDescription: true })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: primaryMessage }), secondaryMessage ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: secondaryMessage })) : null, (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsxs)(material_1.Button, { variant: "contained", fullWidth: true, onClick: handlePrimaryButton, children: [status === stores_1.RouteExecutionStatus.Idle ? t('button.ok') : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done)
|
|
143
145
|
? t('button.done')
|
|
144
146
|
: null, status === stores_1.RouteExecutionStatus.Failed
|
|
145
147
|
? t('button.seeDetails')
|
|
146
|
-
: null] })
|
|
148
|
+
: null] }) }), (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done) ? ((0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "text", onClick: handleSeeDetails, fullWidth: true, children: t('button.seeDetails') }) })) : null] }) }));
|
|
147
149
|
};
|
|
148
150
|
exports.StatusBottomSheet = StatusBottomSheet;
|
|
@@ -7,7 +7,7 @@ export declare const IconContainer: import("@emotion/styled").StyledComponent<im
|
|
|
7
7
|
component?: import("react").ElementType<any> | undefined;
|
|
8
8
|
ref?: import("react").Ref<unknown> | undefined;
|
|
9
9
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
10
|
-
} & Omit<
|
|
10
|
+
} & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
11
11
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
12
12
|
}, "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
|
|
13
13
|
export declare const IconCircle: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
|
|
@@ -15,7 +15,7 @@ export declare const IconCircle: import("@emotion/styled").StyledComponent<impor
|
|
|
15
15
|
component?: import("react").ElementType<any> | undefined;
|
|
16
16
|
ref?: import("react").Ref<unknown> | undefined;
|
|
17
17
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
18
|
-
} & Omit<
|
|
18
|
+
} & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
19
19
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
20
20
|
}, "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
|
|
21
21
|
status: StatusColor;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.SwapPage = void 0;
|
|
13
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -28,7 +19,6 @@ const StatusBottomSheet_1 = require("./StatusBottomSheet");
|
|
|
28
19
|
const SwapPage_style_1 = require("./SwapPage.style");
|
|
29
20
|
const TokenValueBottomSheet_1 = require("./TokenValueBottomSheet");
|
|
30
21
|
const SwapPage = () => {
|
|
31
|
-
var _a;
|
|
32
22
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
33
23
|
const { variant } = (0, providers_1.useWidgetConfig)();
|
|
34
24
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
@@ -37,23 +27,21 @@ const SwapPage = () => {
|
|
|
37
27
|
const exchangeRateBottomSheetRef = (0, react_1.useRef)(null);
|
|
38
28
|
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
39
29
|
const { route, status, executeRoute, restartRoute, deleteRoute } = (0, hooks_1.useRouteExecution)({
|
|
40
|
-
routeId: state
|
|
41
|
-
onAcceptExchangeRateUpdate:
|
|
30
|
+
routeId: state?.routeId,
|
|
31
|
+
onAcceptExchangeRateUpdate: exchangeRateBottomSheetRef.current?.open,
|
|
42
32
|
});
|
|
43
33
|
const handleExecuteRoute = (0, react_1.useCallback)(() => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
(_b = tokenValueBottomSheetRef.current) === null || _b === void 0 ? void 0 : _b.close();
|
|
34
|
+
if (tokenValueBottomSheetRef.current?.isOpen()) {
|
|
35
|
+
tokenValueBottomSheetRef.current?.close();
|
|
47
36
|
}
|
|
48
37
|
executeRoute();
|
|
49
38
|
setValue(providers_1.SwapFormKey.FromAmount, '');
|
|
50
39
|
}, [executeRoute, setValue]);
|
|
51
|
-
const handleSwapClick = () =>
|
|
52
|
-
var _b;
|
|
40
|
+
const handleSwapClick = async () => {
|
|
53
41
|
if (status === stores_1.RouteExecutionStatus.Idle) {
|
|
54
42
|
const thresholdExceeded = (0, TokenValueBottomSheet_1.getTokenValueLossThreshold)(route);
|
|
55
43
|
if (thresholdExceeded) {
|
|
56
|
-
|
|
44
|
+
tokenValueBottomSheetRef.current?.open();
|
|
57
45
|
}
|
|
58
46
|
else {
|
|
59
47
|
handleExecuteRoute();
|
|
@@ -62,7 +50,7 @@ const SwapPage = () => {
|
|
|
62
50
|
if (status === stores_1.RouteExecutionStatus.Failed) {
|
|
63
51
|
restartRoute();
|
|
64
52
|
}
|
|
65
|
-
}
|
|
53
|
+
};
|
|
66
54
|
const handleRemoveRoute = () => {
|
|
67
55
|
navigateBack();
|
|
68
56
|
deleteRoute();
|
|
@@ -80,9 +68,9 @@ const SwapPage = () => {
|
|
|
80
68
|
}
|
|
81
69
|
};
|
|
82
70
|
return ((0, jsx_runtime_1.jsxs)(SwapPage_style_1.Container, { children: [(0, Step_1.getStepList)(route), status === stores_1.RouteExecutionStatus.Idle ||
|
|
83
|
-
status === stores_1.RouteExecutionStatus.Failed ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { route: route, mt: 2 }), (0, jsx_runtime_1.jsxs)(material_1.Box,
|
|
71
|
+
status === stores_1.RouteExecutionStatus.Failed ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { route: route, mt: 2 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { mt: 2, display: "flex", children: [(0, jsx_runtime_1.jsx)(StartSwapButton_1.StartSwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route }), status === stores_1.RouteExecutionStatus.Failed ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleRemoveRoute, sx: {
|
|
84
72
|
minWidth: 48,
|
|
85
73
|
marginLeft: 1,
|
|
86
|
-
}
|
|
74
|
+
}, children: (0, jsx_runtime_1.jsx)(icons_material_1.Delete, {}) }) })) : null] })] })) : null, route && status ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_1.StatusBottomSheet, { status: status, route: route })) : null, route ? ((0, jsx_runtime_1.jsx)(TokenValueBottomSheet_1.TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? ((0, jsx_runtime_1.jsx)(ExchangeRateBottomSheet_1.ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })) : null] }));
|
|
87
75
|
};
|
|
88
76
|
exports.SwapPage = SwapPage;
|
|
@@ -6,6 +6,6 @@ export declare const Container: 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>, {}, {}>;
|