@lifi/widget 2.9.3 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppProvider.js +2 -2
- package/AppRoutes.js +75 -67
- package/cjs/AppProvider.js +1 -1
- package/cjs/AppRoutes.js +74 -66
- package/cjs/components/ActiveTransactions/ActiveTransactionItem.js +1 -5
- package/cjs/components/ActiveTransactions/ActiveTransactions.js +2 -2
- package/cjs/components/AmountInput/AmountInputEndAdornment.js +9 -10
- package/cjs/components/AmountInput/FormPriceHelperText.js +1 -1
- package/cjs/components/BaseTransactionButton/BaseTransactionButton.js +5 -4
- package/cjs/components/Card/CardLabel.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.js +8 -5
- package/cjs/components/ChainSelect/useChainSelect.js +21 -2
- package/cjs/components/GasMessage/GasMessage.style.js +3 -6
- package/cjs/components/GasMessage/GasSufficiencyMessage.js +2 -1
- package/cjs/components/Header/Header.style.d.ts +8 -0
- package/cjs/components/Header/Header.style.js +16 -1
- package/cjs/components/Header/NavigationHeader.d.ts +1 -0
- package/cjs/components/Header/NavigationHeader.js +15 -8
- package/cjs/components/Header/NavigationTabs.js +2 -2
- package/cjs/components/Header/SettingsButton.d.ts +1 -0
- package/cjs/components/Header/SettingsButton.js +25 -0
- package/cjs/components/Header/SettingsButton.style.d.ts +11 -0
- package/cjs/components/Header/SettingsButton.style.js +43 -0
- package/cjs/components/Header/WalletHeader.js +11 -24
- package/cjs/components/Header/WalletMenu.d.ts +3 -1
- package/cjs/components/Header/WalletMenu.js +58 -24
- package/cjs/components/Header/WalletMenu.style.d.ts +1 -0
- package/cjs/components/Header/WalletMenu.style.js +27 -0
- package/cjs/components/Insurance/InsuranceCollapsed.js +1 -1
- package/cjs/components/NFT/NFT.js +3 -1
- package/cjs/components/NFT/types.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.js +2 -1
- package/cjs/components/RouteCard/RouteCard.js +3 -3
- package/cjs/components/RouteCard/RouteCardEssentials.js +2 -1
- package/cjs/components/RouteCard/utils.d.ts +2 -3
- package/cjs/components/RouteCard/utils.js +4 -9
- package/cjs/components/SendToWallet/SendToWallet.js +24 -21
- package/cjs/components/SendToWallet/SendToWalletButton.js +3 -2
- package/{pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts → cjs/components/SettingsListItemButton.d.ts} +1 -1
- package/cjs/components/SettingsListItemButton.js +8 -0
- package/cjs/components/Step/DestinationWalletAddress.d.ts +2 -2
- package/cjs/components/Step/GasStepProcess.d.ts +2 -2
- package/cjs/components/Step/Step.d.ts +2 -2
- package/cjs/components/Step/Step.js +1 -1
- package/cjs/components/Step/StepList.d.ts +2 -2
- package/cjs/components/Step/StepList.js +4 -4
- package/cjs/components/Step/StepProcess.d.ts +2 -2
- package/cjs/components/Step/StepTimer.d.ts +2 -2
- package/cjs/components/StepActions/StepActions.d.ts +3 -3
- package/cjs/components/StepActions/StepActions.js +11 -14
- package/cjs/components/StepActions/types.d.ts +2 -2
- package/cjs/components/{Header/NavigationTabs.style.d.ts → Tabs/Tabs.style.d.ts} +2 -2
- package/cjs/components/{Header/NavigationTabs.style.js → Tabs/Tabs.style.js} +9 -31
- package/cjs/components/Tabs/index.d.ts +1 -0
- package/cjs/{providers/SDKProvider → components/Tabs}/index.js +1 -1
- package/cjs/components/Token/Token.d.ts +3 -3
- package/cjs/components/Token/Token.js +5 -5
- package/cjs/components/TokenList/TokenList.js +2 -2
- package/cjs/components/TokenList/TokenListItem.js +9 -5
- package/cjs/components/TokenList/TokenNotFound.js +1 -1
- package/cjs/components/TokenList/VirtualizedTokenList.js +2 -1
- package/cjs/config/queryClient.js +0 -4
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +7 -1
- package/cjs/hooks/index.js +7 -1
- package/cjs/hooks/useAccount.d.ts +31 -0
- package/cjs/hooks/useAccount.js +53 -0
- package/cjs/hooks/useAvailableChains.d.ts +6 -0
- package/cjs/hooks/useAvailableChains.js +36 -0
- package/cjs/hooks/useChain.js +3 -6
- package/cjs/hooks/useChains.d.ts +1 -1
- package/cjs/hooks/useChains.js +7 -38
- package/cjs/hooks/useFromTokenSufficiency.d.ts +3 -3
- package/cjs/hooks/useFromTokenSufficiency.js +39 -41
- package/cjs/hooks/useGasRecommendation.d.ts +2 -2
- package/cjs/hooks/useGasRecommendation.js +23 -18
- package/cjs/hooks/useGasRefuel.js +18 -11
- package/cjs/hooks/useGasSufficiency.d.ts +6 -7
- package/cjs/hooks/useGasSufficiency.js +68 -71
- package/cjs/hooks/useLanguages.d.ts +6 -0
- package/cjs/hooks/useLanguages.js +28 -0
- package/cjs/hooks/useProcessMessage.d.ts +3 -3
- package/cjs/hooks/useProcessMessage.js +32 -28
- package/cjs/hooks/useRequiredToAddress.d.ts +1 -0
- package/cjs/hooks/useRequiredToAddress.js +19 -0
- package/cjs/hooks/useRouteExecution.d.ts +2 -2
- package/cjs/hooks/useRouteExecution.js +44 -58
- package/cjs/hooks/useRoutes.d.ts +1 -1
- package/cjs/hooks/useRoutes.js +128 -113
- package/cjs/hooks/useSettingMonitor.d.ts +11 -0
- package/cjs/hooks/useSettingMonitor.js +57 -0
- package/cjs/hooks/useTokenAddressBalance.d.ts +1 -1
- package/cjs/hooks/useTokenBalance.d.ts +5 -3
- package/cjs/hooks/useTokenBalance.js +77 -47
- package/cjs/hooks/useTokenBalances.d.ts +3 -3
- package/cjs/hooks/useTokenBalances.js +34 -24
- package/cjs/hooks/useTokenSearch.js +18 -17
- package/cjs/hooks/useTokens.d.ts +2 -1
- package/cjs/hooks/useTokens.js +18 -15
- package/cjs/hooks/useTools.d.ts +1 -1
- package/cjs/hooks/useTools.js +12 -11
- package/cjs/hooks/useTransactionDetails.d.ts +4 -0
- package/cjs/hooks/useTransactionDetails.js +56 -0
- package/cjs/hooks/useTransactionHistory.d.ts +5 -0
- package/cjs/hooks/useTransactionHistory.js +39 -0
- package/cjs/i18n/en.json +18 -9
- package/cjs/i18n/fr.json +7 -4
- package/cjs/i18n/pt.json +7 -4
- package/cjs/i18n/tr.json +7 -4
- package/cjs/i18n/uk.json +7 -4
- package/cjs/i18n/zh.json +7 -4
- package/cjs/icons/index.d.ts +1 -3
- package/cjs/icons/index.js +1 -3
- package/cjs/icons/lifi.d.ts +1 -0
- package/cjs/icons/lifi.js +4 -0
- package/cjs/index.d.ts +2 -3
- package/cjs/index.js +4 -4
- package/cjs/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +2 -2
- package/cjs/pages/LanguagesPage/LanguagesPage.d.ts +2 -0
- package/cjs/pages/LanguagesPage/LanguagesPage.js +22 -0
- package/cjs/pages/LanguagesPage/index.d.ts +1 -0
- package/cjs/pages/LanguagesPage/index.js +17 -0
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +15 -5
- package/cjs/pages/SelectWalletPage/EVMListItemButton.d.ts +8 -0
- package/cjs/pages/SelectWalletPage/EVMListItemButton.js +40 -0
- package/cjs/pages/SelectWalletPage/SVMListItemButton.d.ts +6 -0
- package/cjs/pages/SelectWalletPage/SVMListItemButton.js +34 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +31 -32
- package/cjs/pages/SelectWalletPage/utils.d.ts +3 -0
- package/cjs/pages/SelectWalletPage/utils.js +21 -0
- package/{pages/SettingsPage/EnabledToolsButton.d.ts → cjs/pages/SettingsPage/BridgeAndExchangeSettings.d.ts} +1 -1
- package/cjs/pages/SettingsPage/BridgeAndExchangeSettings.js +36 -0
- package/cjs/pages/SettingsPage/GasPriceSettings.d.ts +2 -0
- package/cjs/pages/SettingsPage/GasPriceSettings.js +21 -0
- package/cjs/pages/SettingsPage/LanguageSetting.d.ts +2 -0
- package/cjs/pages/SettingsPage/LanguageSetting.js +26 -0
- package/cjs/pages/SettingsPage/ResetSettingsButton.js +3 -30
- package/cjs/pages/SettingsPage/RoutePrioritySettings.d.ts +2 -0
- package/cjs/pages/SettingsPage/RoutePrioritySettings.js +25 -0
- package/cjs/pages/SettingsPage/SendToWalletOptionSetting.d.ts +1 -0
- package/cjs/pages/SettingsPage/{ShowDestinationWallet.js → SendToWalletOptionSetting.js} +6 -9
- package/cjs/pages/SettingsPage/SettingsCard/BadgedValue.d.ts +8 -0
- package/cjs/pages/SettingsPage/SettingsCard/BadgedValue.js +7 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingCard.d.ts +2 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingCard.js +11 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +19 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingCard.style.js +53 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingCardButton.d.ts +7 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingCardButton.js +8 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingCardExpandable.d.ts +7 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingCardExpandable.js +16 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingsAccordian.d.ts +6 -0
- package/cjs/pages/SettingsPage/SettingsCard/SettingsAccordian.js +36 -0
- package/cjs/pages/SettingsPage/SettingsCard/index.d.ts +6 -0
- package/cjs/pages/SettingsPage/SettingsCard/index.js +22 -0
- package/cjs/pages/SettingsPage/SettingsCard/types.d.ts +5 -0
- package/cjs/pages/SettingsPage/SettingsPage.js +9 -8
- package/cjs/pages/SettingsPage/SlippageSettings/SlippageSettings.d.ts +2 -0
- package/cjs/pages/SettingsPage/SlippageSettings/SlippageSettings.js +51 -0
- package/cjs/pages/SettingsPage/SlippageSettings/SlippageSettings.style.d.ts +16 -0
- package/cjs/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +74 -0
- package/cjs/pages/SettingsPage/SlippageSettings/index.d.ts +1 -0
- package/cjs/pages/SettingsPage/SlippageSettings/index.js +17 -0
- package/cjs/pages/SettingsPage/ThemeSettings.d.ts +2 -0
- package/cjs/pages/SettingsPage/ThemeSettings.js +39 -0
- package/cjs/pages/TransactionDetailsPage/ContactSupportButton.js +2 -2
- package/cjs/pages/TransactionDetailsPage/TransactionDetailsPage.js +33 -28
- package/cjs/pages/TransactionDetailsPage/TransactionDetailsSkeleton.d.ts +1 -0
- package/cjs/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js +31 -0
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryItem.d.ts +4 -2
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryItem.js +34 -7
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryPage.js +21 -22
- package/cjs/pages/TransactionHistoryPage/TransactionHistorySkeleton.d.ts +1 -0
- package/cjs/pages/TransactionHistoryPage/TransactionHistorySkeleton.js +26 -0
- package/cjs/pages/TransactionHistoryPage/constants.d.ts +1 -0
- package/cjs/pages/TransactionHistoryPage/constants.js +4 -0
- package/cjs/pages/TransactionPage/ExchangeRateBottomSheet.js +11 -10
- package/cjs/pages/TransactionPage/StartTransactionButton.js +2 -2
- package/cjs/pages/TransactionPage/StatusBottomSheet.js +12 -8
- package/cjs/pages/TransactionPage/TransactionPage.js +1 -1
- package/cjs/providers/FormProvider/FormUpdater.js +4 -4
- package/cjs/providers/I18nProvider/I18nProvider.js +3 -7
- package/cjs/providers/I18nProvider/types.d.ts +4 -3
- package/cjs/providers/WalletProvider/EVMProvider.d.ts +3 -0
- package/cjs/providers/WalletProvider/EVMProvider.js +79 -0
- package/cjs/providers/WalletProvider/SDKProviders.d.ts +1 -0
- package/cjs/providers/WalletProvider/SDKProviders.js +31 -0
- package/cjs/providers/WalletProvider/SolanaProvider.d.ts +3 -0
- package/cjs/providers/WalletProvider/SolanaProvider.js +35 -0
- package/cjs/providers/WalletProvider/WalletProvider.d.ts +1 -15
- package/cjs/providers/WalletProvider/WalletProvider.js +5 -183
- package/cjs/providers/WalletProvider/index.d.ts +1 -1
- package/cjs/providers/WalletProvider/index.js +1 -1
- package/cjs/providers/WalletProvider/utils.d.ts +3 -0
- package/cjs/providers/WalletProvider/utils.js +25 -0
- package/cjs/providers/WidgetProvider/WidgetProvider.js +51 -35
- package/cjs/providers/index.d.ts +0 -1
- package/cjs/providers/index.js +0 -1
- package/cjs/stores/chains/ChainOrderStore.js +24 -0
- package/cjs/stores/header/useHeaderStore.d.ts +1 -1
- package/cjs/stores/header/useHeaderStore.js +2 -2
- package/cjs/stores/routes/createRouteExecutionStore.js +6 -60
- package/cjs/stores/routes/index.d.ts +0 -1
- package/cjs/stores/routes/index.js +0 -1
- package/cjs/stores/routes/types.d.ts +2 -2
- package/cjs/stores/routes/utils.d.ts +8 -8
- package/cjs/stores/routes/utils.js +7 -5
- package/cjs/stores/settings/useSettingsStore.js +2 -4
- package/cjs/stores/settings/useSplitSubvariantStore.d.ts +1 -1
- package/cjs/stores/settings/useSplitSubvariantStore.js +2 -2
- package/cjs/types/events.d.ts +6 -5
- package/cjs/types/events.js +1 -1
- package/cjs/types/widget.d.ts +7 -14
- package/cjs/utils/colors.d.ts +3 -0
- package/cjs/utils/colors.js +13 -1
- package/cjs/utils/converters.d.ts +3 -0
- package/cjs/utils/converters.js +172 -0
- package/cjs/utils/format.d.ts +1 -1
- package/cjs/utils/format.js +5 -12
- package/cjs/utils/index.d.ts +1 -0
- package/cjs/utils/index.js +1 -0
- package/cjs/utils/navigationRoutes.d.ts +1 -0
- package/cjs/utils/navigationRoutes.js +3 -1
- package/cjs/utils/svm.d.ts +1 -0
- package/cjs/utils/svm.js +14 -0
- package/components/ActiveTransactions/ActiveTransactionItem.js +1 -5
- package/components/ActiveTransactions/ActiveTransactions.js +2 -2
- package/components/AmountInput/AmountInputEndAdornment.js +10 -11
- package/components/AmountInput/FormPriceHelperText.js +1 -1
- package/components/BaseTransactionButton/BaseTransactionButton.js +6 -5
- package/components/Card/CardLabel.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.js +8 -5
- package/components/ChainSelect/useChainSelect.js +22 -3
- package/components/GasMessage/GasMessage.style.js +3 -6
- package/components/GasMessage/GasSufficiencyMessage.js +2 -1
- package/components/Header/Header.style.d.ts +8 -0
- package/components/Header/Header.style.js +16 -1
- package/components/Header/NavigationHeader.d.ts +1 -0
- package/components/Header/NavigationHeader.js +16 -10
- package/components/Header/NavigationTabs.js +3 -3
- package/components/Header/SettingsButton.d.ts +1 -0
- package/components/Header/SettingsButton.js +21 -0
- package/components/Header/SettingsButton.style.d.ts +11 -0
- package/components/Header/SettingsButton.style.js +40 -0
- package/components/Header/WalletHeader.js +15 -28
- package/components/Header/WalletMenu.d.ts +3 -1
- package/components/Header/WalletMenu.js +58 -25
- package/components/Header/WalletMenu.style.d.ts +1 -0
- package/components/Header/WalletMenu.style.js +24 -0
- package/components/Insurance/InsuranceCollapsed.js +1 -1
- package/components/NFT/NFT.js +3 -1
- package/components/NFT/types.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.js +2 -1
- package/components/RouteCard/RouteCard.js +3 -3
- package/components/RouteCard/RouteCardEssentials.js +2 -1
- package/components/RouteCard/utils.d.ts +2 -3
- package/components/RouteCard/utils.js +4 -9
- package/components/SendToWallet/SendToWallet.js +26 -23
- package/components/SendToWallet/SendToWalletButton.js +5 -4
- package/{cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts → components/SettingsListItemButton.d.ts} +1 -1
- package/components/SettingsListItemButton.js +5 -0
- package/components/Step/DestinationWalletAddress.d.ts +2 -2
- package/components/Step/GasStepProcess.d.ts +2 -2
- package/components/Step/Step.d.ts +2 -2
- package/components/Step/Step.js +2 -2
- package/components/Step/StepList.d.ts +2 -2
- package/components/Step/StepList.js +4 -4
- package/components/Step/StepProcess.d.ts +2 -2
- package/components/Step/StepTimer.d.ts +2 -2
- package/components/StepActions/StepActions.d.ts +3 -3
- package/components/StepActions/StepActions.js +12 -15
- package/components/StepActions/types.d.ts +2 -2
- package/components/{Header/NavigationTabs.style.d.ts → Tabs/Tabs.style.d.ts} +2 -2
- package/components/Tabs/Tabs.style.js +36 -0
- package/components/Tabs/index.d.ts +1 -0
- package/components/Tabs/index.js +1 -0
- package/components/Token/Token.d.ts +3 -3
- package/components/Token/Token.js +5 -5
- package/components/TokenList/TokenList.js +4 -4
- package/components/TokenList/TokenListItem.js +9 -6
- package/components/TokenList/TokenNotFound.js +2 -2
- package/components/TokenList/VirtualizedTokenList.js +2 -1
- package/config/queryClient.js +0 -4
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +7 -1
- package/hooks/index.js +7 -1
- package/hooks/useAccount.d.ts +31 -0
- package/hooks/useAccount.js +48 -0
- package/hooks/useAvailableChains.d.ts +6 -0
- package/hooks/useAvailableChains.js +32 -0
- package/hooks/useChain.js +3 -6
- package/hooks/useChains.d.ts +1 -1
- package/hooks/useChains.js +9 -40
- package/hooks/useFromTokenSufficiency.d.ts +3 -3
- package/hooks/useFromTokenSufficiency.js +41 -43
- package/hooks/useGasRecommendation.d.ts +2 -2
- package/hooks/useGasRecommendation.js +23 -18
- package/hooks/useGasRefuel.js +19 -12
- package/hooks/useGasSufficiency.d.ts +6 -7
- package/hooks/useGasSufficiency.js +69 -72
- package/hooks/useLanguages.d.ts +6 -0
- package/hooks/useLanguages.js +24 -0
- package/hooks/useProcessMessage.d.ts +3 -3
- package/hooks/useProcessMessage.js +33 -29
- package/hooks/useRequiredToAddress.d.ts +1 -0
- package/hooks/useRequiredToAddress.js +15 -0
- package/hooks/useRouteExecution.d.ts +2 -2
- package/hooks/useRouteExecution.js +44 -58
- package/hooks/useRoutes.d.ts +1 -1
- package/hooks/useRoutes.js +131 -116
- package/hooks/useSettingMonitor.d.ts +11 -0
- package/hooks/useSettingMonitor.js +53 -0
- package/hooks/useTokenAddressBalance.d.ts +1 -1
- package/hooks/useTokenBalance.d.ts +5 -3
- package/hooks/useTokenBalance.js +74 -45
- package/hooks/useTokenBalances.d.ts +3 -3
- package/hooks/useTokenBalances.js +34 -24
- package/hooks/useTokenSearch.js +18 -17
- package/hooks/useTokens.d.ts +2 -1
- package/hooks/useTokens.js +19 -16
- package/hooks/useTools.d.ts +1 -1
- package/hooks/useTools.js +13 -12
- package/hooks/useTransactionDetails.d.ts +4 -0
- package/hooks/useTransactionDetails.js +52 -0
- package/hooks/useTransactionHistory.d.ts +5 -0
- package/hooks/useTransactionHistory.js +35 -0
- package/i18n/en.json +18 -9
- package/i18n/fr.json +7 -4
- package/i18n/pt.json +7 -4
- package/i18n/tr.json +7 -4
- package/i18n/uk.json +7 -4
- package/i18n/zh.json +7 -4
- package/icons/index.d.ts +1 -3
- package/icons/index.js +1 -3
- package/icons/lifi.d.ts +1 -0
- package/icons/lifi.js +1 -0
- package/index.d.ts +2 -3
- package/index.js +2 -4
- package/package.json +19 -19
- package/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +2 -2
- package/pages/LanguagesPage/LanguagesPage.d.ts +2 -0
- package/pages/LanguagesPage/LanguagesPage.js +18 -0
- package/pages/LanguagesPage/index.d.ts +1 -0
- package/pages/LanguagesPage/index.js +1 -0
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +16 -6
- package/pages/SelectWalletPage/EVMListItemButton.d.ts +8 -0
- package/pages/SelectWalletPage/EVMListItemButton.js +36 -0
- package/pages/SelectWalletPage/SVMListItemButton.d.ts +6 -0
- package/pages/SelectWalletPage/SVMListItemButton.js +30 -0
- package/pages/SelectWalletPage/SelectWalletPage.js +34 -35
- package/pages/SelectWalletPage/utils.d.ts +3 -0
- package/pages/SelectWalletPage/utils.js +17 -0
- package/{cjs/pages/SettingsPage/EnabledToolsButton.d.ts → pages/SettingsPage/BridgeAndExchangeSettings.d.ts} +1 -1
- package/pages/SettingsPage/BridgeAndExchangeSettings.js +32 -0
- package/pages/SettingsPage/GasPriceSettings.d.ts +2 -0
- package/pages/SettingsPage/GasPriceSettings.js +17 -0
- package/pages/SettingsPage/LanguageSetting.d.ts +2 -0
- package/pages/SettingsPage/LanguageSetting.js +22 -0
- package/pages/SettingsPage/ResetSettingsButton.js +4 -31
- package/pages/SettingsPage/RoutePrioritySettings.d.ts +2 -0
- package/pages/SettingsPage/RoutePrioritySettings.js +21 -0
- package/pages/SettingsPage/SendToWalletOptionSetting.d.ts +1 -0
- package/pages/SettingsPage/{ShowDestinationWallet.js → SendToWalletOptionSetting.js} +4 -7
- package/pages/SettingsPage/SettingsCard/BadgedValue.d.ts +8 -0
- package/pages/SettingsPage/SettingsCard/BadgedValue.js +3 -0
- package/pages/SettingsPage/SettingsCard/SettingCard.d.ts +2 -0
- package/pages/SettingsPage/SettingsCard/SettingCard.js +7 -0
- package/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +19 -0
- package/pages/SettingsPage/SettingsCard/SettingCard.style.js +50 -0
- package/pages/SettingsPage/SettingsCard/SettingCardButton.d.ts +7 -0
- package/pages/SettingsPage/SettingsCard/SettingCardButton.js +4 -0
- package/pages/SettingsPage/SettingsCard/SettingCardExpandable.d.ts +7 -0
- package/pages/SettingsPage/SettingsCard/SettingCardExpandable.js +12 -0
- package/pages/SettingsPage/SettingsCard/SettingsAccordian.d.ts +6 -0
- package/pages/SettingsPage/SettingsCard/SettingsAccordian.js +31 -0
- package/pages/SettingsPage/SettingsCard/index.d.ts +6 -0
- package/pages/SettingsPage/SettingsCard/index.js +6 -0
- package/pages/SettingsPage/SettingsCard/types.d.ts +5 -0
- package/pages/SettingsPage/SettingsPage.js +10 -9
- package/pages/SettingsPage/SlippageSettings/SlippageSettings.d.ts +2 -0
- package/pages/SettingsPage/SlippageSettings/SlippageSettings.js +47 -0
- package/pages/SettingsPage/SlippageSettings/SlippageSettings.style.d.ts +16 -0
- package/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +71 -0
- package/pages/SettingsPage/SlippageSettings/index.d.ts +1 -0
- package/pages/SettingsPage/SlippageSettings/index.js +1 -0
- package/pages/SettingsPage/ThemeSettings.d.ts +2 -0
- package/pages/SettingsPage/ThemeSettings.js +35 -0
- package/pages/TransactionDetailsPage/ContactSupportButton.js +2 -2
- package/pages/TransactionDetailsPage/TransactionDetailsPage.js +38 -33
- package/pages/TransactionDetailsPage/TransactionDetailsSkeleton.d.ts +1 -0
- package/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js +27 -0
- package/pages/TransactionHistoryPage/TransactionHistoryItem.d.ts +4 -2
- package/pages/TransactionHistoryPage/TransactionHistoryItem.js +34 -7
- package/pages/TransactionHistoryPage/TransactionHistoryPage.js +24 -25
- package/pages/TransactionHistoryPage/TransactionHistorySkeleton.d.ts +1 -0
- package/pages/TransactionHistoryPage/TransactionHistorySkeleton.js +22 -0
- package/pages/TransactionHistoryPage/constants.d.ts +1 -0
- package/pages/TransactionHistoryPage/constants.js +1 -0
- package/pages/TransactionPage/ExchangeRateBottomSheet.js +11 -10
- package/pages/TransactionPage/StartTransactionButton.js +2 -2
- package/pages/TransactionPage/StatusBottomSheet.js +14 -10
- package/pages/TransactionPage/TransactionPage.js +1 -1
- package/providers/FormProvider/FormUpdater.js +4 -4
- package/providers/I18nProvider/I18nProvider.js +4 -8
- package/providers/I18nProvider/types.d.ts +4 -3
- package/providers/WalletProvider/EVMProvider.d.ts +3 -0
- package/providers/WalletProvider/EVMProvider.js +74 -0
- package/providers/WalletProvider/SDKProviders.d.ts +1 -0
- package/providers/WalletProvider/SDKProviders.js +27 -0
- package/providers/WalletProvider/SolanaProvider.d.ts +3 -0
- package/providers/WalletProvider/SolanaProvider.js +30 -0
- package/providers/WalletProvider/WalletProvider.d.ts +1 -15
- package/providers/WalletProvider/WalletProvider.js +5 -181
- package/providers/WalletProvider/index.d.ts +1 -1
- package/providers/WalletProvider/index.js +1 -1
- package/providers/WalletProvider/utils.d.ts +3 -0
- package/providers/WalletProvider/utils.js +21 -0
- package/providers/WidgetProvider/WidgetProvider.js +52 -36
- package/providers/index.d.ts +0 -1
- package/providers/index.js +0 -1
- package/stores/chains/ChainOrderStore.js +25 -1
- package/stores/header/useHeaderStore.d.ts +1 -1
- package/stores/header/useHeaderStore.js +2 -2
- package/stores/routes/createRouteExecutionStore.js +6 -60
- package/stores/routes/index.d.ts +0 -1
- package/stores/routes/index.js +0 -1
- package/stores/routes/types.d.ts +2 -2
- package/stores/routes/utils.d.ts +8 -8
- package/stores/routes/utils.js +5 -3
- package/stores/settings/useSettingsStore.js +2 -4
- package/stores/settings/useSplitSubvariantStore.d.ts +1 -1
- package/stores/settings/useSplitSubvariantStore.js +2 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/events.d.ts +6 -5
- package/types/events.js +1 -1
- package/types/widget.d.ts +7 -14
- package/utils/colors.d.ts +3 -0
- package/utils/colors.js +10 -1
- package/utils/converters.d.ts +3 -0
- package/utils/converters.js +168 -0
- package/utils/format.d.ts +1 -1
- package/utils/format.js +5 -12
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/navigationRoutes.d.ts +1 -0
- package/utils/navigationRoutes.js +3 -1
- package/utils/svm.d.ts +1 -0
- package/utils/svm.js +10 -0
- package/cjs/components/LiFiLogo.d.ts +0 -5
- package/cjs/components/LiFiLogo.js +0 -10
- package/cjs/fonts/Inter-Black.woff +0 -0
- package/cjs/fonts/Inter-Black.woff2 +0 -0
- package/cjs/fonts/Inter-BlackItalic.woff +0 -0
- package/cjs/fonts/Inter-BlackItalic.woff2 +0 -0
- package/cjs/fonts/Inter-Bold.woff +0 -0
- package/cjs/fonts/Inter-Bold.woff2 +0 -0
- package/cjs/fonts/Inter-BoldItalic.woff +0 -0
- package/cjs/fonts/Inter-BoldItalic.woff2 +0 -0
- package/cjs/fonts/Inter-ExtraBold.woff +0 -0
- package/cjs/fonts/Inter-ExtraBold.woff2 +0 -0
- package/cjs/fonts/Inter-ExtraBoldItalic.woff +0 -0
- package/cjs/fonts/Inter-ExtraBoldItalic.woff2 +0 -0
- package/cjs/fonts/Inter-ExtraLight.woff +0 -0
- package/cjs/fonts/Inter-ExtraLight.woff2 +0 -0
- package/cjs/fonts/Inter-ExtraLightItalic.woff +0 -0
- package/cjs/fonts/Inter-ExtraLightItalic.woff2 +0 -0
- package/cjs/fonts/Inter-Italic.woff +0 -0
- package/cjs/fonts/Inter-Italic.woff2 +0 -0
- package/cjs/fonts/Inter-Light.woff +0 -0
- package/cjs/fonts/Inter-Light.woff2 +0 -0
- package/cjs/fonts/Inter-LightItalic.woff +0 -0
- package/cjs/fonts/Inter-LightItalic.woff2 +0 -0
- package/cjs/fonts/Inter-Medium.woff +0 -0
- package/cjs/fonts/Inter-Medium.woff2 +0 -0
- package/cjs/fonts/Inter-MediumItalic.woff +0 -0
- package/cjs/fonts/Inter-MediumItalic.woff2 +0 -0
- package/cjs/fonts/Inter-Regular.woff +0 -0
- package/cjs/fonts/Inter-Regular.woff2 +0 -0
- package/cjs/fonts/Inter-SemiBold.woff +0 -0
- package/cjs/fonts/Inter-SemiBold.woff2 +0 -0
- package/cjs/fonts/Inter-SemiBoldItalic.woff +0 -0
- package/cjs/fonts/Inter-SemiBoldItalic.woff2 +0 -0
- package/cjs/fonts/Inter-Thin.woff +0 -0
- package/cjs/fonts/Inter-Thin.woff2 +0 -0
- package/cjs/fonts/Inter-ThinItalic.woff +0 -0
- package/cjs/fonts/Inter-ThinItalic.woff2 +0 -0
- package/cjs/fonts/Inter-italic.var.woff2 +0 -0
- package/cjs/fonts/Inter-roman.var.woff2 +0 -0
- package/cjs/fonts/Inter.var.woff2 +0 -0
- package/cjs/fonts/inter.css +0 -217
- package/cjs/hooks/useGetTokenBalancesWithRetry.d.ts +0 -3
- package/cjs/hooks/useGetTokenBalancesWithRetry.js +0 -33
- package/cjs/icons/LiFiFullLogo.d.ts +0 -2
- package/cjs/icons/LiFiFullLogo.js +0 -6
- package/cjs/icons/LiFiLogo.d.ts +0 -2
- package/cjs/icons/LiFiLogo.js +0 -6
- package/cjs/icons/LiFiToolLogo.d.ts +0 -2
- package/cjs/icons/LiFiToolLogo.js +0 -6
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +0 -8
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.d.ts +0 -2
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +0 -27
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +0 -4
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.js +0 -19
- package/cjs/pages/SettingsPage/EnabledToolsButton.js +0 -25
- package/cjs/pages/SettingsPage/EnabledToolsButton.style.d.ts +0 -5
- package/cjs/pages/SettingsPage/EnabledToolsButton.style.js +0 -17
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/cjs/pages/SettingsPage/GasPriceSelect.js +0 -17
- package/cjs/pages/SettingsPage/LanguageSelect.d.ts +0 -2
- package/cjs/pages/SettingsPage/LanguageSelect.js +0 -37
- package/cjs/pages/SettingsPage/RoutePrioritySelect.d.ts +0 -2
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +0 -23
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/cjs/pages/SettingsPage/SlippageInput.js +0 -30
- package/cjs/providers/SDKProvider/SDKProvider.d.ts +0 -4
- package/cjs/providers/SDKProvider/SDKProvider.js +0 -41
- package/cjs/providers/SDKProvider/index.d.ts +0 -1
- package/cjs/providers/WalletProvider/types.d.ts +0 -17
- package/cjs/stores/routes/useTransactionHistory.d.ts +0 -2
- package/cjs/stores/routes/useTransactionHistory.js +0 -15
- package/components/Header/NavigationTabs.style.js +0 -58
- package/components/LiFiLogo.d.ts +0 -5
- package/components/LiFiLogo.js +0 -6
- package/fonts/Inter-Black.woff +0 -0
- package/fonts/Inter-Black.woff2 +0 -0
- package/fonts/Inter-BlackItalic.woff +0 -0
- package/fonts/Inter-BlackItalic.woff2 +0 -0
- package/fonts/Inter-Bold.woff +0 -0
- package/fonts/Inter-Bold.woff2 +0 -0
- package/fonts/Inter-BoldItalic.woff +0 -0
- package/fonts/Inter-BoldItalic.woff2 +0 -0
- package/fonts/Inter-ExtraBold.woff +0 -0
- package/fonts/Inter-ExtraBold.woff2 +0 -0
- package/fonts/Inter-ExtraBoldItalic.woff +0 -0
- package/fonts/Inter-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter-ExtraLight.woff +0 -0
- package/fonts/Inter-ExtraLight.woff2 +0 -0
- package/fonts/Inter-ExtraLightItalic.woff +0 -0
- package/fonts/Inter-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter-Italic.woff +0 -0
- package/fonts/Inter-Italic.woff2 +0 -0
- package/fonts/Inter-Light.woff +0 -0
- package/fonts/Inter-Light.woff2 +0 -0
- package/fonts/Inter-LightItalic.woff +0 -0
- package/fonts/Inter-LightItalic.woff2 +0 -0
- package/fonts/Inter-Medium.woff +0 -0
- package/fonts/Inter-Medium.woff2 +0 -0
- package/fonts/Inter-MediumItalic.woff +0 -0
- package/fonts/Inter-MediumItalic.woff2 +0 -0
- package/fonts/Inter-Regular.woff +0 -0
- package/fonts/Inter-Regular.woff2 +0 -0
- package/fonts/Inter-SemiBold.woff +0 -0
- package/fonts/Inter-SemiBold.woff2 +0 -0
- package/fonts/Inter-SemiBoldItalic.woff +0 -0
- package/fonts/Inter-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter-Thin.woff +0 -0
- package/fonts/Inter-Thin.woff2 +0 -0
- package/fonts/Inter-ThinItalic.woff +0 -0
- package/fonts/Inter-ThinItalic.woff2 +0 -0
- package/fonts/Inter-italic.var.woff2 +0 -0
- package/fonts/Inter-roman.var.woff2 +0 -0
- package/fonts/Inter.var.woff2 +0 -0
- package/fonts/inter.css +0 -217
- package/hooks/useGetTokenBalancesWithRetry.d.ts +0 -3
- package/hooks/useGetTokenBalancesWithRetry.js +0 -29
- package/icons/LiFiFullLogo.d.ts +0 -2
- package/icons/LiFiFullLogo.js +0 -2
- package/icons/LiFiLogo.d.ts +0 -2
- package/icons/LiFiLogo.js +0 -2
- package/icons/LiFiToolLogo.d.ts +0 -2
- package/icons/LiFiToolLogo.js +0 -2
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +0 -5
- package/pages/SettingsPage/ColorSchemeButtonGroup.d.ts +0 -2
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +0 -23
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +0 -4
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.js +0 -16
- package/pages/SettingsPage/EnabledToolsButton.js +0 -21
- package/pages/SettingsPage/EnabledToolsButton.style.d.ts +0 -5
- package/pages/SettingsPage/EnabledToolsButton.style.js +0 -14
- package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/pages/SettingsPage/GasPriceSelect.js +0 -13
- package/pages/SettingsPage/LanguageSelect.d.ts +0 -2
- package/pages/SettingsPage/LanguageSelect.js +0 -33
- package/pages/SettingsPage/RoutePrioritySelect.d.ts +0 -2
- package/pages/SettingsPage/RoutePrioritySelect.js +0 -19
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/pages/SettingsPage/SlippageInput.js +0 -26
- package/providers/SDKProvider/SDKProvider.d.ts +0 -4
- package/providers/SDKProvider/SDKProvider.js +0 -36
- package/providers/SDKProvider/index.d.ts +0 -1
- package/providers/SDKProvider/index.js +0 -1
- package/providers/WalletProvider/types.d.ts +0 -17
- package/stores/routes/useTransactionHistory.d.ts +0 -2
- package/stores/routes/useTransactionHistory.js +0 -11
- /package/cjs/{providers/WalletProvider → pages/SettingsPage/SettingsCard}/types.js +0 -0
- /package/{providers/WalletProvider → pages/SettingsPage/SettingsCard}/types.js +0 -0
package/cjs/types/events.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ChainId, Process, Route } from '@lifi/sdk';
|
|
1
|
+
import type { ChainId, ChainType, Process, Route } from '@lifi/sdk';
|
|
2
2
|
export declare enum WidgetEvent {
|
|
3
3
|
RouteExecutionStarted = "routeExecutionStarted",
|
|
4
4
|
RouteExecutionUpdated = "routeExecutionUpdated",
|
|
5
5
|
RouteExecutionCompleted = "routeExecutionCompleted",
|
|
6
6
|
RouteExecutionFailed = "routeExecutionFailed",
|
|
7
7
|
RouteHighValueLoss = "routeHighValueLoss",
|
|
8
|
-
|
|
8
|
+
ContactSupport = "contactSupport",
|
|
9
9
|
SourceChainTokenSelected = "sourceChainTokenSelected",
|
|
10
10
|
DestinationChainTokenSelected = "destinationChainTokenSelected",
|
|
11
11
|
SendToWalletToggled = "sendToWalletToggled",
|
|
@@ -18,14 +18,14 @@ export type WidgetEvents = {
|
|
|
18
18
|
routeExecutionCompleted: Route;
|
|
19
19
|
routeExecutionFailed: RouteExecutionUpdate;
|
|
20
20
|
routeHighValueLoss: RouteHighValueLossUpdate;
|
|
21
|
-
|
|
21
|
+
contactSupport: ContactSupport;
|
|
22
22
|
sourceChainTokenSelected: ChainTokenSelected;
|
|
23
23
|
destinationChainTokenSelected: ChainTokenSelected;
|
|
24
24
|
sendToWalletToggled: boolean;
|
|
25
25
|
reviewTransactionPageEntered?: Route;
|
|
26
26
|
walletConnected: WalletConnected;
|
|
27
27
|
};
|
|
28
|
-
export interface
|
|
28
|
+
export interface ContactSupport {
|
|
29
29
|
supportId?: string;
|
|
30
30
|
}
|
|
31
31
|
export interface RouteHighValueLossUpdate {
|
|
@@ -43,6 +43,7 @@ export interface ChainTokenSelected {
|
|
|
43
43
|
tokenAddress: string;
|
|
44
44
|
}
|
|
45
45
|
export interface WalletConnected {
|
|
46
|
-
chainId?: number;
|
|
47
46
|
address?: string;
|
|
47
|
+
chainId?: number;
|
|
48
|
+
chainType?: ChainType;
|
|
48
49
|
}
|
package/cjs/types/events.js
CHANGED
|
@@ -8,7 +8,7 @@ var WidgetEvent;
|
|
|
8
8
|
WidgetEvent["RouteExecutionCompleted"] = "routeExecutionCompleted";
|
|
9
9
|
WidgetEvent["RouteExecutionFailed"] = "routeExecutionFailed";
|
|
10
10
|
WidgetEvent["RouteHighValueLoss"] = "routeHighValueLoss";
|
|
11
|
-
WidgetEvent["
|
|
11
|
+
WidgetEvent["ContactSupport"] = "contactSupport";
|
|
12
12
|
WidgetEvent["SourceChainTokenSelected"] = "sourceChainTokenSelected";
|
|
13
13
|
WidgetEvent["DestinationChainTokenSelected"] = "destinationChainTokenSelected";
|
|
14
14
|
WidgetEvent["SendToWalletToggled"] = "sendToWalletToggled";
|
package/cjs/types/widget.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { BaseToken, ChainKey, ConfigUpdate, Order, RouteOptions, StaticToken, Token } from '@lifi/sdk';
|
|
1
|
+
import type { BaseToken, Order, RouteOptions, SDKOptions, StaticToken, Token } from '@lifi/sdk';
|
|
3
2
|
import type { Components, PaletteMode, PaletteOptions, Shape, Theme } from '@mui/material';
|
|
4
3
|
import type { TypographyOptions } from '@mui/material/styles/createTypography';
|
|
5
4
|
import type { CSSProperties, ReactNode, RefObject } from 'react';
|
|
@@ -37,15 +36,10 @@ export type ThemeConfig = {
|
|
|
37
36
|
components?: Pick<Components<Omit<Theme, 'components'>>, 'MuiAvatar'>;
|
|
38
37
|
};
|
|
39
38
|
export interface WidgetWalletManagement {
|
|
40
|
-
connect(): Promise<
|
|
41
|
-
disconnect(): Promise<void>;
|
|
42
|
-
switchChain?(chainId: number): Promise<Signer>;
|
|
43
|
-
addToken?(token: StaticToken, chainId: number): Promise<void>;
|
|
44
|
-
addChain?(chainId: number): Promise<boolean>;
|
|
45
|
-
signer?: Signer;
|
|
39
|
+
connect(): Promise<void>;
|
|
46
40
|
}
|
|
47
|
-
export interface
|
|
48
|
-
|
|
41
|
+
export interface WidgetSDKOptions extends Omit<SDKOptions, 'apiKey' | 'disableVersionCheck' | 'integrator' | 'routeOptions' | 'widgetVersion'> {
|
|
42
|
+
routeOptions?: Omit<RouteOptions, 'bridges' | 'exchanges' | 'insurance'>;
|
|
49
43
|
}
|
|
50
44
|
export interface WidgetContractTool {
|
|
51
45
|
logoURI: string;
|
|
@@ -60,8 +54,8 @@ export interface WidgetContract {
|
|
|
60
54
|
fallbackAddress?: string;
|
|
61
55
|
}
|
|
62
56
|
export interface WidgetConfig {
|
|
63
|
-
fromChain?:
|
|
64
|
-
toChain?:
|
|
57
|
+
fromChain?: number;
|
|
58
|
+
toChain?: number;
|
|
65
59
|
fromToken?: string;
|
|
66
60
|
toToken?: string;
|
|
67
61
|
toAddress?: string;
|
|
@@ -90,7 +84,7 @@ export interface WidgetConfig {
|
|
|
90
84
|
requiredUI?: RequiredUIType[];
|
|
91
85
|
useRecommendedRoute?: boolean;
|
|
92
86
|
walletManagement?: WidgetWalletManagement;
|
|
93
|
-
sdkConfig?:
|
|
87
|
+
sdkConfig?: WidgetSDKOptions;
|
|
94
88
|
buildUrl?: boolean;
|
|
95
89
|
keyPrefix?: string;
|
|
96
90
|
bridges?: {
|
|
@@ -117,7 +111,6 @@ export interface WidgetConfig {
|
|
|
117
111
|
deny?: LanguageKey[];
|
|
118
112
|
};
|
|
119
113
|
languageResources?: LanguageResources;
|
|
120
|
-
disableLanguageDetector?: boolean;
|
|
121
114
|
}
|
|
122
115
|
export type WidgetDrawerProps = {
|
|
123
116
|
elementRef?: RefObject<HTMLDivElement>;
|
package/cjs/utils/colors.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { PaletteMode, Theme } from '@mui/material';
|
|
2
2
|
export declare const getContrastAlphaColor: (mode: PaletteMode, alpha: string | number) => string;
|
|
3
3
|
export declare const getContrastTextColor: (theme: Theme, background?: string) => "#fff" | "#000";
|
|
4
|
+
export declare const getWarningBackgroundColor: (theme: Theme) => string;
|
|
5
|
+
export declare const getInfoBackgroundColor: (theme: Theme) => string;
|
|
6
|
+
export declare const getCardFieldsetBackgroundColor: (theme: Theme) => string;
|
package/cjs/utils/colors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getContrastTextColor = exports.getContrastAlphaColor = void 0;
|
|
3
|
+
exports.getCardFieldsetBackgroundColor = exports.getInfoBackgroundColor = exports.getWarningBackgroundColor = exports.getContrastTextColor = exports.getContrastAlphaColor = void 0;
|
|
4
4
|
const colors_1 = require("@mui/material/colors");
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
6
|
const getContrastAlphaColor = (mode, alpha) => mode === 'light' ? `rgb(0 0 0 / ${alpha})` : `rgb(255 255 255 / ${alpha})`;
|
|
@@ -9,3 +9,15 @@ const getContrastTextColor = (theme, background) => (0, styles_1.getContrastRati
|
|
|
9
9
|
? colors_1.common.white
|
|
10
10
|
: colors_1.common.black;
|
|
11
11
|
exports.getContrastTextColor = getContrastTextColor;
|
|
12
|
+
const getWarningBackgroundColor = (theme) => theme.palette.mode === 'light'
|
|
13
|
+
? (0, styles_1.alpha)(theme.palette.warning.main, 0.32)
|
|
14
|
+
: (0, styles_1.alpha)(theme.palette.warning.main, 0.16);
|
|
15
|
+
exports.getWarningBackgroundColor = getWarningBackgroundColor;
|
|
16
|
+
const getInfoBackgroundColor = (theme) => theme.palette.mode === 'light'
|
|
17
|
+
? (0, styles_1.alpha)(theme.palette.info.main, 0.12)
|
|
18
|
+
: (0, styles_1.alpha)(theme.palette.info.main, 0.16);
|
|
19
|
+
exports.getInfoBackgroundColor = getInfoBackgroundColor;
|
|
20
|
+
const getCardFieldsetBackgroundColor = (theme) => theme.palette.mode === 'dark'
|
|
21
|
+
? theme.palette.grey[800]
|
|
22
|
+
: (0, styles_1.alpha)(theme.palette.common.black, 0.04);
|
|
23
|
+
exports.getCardFieldsetBackgroundColor = getCardFieldsetBackgroundColor;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildRouteFromTxHistory = void 0;
|
|
4
|
+
const buildProcessFromTxHistory = (tx) => {
|
|
5
|
+
const sending = tx.sending;
|
|
6
|
+
const receiving = tx.receiving;
|
|
7
|
+
if (!sending.token?.chainId || !receiving.token?.chainId) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
const processStatus = tx.status === 'DONE' ? 'DONE' : 'FAILED';
|
|
11
|
+
const substatus = processStatus === 'FAILED' ? 'UNKNOWN_ERROR' : 'COMPLETED';
|
|
12
|
+
if (sending.chainId === receiving.chainId) {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
type: 'SWAP', // operations on same chain will be swaps
|
|
16
|
+
startedAt: sending.timestamp ?? Date.now(),
|
|
17
|
+
message: '',
|
|
18
|
+
status: processStatus,
|
|
19
|
+
txHash: sending.txHash,
|
|
20
|
+
txLink: sending.txLink,
|
|
21
|
+
doneAt: receiving.timestamp ?? Date.now(),
|
|
22
|
+
substatus,
|
|
23
|
+
substatusMessage: '',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
const process = [
|
|
28
|
+
{
|
|
29
|
+
type: 'CROSS_CHAIN', // first step of bridging, ignoring the approvals
|
|
30
|
+
startedAt: sending.timestamp ?? Date.now(),
|
|
31
|
+
message: '',
|
|
32
|
+
status: processStatus, // can be FAILED
|
|
33
|
+
txHash: sending.txHash,
|
|
34
|
+
txLink: sending.txLink,
|
|
35
|
+
doneAt: sending.timestamp,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'RECEIVING_CHAIN', // final step of bridging, post swaps
|
|
39
|
+
startedAt: receiving.timestamp ?? Date.now(),
|
|
40
|
+
message: '',
|
|
41
|
+
status: processStatus,
|
|
42
|
+
substatus,
|
|
43
|
+
substatusMessage: '',
|
|
44
|
+
doneAt: receiving.timestamp ?? Date.now(),
|
|
45
|
+
txHash: receiving.txHash,
|
|
46
|
+
txLink: receiving.txLink,
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
return process;
|
|
50
|
+
};
|
|
51
|
+
const buildRouteFromTxHistory = (tx, tools) => {
|
|
52
|
+
const sending = tx.sending;
|
|
53
|
+
const receiving = tx.receiving;
|
|
54
|
+
if (!sending.token?.chainId || !receiving.token?.chainId) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const selectedBridge = tools?.bridges.find((bridge) => bridge.key === tx.tool);
|
|
58
|
+
const selectedExchange = tools?.exchanges.find((exchange) => exchange.key === tx.tool);
|
|
59
|
+
const usedTool = {
|
|
60
|
+
key: tx.tool,
|
|
61
|
+
name: selectedBridge?.name ?? selectedExchange?.name ?? tx.tool,
|
|
62
|
+
logoURI: selectedBridge?.logoURI ?? selectedExchange?.logoURI ?? '',
|
|
63
|
+
};
|
|
64
|
+
const fromToken = {
|
|
65
|
+
...sending.token,
|
|
66
|
+
amount: BigInt(sending.amount ?? 0),
|
|
67
|
+
priceUSD: sending.amountUSD ?? '0',
|
|
68
|
+
symbol: sending.token?.symbol ?? '',
|
|
69
|
+
decimals: sending.token?.decimals ?? 0,
|
|
70
|
+
name: sending.token?.name ?? '',
|
|
71
|
+
chainId: sending.token?.chainId,
|
|
72
|
+
};
|
|
73
|
+
const toToken = {
|
|
74
|
+
...receiving.token,
|
|
75
|
+
amount: BigInt(receiving.amount ?? 0),
|
|
76
|
+
priceUSD: receiving.amountUSD ?? '0',
|
|
77
|
+
symbol: receiving.token?.symbol ?? '',
|
|
78
|
+
decimals: receiving.token?.decimals ?? 0,
|
|
79
|
+
name: receiving.token?.name ?? '',
|
|
80
|
+
chainId: receiving.token?.chainId,
|
|
81
|
+
};
|
|
82
|
+
const routeExecution = {
|
|
83
|
+
status: 1,
|
|
84
|
+
route: {
|
|
85
|
+
id: tx.transactionId,
|
|
86
|
+
fromAddress: tx.fromAddress,
|
|
87
|
+
toAddress: tx.toAddress,
|
|
88
|
+
fromChainId: sending.chainId,
|
|
89
|
+
fromAmount: sending.amount ?? '',
|
|
90
|
+
fromAmountUSD: sending.amountUSD ?? '',
|
|
91
|
+
toAmount: receiving.amount ?? '',
|
|
92
|
+
toAmountMin: receiving.amount ?? '',
|
|
93
|
+
toAmountUSD: receiving.amountUSD ?? '',
|
|
94
|
+
toChainId: receiving.chainId,
|
|
95
|
+
fromToken,
|
|
96
|
+
toToken,
|
|
97
|
+
steps: [
|
|
98
|
+
{
|
|
99
|
+
id: '',
|
|
100
|
+
type: 'lifi',
|
|
101
|
+
tool: tx.tool,
|
|
102
|
+
toolDetails: usedTool,
|
|
103
|
+
action: {
|
|
104
|
+
fromToken: sending.token,
|
|
105
|
+
fromAmount: sending.amount ?? '',
|
|
106
|
+
fromChainId: sending.chainId,
|
|
107
|
+
fromAddress: tx.fromAddress,
|
|
108
|
+
toToken: receiving.token,
|
|
109
|
+
toChainId: receiving.chainId,
|
|
110
|
+
toAddress: tx.toAddress,
|
|
111
|
+
slippage: 0,
|
|
112
|
+
},
|
|
113
|
+
estimate: {
|
|
114
|
+
tool: tx.tool,
|
|
115
|
+
approvalAddress: '',
|
|
116
|
+
fromAmount: sending.amount ?? '',
|
|
117
|
+
fromAmountUSD: sending.amountUSD ?? '',
|
|
118
|
+
toAmountMin: receiving.amount ?? '',
|
|
119
|
+
toAmount: receiving.amount ?? '',
|
|
120
|
+
toAmountUSD: receiving.amountUSD ?? '',
|
|
121
|
+
executionDuration: 30,
|
|
122
|
+
},
|
|
123
|
+
includedSteps: [
|
|
124
|
+
{
|
|
125
|
+
id: '',
|
|
126
|
+
type: sending.chainId === receiving.chainId ? 'swap' : 'cross',
|
|
127
|
+
action: {
|
|
128
|
+
fromChainId: sending.chainId,
|
|
129
|
+
fromAmount: sending.amount ?? '',
|
|
130
|
+
fromToken: sending.token,
|
|
131
|
+
toChainId: receiving.chainId,
|
|
132
|
+
toToken: receiving.token,
|
|
133
|
+
slippage: 0,
|
|
134
|
+
fromAddress: tx.fromAddress,
|
|
135
|
+
toAddress: tx.toAddress,
|
|
136
|
+
},
|
|
137
|
+
estimate: {
|
|
138
|
+
tool: tx.tool,
|
|
139
|
+
fromAmount: sending.amount ?? '',
|
|
140
|
+
toAmount: receiving.amount ?? '',
|
|
141
|
+
toAmountMin: receiving.amount ?? '',
|
|
142
|
+
approvalAddress: '',
|
|
143
|
+
executionDuration: 30,
|
|
144
|
+
},
|
|
145
|
+
tool: tx.tool,
|
|
146
|
+
toolDetails: usedTool,
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
integrator: '',
|
|
150
|
+
execution: {
|
|
151
|
+
status: 'DONE', // can be FAILED
|
|
152
|
+
process: buildProcessFromTxHistory(tx),
|
|
153
|
+
fromAmount: sending.amount,
|
|
154
|
+
toAmount: receiving.amount,
|
|
155
|
+
toToken: receiving.token,
|
|
156
|
+
gasAmount: sending.gasAmount,
|
|
157
|
+
gasAmountUSD: sending.gasAmountUSD,
|
|
158
|
+
gasPrice: sending.gasPrice,
|
|
159
|
+
gasToken: sending.gasToken,
|
|
160
|
+
gasUsed: sending.gasUsed,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
insurance: {
|
|
165
|
+
state: 'NOT_INSURABLE',
|
|
166
|
+
feeAmountUsd: '0',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
return routeExecution;
|
|
171
|
+
};
|
|
172
|
+
exports.buildRouteFromTxHistory = buildRouteFromTxHistory;
|
package/cjs/utils/format.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param amount amount to format.
|
|
4
4
|
* @returns formatted amount.
|
|
5
5
|
*/
|
|
6
|
-
export declare const formatTokenAmount: (amount
|
|
6
|
+
export declare const formatTokenAmount: (amount: bigint | undefined, decimals: number, decimalPlaces?: number) => string;
|
|
7
7
|
export declare const formatSlippage: (slippage?: string, defaultValue?: string, returnInitial?: boolean) => string;
|
|
8
8
|
export declare const formatInputAmount: (amount: string, decimals?: number | null, returnInitial?: boolean) => string;
|
|
9
9
|
export declare const formatTokenPrice: (amount?: string, price?: string) => number;
|
package/cjs/utils/format.js
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatTokenPrice = exports.formatInputAmount = exports.formatSlippage = exports.formatTokenAmount = void 0;
|
|
4
|
-
const
|
|
5
|
-
// JavaScript numbers use exponential notation for positive exponents of 21 and above. We need more.
|
|
6
|
-
big_js_1.default.PE = 42;
|
|
7
|
-
// JavaScript numbers use exponential notation for negative exponents of -7 and below. We need more.
|
|
8
|
-
big_js_1.default.NE = -42;
|
|
4
|
+
const viem_1 = require("viem");
|
|
9
5
|
/**
|
|
10
6
|
* Format token amount to at least 4 decimals.
|
|
11
7
|
* @param amount amount to format.
|
|
12
8
|
* @returns formatted amount.
|
|
13
9
|
*/
|
|
14
|
-
const formatTokenAmount = (amount =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
const parsedAmount = parseFloat(shiftedAmount);
|
|
20
|
-
if (parsedAmount === 0 || isNaN(Number(shiftedAmount))) {
|
|
10
|
+
const formatTokenAmount = (amount = 0n, decimals, decimalPlaces = 3) => {
|
|
11
|
+
const formattedAmount = amount ? (0, viem_1.formatUnits)(amount, decimals) : '0';
|
|
12
|
+
const parsedAmount = parseFloat(formattedAmount);
|
|
13
|
+
if (parsedAmount === 0 || isNaN(Number(formattedAmount))) {
|
|
21
14
|
return '0';
|
|
22
15
|
}
|
|
23
16
|
const absAmount = Math.abs(parsedAmount);
|
package/cjs/utils/index.d.ts
CHANGED
package/cjs/utils/index.js
CHANGED
|
@@ -21,4 +21,5 @@ __exportStar(require("./enum"), exports);
|
|
|
21
21
|
__exportStar(require("./format"), exports);
|
|
22
22
|
__exportStar(require("./input"), exports);
|
|
23
23
|
__exportStar(require("./navigationRoutes"), exports);
|
|
24
|
+
__exportStar(require("./svm"), exports);
|
|
24
25
|
__exportStar(require("./wallet"), exports);
|
|
@@ -8,8 +8,9 @@ exports.navigationRoutes = {
|
|
|
8
8
|
exchanges: 'exchanges',
|
|
9
9
|
fromChain: 'from-chain',
|
|
10
10
|
fromToken: 'from-token',
|
|
11
|
+
languages: 'languages',
|
|
11
12
|
routes: 'routes',
|
|
12
|
-
selectWallet: 'wallet',
|
|
13
|
+
selectWallet: 'select-wallet',
|
|
13
14
|
settings: 'settings',
|
|
14
15
|
toChain: 'to-chain',
|
|
15
16
|
toToken: 'to-token',
|
|
@@ -38,6 +39,7 @@ exports.backButtonRoutes = [
|
|
|
38
39
|
exports.navigationRoutes.activeTransactions,
|
|
39
40
|
exports.navigationRoutes.bridges,
|
|
40
41
|
exports.navigationRoutes.exchanges,
|
|
42
|
+
exports.navigationRoutes.languages,
|
|
41
43
|
exports.navigationRoutes.fromChain,
|
|
42
44
|
exports.navigationRoutes.fromToken,
|
|
43
45
|
exports.navigationRoutes.routes,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isSVMAddress: (address: string) => boolean;
|
package/cjs/utils/svm.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSVMAddress = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const isSVMAddress = (address) => {
|
|
6
|
+
try {
|
|
7
|
+
new web3_js_1.PublicKey(address);
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
exports.isSVMAddress = isSVMAddress;
|
|
@@ -16,11 +16,7 @@ export const ActiveTransactionItem = ({ routeId, dense }) => {
|
|
|
16
16
|
routeId,
|
|
17
17
|
executeInBackground: true,
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
const lastActiveStep = route?.steps
|
|
21
|
-
.slice()
|
|
22
|
-
.reverse()
|
|
23
|
-
.find((step) => step.execution);
|
|
19
|
+
const lastActiveStep = route?.steps.findLast((step) => step.execution);
|
|
24
20
|
const lastActiveProcess = lastActiveStep?.execution?.process.at(-1);
|
|
25
21
|
const { title } = useProcessMessage(lastActiveStep, lastActiveProcess);
|
|
26
22
|
if (!route || !lastActiveStep) {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Stack } from '@mui/material';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useNavigate } from 'react-router-dom';
|
|
5
|
-
import {
|
|
5
|
+
import { useAccount } from '../../hooks';
|
|
6
6
|
import { useExecutingRoutesIds } from '../../stores';
|
|
7
7
|
import { navigationRoutes } from '../../utils';
|
|
8
8
|
import { Card, CardTitle } from '../Card';
|
|
@@ -11,7 +11,7 @@ import { ShowAllButton } from './ActiveTransactions.style';
|
|
|
11
11
|
export const ActiveTransactions = (props) => {
|
|
12
12
|
const { t } = useTranslation();
|
|
13
13
|
const navigate = useNavigate();
|
|
14
|
-
const { account } =
|
|
14
|
+
const { account } = useAccount();
|
|
15
15
|
const executingRoutes = useExecutingRoutesIds(account.address);
|
|
16
16
|
if (!executingRoutes?.length) {
|
|
17
17
|
return null;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { InputAdornment, Skeleton } from '@mui/material';
|
|
3
|
-
import Big from 'big.js';
|
|
4
3
|
import { useFormContext, useWatch } from 'react-hook-form';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import {
|
|
5
|
+
import { formatUnits } from 'viem';
|
|
6
|
+
import { useAvailableChains, useGasRecommendation, useTokenAddressBalance, } from '../../hooks';
|
|
7
7
|
import { FormKeyHelper } from '../../providers';
|
|
8
|
-
import { formatTokenAmount } from '../../utils';
|
|
9
8
|
import { Button } from './AmountInputAdornment.style';
|
|
10
9
|
export const AmountInputEndAdornment = ({ formType }) => {
|
|
11
10
|
const { t } = useTranslation();
|
|
12
11
|
const { setValue } = useFormContext();
|
|
13
|
-
const { getChainById } =
|
|
12
|
+
const { getChainById } = useAvailableChains();
|
|
14
13
|
const [chainId, tokenAddress] = useWatch({
|
|
15
14
|
name: [
|
|
16
15
|
FormKeyHelper.getChainKey(formType),
|
|
17
16
|
FormKeyHelper.getTokenKey(formType),
|
|
18
17
|
],
|
|
19
18
|
});
|
|
19
|
+
// We get gas recommendations for the source chain to make sure that after pressing the Max button
|
|
20
|
+
// the user will have enough funds remaining to cover gas costs
|
|
20
21
|
const { data } = useGasRecommendation(chainId);
|
|
21
22
|
const { token, isLoading } = useTokenAddressBalance(chainId, tokenAddress);
|
|
22
23
|
const handleMax = () => {
|
|
@@ -25,15 +26,13 @@ export const AmountInputEndAdornment = ({ formType }) => {
|
|
|
25
26
|
if (chain?.nativeToken.address === tokenAddress &&
|
|
26
27
|
data?.available &&
|
|
27
28
|
data?.recommended) {
|
|
28
|
-
const tokenAmount =
|
|
29
|
-
const recommendedAmount =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (tokenAmount.gt(recommendedAmount)) {
|
|
33
|
-
maxAmount = formatTokenAmount(tokenAmount.minus(recommendedAmount).toString());
|
|
29
|
+
const tokenAmount = token?.amount ?? 0n;
|
|
30
|
+
const recommendedAmount = BigInt(data.recommended.amount) / 2n;
|
|
31
|
+
if (tokenAmount > recommendedAmount) {
|
|
32
|
+
maxAmount = tokenAmount - recommendedAmount;
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
setValue(FormKeyHelper.getAmountKey(formType), maxAmount
|
|
35
|
+
setValue(FormKeyHelper.getAmountKey(formType), maxAmount && token ? formatUnits(maxAmount, token.decimals) : '', {
|
|
37
36
|
shouldTouch: true,
|
|
38
37
|
});
|
|
39
38
|
};
|
|
@@ -27,6 +27,6 @@ export const FormPriceHelperTextBase = ({ formType, isLoading, tokenAddress, tok
|
|
|
27
27
|
}, children: t(`format.currency`, {
|
|
28
28
|
value: fromAmountTokenPrice,
|
|
29
29
|
}) }), isLoading && tokenAddress ? (_jsx(Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : token?.amount ? (_jsx(Typography, { fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25, children: `/ ${t(`format.number`, {
|
|
30
|
-
value: formatTokenAmount(token
|
|
30
|
+
value: formatTokenAmount(token.amount, token.decimals),
|
|
31
31
|
})}` })) : null] }));
|
|
32
32
|
};
|
|
@@ -2,26 +2,27 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { LoadingButton } from '@mui/lab';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useNavigate } from 'react-router-dom';
|
|
5
|
-
import {
|
|
5
|
+
import { useAccount } from '../../hooks';
|
|
6
|
+
import { useWidgetConfig } from '../../providers';
|
|
6
7
|
import { navigationRoutes } from '../../utils';
|
|
7
8
|
export const BaseTransactionButton = ({ onClick, text, disabled, loading, }) => {
|
|
8
9
|
const { t } = useTranslation();
|
|
9
10
|
const navigate = useNavigate();
|
|
10
11
|
const { walletManagement } = useWidgetConfig();
|
|
11
|
-
const { account
|
|
12
|
+
const { account } = useAccount();
|
|
12
13
|
const handleClick = async () => {
|
|
13
|
-
if (account.
|
|
14
|
+
if (account.isConnected) {
|
|
14
15
|
onClick?.();
|
|
15
16
|
}
|
|
16
17
|
else if (walletManagement) {
|
|
17
|
-
await connect();
|
|
18
|
+
await walletManagement.connect();
|
|
18
19
|
}
|
|
19
20
|
else {
|
|
20
21
|
navigate(navigationRoutes.selectWallet);
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
const getButtonText = () => {
|
|
24
|
-
if (account.
|
|
25
|
+
if (account.isConnected) {
|
|
25
26
|
if (text) {
|
|
26
27
|
return text;
|
|
27
28
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const CardLabel: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
3
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
4
4
|
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
5
|
-
type?: "
|
|
5
|
+
type?: "insurance" | "active" | "insurance-icon" | undefined;
|
|
6
6
|
}, {}, {}>;
|
|
7
7
|
export declare const CardLabelTypography: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
8
8
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Avatar, Box, Skeleton, Tooltip, Typography } from '@mui/material';
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import { useWatch } from 'react-hook-form';
|
|
4
5
|
import { useNavigate } from 'react-router-dom';
|
|
5
6
|
import { FormKeyHelper } from '../../providers';
|
|
@@ -13,11 +14,13 @@ export const ChainSelect = ({ formType }) => {
|
|
|
13
14
|
const [chainId] = useWatch({
|
|
14
15
|
name: [FormKeyHelper.getChainKey(formType)],
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const hasChainInOrderedList = chainOrder.includes(chainId);
|
|
19
|
+
// If we don't have a chain in the ordered chain list we should add it.
|
|
20
|
+
if (!hasChainInOrderedList) {
|
|
21
|
+
setChainOrder(chainId);
|
|
22
|
+
}
|
|
23
|
+
}, [chainId, chainOrder, setChainOrder]);
|
|
21
24
|
const showAllChains = () => {
|
|
22
25
|
navigate(navigationRoutes[`${formType}Chain`]);
|
|
23
26
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { useController, useFormContext } from 'react-hook-form';
|
|
2
2
|
import { useChains, useSwapOnly } from '../../hooks';
|
|
3
|
-
import { FormKey, FormKeyHelper } from '../../providers';
|
|
3
|
+
import { FormKey, FormKeyHelper, useWidgetConfig } from '../../providers';
|
|
4
4
|
import { useChainOrder } from '../../stores';
|
|
5
|
+
import { RequiredUI } from '../../types';
|
|
5
6
|
export const useChainSelect = (formType) => {
|
|
7
|
+
const { requiredUI } = useWidgetConfig();
|
|
6
8
|
const chainKey = FormKeyHelper.getChainKey(formType);
|
|
7
9
|
const { field: { onChange, onBlur }, } = useController({ name: chainKey });
|
|
8
|
-
const { setValue } = useFormContext();
|
|
9
|
-
const { chains, isLoading } = useChains();
|
|
10
|
+
const { setValue, getValues } = useFormContext();
|
|
11
|
+
const { chains, isLoading, getChainById } = useChains();
|
|
10
12
|
const [chainOrder, setChainOrder] = useChainOrder();
|
|
11
13
|
const swapOnly = useSwapOnly();
|
|
12
14
|
const getChains = () => {
|
|
@@ -29,6 +31,23 @@ export const useChainSelect = (formType) => {
|
|
|
29
31
|
setValue(FormKeyHelper.getTokenKey(formType), '');
|
|
30
32
|
setValue(FormKeyHelper.getAmountKey(formType), '');
|
|
31
33
|
setValue(FormKey.TokenSearchFilter, '');
|
|
34
|
+
const [fromChainId, toChainId] = getValues([
|
|
35
|
+
FormKey.FromChain,
|
|
36
|
+
FormKey.ToChain,
|
|
37
|
+
]);
|
|
38
|
+
const fromChain = getChainById(fromChainId);
|
|
39
|
+
const toChain = getChainById(toChainId);
|
|
40
|
+
const differentChainType = fromChain && toChain && fromChain.chainType !== toChain.chainType;
|
|
41
|
+
const requiredToAddress = requiredUI?.includes(RequiredUI.ToAddress) || differentChainType;
|
|
42
|
+
// toAddress field is required (always visible) when bridging between
|
|
43
|
+
// two ecosystems (fromChain and toChain have different chain types).
|
|
44
|
+
// We clean up toAddress on every chain change if toAddress is not required.
|
|
45
|
+
// This is used when we switch between different chain ecosystems (chain types) and
|
|
46
|
+
// prevents cases when after we switch the chain from one type to another "Send to wallet" field hides,
|
|
47
|
+
// but it keeps toAddress value set for the previous chain pair.
|
|
48
|
+
if (!requiredToAddress) {
|
|
49
|
+
setValue(FormKey.ToAddress, '');
|
|
50
|
+
}
|
|
32
51
|
setChainOrder(chainId);
|
|
33
52
|
};
|
|
34
53
|
return {
|
|
@@ -2,15 +2,14 @@ import { Box } from '@mui/material';
|
|
|
2
2
|
import { switchClasses } from '@mui/material/Switch';
|
|
3
3
|
import { alpha, darken, lighten, styled } from '@mui/material/styles';
|
|
4
4
|
import { Switch } from '../Switch';
|
|
5
|
+
import { getInfoBackgroundColor, getWarningBackgroundColor } from '../../utils';
|
|
5
6
|
const MessageCard = styled(Box)(({ theme }) => ({
|
|
6
7
|
borderRadius: theme.shape.borderRadius,
|
|
7
8
|
position: 'relative',
|
|
8
9
|
whiteSpace: 'pre-line',
|
|
9
10
|
}));
|
|
10
11
|
export const WarningMessageCard = styled(MessageCard)(({ theme }) => ({
|
|
11
|
-
backgroundColor: theme
|
|
12
|
-
? alpha(theme.palette.warning.main, 0.32)
|
|
13
|
-
: alpha(theme.palette.warning.main, 0.16),
|
|
12
|
+
backgroundColor: getWarningBackgroundColor(theme),
|
|
14
13
|
}));
|
|
15
14
|
export const WarningMessageCardTitle = styled(Box)(({ theme }) => ({
|
|
16
15
|
color: theme.palette.mode === 'light'
|
|
@@ -18,9 +17,7 @@ export const WarningMessageCardTitle = styled(Box)(({ theme }) => ({
|
|
|
18
17
|
: alpha(theme.palette.warning.main, 1),
|
|
19
18
|
}));
|
|
20
19
|
export const InfoMessageCard = styled(MessageCard)(({ theme }) => ({
|
|
21
|
-
backgroundColor: theme
|
|
22
|
-
? alpha(theme.palette.info.main, 0.12)
|
|
23
|
-
: alpha(theme.palette.info.main, 0.16),
|
|
20
|
+
backgroundColor: getInfoBackgroundColor(theme),
|
|
24
21
|
}));
|
|
25
22
|
export const InfoMessageCardTitle = styled(Box)(({ theme }) => ({
|
|
26
23
|
color: theme.palette.mode === 'light'
|