@lifi/widget 1.32.8 → 2.0.0-alpha.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 +3 -3
- package/AppDrawer.js +4 -3
- package/AppDrawer.style.d.ts +5 -5
- package/AppProvider.js +4 -3
- package/cjs/App.js +3 -3
- package/cjs/AppDrawer.js +4 -3
- package/cjs/AppDrawer.style.d.ts +5 -5
- package/cjs/AppProvider.js +2 -1
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +5 -5
- package/cjs/components/Card/CardIconButton.d.ts +29 -0
- package/cjs/components/Card/CardIconButton.js +17 -0
- package/cjs/components/Card/CardLabel.d.ts +26 -0
- package/cjs/components/Card/CardLabel.js +45 -0
- package/cjs/components/Card/CardTitle.d.ts +2 -2
- package/cjs/components/Card/index.d.ts +2 -0
- package/cjs/components/Card/index.js +2 -0
- package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
- package/cjs/components/GasMessage/FundsSufficiencyMessage.js +16 -0
- package/cjs/components/{GasSufficiencyMessage/GasSufficiencyMessage.d.ts → GasMessage/GasMessage.d.ts} +4 -2
- package/cjs/components/GasMessage/GasMessage.js +19 -0
- package/cjs/components/GasMessage/GasMessage.style.d.ts +34 -0
- package/cjs/components/GasMessage/GasMessage.style.js +48 -0
- package/cjs/components/GasMessage/GasRefuelMessage.d.ts +3 -0
- package/cjs/components/GasMessage/GasRefuelMessage.js +26 -0
- package/cjs/components/GasMessage/GasSufficiencyMessage.d.ts +7 -0
- package/cjs/components/GasMessage/GasSufficiencyMessage.js +21 -0
- package/cjs/components/GasMessage/index.d.ts +2 -0
- package/cjs/components/GasMessage/index.js +18 -0
- package/cjs/components/Header/Header.style.d.ts +6 -6
- package/cjs/components/Header/NavigationHeader.js +4 -4
- package/cjs/components/Header/WalletHeader.js +5 -5
- package/cjs/components/Insurance/Insurance.d.ts +3 -0
- package/cjs/components/Insurance/Insurance.js +11 -0
- package/cjs/components/Insurance/InsuranceCard.d.ts +3 -0
- package/cjs/components/Insurance/InsuranceCard.js +20 -0
- package/cjs/components/Insurance/InsuranceCollapsed.d.ts +3 -0
- package/cjs/components/Insurance/InsuranceCollapsed.js +32 -0
- package/cjs/components/Insurance/index.d.ts +1 -0
- package/cjs/components/{GasSufficiencyMessage → Insurance}/index.js +1 -1
- package/cjs/components/Insurance/types.d.ts +14 -0
- package/cjs/components/Insurance/types.js +2 -0
- package/cjs/components/ListItemButton.d.ts +1 -1
- package/cjs/components/NFT/NFT.style.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +3 -12
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
- package/cjs/components/SendToWallet/SendToWallet.js +31 -25
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +2 -2
- package/cjs/components/SendToWallet/SendToWalletButton.js +3 -3
- package/cjs/components/SmallAvatar.d.ts +2 -2
- package/cjs/components/Step/CircularProgress.style.d.ts +1 -1
- package/cjs/components/Step/DestinationWalletAddress.d.ts +2 -2
- package/cjs/components/Step/DestinationWalletAddress.js +4 -8
- package/cjs/components/Step/GasStepProcess.d.ts +2 -2
- package/cjs/components/Step/GasStepProcess.js +3 -3
- package/cjs/components/Step/Step.d.ts +2 -2
- package/cjs/components/Step/Step.js +6 -8
- package/cjs/components/Step/StepList.d.ts +1 -1
- package/cjs/components/Step/StepProcess.d.ts +2 -2
- package/cjs/components/Step/StepProcess.js +1 -5
- package/cjs/components/Step/StepProcess.style.d.ts +3 -39
- package/cjs/components/Step/StepTimer.d.ts +2 -2
- package/cjs/components/Step/StepTimer.js +1 -1
- package/cjs/components/StepActions/StepActions.d.ts +6 -1
- package/cjs/components/StepActions/StepActions.js +54 -17
- package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
- package/cjs/components/StepActions/types.d.ts +2 -2
- package/cjs/components/SwapButton/SwapButton.js +2 -2
- package/cjs/components/SwapButton/types.d.ts +1 -2
- package/cjs/components/SwapInput/SwapInput.style.d.ts +2 -2
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +3 -3
- package/cjs/components/SwapInput/SwapInputEndAdornment.js +18 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +1 -2
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +10 -26
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +4 -36
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +7 -38
- package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +3 -0
- package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +27 -0
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +5 -5
- package/cjs/components/SwapRouteCard/types.d.ts +2 -2
- package/cjs/components/SwapRouteCard/utils.d.ts +5 -0
- package/cjs/components/SwapRouteCard/utils.js +32 -2
- package/cjs/components/SwapRoutes/SwapRoutes.js +3 -12
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +4 -11
- package/cjs/components/SwapRoutes/{SwapRoutes.style.d.ts → SwapRoutesExpanded.style.d.ts} +0 -9
- package/cjs/components/SwapRoutes/{SwapRoutes.style.js → SwapRoutesExpanded.style.js} +1 -12
- package/cjs/components/Switch.js +4 -4
- package/cjs/components/Token/Token.d.ts +2 -2
- package/cjs/components/Token/Token.style.d.ts +2 -2
- package/cjs/components/TokenList/TokenList.style.d.ts +2 -2
- package/cjs/config/theme.js +1 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +4 -0
- package/cjs/hooks/index.js +4 -0
- package/cjs/hooks/useChains.js +2 -2
- package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
- package/cjs/hooks/useFeaturedTokens.js +2 -2
- package/cjs/hooks/useFundsSufficiency.d.ts +5 -0
- package/cjs/hooks/useFundsSufficiency.js +73 -0
- package/cjs/hooks/useGasRecommendation.d.ts +2 -0
- package/cjs/hooks/useGasRecommendation.js +23 -0
- package/cjs/hooks/useGasRefuel.d.ts +7 -0
- package/cjs/hooks/useGasRefuel.js +61 -0
- package/cjs/hooks/useGasSufficiency.d.ts +2 -3
- package/cjs/hooks/useGasSufficiency.js +6 -37
- package/cjs/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
- package/cjs/hooks/useGetTokenBalancesWithRetry.js +33 -0
- package/cjs/hooks/useProcessMessage.d.ts +3 -3
- package/cjs/hooks/useSwapRoutes.d.ts +7 -2
- package/cjs/hooks/useSwapRoutes.js +31 -11
- package/cjs/hooks/useTokenAddressBalance.js +4 -2
- package/cjs/hooks/useTokenBalance.js +4 -22
- package/cjs/hooks/useTokenBalances.d.ts +1 -1
- package/cjs/hooks/useTokenSearch.js +2 -2
- package/cjs/hooks/useTokens.js +2 -3
- package/cjs/i18n/en.json +14 -7
- package/cjs/i18n/it.json +6 -2
- package/cjs/i18n/pt.json +234 -0
- package/cjs/i18n/uk.json +5 -1
- package/cjs/icons/InsuraceLogo.d.ts +2 -0
- package/cjs/icons/InsuraceLogo.js +11 -0
- package/cjs/icons/index.d.ts +1 -0
- package/cjs/icons/index.js +1 -0
- package/cjs/index.d.ts +0 -6
- package/cjs/index.js +1 -6
- package/cjs/pages/MainPage/MainGasMessage.d.ts +3 -0
- package/cjs/pages/MainPage/MainGasMessage.js +12 -0
- package/cjs/pages/MainPage/MainPage.js +3 -2
- package/cjs/pages/MainPage/MainSwapButton.js +1 -1
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
- package/cjs/pages/SettingsPage/EnabledToolsButton.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +1 -1
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -14
- package/cjs/pages/SwapPage/StartSwapButton.d.ts +3 -2
- package/cjs/pages/SwapPage/StartSwapButton.js +14 -4
- package/cjs/pages/SwapPage/SwapPage.js +18 -7
- package/cjs/pages/SwapPage/types.d.ts +9 -0
- package/cjs/pages/SwapPage/types.js +2 -0
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +2 -1
- package/cjs/providers/SDKProvider/SDKProvider.d.ts +2 -2
- package/cjs/providers/SDKProvider/SDKProvider.js +2 -1
- package/cjs/providers/SwapFormProvider/FormUpdater.js +2 -3
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +2 -3
- package/cjs/providers/SwapFormProvider/index.d.ts +1 -0
- package/cjs/providers/SwapFormProvider/index.js +1 -0
- package/cjs/providers/WidgetProvider/WidgetProvider.js +17 -4
- package/cjs/providers/WidgetProvider/utils.d.ts +1 -1
- package/cjs/providers/WidgetProvider/utils.js +2 -4
- package/cjs/stores/StoreProvider.js +1 -1
- package/cjs/stores/routes/createRouteExecutionStore.js +3 -2
- package/cjs/stores/routes/index.d.ts +0 -1
- package/cjs/stores/routes/index.js +0 -1
- package/cjs/stores/routes/types.d.ts +1 -5
- package/cjs/stores/routes/useSetExecutableRoute.d.ts +1 -1
- package/cjs/stores/settings/types.d.ts +1 -0
- package/cjs/stores/settings/useSettingsStore.js +1 -0
- package/cjs/types/widget.d.ts +5 -10
- package/cjs/utils/format.js +4 -1
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +5 -5
- package/components/Card/CardIconButton.d.ts +29 -0
- package/components/Card/CardIconButton.js +14 -0
- package/components/Card/CardLabel.d.ts +26 -0
- package/components/Card/CardLabel.js +42 -0
- package/components/Card/CardTitle.d.ts +2 -2
- package/components/Card/index.d.ts +2 -0
- package/components/Card/index.js +2 -0
- package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
- package/components/GasMessage/FundsSufficiencyMessage.js +12 -0
- package/components/{GasSufficiencyMessage/GasSufficiencyMessage.d.ts → GasMessage/GasMessage.d.ts} +4 -2
- package/components/GasMessage/GasMessage.js +15 -0
- package/components/GasMessage/GasMessage.style.d.ts +34 -0
- package/components/GasMessage/GasMessage.style.js +45 -0
- package/components/GasMessage/GasRefuelMessage.d.ts +3 -0
- package/components/GasMessage/GasRefuelMessage.js +22 -0
- package/components/GasMessage/GasSufficiencyMessage.d.ts +7 -0
- package/components/GasMessage/GasSufficiencyMessage.js +17 -0
- package/components/GasMessage/index.d.ts +2 -0
- package/components/GasMessage/index.js +2 -0
- package/components/Header/Header.style.d.ts +6 -6
- package/components/Header/NavigationHeader.js +4 -4
- package/components/Header/WalletHeader.js +6 -6
- package/components/Insurance/Insurance.d.ts +3 -0
- package/components/Insurance/Insurance.js +7 -0
- package/components/Insurance/InsuranceCard.d.ts +3 -0
- package/components/Insurance/InsuranceCard.js +16 -0
- package/components/Insurance/InsuranceCollapsed.d.ts +3 -0
- package/components/Insurance/InsuranceCollapsed.js +28 -0
- package/components/Insurance/index.d.ts +1 -0
- package/components/Insurance/index.js +1 -0
- package/components/Insurance/types.d.ts +14 -0
- package/components/Insurance/types.js +1 -0
- package/components/ListItemButton.d.ts +1 -1
- package/components/NFT/NFT.style.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.style.d.ts +3 -12
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
- package/components/SendToWallet/SendToWallet.js +34 -28
- package/components/SendToWallet/SendToWallet.style.d.ts +2 -2
- package/components/SendToWallet/SendToWalletButton.js +4 -4
- package/components/SmallAvatar.d.ts +2 -2
- package/components/Step/CircularProgress.style.d.ts +1 -1
- package/components/Step/DestinationWalletAddress.d.ts +2 -2
- package/components/Step/DestinationWalletAddress.js +4 -8
- package/components/Step/GasStepProcess.d.ts +2 -2
- package/components/Step/GasStepProcess.js +3 -3
- package/components/Step/Step.d.ts +2 -2
- package/components/Step/Step.js +6 -8
- package/components/Step/StepList.d.ts +1 -1
- package/components/Step/StepProcess.d.ts +2 -2
- package/components/Step/StepProcess.js +1 -5
- package/components/Step/StepProcess.style.d.ts +3 -39
- package/components/Step/StepTimer.d.ts +2 -2
- package/components/Step/StepTimer.js +1 -1
- package/components/StepActions/StepActions.d.ts +6 -1
- package/components/StepActions/StepActions.js +51 -16
- package/components/StepActions/StepActions.style.d.ts +1 -1
- package/components/StepActions/types.d.ts +2 -2
- package/components/SwapButton/SwapButton.js +2 -2
- package/components/SwapButton/types.d.ts +1 -2
- package/components/SwapInput/SwapInput.style.d.ts +2 -2
- package/components/SwapInput/SwapInputAdornment.style.d.ts +3 -3
- package/components/SwapInput/SwapInputEndAdornment.js +19 -2
- package/components/SwapRouteCard/SwapRouteCard.d.ts +1 -2
- package/components/SwapRouteCard/SwapRouteCard.js +11 -26
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +4 -36
- package/components/SwapRouteCard/SwapRouteCard.style.js +7 -38
- package/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +3 -0
- package/components/SwapRouteCard/SwapRouteCardEssentials.js +23 -0
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +5 -5
- package/components/SwapRouteCard/types.d.ts +2 -2
- package/components/SwapRouteCard/utils.d.ts +5 -0
- package/components/SwapRouteCard/utils.js +30 -1
- package/components/SwapRoutes/SwapRoutes.js +5 -14
- package/components/SwapRoutes/SwapRoutesExpanded.js +4 -11
- package/components/SwapRoutes/{SwapRoutes.style.d.ts → SwapRoutesExpanded.style.d.ts} +0 -9
- package/components/SwapRoutes/{SwapRoutes.style.js → SwapRoutesExpanded.style.js} +1 -12
- package/components/Switch.js +5 -5
- package/components/Token/Token.d.ts +2 -2
- package/components/Token/Token.style.d.ts +2 -2
- package/components/TokenList/TokenList.style.d.ts +2 -2
- package/config/theme.js +1 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +4 -0
- package/hooks/index.js +4 -0
- package/hooks/useChains.js +2 -2
- package/hooks/useFeaturedTokens.d.ts +1 -1
- package/hooks/useFeaturedTokens.js +2 -2
- package/hooks/useFundsSufficiency.d.ts +5 -0
- package/hooks/useFundsSufficiency.js +69 -0
- package/hooks/useGasRecommendation.d.ts +2 -0
- package/hooks/useGasRecommendation.js +19 -0
- package/hooks/useGasRefuel.d.ts +7 -0
- package/hooks/useGasRefuel.js +57 -0
- package/hooks/useGasSufficiency.d.ts +2 -3
- package/hooks/useGasSufficiency.js +7 -38
- package/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
- package/hooks/useGetTokenBalancesWithRetry.js +29 -0
- package/hooks/useProcessMessage.d.ts +3 -3
- package/hooks/useSwapRoutes.d.ts +7 -2
- package/hooks/useSwapRoutes.js +32 -12
- package/hooks/useTokenAddressBalance.js +4 -2
- package/hooks/useTokenBalance.js +5 -23
- package/hooks/useTokenBalances.d.ts +1 -1
- package/hooks/useTokenSearch.js +2 -2
- package/hooks/useTokens.js +2 -3
- package/i18n/en.json +14 -7
- package/i18n/it.json +6 -2
- package/i18n/pt.json +234 -0
- package/i18n/uk.json +5 -1
- package/icons/InsuraceLogo.d.ts +2 -0
- package/icons/InsuraceLogo.js +7 -0
- package/icons/index.d.ts +1 -0
- package/icons/index.js +1 -0
- package/index.d.ts +0 -6
- package/index.js +0 -5
- package/package.json +12 -12
- package/pages/ActiveSwapsPage/ActiveSwapsPage.js +2 -2
- package/pages/MainPage/MainGasMessage.d.ts +3 -0
- package/pages/MainPage/MainGasMessage.js +8 -0
- package/pages/MainPage/MainPage.js +3 -2
- package/pages/MainPage/MainSwapButton.js +1 -1
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +1 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
- package/pages/SettingsPage/EnabledToolsButton.style.d.ts +1 -1
- package/pages/SettingsPage/RoutePrioritySelect.js +1 -1
- package/pages/SwapDetailsPage/SwapDetailsPage.js +5 -4
- package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
- package/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
- package/pages/SwapPage/ExchangeRateBottomSheet.js +0 -12
- package/pages/SwapPage/StartSwapButton.d.ts +3 -2
- package/pages/SwapPage/StartSwapButton.js +13 -4
- package/pages/SwapPage/SwapPage.js +21 -10
- package/pages/SwapPage/types.d.ts +9 -0
- package/pages/SwapPage/types.js +1 -0
- package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +2 -1
- package/providers/SDKProvider/SDKProvider.d.ts +2 -2
- package/providers/SDKProvider/SDKProvider.js +3 -2
- package/providers/SwapFormProvider/FormUpdater.js +2 -3
- package/providers/SwapFormProvider/SwapFormProvider.js +2 -3
- package/providers/SwapFormProvider/index.d.ts +1 -0
- package/providers/SwapFormProvider/index.js +1 -0
- package/providers/WidgetProvider/WidgetProvider.js +17 -4
- package/providers/WidgetProvider/utils.d.ts +1 -1
- package/providers/WidgetProvider/utils.js +2 -4
- package/stores/StoreProvider.js +2 -2
- package/stores/routes/createRouteExecutionStore.js +3 -2
- package/stores/routes/index.d.ts +0 -1
- package/stores/routes/index.js +0 -1
- package/stores/routes/types.d.ts +1 -5
- package/stores/routes/useSetExecutableRoute.d.ts +1 -1
- package/stores/settings/types.d.ts +1 -0
- package/stores/settings/useSettingsStore.js +1 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +5 -10
- package/utils/format.js +4 -1
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -31
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -14
- package/cjs/components/GasSufficiencyMessage/index.d.ts +0 -1
- package/cjs/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
- package/cjs/components/SwapRoutes/useSetRecommendedRoute.js +0 -13
- package/cjs/config/env.d.ts +0 -3
- package/cjs/config/env.js +0 -6
- package/cjs/stores/routes/useRecommendedRouteStore.d.ts +0 -10
- package/cjs/stores/routes/useRecommendedRouteStore.js +0 -39
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -27
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -11
- package/components/GasSufficiencyMessage/index.d.ts +0 -1
- package/components/GasSufficiencyMessage/index.js +0 -1
- package/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
- package/components/SwapRoutes/useSetRecommendedRoute.js +0 -9
- package/config/env.d.ts +0 -3
- package/config/env.js +0 -3
- package/stores/routes/useRecommendedRouteStore.d.ts +0 -10
- package/stores/routes/useRecommendedRouteStore.js +0 -32
|
@@ -8,7 +8,8 @@ const react_1 = require("react");
|
|
|
8
8
|
const react_hook_form_1 = require("react-hook-form");
|
|
9
9
|
const react_i18next_1 = require("react-i18next");
|
|
10
10
|
const react_router_dom_1 = require("react-router-dom");
|
|
11
|
-
const
|
|
11
|
+
const GasMessage_1 = require("../../components/GasMessage");
|
|
12
|
+
const Insurance_1 = require("../../components/Insurance");
|
|
12
13
|
const Step_1 = require("../../components/Step");
|
|
13
14
|
const hooks_1 = require("../../hooks");
|
|
14
15
|
const providers_1 = require("../../providers");
|
|
@@ -20,14 +21,16 @@ const SwapPage_style_1 = require("./SwapPage.style");
|
|
|
20
21
|
const TokenValueBottomSheet_1 = require("./TokenValueBottomSheet");
|
|
21
22
|
const SwapPage = () => {
|
|
22
23
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
23
|
-
const {
|
|
24
|
-
const { state } = (0, react_router_dom_1.useLocation)();
|
|
24
|
+
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
25
25
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
26
|
+
const { variant, insurance } = (0, providers_1.useWidgetConfig)();
|
|
27
|
+
const { state } = (0, react_router_dom_1.useLocation)();
|
|
28
|
+
const stateRouteId = state?.routeId;
|
|
29
|
+
const [routeId, setRouteId] = (0, react_1.useState)(stateRouteId);
|
|
26
30
|
const tokenValueBottomSheetRef = (0, react_1.useRef)(null);
|
|
27
31
|
const exchangeRateBottomSheetRef = (0, react_1.useRef)(null);
|
|
28
|
-
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
29
32
|
const { route, status, executeRoute, restartRoute, deleteRoute } = (0, hooks_1.useRouteExecution)({
|
|
30
|
-
routeId:
|
|
33
|
+
routeId: routeId,
|
|
31
34
|
onAcceptExchangeRateUpdate: exchangeRateBottomSheetRef.current?.open,
|
|
32
35
|
});
|
|
33
36
|
const handleExecuteRoute = (0, react_1.useCallback)(() => {
|
|
@@ -67,8 +70,16 @@ const SwapPage = () => {
|
|
|
67
70
|
return '';
|
|
68
71
|
}
|
|
69
72
|
};
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
const SwapButton = insurance && status === stores_1.RouteExecutionStatus.Idle
|
|
74
|
+
? StartSwapButton_1.StartIdleSwapButton
|
|
75
|
+
: StartSwapButton_1.StartSwapButton;
|
|
76
|
+
const insuranceAvailable = insurance &&
|
|
77
|
+
variant !== 'refuel' &&
|
|
78
|
+
(route?.insurance?.state === 'INSURED' ||
|
|
79
|
+
(status === stores_1.RouteExecutionStatus.Idle &&
|
|
80
|
+
route?.insurance?.state === 'INSURABLE'));
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)(SwapPage_style_1.Container, { children: [(0, Step_1.getStepList)(route), insuranceAvailable ? ((0, jsx_runtime_1.jsx)(Insurance_1.Insurance, { mt: 2, status: status, insurableRouteId: stateRouteId, feeAmountUsd: route?.insurance.feeAmountUsd, onChange: setRouteId })) : null, status === stores_1.RouteExecutionStatus.Idle ||
|
|
82
|
+
status === stores_1.RouteExecutionStatus.Failed ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GasMessage_1.GasMessage, { mt: 2, route: route }), (0, jsx_runtime_1.jsxs)(material_1.Box, { mt: 2, display: "flex", children: [(0, jsx_runtime_1.jsx)(SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, route: route, insurableRouteId: stateRouteId }), 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: {
|
|
72
83
|
minWidth: 48,
|
|
73
84
|
marginLeft: 1,
|
|
74
85
|
}, children: (0, jsx_runtime_1.jsx)(Delete_1.default, {}) }) })) : 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] }));
|
|
@@ -33,6 +33,6 @@ const SwapRoutesPage = () => {
|
|
|
33
33
|
.setAction((0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 }, size: "medium", edge: "end" }));
|
|
34
34
|
}, [dataUpdatedAt, isFetching, refetch, refetchTime]);
|
|
35
35
|
const routeNotFound = !swapRoutes?.length && !isLoading && !isFetching;
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(SwapRoutesPage_style_1.Stack, { direction: "column", spacing: 2, flex: 1, children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (swapRoutes?.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0 }, route.id)))) }));
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(SwapRoutesPage_style_1.Stack, { direction: "column", spacing: 2, flex: 1, children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (swapRoutes?.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, expanded: swapRoutes?.length <= 2 }, route.id)))) }));
|
|
37
37
|
};
|
|
38
38
|
exports.SwapRoutesPage = SwapRoutesPage;
|
|
@@ -4,7 +4,8 @@ export declare const Stack: import("@emotion/styled").StyledComponent<import("@m
|
|
|
4
4
|
direction?: import("@mui/system").ResponsiveStyleValue<"column" | "column-reverse" | "row" | "row-reverse"> | undefined;
|
|
5
5
|
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
6
6
|
divider?: import("react").ReactNode;
|
|
7
|
+
useFlexGap?: boolean | undefined;
|
|
7
8
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
8
9
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
10
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
10
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "direction" | ("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") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
11
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "direction" | ("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") | "divider" | "spacing" | "useFlexGap"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -14,6 +14,7 @@ const SDKProvider = ({ children, }) => {
|
|
|
14
14
|
const value = (0, react_1.useMemo)(() => {
|
|
15
15
|
const config = {
|
|
16
16
|
...sdkConfig,
|
|
17
|
+
integrator: integrator ?? window.location.hostname,
|
|
17
18
|
defaultRouteOptions: {
|
|
18
19
|
fee,
|
|
19
20
|
integrator: integrator ?? window.location.hostname,
|
|
@@ -24,7 +25,7 @@ const SDKProvider = ({ children, }) => {
|
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
27
|
if (!lifi) {
|
|
27
|
-
lifi = new sdk_1.
|
|
28
|
+
lifi = new sdk_1.LiFi({
|
|
28
29
|
disableVersionCheck: true,
|
|
29
30
|
...config,
|
|
30
31
|
});
|
|
@@ -8,7 +8,7 @@ const SwapFormProvider_1 = require("../SwapFormProvider");
|
|
|
8
8
|
const WalletProvider_1 = require("../WalletProvider");
|
|
9
9
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
10
10
|
const FormUpdater = ({ defaultValues }) => {
|
|
11
|
-
const { fromChain, toChain, chains
|
|
11
|
+
const { fromChain, toChain, chains } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
12
12
|
const { account } = (0, WalletProvider_1.useWallet)();
|
|
13
13
|
const { setValue, getValues, getFieldState, resetField,
|
|
14
14
|
// Subscription to touchedFields is required by getFieldState to work
|
|
@@ -16,7 +16,7 @@ const FormUpdater = ({ defaultValues }) => {
|
|
|
16
16
|
const previousDefaultValues = (0, react_1.useRef)(defaultValues);
|
|
17
17
|
// Set wallet chain as default if no chains are provided by config and if they were not changed during widget usage
|
|
18
18
|
(0, react_1.useEffect)(() => {
|
|
19
|
-
const chainAllowed = account.chainId && (0, WidgetProvider_1.isItemAllowed)(account.chainId, chains
|
|
19
|
+
const chainAllowed = account.chainId && (0, WidgetProvider_1.isItemAllowed)(account.chainId, chains);
|
|
20
20
|
if (!account.isActive || !account.chainId || !chainAllowed) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
@@ -40,7 +40,6 @@ const FormUpdater = ({ defaultValues }) => {
|
|
|
40
40
|
account.chainId,
|
|
41
41
|
account.isActive,
|
|
42
42
|
chains,
|
|
43
|
-
disabledChains,
|
|
44
43
|
fromChain,
|
|
45
44
|
getFieldState,
|
|
46
45
|
getValues,
|
|
@@ -7,7 +7,6 @@ const react_hook_form_1 = require("react-hook-form");
|
|
|
7
7
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
8
8
|
const FormUpdater_1 = require("./FormUpdater");
|
|
9
9
|
const types_1 = require("./types");
|
|
10
|
-
const URLSearchParamsBuilder_1 = require("./URLSearchParamsBuilder");
|
|
11
10
|
exports.formDefaultValues = {
|
|
12
11
|
[types_1.SwapFormKey.FromAmount]: '',
|
|
13
12
|
[types_1.SwapFormKey.ToAddress]: '',
|
|
@@ -19,7 +18,7 @@ exports.formDefaultValues = {
|
|
|
19
18
|
[types_1.SwapFormKey.ToAmount]: '',
|
|
20
19
|
};
|
|
21
20
|
const SwapFormProvider = ({ children, }) => {
|
|
22
|
-
const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress
|
|
21
|
+
const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
23
22
|
const defaultValues = (0, react_1.useMemo)(() => ({
|
|
24
23
|
...exports.formDefaultValues,
|
|
25
24
|
fromChain,
|
|
@@ -35,6 +34,6 @@ const SwapFormProvider = ({ children, }) => {
|
|
|
35
34
|
// values,
|
|
36
35
|
defaultValues,
|
|
37
36
|
});
|
|
38
|
-
return ((0, jsx_runtime_1.jsxs)(react_hook_form_1.FormProvider, { ...methods, children: [(0, jsx_runtime_1.jsx)(FormUpdater_1.FormUpdater, { defaultValues: defaultValues }),
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(react_hook_form_1.FormProvider, { ...methods, children: [(0, jsx_runtime_1.jsx)(FormUpdater_1.FormUpdater, { defaultValues: defaultValues }), children] }));
|
|
39
38
|
};
|
|
40
39
|
exports.SwapFormProvider = SwapFormProvider;
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./SwapFormProvider"), exports);
|
|
18
|
+
__exportStar(require("./URLSearchParamsBuilder"), exports);
|
|
18
19
|
__exportStar(require("./types"), exports);
|
|
@@ -7,14 +7,17 @@ const react_1 = require("react");
|
|
|
7
7
|
const stores_1 = require("../../stores");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const initialContext = {
|
|
10
|
-
disabledChains: [],
|
|
11
10
|
elementId: '',
|
|
11
|
+
integrator: '',
|
|
12
12
|
};
|
|
13
13
|
const WidgetContext = (0, react_1.createContext)(initialContext);
|
|
14
14
|
const useWidgetConfig = () => (0, react_1.useContext)(WidgetContext);
|
|
15
15
|
exports.useWidgetConfig = useWidgetConfig;
|
|
16
|
-
const WidgetProvider = ({ children, config: { fromChain, fromToken, toChain, toToken, fromAmount, ...config } = {}, }) => {
|
|
16
|
+
const WidgetProvider = ({ children, config: { fromChain, fromToken, toChain, toToken, fromAmount, integrator, ...config } = {}, }) => {
|
|
17
17
|
const elementId = (0, react_1.useId)();
|
|
18
|
+
if (!integrator) {
|
|
19
|
+
throw Error('Required property "integrator" is missing.');
|
|
20
|
+
}
|
|
18
21
|
const value = (0, react_1.useMemo)(() => {
|
|
19
22
|
try {
|
|
20
23
|
const searchParams = Object.fromEntries(new URLSearchParams(window?.location.search));
|
|
@@ -50,15 +53,25 @@ const WidgetProvider = ({ children, config: { fromChain, fromToken, toChain, toT
|
|
|
50
53
|
? (0, utils_1.formatAmount)(searchParams.fromAmount)
|
|
51
54
|
: fromAmount,
|
|
52
55
|
elementId,
|
|
56
|
+
integrator,
|
|
53
57
|
};
|
|
54
58
|
(0, stores_1.setDefaultSettings)(value);
|
|
55
59
|
return value;
|
|
56
60
|
}
|
|
57
61
|
catch (e) {
|
|
58
62
|
console.warn(e);
|
|
59
|
-
return { ...config, elementId };
|
|
63
|
+
return { ...config, elementId, integrator };
|
|
60
64
|
}
|
|
61
|
-
}, [
|
|
65
|
+
}, [
|
|
66
|
+
config,
|
|
67
|
+
elementId,
|
|
68
|
+
fromAmount,
|
|
69
|
+
fromChain,
|
|
70
|
+
fromToken,
|
|
71
|
+
integrator,
|
|
72
|
+
toChain,
|
|
73
|
+
toToken,
|
|
74
|
+
]);
|
|
62
75
|
return ((0, jsx_runtime_1.jsx)(WidgetContext.Provider, { value: value, children: children }));
|
|
63
76
|
};
|
|
64
77
|
exports.WidgetProvider = WidgetProvider;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isItemAllowed = void 0;
|
|
4
|
-
const isItemAllowed = (itemId, items
|
|
5
|
-
/** @deprecated Remove in the next major release */
|
|
6
|
-
disabledChains) => {
|
|
4
|
+
const isItemAllowed = (itemId, items) => {
|
|
7
5
|
if (items?.allow?.length) {
|
|
8
6
|
return items.allow.includes(itemId);
|
|
9
7
|
}
|
|
10
|
-
return !
|
|
8
|
+
return !items?.deny?.includes(itemId);
|
|
11
9
|
};
|
|
12
10
|
exports.isItemAllowed = isItemAllowed;
|
|
@@ -4,6 +4,6 @@ exports.StoreProvider = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const routes_1 = require("./routes");
|
|
6
6
|
const StoreProvider = ({ children, namePrefix }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(routes_1.RouteExecutionStoreProvider, { namePrefix: namePrefix, children:
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(routes_1.RouteExecutionStoreProvider, { namePrefix: namePrefix, children: children }));
|
|
8
8
|
};
|
|
9
9
|
exports.StoreProvider = StoreProvider;
|
|
@@ -8,13 +8,14 @@ const types_1 = require("./types");
|
|
|
8
8
|
const utils_2 = require("./utils");
|
|
9
9
|
const createRouteExecutionStore = ({ namePrefix }) => (0, zustand_1.create)((0, middleware_1.persist)((set, get) => ({
|
|
10
10
|
routes: {},
|
|
11
|
-
setExecutableRoute: (route) => {
|
|
11
|
+
setExecutableRoute: (route, insurableRouteId) => {
|
|
12
12
|
if (!get().routes[route.id]) {
|
|
13
13
|
set((state) => {
|
|
14
14
|
const routes = { ...state.routes };
|
|
15
15
|
// clean previous idle routes that were not executed
|
|
16
16
|
Object.keys(routes)
|
|
17
|
-
.filter((routeId) =>
|
|
17
|
+
.filter((routeId) => routeId !== insurableRouteId &&
|
|
18
|
+
routes[routeId]?.status === types_1.RouteExecutionStatus.Idle)
|
|
18
19
|
.forEach((routeId) => delete routes[routeId]);
|
|
19
20
|
routes[route.id] = {
|
|
20
21
|
route,
|
|
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./RouteExecutionStore"), exports);
|
|
18
18
|
__exportStar(require("./types"), exports);
|
|
19
19
|
__exportStar(require("./useExecutingRoutesIds"), exports);
|
|
20
|
-
__exportStar(require("./useRecommendedRouteStore"), exports);
|
|
21
20
|
__exportStar(require("./useSetExecutableRoute"), exports);
|
|
22
21
|
__exportStar(require("./useSwapHistory"), exports);
|
|
23
22
|
__exportStar(require("./utils"), exports);
|
|
@@ -5,7 +5,7 @@ export interface RouteExecution {
|
|
|
5
5
|
}
|
|
6
6
|
export interface RouteExecutionState {
|
|
7
7
|
routes: Partial<Record<string, RouteExecution>>;
|
|
8
|
-
setExecutableRoute: (route: Route) => void;
|
|
8
|
+
setExecutableRoute: (route: Route, insurableRouteId?: string) => void;
|
|
9
9
|
updateRoute: (route: Route) => void;
|
|
10
10
|
restartRoute: (routeId: string) => void;
|
|
11
11
|
deleteRoute: (routeId: string) => void;
|
|
@@ -19,7 +19,3 @@ export declare enum RouteExecutionStatus {
|
|
|
19
19
|
Partial = 8,
|
|
20
20
|
Refunded = 16
|
|
21
21
|
}
|
|
22
|
-
export interface RecommendedRouteState {
|
|
23
|
-
recommendedRoute?: Route;
|
|
24
|
-
setRecommendedRoute: (route?: Route) => void;
|
|
25
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useSetExecutableRoute: () => (route: import("@lifi/types").Route) => void;
|
|
1
|
+
export declare const useSetExecutableRoute: () => (route: import("@lifi/types").Route, insurableRouteId?: string | undefined) => void;
|
package/cjs/types/widget.d.ts
CHANGED
|
@@ -38,8 +38,8 @@ export interface WidgetWalletManagement {
|
|
|
38
38
|
addChain?(chainId: number): Promise<boolean>;
|
|
39
39
|
signer?: Signer;
|
|
40
40
|
}
|
|
41
|
-
export interface SDKConfig extends Omit<ConfigUpdate, 'defaultExecutionSettings' | 'defaultRouteOptions' | 'disableVersionCheck'> {
|
|
42
|
-
defaultRouteOptions?: Omit<RouteOptions, 'bridges' | 'exchanges'>;
|
|
41
|
+
export interface SDKConfig extends Omit<ConfigUpdate, 'defaultExecutionSettings' | 'defaultRouteOptions' | 'disableVersionCheck' | 'integrator'> {
|
|
42
|
+
defaultRouteOptions?: Omit<RouteOptions, 'bridges' | 'exchanges' | 'insurance'>;
|
|
43
43
|
}
|
|
44
44
|
export interface WidgetContractTool {
|
|
45
45
|
logoURI: string;
|
|
@@ -66,10 +66,11 @@ export interface WidgetConfig {
|
|
|
66
66
|
contractCompactComponent?: ReactNode;
|
|
67
67
|
contractTool?: WidgetContractTool;
|
|
68
68
|
fee?: number;
|
|
69
|
-
integrator
|
|
69
|
+
integrator: string;
|
|
70
70
|
referrer?: string;
|
|
71
|
-
slippage?: number;
|
|
72
71
|
routePriority?: Order;
|
|
72
|
+
slippage?: number;
|
|
73
|
+
insurance?: boolean;
|
|
73
74
|
variant?: WidgetVariant;
|
|
74
75
|
appearance?: Appearance;
|
|
75
76
|
theme?: ThemeConfig;
|
|
@@ -107,12 +108,6 @@ export interface WidgetConfig {
|
|
|
107
108
|
};
|
|
108
109
|
languageResources?: LanguageResources;
|
|
109
110
|
disableI18n?: boolean;
|
|
110
|
-
/** @deprecated Use hiddenUI: ['appearance'] instead */
|
|
111
|
-
disableAppearance?: boolean;
|
|
112
|
-
/** @deprecated Use chains.deny instead */
|
|
113
|
-
disabledChains?: number[];
|
|
114
|
-
/** @deprecated Use tokens.featured instead */
|
|
115
|
-
featuredTokens?: Token[];
|
|
116
111
|
}
|
|
117
112
|
export type WidgetDrawerProps = {
|
|
118
113
|
elementRef?: RefObject<HTMLDivElement>;
|
package/cjs/utils/format.js
CHANGED
|
@@ -54,7 +54,10 @@ const formatAmount = (amount = '', returnInitial = false) => {
|
|
|
54
54
|
if (!amount) {
|
|
55
55
|
return amount;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
let formattedAmount = amount.replaceAll(',', '.');
|
|
58
|
+
if (formattedAmount.startsWith('.')) {
|
|
59
|
+
formattedAmount = '0' + formattedAmount;
|
|
60
|
+
}
|
|
58
61
|
const parsedAmount = parseFloat(formattedAmount);
|
|
59
62
|
if (isNaN(Number(formattedAmount)) && !isNaN(parsedAmount)) {
|
|
60
63
|
return parsedAmount.toString();
|
|
@@ -17,7 +17,7 @@ export declare const ListItemButton: import("@emotion/styled").StyledComponent<i
|
|
|
17
17
|
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
18
18
|
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & 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
|
-
}, "className" | "style" | "classes" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "
|
|
20
|
+
}, "className" | "style" | "classes" | "autoFocus" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "dense" | "divider" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
21
21
|
export declare const ListItem: import("@emotion/styled").StyledComponent<{
|
|
22
22
|
button?: false | undefined;
|
|
23
23
|
} & import("@mui/material").ListItemBaseProps & {
|
|
@@ -35,21 +35,21 @@ export declare const ListItem: import("@emotion/styled").StyledComponent<{
|
|
|
35
35
|
} | undefined;
|
|
36
36
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
37
37
|
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
38
|
-
}, "button" | "className" | "style" | "classes" | "
|
|
38
|
+
}, "button" | "className" | "style" | "classes" | "autoFocus" | "children" | "disabled" | "sx" | "alignItems" | "dense" | "divider" | "components" | "slotProps" | "slots" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
39
39
|
export declare const ShowAllButton: import("@emotion/styled").StyledComponent<{
|
|
40
40
|
children?: import("react").ReactNode;
|
|
41
41
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
42
|
-
color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
42
|
+
color?: import("@mui/types").OverridableStringUnion<"inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info", import("@mui/material").ButtonPropsColorOverrides> | undefined;
|
|
43
43
|
disabled?: boolean | undefined;
|
|
44
44
|
disableElevation?: boolean | undefined;
|
|
45
45
|
disableFocusRipple?: boolean | undefined;
|
|
46
46
|
endIcon?: import("react").ReactNode;
|
|
47
47
|
fullWidth?: boolean | undefined;
|
|
48
48
|
href?: string | undefined;
|
|
49
|
-
size?: "small" | "medium" | "large" | undefined;
|
|
49
|
+
size?: import("@mui/types").OverridableStringUnion<"small" | "medium" | "large", import("@mui/material").ButtonPropsSizeOverrides> | undefined;
|
|
50
50
|
startIcon?: import("react").ReactNode;
|
|
51
51
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
52
|
-
variant?: "text" | "outlined" | "contained" | undefined;
|
|
52
|
+
variant?: import("@mui/types").OverridableStringUnion<"text" | "outlined" | "contained", import("@mui/material").ButtonPropsVariantOverrides> | undefined;
|
|
53
53
|
} & Omit<{
|
|
54
54
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
55
55
|
centerRipple?: boolean | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const CardIconButton: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
+
color?: import("@mui/types").OverridableStringUnion<"inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info", import("@mui/material").IconButtonPropsColorOverrides> | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
disableFocusRipple?: boolean | undefined;
|
|
8
|
+
edge?: false | "end" | "start" | undefined;
|
|
9
|
+
size?: import("@mui/types").OverridableStringUnion<"small" | "medium" | "large", import("@mui/material").IconButtonPropsSizeOverrides> | undefined;
|
|
10
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
11
|
+
} & Omit<{
|
|
12
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
13
|
+
centerRipple?: boolean | undefined;
|
|
14
|
+
children?: import("react").ReactNode;
|
|
15
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
16
|
+
disabled?: boolean | undefined;
|
|
17
|
+
disableRipple?: boolean | undefined;
|
|
18
|
+
disableTouchRipple?: boolean | undefined;
|
|
19
|
+
focusRipple?: boolean | undefined;
|
|
20
|
+
focusVisibleClassName?: string | undefined;
|
|
21
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
22
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
23
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
24
|
+
tabIndex?: number | undefined;
|
|
25
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
26
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
27
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
28
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
29
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "size" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IconButton as MuiIconButton } from '@mui/material';
|
|
2
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
3
|
+
export const CardIconButton = styled(MuiIconButton)(({ theme }) => {
|
|
4
|
+
const backgroundColor = theme.palette.mode === 'light'
|
|
5
|
+
? theme.palette.common.black
|
|
6
|
+
: theme.palette.common.white;
|
|
7
|
+
return {
|
|
8
|
+
padding: theme.spacing(0.5),
|
|
9
|
+
backgroundColor: alpha(backgroundColor, 0.04),
|
|
10
|
+
'&:hover': {
|
|
11
|
+
backgroundColor: alpha(backgroundColor, 0.08),
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const CardLabel: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").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").SxProps<import("@mui/material").Theme> | undefined;
|
|
7
|
+
} & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
8
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
|
+
}, "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").Theme> & {
|
|
10
|
+
type?: "active" | "insurance" | "insurance-icon" | undefined;
|
|
11
|
+
}, {}, {}>;
|
|
12
|
+
export declare const CardLabelTypography: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
13
|
+
align?: "center" | "left" | "right" | "inherit" | "justify" | undefined;
|
|
14
|
+
children?: import("react").ReactNode;
|
|
15
|
+
classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
|
|
16
|
+
gutterBottom?: boolean | undefined;
|
|
17
|
+
noWrap?: boolean | undefined;
|
|
18
|
+
paragraph?: boolean | undefined;
|
|
19
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
20
|
+
variant?: import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides> | undefined;
|
|
21
|
+
variantMapping?: Partial<Record<import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides>, string>> | undefined;
|
|
22
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
23
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
24
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("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") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
25
|
+
type?: "icon" | undefined;
|
|
26
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material';
|
|
2
|
+
import { alpha, lighten, styled } from '@mui/material/styles';
|
|
3
|
+
export const CardLabel = styled(Box, {
|
|
4
|
+
shouldForwardProp: (prop) => prop !== 'type',
|
|
5
|
+
})(({ theme, type }) => ({
|
|
6
|
+
backgroundColor: type === 'active'
|
|
7
|
+
? theme.palette.mode === 'light'
|
|
8
|
+
? theme.palette.secondary.main
|
|
9
|
+
: alpha(theme.palette.secondary.main, 0.32)
|
|
10
|
+
: type?.includes('insurance')
|
|
11
|
+
? alpha(theme.palette.success.main, theme.palette.mode === 'light' ? 0.12 : 0.24)
|
|
12
|
+
: theme.palette.mode === 'light'
|
|
13
|
+
? alpha(theme.palette.common.black, 0.12)
|
|
14
|
+
: alpha(theme.palette.common.white, 0.16),
|
|
15
|
+
borderRadius: theme.shape.borderRadius,
|
|
16
|
+
color: type?.includes('insurance')
|
|
17
|
+
? lighten(theme.palette.success.main, theme.palette.mode === 'light' ? 0 : 0.24)
|
|
18
|
+
: theme.palette.text.primary,
|
|
19
|
+
padding: type === 'insurance' ? theme.spacing(0, 1.5) : 0,
|
|
20
|
+
display: 'flex',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
height: 24,
|
|
24
|
+
minWidth: 24,
|
|
25
|
+
userSelect: 'none',
|
|
26
|
+
fontSize: '1rem',
|
|
27
|
+
marginRight: theme.spacing(1),
|
|
28
|
+
}));
|
|
29
|
+
export const CardLabelTypography = styled(Typography, {
|
|
30
|
+
shouldForwardProp: (prop) => prop !== 'type',
|
|
31
|
+
})(({ theme, type }) => ({
|
|
32
|
+
padding: type === 'icon'
|
|
33
|
+
? theme.spacing(0.75, 0, 0.75, 0.75)
|
|
34
|
+
: theme.spacing(0.75, 1.5),
|
|
35
|
+
fontSize: 12,
|
|
36
|
+
lineHeight: 1,
|
|
37
|
+
fontWeight: '600',
|
|
38
|
+
textTransform: 'lowercase',
|
|
39
|
+
'&::first-letter': {
|
|
40
|
+
textTransform: 'uppercase',
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
@@ -7,8 +7,8 @@ export declare const CardTitle: import("@emotion/styled").StyledComponent<import
|
|
|
7
7
|
noWrap?: boolean | undefined;
|
|
8
8
|
paragraph?: boolean | undefined;
|
|
9
9
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
10
|
-
variant?: "
|
|
11
|
-
variantMapping?: Partial<Record<"
|
|
10
|
+
variant?: import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides> | undefined;
|
|
11
|
+
variantMapping?: Partial<Record<import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides>, string>> | undefined;
|
|
12
12
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
13
13
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
14
14
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("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") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
package/components/Card/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FundsSufficiencyMessage: () => JSX.Element;
|