@lifi/widget 1.13.2 → 1.13.3
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/cjs/App.d.ts +4 -0
- package/cjs/App.js +80 -0
- package/cjs/AppDrawer.d.ts +14 -0
- package/cjs/AppDrawer.js +44 -0
- package/cjs/AppDrawer.style.d.ts +53 -0
- package/cjs/AppDrawer.style.js +75 -0
- package/cjs/AppProvider.d.ts +11 -0
- package/cjs/AppProvider.js +31 -0
- package/cjs/components/AppContainer.d.ts +15 -0
- package/cjs/components/AppContainer.js +59 -0
- package/cjs/components/BottomSheet/BottomSheet.d.ts +3 -0
- package/cjs/components/BottomSheet/BottomSheet.js +45 -0
- package/cjs/components/BottomSheet/index.d.ts +2 -0
- package/cjs/components/BottomSheet/index.js +18 -0
- package/cjs/components/BottomSheet/types.d.ts +10 -0
- package/cjs/components/BottomSheet/types.js +2 -0
- package/cjs/components/Card/Card.d.ts +14 -0
- package/cjs/components/Card/Card.js +35 -0
- package/cjs/components/Card/CardHeader.d.ts +18 -0
- package/cjs/components/Card/CardHeader.js +23 -0
- package/cjs/components/Card/CardTitle.d.ts +14 -0
- package/cjs/components/Card/CardTitle.js +12 -0
- package/cjs/components/Card/index.d.ts +3 -0
- package/cjs/components/Card/index.js +19 -0
- package/cjs/components/Dialog.d.ts +3 -0
- package/cjs/components/Dialog.js +27 -0
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +6 -0
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +45 -0
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +9 -0
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +14 -0
- package/cjs/components/GasSufficiencyMessage/index.d.ts +1 -0
- package/cjs/components/GasSufficiencyMessage/index.js +17 -0
- package/cjs/components/Header/Header.d.ts +2 -0
- package/cjs/components/Header/Header.js +27 -0
- package/cjs/components/Header/Header.style.d.ts +20 -0
- package/cjs/components/Header/Header.style.js +26 -0
- package/cjs/components/Header/NavigationHeader.d.ts +2 -0
- package/cjs/components/Header/NavigationHeader.js +58 -0
- package/cjs/components/Header/WalletHeader.d.ts +2 -0
- package/cjs/components/Header/WalletHeader.js +48 -0
- package/cjs/components/Header/index.d.ts +2 -0
- package/cjs/components/Header/index.js +18 -0
- package/cjs/components/Header/types.d.ts +8 -0
- package/cjs/components/Header/types.js +2 -0
- package/cjs/components/Header/useHeaderActionStore.d.ts +6 -0
- package/cjs/components/Header/useHeaderActionStore.js +26 -0
- package/cjs/components/Initializer.d.ts +2 -0
- package/cjs/components/Initializer.js +9 -0
- package/cjs/components/Input.d.ts +1 -0
- package/cjs/components/Input.js +17 -0
- package/cjs/components/LiFiLogo.d.ts +5 -0
- package/cjs/components/LiFiLogo.js +10 -0
- package/cjs/components/NotFound.d.ts +2 -0
- package/cjs/components/NotFound.js +19 -0
- package/cjs/components/PoweredBy/PoweredBy.d.ts +2 -0
- package/cjs/components/PoweredBy/PoweredBy.js +16 -0
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +12 -0
- package/cjs/components/PoweredBy/PoweredBy.style.js +12 -0
- package/cjs/components/PoweredBy/index.d.ts +1 -0
- package/cjs/components/PoweredBy/index.js +5 -0
- package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.d.ts +7 -0
- package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +63 -0
- package/cjs/components/ProgressToNextUpdate/index.d.ts +1 -0
- package/cjs/components/ProgressToNextUpdate/index.js +17 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.d.ts +4 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +26 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +29 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.js +19 -0
- package/cjs/components/ReverseTokensButton/index.d.ts +1 -0
- package/cjs/components/ReverseTokensButton/index.js +17 -0
- package/cjs/components/Select.d.ts +3 -0
- package/cjs/components/Select.js +30 -0
- package/cjs/components/SelectChainAndToken.d.ts +3 -0
- package/cjs/components/SelectChainAndToken.js +23 -0
- package/cjs/components/SelectTokenButton/SelectTokenButton.d.ts +5 -0
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +35 -0
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.d.ts +21 -0
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +27 -0
- package/cjs/components/SelectTokenButton/index.d.ts +1 -0
- package/cjs/components/SelectTokenButton/index.js +17 -0
- package/cjs/components/SmallAvatar.d.ts +16 -0
- package/cjs/components/SmallAvatar.js +11 -0
- package/cjs/components/Step/CircularProgress.d.ts +5 -0
- package/cjs/components/Step/CircularProgress.js +24 -0
- package/cjs/components/Step/CircularProgress.style.d.ts +6 -0
- package/cjs/components/Step/CircularProgress.style.js +54 -0
- package/cjs/components/Step/Step.d.ts +7 -0
- package/cjs/components/Step/Step.js +36 -0
- package/cjs/components/Step/StepProcess.d.ts +6 -0
- package/cjs/components/Step/StepProcess.js +25 -0
- package/cjs/components/Step/StepProcess.style.d.ts +39 -0
- package/cjs/components/Step/StepProcess.style.js +8 -0
- package/cjs/components/Step/StepTimer.d.ts +5 -0
- package/cjs/components/Step/StepTimer.js +64 -0
- package/cjs/components/Step/index.d.ts +1 -0
- package/cjs/components/Step/index.js +17 -0
- package/cjs/components/Step/utils.d.ts +6 -0
- package/cjs/components/Step/utils.js +93 -0
- package/cjs/components/StepActions/StepActions.d.ts +13 -0
- package/cjs/components/StepActions/StepActions.js +71 -0
- package/cjs/components/StepActions/StepActions.style.d.ts +20 -0
- package/cjs/components/StepActions/StepActions.style.js +59 -0
- package/cjs/components/StepActions/index.d.ts +1 -0
- package/cjs/components/StepActions/index.js +5 -0
- package/cjs/components/StepActions/types.d.ts +6 -0
- package/cjs/components/StepActions/types.js +2 -0
- package/cjs/components/StepDivider/StepDivider.d.ts +2 -0
- package/cjs/components/StepDivider/StepDivider.js +10 -0
- package/cjs/components/StepDivider/StepDivider.style.d.ts +11 -0
- package/cjs/components/StepDivider/StepDivider.style.js +11 -0
- package/cjs/components/StepDivider/index.d.ts +1 -0
- package/cjs/components/StepDivider/index.js +17 -0
- package/cjs/components/SwapButton/ButtonTooltip.d.ts +5 -0
- package/cjs/components/SwapButton/ButtonTooltip.js +7 -0
- package/cjs/components/SwapButton/SwapButton.d.ts +3 -0
- package/cjs/components/SwapButton/SwapButton.js +74 -0
- package/cjs/components/SwapButton/SwapButton.style.d.ts +65 -0
- package/cjs/components/SwapButton/SwapButton.style.js +15 -0
- package/cjs/components/SwapButton/index.d.ts +1 -0
- package/cjs/components/SwapButton/index.js +5 -0
- package/cjs/components/SwapButton/types.d.ts +7 -0
- package/cjs/components/SwapButton/types.js +2 -0
- package/cjs/components/SwapInProgress/SwapInProgress.d.ts +3 -0
- package/cjs/components/SwapInProgress/SwapInProgress.js +29 -0
- package/cjs/components/SwapInProgress/SwapInProgress.style.d.ts +31 -0
- package/cjs/components/SwapInProgress/SwapInProgress.style.js +17 -0
- package/cjs/components/SwapInProgress/index.d.ts +1 -0
- package/cjs/components/SwapInProgress/index.js +17 -0
- package/cjs/components/SwapInput/FormPriceHelperText.d.ts +5 -0
- package/cjs/components/SwapInput/FormPriceHelperText.js +31 -0
- package/cjs/components/SwapInput/SwapInput.d.ts +3 -0
- package/cjs/components/SwapInput/SwapInput.js +46 -0
- package/cjs/components/SwapInput/SwapInput.style.d.ts +21 -0
- package/cjs/components/SwapInput/SwapInput.style.js +33 -0
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +3 -0
- package/cjs/components/SwapInput/SwapInputAdornment.js +27 -0
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +34 -0
- package/cjs/components/SwapInput/SwapInputAdornment.style.js +23 -0
- package/cjs/components/SwapInput/index.d.ts +1 -0
- package/cjs/components/SwapInput/index.js +17 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +4 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +42 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +16 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +30 -0
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.d.ts +4 -0
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +32 -0
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +4 -0
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +30 -0
- package/cjs/components/SwapRouteCard/index.d.ts +3 -0
- package/cjs/components/SwapRouteCard/index.js +19 -0
- package/cjs/components/SwapRouteCard/types.d.ts +9 -0
- package/cjs/components/SwapRouteCard/types.js +2 -0
- package/cjs/components/Switch.d.ts +1 -0
- package/cjs/components/Switch.js +56 -0
- package/cjs/components/TextFitter/TextFitter.d.ts +3 -0
- package/cjs/components/TextFitter/TextFitter.js +52 -0
- package/cjs/components/TextFitter/index.d.ts +1 -0
- package/cjs/components/TextFitter/index.js +17 -0
- package/cjs/components/TextFitter/types.d.ts +12 -0
- package/cjs/components/TextFitter/types.js +2 -0
- package/cjs/components/Token/Token.d.ts +7 -0
- package/cjs/components/Token/Token.js +35 -0
- package/cjs/components/Token/Token.style.d.ts +24 -0
- package/cjs/components/Token/Token.style.js +34 -0
- package/cjs/components/Token/index.d.ts +2 -0
- package/cjs/components/Token/index.js +18 -0
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +7 -0
- package/cjs/components/TokenAvatar/TokenAvatar.js +13 -0
- package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +19 -0
- package/cjs/components/TokenAvatar/index.d.ts +2 -0
- package/cjs/components/TokenAvatar/index.js +18 -0
- package/cjs/components/TokenList/TokenList.d.ts +3 -0
- package/cjs/components/TokenList/TokenList.js +55 -0
- package/cjs/components/TokenList/TokenList.style.d.ts +32 -0
- package/cjs/components/TokenList/TokenList.style.js +28 -0
- package/cjs/components/TokenList/TokenListItem.d.ts +5 -0
- package/cjs/components/TokenList/TokenListItem.js +32 -0
- package/cjs/components/TokenList/TokenNotFound.d.ts +2 -0
- package/cjs/components/TokenList/TokenNotFound.js +19 -0
- package/cjs/components/TokenList/VirtualizedTokenList.d.ts +3 -0
- package/cjs/components/TokenList/VirtualizedTokenList.js +57 -0
- package/cjs/components/TokenList/index.d.ts +1 -0
- package/cjs/components/TokenList/index.js +17 -0
- package/cjs/components/TokenList/types.d.ts +32 -0
- package/cjs/components/TokenList/types.js +2 -0
- package/cjs/config/env.d.ts +3 -0
- package/cjs/config/env.js +6 -0
- package/cjs/config/lifi.d.ts +3 -0
- package/cjs/config/lifi.js +12 -0
- package/cjs/config/queryClient.d.ts +2 -0
- package/cjs/config/queryClient.js +28 -0
- package/cjs/config/sentry.d.ts +1 -0
- package/cjs/config/sentry.js +65 -0
- package/cjs/config/theme.d.ts +27 -0
- package/cjs/config/theme.js +175 -0
- package/cjs/config/version.d.ts +2 -0
- package/cjs/config/version.js +5 -0
- package/cjs/hooks/index.d.ts +17 -0
- package/cjs/hooks/index.js +33 -0
- package/cjs/hooks/useChain.d.ts +4 -0
- package/cjs/hooks/useChain.js +17 -0
- package/cjs/hooks/useChains.d.ts +101 -0
- package/cjs/hooks/useChains.js +43 -0
- package/cjs/hooks/useContentHeight.d.ts +1 -0
- package/cjs/hooks/useContentHeight.js +27 -0
- package/cjs/hooks/useDebouncedWatch.d.ts +1 -0
- package/cjs/hooks/useDebouncedWatch.js +36 -0
- package/cjs/hooks/useFeaturedTokens.d.ts +1 -0
- package/cjs/hooks/useFeaturedTokens.js +10 -0
- package/cjs/hooks/useGasSufficiency.d.ts +15 -0
- package/cjs/hooks/useGasSufficiency.js +105 -0
- package/cjs/hooks/useInitializer.d.ts +1 -0
- package/cjs/hooks/useInitializer.js +9 -0
- package/cjs/hooks/useRouteExecution.d.ts +8 -0
- package/cjs/hooks/useRouteExecution.js +163 -0
- package/cjs/hooks/useScrollableContainer.d.ts +2 -0
- package/cjs/hooks/useScrollableContainer.js +29 -0
- package/cjs/hooks/useSwapRoutes.d.ts +9 -0
- package/cjs/hooks/useSwapRoutes.js +109 -0
- package/cjs/hooks/useTelemetry.d.ts +1 -0
- package/cjs/hooks/useTelemetry.js +22 -0
- package/cjs/hooks/useToken.d.ts +5 -0
- package/cjs/hooks/useToken.js +18 -0
- package/cjs/hooks/useTokenBalance.d.ts +5 -0
- package/cjs/hooks/useTokenBalance.js +19 -0
- package/cjs/hooks/useTokenBalances.d.ts +10 -0
- package/cjs/hooks/useTokenBalances.js +80 -0
- package/cjs/hooks/useTokenSearch.d.ts +7 -0
- package/cjs/hooks/useTokenSearch.js +41 -0
- package/cjs/hooks/useTokens.d.ts +6 -0
- package/cjs/hooks/useTokens.js +36 -0
- package/cjs/hooks/useTools.d.ts +10 -0
- package/cjs/hooks/useTools.js +28 -0
- package/cjs/i18n/en/translation.json +175 -0
- package/cjs/i18n/index.d.ts +181 -0
- package/cjs/i18n/index.js +27 -0
- package/cjs/icons/LiFiFullLogo.d.ts +2 -0
- package/cjs/icons/LiFiFullLogo.js +6 -0
- package/cjs/icons/LiFiLogo.d.ts +2 -0
- package/cjs/icons/LiFiLogo.js +6 -0
- package/cjs/icons/LiFiToolLogo.d.ts +2 -0
- package/cjs/icons/LiFiToolLogo.js +6 -0
- package/cjs/icons/index.d.ts +3 -0
- package/cjs/icons/index.js +19 -0
- package/cjs/index.d.ts +5 -0
- package/cjs/index.js +28 -0
- package/cjs/pages/MainPage/MainPage.d.ts +2 -0
- package/cjs/pages/MainPage/MainPage.js +15 -0
- package/cjs/pages/MainPage/MainPage.style.d.ts +11 -0
- package/cjs/pages/MainPage/MainPage.style.js +11 -0
- package/cjs/pages/MainPage/MainSwapButton.d.ts +2 -0
- package/cjs/pages/MainPage/MainSwapButton.js +34 -0
- package/cjs/pages/MainPage/SwapRoutes.d.ts +3 -0
- package/cjs/pages/MainPage/SwapRoutes.js +40 -0
- package/cjs/pages/MainPage/SwapRoutes.style.d.ts +11 -0
- package/cjs/pages/MainPage/SwapRoutes.style.js +16 -0
- package/cjs/pages/MainPage/index.d.ts +1 -0
- package/cjs/pages/MainPage/index.js +17 -0
- package/cjs/pages/SelectTokenPage/ChainSelect.d.ts +3 -0
- package/cjs/pages/SelectTokenPage/ChainSelect.js +32 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +2 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.js +21 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.style.d.ts +1 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.style.js +8 -0
- package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +5 -0
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +27 -0
- package/cjs/pages/SelectTokenPage/index.d.ts +2 -0
- package/cjs/pages/SelectTokenPage/index.js +18 -0
- package/cjs/pages/SelectTokenPage/types.d.ts +4 -0
- package/cjs/pages/SelectTokenPage/types.js +8 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +2 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +53 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +46 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +30 -0
- package/cjs/pages/SelectWalletPage/index.d.ts +1 -0
- package/cjs/pages/SelectWalletPage/index.js +17 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +2 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.js +24 -0
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.d.ts +2 -0
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +24 -0
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +33 -0
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.js +19 -0
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +30 -0
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +29 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.js +17 -0
- package/cjs/pages/SettingsPage/RoutePrioritySelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +18 -0
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +2 -0
- package/cjs/pages/SettingsPage/SettingsPage.js +14 -0
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +2 -0
- package/cjs/pages/SettingsPage/SlippageInput.js +29 -0
- package/cjs/pages/SettingsPage/index.d.ts +1 -0
- package/cjs/pages/SettingsPage/index.js +17 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +69 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.style.js +8 -0
- package/cjs/pages/SwapDetailsPage/index.d.ts +1 -0
- package/cjs/pages/SwapDetailsPage/index.js +17 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +18 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +27 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +34 -0
- package/cjs/pages/SwapHistoryPage/index.d.ts +1 -0
- package/cjs/pages/SwapHistoryPage/index.js +17 -0
- package/cjs/pages/SwapPage/StatusBottomSheet.d.ts +3 -0
- package/cjs/pages/SwapPage/StatusBottomSheet.js +83 -0
- package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +25 -0
- package/cjs/pages/SwapPage/StatusBottomSheet.style.js +35 -0
- package/cjs/pages/SwapPage/SwapPage.d.ts +2 -0
- package/cjs/pages/SwapPage/SwapPage.js +49 -0
- package/cjs/pages/SwapPage/SwapPage.style.d.ts +11 -0
- package/cjs/pages/SwapPage/SwapPage.style.js +8 -0
- package/cjs/pages/SwapPage/index.d.ts +1 -0
- package/cjs/pages/SwapPage/index.js +17 -0
- package/cjs/pages/SwapPage/utils.d.ts +6 -0
- package/cjs/pages/SwapPage/utils.js +93 -0
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.d.ts +3 -0
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +39 -0
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +11 -0
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.js +9 -0
- package/cjs/pages/SwapRoutesPage/index.d.ts +1 -0
- package/cjs/pages/SwapRoutesPage/index.js +17 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.d.ts +6 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +45 -0
- package/cjs/providers/SwapFormProvider/index.d.ts +2 -0
- package/cjs/providers/SwapFormProvider/index.js +18 -0
- package/cjs/providers/SwapFormProvider/types.d.ts +25 -0
- package/cjs/providers/SwapFormProvider/types.js +17 -0
- package/cjs/providers/ThemeProvider/ThemeProvider.d.ts +2 -0
- package/cjs/providers/ThemeProvider/ThemeProvider.js +37 -0
- package/cjs/providers/ThemeProvider/index.d.ts +1 -0
- package/cjs/providers/ThemeProvider/index.js +17 -0
- package/cjs/providers/WalletProvider/WalletProvider.d.ts +19 -0
- package/cjs/providers/WalletProvider/WalletProvider.js +106 -0
- package/cjs/providers/WalletProvider/index.d.ts +2 -0
- package/cjs/providers/WalletProvider/index.js +18 -0
- package/cjs/providers/WalletProvider/types.d.ts +17 -0
- package/cjs/providers/WalletProvider/types.js +2 -0
- package/cjs/providers/WidgetProvider/WidgetProvider.d.ts +4 -0
- package/cjs/providers/WidgetProvider/WidgetProvider.js +68 -0
- package/cjs/providers/WidgetProvider/index.d.ts +2 -0
- package/cjs/providers/WidgetProvider/index.js +18 -0
- package/cjs/providers/WidgetProvider/types.d.ts +8 -0
- package/cjs/providers/WidgetProvider/types.js +2 -0
- package/cjs/stores/index.d.ts +2 -0
- package/cjs/stores/index.js +18 -0
- package/cjs/stores/route/index.d.ts +5 -0
- package/cjs/stores/route/index.js +21 -0
- package/cjs/stores/route/types.d.ts +14 -0
- package/cjs/stores/route/types.js +2 -0
- package/cjs/stores/route/useExecutingRoutes.d.ts +2 -0
- package/cjs/stores/route/useExecutingRoutes.js +13 -0
- package/cjs/stores/route/useRouteStore.d.ts +18 -0
- package/cjs/stores/route/useRouteStore.js +57 -0
- package/cjs/stores/route/useSetExecutableRoute.d.ts +1 -0
- package/cjs/stores/route/useSetExecutableRoute.js +8 -0
- package/cjs/stores/route/useSwapHistory.d.ts +2 -0
- package/cjs/stores/route/useSwapHistory.js +18 -0
- package/cjs/stores/settings/index.d.ts +5 -0
- package/cjs/stores/settings/index.js +21 -0
- package/cjs/stores/settings/types.d.ts +23 -0
- package/cjs/stores/settings/types.js +4 -0
- package/cjs/stores/settings/useAppearance.d.ts +2 -0
- package/cjs/stores/settings/useAppearance.js +14 -0
- package/cjs/stores/settings/useSetSettings.d.ts +5 -0
- package/cjs/stores/settings/useSetSettings.js +12 -0
- package/cjs/stores/settings/useSettings.d.ts +2 -0
- package/cjs/stores/settings/useSettings.js +15 -0
- package/cjs/stores/settings/useSettingsStore.d.ts +38 -0
- package/cjs/stores/settings/useSettingsStore.js +90 -0
- package/cjs/types/index.d.ts +2 -0
- package/cjs/types/index.js +18 -0
- package/cjs/types/token.d.ts +4 -0
- package/cjs/types/token.js +2 -0
- package/cjs/types/widget.d.ts +47 -0
- package/cjs/types/widget.js +2 -0
- package/cjs/utils/colors.d.ts +3 -0
- package/cjs/utils/colors.js +13 -0
- package/cjs/utils/deepClone.d.ts +1 -0
- package/cjs/utils/deepClone.js +7 -0
- package/cjs/utils/elements.d.ts +4 -0
- package/cjs/utils/elements.js +8 -0
- package/cjs/utils/format.d.ts +9 -0
- package/cjs/utils/format.js +86 -0
- package/cjs/utils/index.d.ts +6 -0
- package/cjs/utils/index.js +22 -0
- package/cjs/utils/input.d.ts +1 -0
- package/cjs/utils/input.js +28 -0
- package/cjs/utils/navigationRoutes.d.ts +13 -0
- package/cjs/utils/navigationRoutes.js +15 -0
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/index.js +3 -1
- package/package.json +25 -11
- package/tsconfig.cjs.tsbuildinfo +1 -0
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SwapButton = void 0;
|
|
13
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
+
const sdk_1 = require("@lifi/sdk");
|
|
15
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
16
|
+
const react_i18next_1 = require("react-i18next");
|
|
17
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
18
|
+
const hooks_1 = require("../../hooks");
|
|
19
|
+
const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
|
|
20
|
+
const WalletProvider_1 = require("../../providers/WalletProvider");
|
|
21
|
+
const WidgetProvider_1 = require("../../providers/WidgetProvider");
|
|
22
|
+
const utils_1 = require("../../utils");
|
|
23
|
+
const SwapButton_style_1 = require("./SwapButton.style");
|
|
24
|
+
const SwapButton = ({ onClick, currentRoute, text, loading, }) => {
|
|
25
|
+
var _a;
|
|
26
|
+
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
27
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
28
|
+
const { getChainById } = (0, hooks_1.useChains)();
|
|
29
|
+
const config = (0, WidgetProvider_1.useWidgetConfig)();
|
|
30
|
+
const { account, switchChain, connect: walletConnect } = (0, WalletProvider_1.useWallet)();
|
|
31
|
+
const { insufficientFunds, insufficientGas } = (0, hooks_1.useGasSufficiency)(currentRoute);
|
|
32
|
+
const [chainId] = (0, react_hook_form_1.useWatch)({
|
|
33
|
+
name: [SwapFormProvider_1.SwapFormKeyHelper.getChainKey('from')],
|
|
34
|
+
});
|
|
35
|
+
// Allow switching chain only if execution is not started
|
|
36
|
+
const switchChainAllowed = ((_a = getChainById(chainId || sdk_1.ChainId.ETH)) === null || _a === void 0 ? void 0 : _a.id) !== account.chainId &&
|
|
37
|
+
currentRoute &&
|
|
38
|
+
!currentRoute.steps.some((step) => step.execution);
|
|
39
|
+
const handleSwapButtonClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
if (!account.isActive) {
|
|
41
|
+
if (config.walletManagement) {
|
|
42
|
+
yield walletConnect();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
navigate(utils_1.navigationRoutes.selectWallet);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else if (switchChainAllowed) {
|
|
49
|
+
yield switchChain(chainId);
|
|
50
|
+
// check that the current route exists in the up to date route list
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const getButtonText = () => {
|
|
57
|
+
if (account.isActive) {
|
|
58
|
+
if (switchChainAllowed) {
|
|
59
|
+
return t(`button.switchChain`);
|
|
60
|
+
}
|
|
61
|
+
if (!currentRoute) {
|
|
62
|
+
return t(`button.swap`);
|
|
63
|
+
}
|
|
64
|
+
return text || t(`button.reviewSwap`);
|
|
65
|
+
}
|
|
66
|
+
return t(`button.connectWallet`);
|
|
67
|
+
};
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)(SwapButton_style_1.Button, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick,
|
|
69
|
+
// loading={isLoading || isFetching}
|
|
70
|
+
disabled: (insufficientFunds || !!insufficientGas.length || loading) &&
|
|
71
|
+
currentRoute &&
|
|
72
|
+
!switchChainAllowed, fullWidth: true }, { children: getButtonText() })));
|
|
73
|
+
};
|
|
74
|
+
exports.SwapButton = SwapButton;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
classes?: (Partial<import("@mui/material").ButtonClasses> & {
|
|
4
|
+
root?: string | undefined;
|
|
5
|
+
loading?: string | undefined;
|
|
6
|
+
loadingIndicator?: string | undefined;
|
|
7
|
+
loadingIndicatorCenter?: string | undefined;
|
|
8
|
+
loadingIndicatorStart?: string | undefined;
|
|
9
|
+
loadingIndicatorEnd?: string | undefined;
|
|
10
|
+
endIconLoadingEnd?: string | undefined;
|
|
11
|
+
startIconLoadingStart?: string | undefined;
|
|
12
|
+
}) | undefined;
|
|
13
|
+
loading?: boolean | undefined;
|
|
14
|
+
loadingIndicator?: import("react").ReactNode;
|
|
15
|
+
loadingPosition?: "center" | "end" | "start" | undefined;
|
|
16
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
17
|
+
} & Omit<{
|
|
18
|
+
children?: import("react").ReactNode;
|
|
19
|
+
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
20
|
+
color?: "inherit" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
disableElevation?: boolean | undefined;
|
|
23
|
+
disableFocusRipple?: boolean | undefined;
|
|
24
|
+
endIcon?: import("react").ReactNode;
|
|
25
|
+
fullWidth?: boolean | undefined;
|
|
26
|
+
href?: string | undefined;
|
|
27
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
28
|
+
startIcon?: import("react").ReactNode;
|
|
29
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
30
|
+
variant?: "text" | "outlined" | "contained" | undefined;
|
|
31
|
+
} & Omit<{
|
|
32
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
33
|
+
centerRipple?: boolean | undefined;
|
|
34
|
+
children?: import("react").ReactNode;
|
|
35
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
36
|
+
disabled?: boolean | undefined;
|
|
37
|
+
disableRipple?: boolean | undefined;
|
|
38
|
+
disableTouchRipple?: boolean | undefined;
|
|
39
|
+
focusRipple?: boolean | undefined;
|
|
40
|
+
focusVisibleClassName?: string | undefined;
|
|
41
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
42
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
43
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
44
|
+
tabIndex?: number | undefined;
|
|
45
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
46
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
47
|
+
}, "classes">, "classes"> & Omit<{
|
|
48
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
49
|
+
centerRipple?: boolean | undefined;
|
|
50
|
+
children?: import("react").ReactNode;
|
|
51
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
52
|
+
disabled?: boolean | undefined;
|
|
53
|
+
disableRipple?: boolean | undefined;
|
|
54
|
+
disableTouchRipple?: boolean | undefined;
|
|
55
|
+
focusRipple?: boolean | undefined;
|
|
56
|
+
focusVisibleClassName?: string | undefined;
|
|
57
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
58
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
59
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
60
|
+
tabIndex?: number | undefined;
|
|
61
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
62
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
63
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
64
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
65
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "size" | "startIcon" | "variant" | "loading" | "loadingIndicator" | "loadingPosition"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = void 0;
|
|
4
|
+
const lab_1 = require("@mui/lab");
|
|
5
|
+
const LoadingButton_1 = require("@mui/lab/LoadingButton");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
exports.Button = (0, styles_1.styled)(lab_1.LoadingButton)(({ theme }) => ({
|
|
9
|
+
[`&.${LoadingButton_1.loadingButtonClasses.loading}`]: {
|
|
10
|
+
color: 'transparent',
|
|
11
|
+
},
|
|
12
|
+
[`.${LoadingButton_1.loadingButtonClasses.loadingIndicator}`]: {
|
|
13
|
+
color: (0, utils_1.getContrastAlphaColor)(theme, '70%'),
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwapButton } from './SwapButton';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapButton = void 0;
|
|
4
|
+
var SwapButton_1 = require("./SwapButton");
|
|
5
|
+
Object.defineProperty(exports, "SwapButton", { enumerable: true, get: function () { return SwapButton_1.SwapButton; } });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapInProgress = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_i18next_1 = require("react-i18next");
|
|
9
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
10
|
+
const WalletProvider_1 = require("../../providers/WalletProvider");
|
|
11
|
+
const stores_1 = require("../../stores");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
13
|
+
const Card_1 = require("../Card");
|
|
14
|
+
const TokenAvatar_1 = require("../TokenAvatar");
|
|
15
|
+
const SwapInProgress_style_1 = require("./SwapInProgress.style");
|
|
16
|
+
const SwapInProgress = (props) => {
|
|
17
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
18
|
+
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
19
|
+
const { account } = (0, WalletProvider_1.useWallet)();
|
|
20
|
+
const executingRoutes = (0, stores_1.useExecutingRoutes)(account.address);
|
|
21
|
+
const handleCardClick = (0, react_1.useCallback)((routeId) => {
|
|
22
|
+
navigate(utils_1.navigationRoutes.swapExecution, { state: { routeId } });
|
|
23
|
+
}, [navigate]);
|
|
24
|
+
if (!(executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length)) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(SwapInProgress_style_1.ProgressCard, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.inProgress') }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ spacing: 2, py: 2 }, { children: executingRoutes.map(({ route, status }) => ((0, jsx_runtime_1.jsx)(SwapInProgress_style_1.RouteCard, { onClick: () => handleCardClick(route.id), avatar: (0, jsx_runtime_1.jsxs)(TokenAvatar_1.TokenAvatarGroup, Object.assign({ total: 2 }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: route.fromToken }), (0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: route.toToken })] })), action: (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowRight, {}), title: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: [route.fromToken.symbol, (0, jsx_runtime_1.jsx)(icons_material_1.ArrowForward, { fontSize: "small", sx: { paddingX: 0.5 } }), route.toToken.symbol] })) }, route.id))) }))] })));
|
|
28
|
+
};
|
|
29
|
+
exports.SwapInProgress = SwapInProgress;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ProgressCard: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
component?: import("react").ElementType<any> | undefined;
|
|
5
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
6
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
7
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
8
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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<import("@mui/material/styles").Theme> & {
|
|
10
|
+
variant?: "default" | "error" | undefined;
|
|
11
|
+
dense?: boolean | undefined;
|
|
12
|
+
indented?: boolean | undefined;
|
|
13
|
+
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
14
|
+
}, {}, {}>;
|
|
15
|
+
export declare const RouteCard: import("@emotion/styled").StyledComponent<{
|
|
16
|
+
action?: import("react").ReactNode;
|
|
17
|
+
avatar?: import("react").ReactNode;
|
|
18
|
+
classes?: Partial<import("@mui/material").CardHeaderClasses> | undefined;
|
|
19
|
+
disableTypography?: boolean | undefined;
|
|
20
|
+
subheader?: import("react").ReactNode;
|
|
21
|
+
subheaderTypographyProps?: import("@mui/material").TypographyProps<"span", {
|
|
22
|
+
component?: "span" | undefined;
|
|
23
|
+
}> | undefined;
|
|
24
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
25
|
+
title?: import("react").ReactNode;
|
|
26
|
+
titleTypographyProps?: import("@mui/material").TypographyProps<"span", {
|
|
27
|
+
component?: "span" | undefined;
|
|
28
|
+
}> | undefined;
|
|
29
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
30
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
31
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteCard = exports.ProgressCard = void 0;
|
|
4
|
+
const styles_1 = require("@mui/material/styles");
|
|
5
|
+
const Card_1 = require("../Card");
|
|
6
|
+
exports.ProgressCard = (0, styles_1.styled)(Card_1.Card)(({ theme }) => ({
|
|
7
|
+
borderColor: (0, styles_1.alpha)(theme.palette.secondary.main, 0.48),
|
|
8
|
+
background: (0, styles_1.alpha)(theme.palette.secondary.main, 0.2),
|
|
9
|
+
'&:hover': {
|
|
10
|
+
background: (0, styles_1.alpha)(theme.palette.secondary.main, 0.2),
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
exports.RouteCard = (0, styles_1.styled)(Card_1.CardHeader)(({ theme }) => ({
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
paddingTop: 0,
|
|
16
|
+
paddingBottom: 0,
|
|
17
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SwapInProgress';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SwapInProgress"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormPriceHelperText = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
+
const react_i18next_1 = require("react-i18next");
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const FormPriceHelperText = ({ formType, selected }) => {
|
|
12
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
13
|
+
const [amount, chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
|
|
14
|
+
name: [
|
|
15
|
+
SwapFormProvider_1.SwapFormKeyHelper.getAmountKey(formType),
|
|
16
|
+
SwapFormProvider_1.SwapFormKeyHelper.getChainKey(formType),
|
|
17
|
+
SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(formType),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
const { token, isLoading } = (0, hooks_1.useTokenBalance)(chainId, tokenAddress);
|
|
21
|
+
const fromAmountTokenPrice = (0, utils_1.formatTokenPrice)(amount, token === null || token === void 0 ? void 0 : token.priceUSD);
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormHelperText, Object.assign({ component: "div", sx: { display: 'flex', justifyContent: 'space-between', margin: 0 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: fromAmountTokenPrice ? 'text.secondary' : 'grey.600', fontWeight: 400, fontSize: 12, marginLeft: selected ? 8 : 2, lineHeight: 1.3334, flex: 1, sx: {
|
|
23
|
+
wordBreak: 'break-word',
|
|
24
|
+
overflowWrap: 'break-word',
|
|
25
|
+
} }, { children: t(`swap.currency`, {
|
|
26
|
+
value: fromAmountTokenPrice,
|
|
27
|
+
}) })), isLoading && tokenAddress ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : (token === null || token === void 0 ? void 0 : token.amount) ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25 }, { children: t(`swap.maxAmount`, {
|
|
28
|
+
amount: token === null || token === void 0 ? void 0 : token.amount,
|
|
29
|
+
}) }))) : null] })));
|
|
30
|
+
};
|
|
31
|
+
exports.FormPriceHelperText = FormPriceHelperText;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapInput = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
+
const react_i18next_1 = require("react-i18next");
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const Card_1 = require("../Card");
|
|
12
|
+
const TokenAvatar_1 = require("../TokenAvatar");
|
|
13
|
+
const FormPriceHelperText_1 = require("./FormPriceHelperText");
|
|
14
|
+
const SwapInput_style_1 = require("./SwapInput.style");
|
|
15
|
+
const SwapInputAdornment_1 = require("./SwapInputAdornment");
|
|
16
|
+
const SwapInput = ({ formType }) => {
|
|
17
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
18
|
+
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
19
|
+
const ref = (0, react_1.useRef)(null);
|
|
20
|
+
const amountKey = SwapFormProvider_1.SwapFormKeyHelper.getAmountKey(formType);
|
|
21
|
+
const [amount, chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
|
|
22
|
+
name: [
|
|
23
|
+
amountKey,
|
|
24
|
+
SwapFormProvider_1.SwapFormKeyHelper.getChainKey(formType),
|
|
25
|
+
SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(formType),
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
const { chain } = (0, hooks_1.useChain)(chainId);
|
|
29
|
+
const { token } = (0, hooks_1.useToken)(chainId, tokenAddress);
|
|
30
|
+
const isSelected = !!(chain && token);
|
|
31
|
+
const handleChange = (event) => {
|
|
32
|
+
const { value } = event.target;
|
|
33
|
+
setValue(amountKey, (0, utils_1.formatAmount)(value, true));
|
|
34
|
+
};
|
|
35
|
+
const handleBlur = (event) => {
|
|
36
|
+
const { value } = event.target;
|
|
37
|
+
setValue(amountKey, (0, utils_1.formatAmount)(value));
|
|
38
|
+
};
|
|
39
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
40
|
+
(0, utils_1.fitInputText)(SwapInput_style_1.maxInputFontSize, SwapInput_style_1.minInputFontSize, ref.current);
|
|
41
|
+
}, [amount]);
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.amount') }), (0, jsx_runtime_1.jsxs)(SwapInput_style_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(SwapInput_style_1.Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? ((0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginLeft: 2 } })) : null, endAdornment: (0, jsx_runtime_1.jsx)(SwapInputAdornment_1.SwapInputAdornment, { formType: formType }), inputProps: {
|
|
43
|
+
inputMode: 'decimal',
|
|
44
|
+
}, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, required: true }), (0, jsx_runtime_1.jsx)(FormPriceHelperText_1.FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
|
|
45
|
+
};
|
|
46
|
+
exports.SwapInput = SwapInput;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const maxInputFontSize = 24;
|
|
3
|
+
export declare const minInputFontSize = 14;
|
|
4
|
+
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
5
|
+
children?: import("react").ReactNode;
|
|
6
|
+
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
7
|
+
color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
error?: boolean | undefined;
|
|
10
|
+
fullWidth?: boolean | undefined;
|
|
11
|
+
focused?: boolean | undefined;
|
|
12
|
+
hiddenLabel?: boolean | undefined;
|
|
13
|
+
margin?: "none" | "normal" | "dense" | undefined;
|
|
14
|
+
required?: boolean | undefined;
|
|
15
|
+
size?: "small" | "medium" | undefined;
|
|
16
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
17
|
+
variant?: "outlined" | "filled" | "standard" | undefined;
|
|
18
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
19
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
20
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "children" | "disabled" | "sx" | "margin" | "fullWidth" | "size" | "variant" | "error" | "required" | "focused" | "hiddenLabel"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
21
|
+
export declare const Input: import("@emotion/styled").StyledComponent<import("@mui/material").InputBaseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Input = exports.FormControl = exports.minInputFontSize = exports.maxInputFontSize = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const InputBase_1 = require("@mui/material/InputBase");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
exports.maxInputFontSize = 24;
|
|
8
|
+
exports.minInputFontSize = 14;
|
|
9
|
+
exports.FormControl = (0, styles_1.styled)(material_1.FormControl)(({ theme }) => ({
|
|
10
|
+
padding: theme.spacing(1.5, 2, 1.5, 0),
|
|
11
|
+
}));
|
|
12
|
+
exports.Input = (0, styles_1.styled)(material_1.InputBase)(({ theme }) => ({
|
|
13
|
+
fontSize: 24,
|
|
14
|
+
fontWeight: 700,
|
|
15
|
+
// padding: theme.spacing(2, 2, 2, 0),
|
|
16
|
+
[`.${InputBase_1.inputBaseClasses.input}`]: {
|
|
17
|
+
height: 32,
|
|
18
|
+
padding: theme.spacing(0, 0, 0, 2),
|
|
19
|
+
},
|
|
20
|
+
'& input[type="number"]::-webkit-outer-spin-button, & input[type="number"]::-webkit-inner-spin-button': {
|
|
21
|
+
WebkitAppearance: 'none',
|
|
22
|
+
margin: 0,
|
|
23
|
+
},
|
|
24
|
+
'& input[type="number"]': {
|
|
25
|
+
MozAppearance: 'textfield',
|
|
26
|
+
},
|
|
27
|
+
[`&.${InputBase_1.inputBaseClasses.disabled}`]: {
|
|
28
|
+
color: 'inherit',
|
|
29
|
+
},
|
|
30
|
+
[`.${InputBase_1.inputBaseClasses.input}.${InputBase_1.inputBaseClasses.disabled}`]: {
|
|
31
|
+
WebkitTextFillColor: 'unset',
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapInputAdornment = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
+
const react_i18next_1 = require("react-i18next");
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
|
|
10
|
+
const SwapInputAdornment_style_1 = require("./SwapInputAdornment.style");
|
|
11
|
+
const SwapInputAdornment = ({ formType }) => {
|
|
12
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
13
|
+
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
14
|
+
const [chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
|
|
15
|
+
name: [
|
|
16
|
+
SwapFormProvider_1.SwapFormKeyHelper.getChainKey(formType),
|
|
17
|
+
SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(formType),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
const { token, isLoading } = (0, hooks_1.useTokenBalance)(chainId, tokenAddress);
|
|
21
|
+
const handleMax = () => {
|
|
22
|
+
var _a;
|
|
23
|
+
setValue(SwapFormProvider_1.SwapFormKeyHelper.getAmountKey(formType), (_a = token === null || token === void 0 ? void 0 : token.amount) !== null && _a !== void 0 ? _a : '');
|
|
24
|
+
};
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "end" }, { children: isLoading && tokenAddress ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 46, height: 20, sx: { borderRadius: 0.5 } })) : formType === 'from' && (token === null || token === void 0 ? void 0 : token.amount) ? ((0, jsx_runtime_1.jsx)(SwapInputAdornment_style_1.Button, Object.assign({ onClick: handleMax, variant: "outlined" }, { children: t('button.max') }))) : null })));
|
|
26
|
+
};
|
|
27
|
+
exports.SwapInputAdornment = SwapInputAdornment;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
disableElevation?: boolean | undefined;
|
|
8
|
+
disableFocusRipple?: boolean | undefined;
|
|
9
|
+
endIcon?: import("react").ReactNode;
|
|
10
|
+
fullWidth?: boolean | undefined;
|
|
11
|
+
href?: string | undefined;
|
|
12
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
13
|
+
startIcon?: import("react").ReactNode;
|
|
14
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
+
variant?: "text" | "outlined" | "contained" | undefined;
|
|
16
|
+
} & Omit<{
|
|
17
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
18
|
+
centerRipple?: boolean | undefined;
|
|
19
|
+
children?: import("react").ReactNode;
|
|
20
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
disableRipple?: boolean | undefined;
|
|
23
|
+
disableTouchRipple?: boolean | undefined;
|
|
24
|
+
focusRipple?: boolean | undefined;
|
|
25
|
+
focusVisibleClassName?: string | undefined;
|
|
26
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
27
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
28
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
29
|
+
tabIndex?: number | undefined;
|
|
30
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
31
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
32
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
33
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
34
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "size" | "startIcon" | "variant"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
exports.Button = (0, styles_1.styled)(material_1.Button)(({ theme }) => ({
|
|
7
|
+
borderColor: theme.palette.mode === 'light'
|
|
8
|
+
? theme.palette.grey[300]
|
|
9
|
+
: theme.palette.grey[800],
|
|
10
|
+
color: theme.palette.text.secondary,
|
|
11
|
+
padding: theme.spacing(0.125, 1, 0.375, 1),
|
|
12
|
+
lineHeight: 1,
|
|
13
|
+
fontSize: '0.875rem',
|
|
14
|
+
minWidth: 'unset',
|
|
15
|
+
'&:hover': {
|
|
16
|
+
color: theme.palette.mode === 'light'
|
|
17
|
+
? theme.palette.primary.main
|
|
18
|
+
: theme.palette.text.primary,
|
|
19
|
+
borderColor: theme.palette.mode === 'light'
|
|
20
|
+
? (0, styles_1.lighten)(theme.palette.primary.main, 0.5)
|
|
21
|
+
: theme.palette.text.secondary,
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SwapInput';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SwapInput"), exports);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.SwapRouteCard = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const material_1 = require("@mui/material");
|
|
17
|
+
const react_i18next_1 = require("react-i18next");
|
|
18
|
+
const Card_1 = require("../Card");
|
|
19
|
+
const StepActions_1 = require("../StepActions");
|
|
20
|
+
const Token_1 = require("../Token");
|
|
21
|
+
const SwapRouteCard_style_1 = require("./SwapRouteCard.style");
|
|
22
|
+
const SwapRouteCard = (_a) => {
|
|
23
|
+
var _b, _c;
|
|
24
|
+
var { route, active, dense } = _a, other = __rest(_a, ["route", "active", "dense"]);
|
|
25
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
26
|
+
const label = ((_b = route.tags) === null || _b === void 0 ? void 0 : _b.length)
|
|
27
|
+
? t(`swap.tags.${route.tags[0].toLowerCase()}`).toUpperCase()
|
|
28
|
+
: t(`swap.tags.general`).toUpperCase();
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: dense, indented: true }, other, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
justifyContent: 'space-between',
|
|
33
|
+
}, mb: 2 }, { children: (0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, Object.assign({ active: active }, { children: label })) })), (0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), mb: 2 }), !dense
|
|
34
|
+
? route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mb: 2 }, step.id)))
|
|
35
|
+
: null, (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
} }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "500", lineHeight: 1, pt: 0.25 }, { children: t(`swap.currency`, { value: (_c = route.gasCostUSD) !== null && _c !== void 0 ? _c : 0 }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, color: "text.secondary", lineHeight: 1, mt: 0.5 }, { children: t(`swap.gas`) }))] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "500", display: "flex", justifyContent: "flex-end", lineHeight: 1, pt: 0.25 }, { children: ["~", (route.steps
|
|
39
|
+
.map((step) => step.estimate.executionDuration)
|
|
40
|
+
.reduce((cumulated, x) => cumulated + x) / 60).toFixed(0)] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, color: "text.secondary", textAlign: "end", lineHeight: 1, mt: 0.5 }, { children: t(`swap.minutes`) }))] })] }))] })));
|
|
41
|
+
};
|
|
42
|
+
exports.SwapRouteCard = SwapRouteCard;
|