@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
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isAddress } from '@ethersproject/address';
|
|
3
2
|
import { Collapse, FormHelperText } from '@mui/material';
|
|
3
|
+
import { getEnsAddress } from '@wagmi/core';
|
|
4
4
|
import { forwardRef, useEffect, useRef } from 'react';
|
|
5
5
|
import { useController, useFormContext, useFormState } from 'react-hook-form';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import {
|
|
7
|
+
import { isAddress } from 'viem';
|
|
8
|
+
import { normalize } from 'viem/ens';
|
|
9
|
+
import { useConfig } from 'wagmi';
|
|
10
|
+
import { useAccount, useRequiredToAddress } from '../../hooks';
|
|
11
|
+
import { FormKey, useWidgetConfig } from '../../providers';
|
|
8
12
|
import { useSendToWalletStore, useSettings } from '../../stores';
|
|
9
|
-
import { DisabledUI, HiddenUI
|
|
13
|
+
import { DisabledUI, HiddenUI } from '../../types';
|
|
14
|
+
import { isSVMAddress } from '../../utils';
|
|
10
15
|
import { Card, CardTitle } from '../Card';
|
|
11
16
|
import { FormControl, Input } from './SendToWallet.style';
|
|
12
17
|
export const SendToWallet = forwardRef((props, ref) => {
|
|
13
18
|
const { t } = useTranslation();
|
|
14
19
|
const { trigger, getValues, setValue, clearErrors } = useFormContext();
|
|
15
|
-
const { account } =
|
|
16
|
-
const
|
|
17
|
-
const {
|
|
20
|
+
const { account } = useAccount();
|
|
21
|
+
const config = useConfig();
|
|
22
|
+
const { disabledUI, hiddenUI, toAddress } = useWidgetConfig();
|
|
23
|
+
const { showSendToWallet, showSendToWalletDirty } = useSendToWalletStore();
|
|
18
24
|
const { showDestinationWallet } = useSettings(['showDestinationWallet']);
|
|
19
25
|
const hiddenToAddress = hiddenUI?.includes(HiddenUI.ToAddress);
|
|
20
26
|
const disabledToAddress = disabledUI?.includes(DisabledUI.ToAddress);
|
|
21
|
-
const requiredToAddress =
|
|
27
|
+
const requiredToAddress = useRequiredToAddress();
|
|
22
28
|
const requiredToAddressRef = useRef(requiredToAddress);
|
|
29
|
+
// We want to show toAddress field if it is set via widget configuration and not hidden
|
|
30
|
+
const showInstantly = Boolean(!showSendToWalletDirty &&
|
|
31
|
+
showDestinationWallet &&
|
|
32
|
+
toAddress &&
|
|
33
|
+
!hiddenToAddress) || requiredToAddress;
|
|
23
34
|
const { field: { onChange, onBlur, name, value }, } = useController({
|
|
24
35
|
name: FormKey.ToAddress,
|
|
25
36
|
rules: {
|
|
@@ -29,30 +40,22 @@ export const SendToWallet = forwardRef((props, ref) => {
|
|
|
29
40
|
},
|
|
30
41
|
validate: async (value) => {
|
|
31
42
|
try {
|
|
32
|
-
if (!value) {
|
|
43
|
+
if (!value || isAddress(value) || isSVMAddress(value)) {
|
|
33
44
|
return true;
|
|
34
45
|
}
|
|
35
|
-
const address = await
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
const address = await getEnsAddress(config, {
|
|
47
|
+
chainId: getValues(FormKey.ToChain),
|
|
48
|
+
name: normalize(value),
|
|
49
|
+
});
|
|
50
|
+
return Boolean(address);
|
|
38
51
|
}
|
|
39
|
-
catch {
|
|
52
|
+
catch (error) {
|
|
40
53
|
return t('error.title.walletEnsAddressInvalid');
|
|
41
54
|
}
|
|
42
55
|
},
|
|
43
56
|
onBlur: () => trigger(FormKey.ToAddress),
|
|
44
57
|
},
|
|
45
58
|
});
|
|
46
|
-
// We want to show toAddress field if it is set via widget configuration and not hidden
|
|
47
|
-
const showInstantly = Boolean(!showSendToWalletDirty &&
|
|
48
|
-
showDestinationWallet &&
|
|
49
|
-
toAddress &&
|
|
50
|
-
!hiddenToAddress) || requiredToAddress;
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (showInstantly) {
|
|
53
|
-
setSendToWallet(true);
|
|
54
|
-
}
|
|
55
|
-
}, [showInstantly, setSendToWallet]);
|
|
56
59
|
useEffect(() => {
|
|
57
60
|
const value = getValues(FormKey.ToAddress);
|
|
58
61
|
if (value) {
|
|
@@ -64,7 +67,7 @@ export const SendToWallet = forwardRef((props, ref) => {
|
|
|
64
67
|
trigger(FormKey.ToAddress).then(() => clearErrors(FormKey.ToAddress));
|
|
65
68
|
}
|
|
66
69
|
}, [account.chainId, clearErrors, getValues, requiredToAddress, trigger]);
|
|
67
|
-
if (hiddenToAddress) {
|
|
70
|
+
if (hiddenToAddress && !requiredToAddress) {
|
|
68
71
|
return null;
|
|
69
72
|
}
|
|
70
73
|
return (_jsx(Collapse, { timeout: showInstantly ? 0 : 225, in: showSendToWallet || showInstantly, mountOnEnter: true, unmountOnExit: true, children: _jsxs(Card, { ...props, ref: ref, children: [_jsx(CardTitle, { required: requiredToAddress, children: t('main.sendToWallet') }), _jsxs(FormControl, { fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' }, children: [_jsx(Input, { size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, value: value, placeholder: t('main.walletAddressOrEns'), disabled: Boolean(toAddress && disabledToAddress) }), _jsx(SendToWalletFormHelperText, {})] })] }) }));
|
|
@@ -3,20 +3,21 @@ import WalletIcon from '@mui/icons-material/Wallet';
|
|
|
3
3
|
import { Button, Tooltip } from '@mui/material';
|
|
4
4
|
import { useFormContext } from 'react-hook-form';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { useWidgetEvents } from '../../hooks';
|
|
6
|
+
import { useRequiredToAddress, useWidgetEvents } from '../../hooks';
|
|
7
7
|
import { FormKey, useWidgetConfig } from '../../providers';
|
|
8
8
|
import { useSendToWalletStore, useSettings } from '../../stores';
|
|
9
|
-
import { DisabledUI, HiddenUI,
|
|
9
|
+
import { DisabledUI, HiddenUI, WidgetEvent } from '../../types';
|
|
10
10
|
export const SendToWalletButton = () => {
|
|
11
11
|
const { t } = useTranslation();
|
|
12
12
|
const { setValue } = useFormContext();
|
|
13
13
|
const emitter = useWidgetEvents();
|
|
14
|
-
const { disabledUI, hiddenUI
|
|
14
|
+
const { disabledUI, hiddenUI } = useWidgetConfig();
|
|
15
15
|
const { showSendToWallet, toggleSendToWallet } = useSendToWalletStore();
|
|
16
16
|
const { showDestinationWallet } = useSettings(['showDestinationWallet']);
|
|
17
|
+
const requiredToAddress = useRequiredToAddress();
|
|
17
18
|
if (!showDestinationWallet ||
|
|
18
19
|
hiddenUI?.includes(HiddenUI.ToAddress) ||
|
|
19
|
-
|
|
20
|
+
requiredToAddress) {
|
|
20
21
|
return null;
|
|
21
22
|
}
|
|
22
23
|
const handleClick = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const SettingsListItemButton: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & 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
|
}, "className" | "style" | "classes" | "action" | "centerRipple" | "children" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "tabIndex" | "TouchRippleProps" | "touchRippleRef" | "autoFocus" | "alignItems" | "divider" | "dense" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { LiFiStepExtended } from '@lifi/sdk';
|
|
3
3
|
export declare const DestinationWalletAddress: React.FC<{
|
|
4
|
-
step:
|
|
4
|
+
step: LiFiStepExtended;
|
|
5
5
|
toAddress: string;
|
|
6
6
|
toAddressLink: string;
|
|
7
7
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { LiFiStepExtended, TokenAmount } from '@lifi/sdk';
|
|
3
3
|
export declare const Step: React.FC<{
|
|
4
|
-
step:
|
|
4
|
+
step: LiFiStepExtended;
|
|
5
5
|
fromToken?: TokenAmount;
|
|
6
6
|
toToken?: TokenAmount;
|
|
7
7
|
toAddress?: string;
|
package/components/Step/Step.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import { Card, CardTitle } from '../../components/Card';
|
|
5
5
|
import { StepActions } from '../../components/StepActions';
|
|
6
6
|
import { Token } from '../../components/Token';
|
|
7
|
-
import {
|
|
7
|
+
import { useAvailableChains } from '../../hooks';
|
|
8
8
|
import { useWidgetConfig } from '../../providers';
|
|
9
9
|
import { shortenAddress } from '../../utils';
|
|
10
10
|
import { DestinationWalletAddress } from './DestinationWalletAddress';
|
|
@@ -13,7 +13,7 @@ import { StepProcess } from './StepProcess';
|
|
|
13
13
|
import { StepTimer } from './StepTimer';
|
|
14
14
|
export const Step = ({ step, fromToken, toToken, toAddress }) => {
|
|
15
15
|
const { t } = useTranslation();
|
|
16
|
-
const { getChainById } =
|
|
16
|
+
const { getChainById } = useAvailableChains();
|
|
17
17
|
const { subvariant } = useWidgetConfig();
|
|
18
18
|
const stepHasError = step.execution?.process.some((process) => process.status === 'FAILED');
|
|
19
19
|
const getCardTitle = () => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RouteExtended } from '@lifi/sdk';
|
|
2
2
|
import type { WidgetSubvariant } from '../../types';
|
|
3
|
-
export declare const getStepList: (route?:
|
|
3
|
+
export declare const getStepList: (route?: RouteExtended, subvariant?: WidgetSubvariant) => import("react/jsx-runtime").JSX.Element[] | undefined;
|
|
@@ -5,16 +5,16 @@ import { Step } from './Step';
|
|
|
5
5
|
export const getStepList = (route, subvariant) => route?.steps.map((step, index, steps) => {
|
|
6
6
|
const lastIndex = steps.length - 1;
|
|
7
7
|
const fromToken = index === 0
|
|
8
|
-
? { ...step.action.fromToken, amount: step.action.fromAmount }
|
|
8
|
+
? { ...step.action.fromToken, amount: BigInt(step.action.fromAmount) }
|
|
9
9
|
: undefined;
|
|
10
10
|
const toToken = index === lastIndex
|
|
11
11
|
? {
|
|
12
12
|
...(step.execution?.toToken ?? step.action?.toToken),
|
|
13
13
|
amount: step.execution?.toAmount
|
|
14
|
-
? step.execution.toAmount
|
|
14
|
+
? BigInt(step.execution.toAmount)
|
|
15
15
|
: subvariant === 'nft'
|
|
16
|
-
? route.toAmount
|
|
17
|
-
: step.estimate.toAmount,
|
|
16
|
+
? BigInt(route.toAmount)
|
|
17
|
+
: BigInt(step.estimate.toAmount),
|
|
18
18
|
}
|
|
19
19
|
: undefined;
|
|
20
20
|
const toAddress = index === lastIndex && route.fromAddress !== route.toAddress
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { LiFiStep, StepExtended } from '@lifi/sdk';
|
|
3
3
|
import type { WidgetSubvariant } from '../../types';
|
|
4
4
|
import type { StepActionsProps, StepDetailsLabelProps } from './types';
|
|
5
5
|
export declare const StepActions: React.FC<StepActionsProps>;
|
|
6
6
|
export declare const IncludedSteps: React.FC<{
|
|
7
|
-
step:
|
|
7
|
+
step: LiFiStep;
|
|
8
8
|
subvariant?: WidgetSubvariant;
|
|
9
9
|
}>;
|
|
10
10
|
export declare const StepDetailsContent: React.FC<{
|
|
11
|
-
step:
|
|
11
|
+
step: StepExtended;
|
|
12
12
|
subvariant?: WidgetSubvariant;
|
|
13
13
|
}>;
|
|
14
14
|
export declare const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps>;
|
|
@@ -3,10 +3,10 @@ import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
|
|
|
3
3
|
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
|
|
4
4
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
5
5
|
import { Badge, Box, Collapse, Step as MuiStep, Stepper, Typography, } from '@mui/material';
|
|
6
|
-
import Big from 'big.js';
|
|
7
6
|
import { useState } from 'react';
|
|
8
7
|
import { useTranslation } from 'react-i18next';
|
|
9
|
-
import {
|
|
8
|
+
import { formatUnits } from 'viem';
|
|
9
|
+
import { useAvailableChains } from '../../hooks';
|
|
10
10
|
import { LiFiToolLogo } from '../../icons';
|
|
11
11
|
import { useWidgetConfig } from '../../providers';
|
|
12
12
|
import { formatTokenAmount } from '../../utils';
|
|
@@ -26,7 +26,7 @@ export const StepActions = ({ step, dense, ...other }) => {
|
|
|
26
26
|
const toolDetails = subvariant === 'nft'
|
|
27
27
|
? step.includedSteps.find((step) => step.tool === 'custom' && step.toolDetails.key !== 'custom')?.toolDetails || step.toolDetails
|
|
28
28
|
: step.toolDetails;
|
|
29
|
-
return (_jsxs(Box, { ...other, children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Badge, { overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: _jsx(SmallAvatar, {
|
|
29
|
+
return (_jsxs(Box, { ...other, children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Badge, { overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: _jsx(SmallAvatar, { src: LiFiToolLogo }), children: _jsx(StepAvatar, { variant: "circular", src: toolDetails.logoURI ?? LiFiToolLogo, alt: toolDetails.name, children: toolDetails.name[0] }) }), _jsx(Typography, { ml: 2, fontSize: 18, fontWeight: "500", flex: 1, children: t(`main.stepDetails`, {
|
|
30
30
|
tool: toolDetails.name,
|
|
31
31
|
}) }), hasCollapsedSteps ? (_jsx(CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) })) : null] }), hasCollapsedSteps ? (_jsx(Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: _jsx(IncludedSteps, { step: step, subvariant: subvariant }) })) : (_jsx(IncludedSteps, { step: step, subvariant: subvariant }))] }));
|
|
32
32
|
};
|
|
@@ -52,23 +52,20 @@ export const StepDetailsContent = ({ step, subvariant }) => {
|
|
|
52
52
|
step.action.fromToken.address === step.action.toToken.address;
|
|
53
53
|
let fromAmount;
|
|
54
54
|
if (sameTokenProtocolStep) {
|
|
55
|
-
const estimatedFromAmount =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
: Big(step.estimate.fromAmount)
|
|
61
|
-
.div(10 ** step.action.fromToken.decimals)
|
|
62
|
-
.toString();
|
|
55
|
+
const estimatedFromAmount = BigInt(step.estimate.fromAmount) - BigInt(step.estimate.toAmount);
|
|
56
|
+
fromAmount =
|
|
57
|
+
estimatedFromAmount > 0n
|
|
58
|
+
? formatUnits(estimatedFromAmount, step.action.fromToken.decimals)
|
|
59
|
+
: formatUnits(BigInt(step.estimate.fromAmount), step.action.fromToken.decimals);
|
|
63
60
|
}
|
|
64
61
|
else {
|
|
65
|
-
fromAmount = formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals);
|
|
62
|
+
fromAmount = formatTokenAmount(BigInt(step.estimate.fromAmount), step.action.fromToken.decimals);
|
|
66
63
|
}
|
|
67
64
|
const showToAmount = step.type !== 'custom' && step.tool !== 'custom' && !sameTokenProtocolStep;
|
|
68
65
|
return (_jsxs(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex", children: [t('format.number', {
|
|
69
66
|
value: fromAmount,
|
|
70
67
|
}), ' ', step.action.fromToken.symbol, showToAmount ? (_jsxs(_Fragment, { children: [_jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
|
|
71
|
-
value: formatTokenAmount(step.execution?.toAmount ?? step.estimate.toAmount, step.execution?.toToken?.decimals ?? step.action.toToken.decimals),
|
|
68
|
+
value: formatTokenAmount(BigInt(step.execution?.toAmount ?? step.estimate.toAmount), step.execution?.toToken?.decimals ?? step.action.toToken.decimals),
|
|
72
69
|
}), ' ', step.execution?.toToken?.symbol ?? step.action.toToken.symbol] })) : null] }));
|
|
73
70
|
};
|
|
74
71
|
export const CustomStepDetailsLabel = ({ step, subvariant, }) => {
|
|
@@ -87,7 +84,7 @@ export const CustomStepDetailsLabel = ({ step, subvariant, }) => {
|
|
|
87
84
|
};
|
|
88
85
|
export const CrossStepDetailsLabel = ({ step }) => {
|
|
89
86
|
const { t } = useTranslation();
|
|
90
|
-
const { getChainById } =
|
|
87
|
+
const { getChainById } = useAvailableChains();
|
|
91
88
|
return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: t('main.crossStepDetails', {
|
|
92
89
|
from: getChainById(step.action.fromChainId)?.name,
|
|
93
90
|
to: getChainById(step.action.toChainId)?.name,
|
|
@@ -96,7 +93,7 @@ export const CrossStepDetailsLabel = ({ step }) => {
|
|
|
96
93
|
};
|
|
97
94
|
export const SwapStepDetailsLabel = ({ step }) => {
|
|
98
95
|
const { t } = useTranslation();
|
|
99
|
-
const { getChainById } =
|
|
96
|
+
const { getChainById } = useAvailableChains();
|
|
100
97
|
return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: t('main.swapStepDetails', {
|
|
101
98
|
chain: getChainById(step.action.fromChainId)?.name,
|
|
102
99
|
tool: step.toolDetails.name,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LiFiStep, Step } from '@lifi/sdk';
|
|
2
2
|
import type { BoxProps } from '@mui/material';
|
|
3
3
|
import type { WidgetSubvariant } from '../../types';
|
|
4
4
|
export interface StepActionsProps extends BoxProps {
|
|
5
|
-
step:
|
|
5
|
+
step: LiFiStep;
|
|
6
6
|
dense?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export interface StepDetailsLabelProps {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { StyledComponent } from '@emotion/styled';
|
|
3
3
|
import type { TabsProps } from '@mui/material';
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const Tabs: StyledComponent<TabsProps>;
|
|
5
|
+
export declare const Tab: StyledComponent<import("@mui/material").TabOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
6
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
7
7
|
}, "className" | "style" | "classes" | "action" | "centerRipple" | "children" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "tabIndex" | "TouchRippleProps" | "touchRippleRef" | "label" | "disableFocusRipple" | "value" | "icon" | "iconPosition" | "wrapped"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
8
8
|
component?: import("react").ElementType<any> | undefined;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Tab as MuiTab, Tabs as MuiTabs, tabClasses, tabsClasses, } from '@mui/material';
|
|
2
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
3
|
+
import { getCardFieldsetBackgroundColor } from '../../utils';
|
|
4
|
+
export const Tabs = styled(MuiTabs)(({ theme }) => ({
|
|
5
|
+
backgroundColor: getCardFieldsetBackgroundColor(theme),
|
|
6
|
+
borderRadius: Math.max(theme.shape.borderRadius, theme.shape.borderRadiusSecondary),
|
|
7
|
+
padding: theme.spacing(0.5),
|
|
8
|
+
flex: 1,
|
|
9
|
+
[`.${tabsClasses.indicator}`]: {
|
|
10
|
+
height: '100%',
|
|
11
|
+
width: '100%',
|
|
12
|
+
backgroundColor: theme.palette.mode === 'dark'
|
|
13
|
+
? theme.palette.background.default
|
|
14
|
+
: theme.palette.common.white,
|
|
15
|
+
borderRadius: Math.max(theme.shape.borderRadius, theme.shape.borderRadiusSecondary) -
|
|
16
|
+
4,
|
|
17
|
+
boxShadow: `0px 2px 4px ${alpha(theme.palette.common.black, 0.04)}`,
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
export const Tab = styled(MuiTab, {
|
|
21
|
+
shouldForwardProp: (prop) => prop !== 'isDarkMode',
|
|
22
|
+
})(({ theme }) => ({
|
|
23
|
+
zIndex: 1,
|
|
24
|
+
flex: 1,
|
|
25
|
+
textTransform: 'none',
|
|
26
|
+
fontSize: '1rem',
|
|
27
|
+
fontWeight: 700,
|
|
28
|
+
color: theme.palette.mode === 'dark'
|
|
29
|
+
? theme.palette.common.white
|
|
30
|
+
: theme.palette.common.black,
|
|
31
|
+
[`&.${tabClasses.selected}`]: {
|
|
32
|
+
color: theme.palette.mode === 'dark'
|
|
33
|
+
? theme.palette.common.white
|
|
34
|
+
: theme.palette.common.black,
|
|
35
|
+
},
|
|
36
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tabs.style';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tabs.style';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { LiFiStep, TokenAmount } from '@lifi/sdk';
|
|
3
3
|
import type { BoxProps } from '@mui/material';
|
|
4
4
|
interface TokenProps {
|
|
5
|
-
token
|
|
5
|
+
token: TokenAmount;
|
|
6
6
|
connected?: boolean;
|
|
7
|
-
step?:
|
|
7
|
+
step?: LiFiStep;
|
|
8
8
|
disableDescription?: boolean;
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
}
|
|
@@ -8,20 +8,20 @@ import { TextFitter } from '../TextFitter';
|
|
|
8
8
|
import { TokenAvatar } from '../TokenAvatar';
|
|
9
9
|
import { TextSecondary, TextSecondaryContainer } from './Token.style';
|
|
10
10
|
export const Token = ({ token, ...other }) => {
|
|
11
|
-
if (!token
|
|
11
|
+
if (!token.priceUSD || !token.logoURI) {
|
|
12
12
|
return _jsx(TokenFallback, { token: token, ...other });
|
|
13
13
|
}
|
|
14
14
|
return _jsx(TokenBase, { token: token, ...other });
|
|
15
15
|
};
|
|
16
16
|
export const TokenFallback = ({ token, isLoading, ...other }) => {
|
|
17
|
-
const { token: chainToken, isLoading: isLoadingToken } = useToken(token
|
|
17
|
+
const { token: chainToken, isLoading: isLoadingToken } = useToken(token.chainId, token.address);
|
|
18
18
|
return (_jsx(TokenBase, { token: { ...token, ...chainToken }, isLoading: isLoading || isLoadingToken, ...other }));
|
|
19
19
|
};
|
|
20
20
|
export const TokenBase = ({ token, connected, step, disableDescription, isLoading, ...other }) => {
|
|
21
21
|
const { t } = useTranslation();
|
|
22
22
|
const { chain } = useChain(token?.chainId);
|
|
23
|
-
const formattedTokenAmount = formatTokenAmount(token
|
|
24
|
-
const formattedTokenPrice = formatTokenPrice(formattedTokenAmount, token
|
|
23
|
+
const formattedTokenAmount = formatTokenAmount(token.amount, token.decimals);
|
|
24
|
+
const formattedTokenPrice = formatTokenPrice(formattedTokenAmount, token.priceUSD);
|
|
25
25
|
return (_jsxs(Box, { flex: 1, ...other, children: [_jsxs(Box, { display: "flex", flex: 1, alignItems: "center", children: [_jsx(TokenAvatar, { token: token, chain: chain, isLoading: isLoading, sx: { marginRight: 2 } }), isLoading ? (_jsx(Skeleton, { width: 112, height: 32, variant: "text" })) : (_jsx(TextFitter, { height: 30, textStyle: {
|
|
26
26
|
fontWeight: 700,
|
|
27
27
|
}, children: t('format.number', {
|
|
@@ -29,7 +29,7 @@ export const TokenBase = ({ token, connected, step, disableDescription, isLoadin
|
|
|
29
29
|
}) }))] }), _jsxs(TextSecondaryContainer, { connected: connected, component: "span", children: [isLoading ? (_jsx(Skeleton, { width: 48, height: 12, variant: "rounded", sx: { marginTop: 0.5 } })) : (_jsx(TextSecondary, { connected: connected, children: t(`format.currency`, {
|
|
30
30
|
value: formattedTokenPrice,
|
|
31
31
|
}) })), !disableDescription ? (_jsx(TextSecondary, { connected: connected, px: 0.5, dot: true, children: "\u2022" })) : null, !step && !disableDescription ? (isLoading ? (_jsx(Skeleton, { width: 96, height: 12, variant: "rounded", sx: { marginTop: 0.5 } })) : (_jsx(TextSecondary, { connected: connected, children: t(`main.tokenOnChain`, {
|
|
32
|
-
tokenSymbol: token
|
|
32
|
+
tokenSymbol: token.symbol,
|
|
33
33
|
chainName: chain?.name,
|
|
34
34
|
}) }))) : null, step ? (_jsxs(Box, { display: "flex", alignItems: "flex-end", height: 12, mt: 0.5, children: [_jsx(Box, { pr: 0.75, children: _jsx(SmallAvatar, { src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
|
|
35
35
|
border: 0,
|
|
@@ -2,14 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box } from '@mui/material';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
4
|
import { useWatch } from 'react-hook-form';
|
|
5
|
-
import { useChain, useDebouncedWatch, useTokenBalances, useTokenSearch, } from '../../hooks';
|
|
6
|
-
import { FormKey, FormKeyHelper
|
|
5
|
+
import { useAccount, useChain, useDebouncedWatch, useTokenBalances, useTokenSearch, } from '../../hooks';
|
|
6
|
+
import { FormKey, FormKeyHelper } from '../../providers';
|
|
7
7
|
import { TokenNotFound } from './TokenNotFound';
|
|
8
8
|
import { VirtualizedTokenList } from './VirtualizedTokenList';
|
|
9
9
|
import { useTokenSelect } from './useTokenSelect';
|
|
10
10
|
export const TokenList = ({ formType, height, onClick, }) => {
|
|
11
11
|
const parentRef = useRef(null);
|
|
12
|
-
const { account } =
|
|
12
|
+
const { account } = useAccount();
|
|
13
13
|
const [selectedChainId] = useWatch({
|
|
14
14
|
name: [FormKeyHelper.getChainKey(formType)],
|
|
15
15
|
});
|
|
@@ -39,5 +39,5 @@ export const TokenList = ({ formType, height, onClick, }) => {
|
|
|
39
39
|
? [searchedToken]
|
|
40
40
|
: filteredTokens;
|
|
41
41
|
const handleTokenClick = useTokenSelect(formType, onClick);
|
|
42
|
-
return (_jsxs(Box, { ref: parentRef, style: { height, overflow: 'auto' }, children: [!tokens.length && !isLoading ? (_jsx(TokenNotFound, { formType: formType })) : null, _jsx(VirtualizedTokenList, { tokens: tokens, featuredTokensLength: featuredTokens?.length, scrollElementRef: parentRef, chainId: selectedChainId, chain: chain, isLoading: isLoading, isBalanceLoading: isBalanceLoading, showBalance: account.
|
|
42
|
+
return (_jsxs(Box, { ref: parentRef, style: { height, overflow: 'auto' }, children: [!tokens.length && !isLoading ? (_jsx(TokenNotFound, { formType: formType })) : null, _jsx(VirtualizedTokenList, { tokens: tokens, featuredTokensLength: featuredTokens?.length, scrollElementRef: parentRef, chainId: selectedChainId, chain: chain, isLoading: isLoading, isBalanceLoading: isBalanceLoading, showBalance: account.isConnected, showFeatured: !tokenSearchFilter, onClick: handleTokenClick })] }));
|
|
43
43
|
};
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import OpenInNewIcon from '@mui/icons-material/OpenInNewRounded';
|
|
3
3
|
import { Avatar, Box, Link, ListItemAvatar, ListItemText, Skeleton, Slide, Typography, } from '@mui/material';
|
|
4
|
-
import {
|
|
4
|
+
import { useRef, useState } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { formatUnits } from 'viem';
|
|
6
7
|
import { formatTokenAmount, formatTokenPrice, shortenAddress, } from '../../utils';
|
|
7
8
|
import { IconButton, ListItem, ListItemButton } from './TokenList.style';
|
|
8
|
-
export const TokenListItem =
|
|
9
|
+
export const TokenListItem = ({ onClick, size, start, token, chain, showBalance, isBalanceLoading, startAdornment, endAdornment, }) => {
|
|
9
10
|
const handleClick = () => onClick?.(token.address);
|
|
10
11
|
return (_jsxs(ListItem, { disablePadding: true, style: {
|
|
11
12
|
height: `${size}px`,
|
|
12
13
|
transform: `translateY(${start}px)`,
|
|
13
14
|
}, children: [startAdornment, _jsx(TokenListItemButton, { token: token, chain: chain, showBalance: showBalance, isBalanceLoading: isBalanceLoading, onClick: handleClick }), endAdornment] }));
|
|
14
|
-
}
|
|
15
|
+
};
|
|
15
16
|
export const TokenListItemButton = ({ onClick, token, chain, showBalance, isBalanceLoading, }) => {
|
|
16
17
|
const { t } = useTranslation();
|
|
17
|
-
const tokenPrice =
|
|
18
|
+
const tokenPrice = token.amount
|
|
19
|
+
? formatTokenPrice(formatUnits(token.amount, token.decimals), token.priceUSD)
|
|
20
|
+
: undefined;
|
|
18
21
|
const container = useRef(null);
|
|
19
22
|
const timeoutId = useRef();
|
|
20
23
|
const [showAddress, setShowAddress] = useState(false);
|
|
@@ -33,8 +36,8 @@ export const TokenListItemButton = ({ onClick, token, chain, showBalance, isBala
|
|
|
33
36
|
position: 'absolute',
|
|
34
37
|
}, appear: false, children: _jsx(Box, { pt: 0.25, children: token.name }) }), _jsx(Slide, { direction: "up", in: showAddress, container: container.current, style: {
|
|
35
38
|
position: 'absolute',
|
|
36
|
-
}, appear: false, mountOnEnter: true, children: _jsxs(Box, { display: "flex", children: [_jsx(Box, { display: "flex", alignItems: "center", pt: 0.125, children: shortenAddress(token.address) }), _jsx(IconButton, { size: "small", LinkComponent: Link, href: `${chain?.metamask.blockExplorerUrls[0]}address/${token.address}`, target: "_blank", rel: "nofollow noreferrer", onClick: (e) => e.stopPropagation(), children: _jsx(OpenInNewIcon, {}) })] }) })] }) }), showBalance ? (isBalanceLoading ? (_jsx(TokenAmountSkeleton, {})) : (_jsxs(Box, { sx: { textAlign: 'right' }, children: [
|
|
37
|
-
value: formatTokenAmount(token.amount),
|
|
39
|
+
}, appear: false, mountOnEnter: true, children: _jsxs(Box, { display: "flex", children: [_jsx(Box, { display: "flex", alignItems: "center", pt: 0.125, children: shortenAddress(token.address) }), _jsx(IconButton, { size: "small", LinkComponent: Link, href: `${chain?.metamask.blockExplorerUrls[0]}address/${token.address}`, target: "_blank", rel: "nofollow noreferrer", onClick: (e) => e.stopPropagation(), children: _jsx(OpenInNewIcon, {}) })] }) })] }) }), showBalance ? (isBalanceLoading ? (_jsx(TokenAmountSkeleton, {})) : (_jsxs(Box, { sx: { textAlign: 'right' }, children: [token.amount ? (_jsx(Typography, { variant: "body1", noWrap: true, children: t('format.number', {
|
|
40
|
+
value: formatTokenAmount(token.amount, token.decimals),
|
|
38
41
|
}) })) : null, tokenPrice ? (_jsx(Typography, { fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD, children: t(`format.currency`, {
|
|
39
42
|
value: tokenPrice,
|
|
40
43
|
}) })) : null] }))) : null] }));
|
|
@@ -3,14 +3,14 @@ import SearchOffIcon from '@mui/icons-material/SearchOff';
|
|
|
3
3
|
import { Box, Typography } from '@mui/material';
|
|
4
4
|
import { useWatch } from 'react-hook-form';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import {
|
|
6
|
+
import { useAvailableChains } from '../../hooks';
|
|
7
7
|
import { FormKeyHelper } from '../../providers';
|
|
8
8
|
export const TokenNotFound = ({ formType }) => {
|
|
9
9
|
const { t } = useTranslation();
|
|
10
10
|
const [selectedChainId] = useWatch({
|
|
11
11
|
name: [FormKeyHelper.getChainKey(formType)],
|
|
12
12
|
});
|
|
13
|
-
const { getChainById } =
|
|
13
|
+
const { getChainById } = useAvailableChains();
|
|
14
14
|
return (_jsxs(Box, { sx: {
|
|
15
15
|
display: 'flex',
|
|
16
16
|
justifyContent: 'center',
|
|
@@ -11,9 +11,9 @@ export const VirtualizedTokenList = ({ tokens, featuredTokensLength, scrollEleme
|
|
|
11
11
|
const tokensLastIndex = tokens.length - 1;
|
|
12
12
|
const { getVirtualItems, getTotalSize, scrollToIndex } = useVirtualizer({
|
|
13
13
|
count: tokens.length,
|
|
14
|
-
getScrollElement: () => scrollElementRef.current,
|
|
15
14
|
overscan: 10,
|
|
16
15
|
paddingEnd: 12,
|
|
16
|
+
getScrollElement: () => scrollElementRef.current,
|
|
17
17
|
estimateSize: (index) => {
|
|
18
18
|
// heigth of TokenListItem
|
|
19
19
|
let size = 64;
|
|
@@ -35,6 +35,7 @@ export const VirtualizedTokenList = ({ tokens, featuredTokensLength, scrollEleme
|
|
|
35
35
|
getItemKey: (index) => `${tokens[index].address}-${index}`,
|
|
36
36
|
});
|
|
37
37
|
useEffect(() => {
|
|
38
|
+
// Scroll to the top of the list when switching the chains
|
|
38
39
|
if (getVirtualItems().length) {
|
|
39
40
|
scrollToIndex(0, { align: 'start' });
|
|
40
41
|
}
|
package/config/queryClient.js
CHANGED
|
@@ -4,7 +4,6 @@ export const queryClient = new QueryClient({
|
|
|
4
4
|
queries: {
|
|
5
5
|
enabled: true,
|
|
6
6
|
staleTime: 3600000,
|
|
7
|
-
cacheTime: Infinity,
|
|
8
7
|
refetchInterval: false,
|
|
9
8
|
refetchIntervalInBackground: false,
|
|
10
9
|
refetchOnWindowFocus: true,
|
|
@@ -12,9 +11,6 @@ export const queryClient = new QueryClient({
|
|
|
12
11
|
refetchOnMount: true,
|
|
13
12
|
retryOnMount: true,
|
|
14
13
|
// suspense: true,
|
|
15
|
-
onError: (error) => {
|
|
16
|
-
//
|
|
17
|
-
},
|
|
18
14
|
},
|
|
19
15
|
mutations: {
|
|
20
16
|
onError: (error) => {
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "
|
|
2
|
+
export declare const version = "3.0.0-alpha.0";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '3.0.0-alpha.0';
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from './useAccount';
|
|
2
|
+
export * from './useAvailableChains';
|
|
1
3
|
export * from './useChain';
|
|
2
4
|
export * from './useChains';
|
|
3
5
|
export * from './useContentHeight';
|
|
@@ -9,13 +11,15 @@ export * from './useFromTokenSufficiency';
|
|
|
9
11
|
export * from './useGasRecommendation';
|
|
10
12
|
export * from './useGasRefuel';
|
|
11
13
|
export * from './useGasSufficiency';
|
|
12
|
-
export * from './useGetTokenBalancesWithRetry';
|
|
13
14
|
export * from './useInitializer';
|
|
15
|
+
export * from './useLanguages';
|
|
14
16
|
export * from './useNavigateBack';
|
|
15
17
|
export * from './useProcessMessage';
|
|
18
|
+
export * from './useRequiredToAddress';
|
|
16
19
|
export * from './useRouteExecution';
|
|
17
20
|
export * from './useRoutes';
|
|
18
21
|
export * from './useScrollableContainer';
|
|
22
|
+
export * from './useSettingMonitor';
|
|
19
23
|
export * from './useSwapOnly';
|
|
20
24
|
export * from './useToken';
|
|
21
25
|
export * from './useTokenAddressBalance';
|
|
@@ -24,4 +28,6 @@ export * from './useTokenBalances';
|
|
|
24
28
|
export * from './useTokenSearch';
|
|
25
29
|
export * from './useTokens';
|
|
26
30
|
export * from './useTools';
|
|
31
|
+
export * from './useTransactionDetails';
|
|
32
|
+
export * from './useTransactionHistory';
|
|
27
33
|
export * from './useWidgetEvents';
|