@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,11 +1,11 @@
|
|
|
1
|
-
import type { EVMChain,
|
|
1
|
+
import type { EVMChain, LiFiStep, Process } from '@lifi/sdk';
|
|
2
2
|
import type { TFunction } from 'i18next';
|
|
3
3
|
import type { WidgetSubvariant } from '../types';
|
|
4
|
-
export declare const useProcessMessage: (step?:
|
|
4
|
+
export declare const useProcessMessage: (step?: LiFiStep, process?: Process) => {
|
|
5
5
|
title?: string | undefined;
|
|
6
6
|
message?: string | undefined;
|
|
7
7
|
};
|
|
8
|
-
export declare function getProcessMessage(t: TFunction, getChainById: (chainId: number) => EVMChain | undefined, step:
|
|
8
|
+
export declare function getProcessMessage(t: TFunction, getChainById: (chainId: number) => EVMChain | undefined, step: LiFiStep, process: Process, subvariant?: WidgetSubvariant): {
|
|
9
9
|
title?: string;
|
|
10
10
|
message?: string;
|
|
11
11
|
};
|
|
@@ -5,11 +5,11 @@ const sdk_1 = require("@lifi/sdk");
|
|
|
5
5
|
const react_i18next_1 = require("react-i18next");
|
|
6
6
|
const providers_1 = require("../providers");
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
|
-
const
|
|
8
|
+
const useAvailableChains_1 = require("./useAvailableChains");
|
|
9
9
|
const useProcessMessage = (step, process) => {
|
|
10
10
|
const { subvariant } = (0, providers_1.useWidgetConfig)();
|
|
11
11
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
12
|
-
const { getChainById } = (0,
|
|
12
|
+
const { getChainById } = (0, useAvailableChains_1.useAvailableChains)();
|
|
13
13
|
if (!step || !process) {
|
|
14
14
|
return {};
|
|
15
15
|
}
|
|
@@ -77,72 +77,76 @@ const processSubstatusMessages = {
|
|
|
77
77
|
};
|
|
78
78
|
function getProcessMessage(t, getChainById, step, process, subvariant) {
|
|
79
79
|
if (process.error && process.status === 'FAILED') {
|
|
80
|
-
const
|
|
81
|
-
amount: (0, utils_1.formatTokenAmount)(step.action.fromAmount, step.action.fromToken.decimals),
|
|
80
|
+
const getDefaultErrorMessage = (key) => `${t(key ?? 'error.message.transactionNotSent')} ${t('error.message.remainInYourWallet', {
|
|
81
|
+
amount: (0, utils_1.formatTokenAmount)(BigInt(step.action.fromAmount), step.action.fromToken.decimals),
|
|
82
82
|
tokenSymbol: step.action.fromToken.symbol,
|
|
83
83
|
chainName: getChainById(step.action.fromChainId)?.name ?? '',
|
|
84
|
-
})
|
|
84
|
+
})}`;
|
|
85
85
|
let title = '';
|
|
86
86
|
let message = '';
|
|
87
87
|
switch (process.error.code) {
|
|
88
|
-
case sdk_1.
|
|
88
|
+
case sdk_1.LiFiErrorCode.AllowanceRequired:
|
|
89
89
|
title = t(`error.title.allowanceRequired`);
|
|
90
90
|
message = t(`error.message.allowanceRequired`, {
|
|
91
91
|
tokenSymbol: step.action.fromToken.symbol,
|
|
92
92
|
});
|
|
93
93
|
break;
|
|
94
|
-
case sdk_1.
|
|
94
|
+
case sdk_1.LiFiErrorCode.BalanceError:
|
|
95
95
|
title = t(`error.title.balanceIsTooLow`);
|
|
96
|
-
message =
|
|
96
|
+
message = getDefaultErrorMessage();
|
|
97
97
|
break;
|
|
98
|
-
case sdk_1.
|
|
98
|
+
case sdk_1.LiFiErrorCode.ChainSwitchError:
|
|
99
99
|
title = t(`error.title.chainSwitch`);
|
|
100
|
-
message =
|
|
100
|
+
message = getDefaultErrorMessage();
|
|
101
101
|
break;
|
|
102
|
-
case sdk_1.
|
|
102
|
+
case sdk_1.LiFiErrorCode.GasLimitError:
|
|
103
103
|
title = t(`error.title.gasLimitIsTooLow`);
|
|
104
|
-
message =
|
|
104
|
+
message = getDefaultErrorMessage();
|
|
105
105
|
break;
|
|
106
|
-
case sdk_1.
|
|
106
|
+
case sdk_1.LiFiErrorCode.InsufficientFunds:
|
|
107
107
|
title = t(`error.title.insufficientFunds`);
|
|
108
|
-
message = `${t(`error.message.insufficientFunds`)} ${
|
|
108
|
+
message = `${t(`error.message.insufficientFunds`)} ${getDefaultErrorMessage()}`;
|
|
109
109
|
break;
|
|
110
|
-
case sdk_1.
|
|
110
|
+
case sdk_1.LiFiErrorCode.SlippageError:
|
|
111
111
|
title = t(`error.title.slippageNotMet`);
|
|
112
112
|
message = t(`error.message.slippageThreshold`);
|
|
113
113
|
break;
|
|
114
|
-
case sdk_1.
|
|
114
|
+
case sdk_1.LiFiErrorCode.TransactionFailed:
|
|
115
115
|
title = t(`error.title.transactionFailed`);
|
|
116
116
|
message = t(`error.message.transactionFailed`);
|
|
117
117
|
break;
|
|
118
|
-
case sdk_1.
|
|
118
|
+
case sdk_1.LiFiErrorCode.TransactionUnderpriced:
|
|
119
119
|
title = t(`error.title.transactionUnderpriced`);
|
|
120
|
-
message =
|
|
120
|
+
message = getDefaultErrorMessage();
|
|
121
121
|
break;
|
|
122
|
-
case sdk_1.
|
|
122
|
+
case sdk_1.LiFiErrorCode.TransactionUnprepared:
|
|
123
123
|
title = t(`error.title.transactionUnprepared`);
|
|
124
|
-
message =
|
|
124
|
+
message = getDefaultErrorMessage();
|
|
125
125
|
break;
|
|
126
|
-
case sdk_1.
|
|
126
|
+
case sdk_1.LiFiErrorCode.TransactionCanceled:
|
|
127
127
|
title = t(`error.title.transactionCanceled`);
|
|
128
|
-
message =
|
|
128
|
+
message = getDefaultErrorMessage('error.message.transactionCanceled');
|
|
129
129
|
break;
|
|
130
|
-
case sdk_1.
|
|
131
|
-
title = t(`error.title.
|
|
132
|
-
message =
|
|
133
|
-
|
|
130
|
+
case sdk_1.LiFiErrorCode.ExchangeRateUpdateCanceled:
|
|
131
|
+
title = t(`error.title.exchangeRateUpdateCanceled`);
|
|
132
|
+
message = getDefaultErrorMessage();
|
|
133
|
+
break;
|
|
134
|
+
case sdk_1.LiFiErrorCode.SignatureRejected:
|
|
135
|
+
title = t(`error.title.signatureRejected`);
|
|
136
|
+
message = t(`error.message.signatureRejected`, {
|
|
137
|
+
amount: (0, utils_1.formatTokenAmount)(BigInt(step.action.fromAmount), step.action.fromToken.decimals),
|
|
134
138
|
tokenSymbol: step.action.fromToken.symbol,
|
|
135
139
|
chainName: getChainById(step.action.fromChainId)?.name ?? '',
|
|
136
140
|
});
|
|
137
141
|
break;
|
|
138
|
-
case sdk_1.
|
|
142
|
+
case sdk_1.LiFiErrorCode.ProviderUnavailable:
|
|
139
143
|
default:
|
|
140
144
|
title = t(`error.title.unknown`);
|
|
141
145
|
if (process.txLink) {
|
|
142
146
|
message = t(`error.message.transactionFailed`);
|
|
143
147
|
}
|
|
144
148
|
else {
|
|
145
|
-
message = t(`error.message.unknown`);
|
|
149
|
+
message = process.error.message || t(`error.message.unknown`);
|
|
146
150
|
}
|
|
147
151
|
break;
|
|
148
152
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useRequiredToAddress: () => boolean | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRequiredToAddress = void 0;
|
|
4
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
5
|
+
const hooks_1 = require("../hooks");
|
|
6
|
+
const providers_1 = require("../providers");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
const useRequiredToAddress = () => {
|
|
9
|
+
const { requiredUI } = (0, providers_1.useWidgetConfig)();
|
|
10
|
+
const [fromChainId, toChainId] = (0, react_hook_form_1.useWatch)({
|
|
11
|
+
name: [providers_1.FormKey.FromChain, providers_1.FormKey.ToChain],
|
|
12
|
+
});
|
|
13
|
+
const { chain: fromChain } = (0, hooks_1.useChain)(fromChainId);
|
|
14
|
+
const { chain: toChain } = (0, hooks_1.useChain)(toChainId);
|
|
15
|
+
const differentChainType = fromChain && toChain && fromChain.chainType !== toChain.chainType;
|
|
16
|
+
const requiredToAddress = requiredUI?.includes(types_1.RequiredUI.ToAddress) || differentChainType;
|
|
17
|
+
return requiredToAddress;
|
|
18
|
+
};
|
|
19
|
+
exports.useRequiredToAddress = useRequiredToAddress;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExchangeRateUpdateParams
|
|
1
|
+
import type { ExchangeRateUpdateParams } from '@lifi/sdk';
|
|
2
2
|
interface RouteExecutionProps {
|
|
3
3
|
routeId: string;
|
|
4
4
|
executeInBackground?: boolean;
|
|
@@ -8,7 +8,7 @@ export declare const useRouteExecution: ({ routeId, executeInBackground, onAccep
|
|
|
8
8
|
executeRoute: () => void;
|
|
9
9
|
restartRoute: () => void;
|
|
10
10
|
deleteRoute: () => void;
|
|
11
|
-
route:
|
|
11
|
+
route: import("@lifi/sdk").RouteExtended | undefined;
|
|
12
12
|
status: import("../stores").RouteExecutionStatus | undefined;
|
|
13
13
|
};
|
|
14
14
|
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useRouteExecution = void 0;
|
|
4
|
+
const sdk_1 = require("@lifi/sdk");
|
|
4
5
|
const react_query_1 = require("@tanstack/react-query");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const shallow_1 = require("zustand/shallow");
|
|
7
|
-
const providers_1 = require("../providers");
|
|
8
8
|
const stores_1 = require("../stores");
|
|
9
9
|
const events_1 = require("../types/events");
|
|
10
|
+
const useAccount_1 = require("./useAccount");
|
|
10
11
|
const useWidgetEvents_1 = require("./useWidgetEvents");
|
|
11
12
|
const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateUpdate, }) => {
|
|
12
|
-
const lifi = (0, providers_1.useLiFi)();
|
|
13
13
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
14
|
-
const { account
|
|
14
|
+
const { account } = (0, useAccount_1.useAccount)();
|
|
15
15
|
const resumedAfterMount = (0, react_1.useRef)(false);
|
|
16
16
|
const emitter = (0, useWidgetEvents_1.useWidgetEvents)();
|
|
17
17
|
const routeExecutionStoreContext = (0, stores_1.useRouteExecutionStoreContext)();
|
|
@@ -42,20 +42,6 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
|
|
|
42
42
|
}
|
|
43
43
|
console.log('Route updated.', clonedUpdatedRoute);
|
|
44
44
|
};
|
|
45
|
-
const switchChainHook = async (requiredChainId) => {
|
|
46
|
-
if (!account.isActive || !account.signer) {
|
|
47
|
-
return account.signer;
|
|
48
|
-
}
|
|
49
|
-
const currentChainId = await account.signer.getChainId();
|
|
50
|
-
if (currentChainId !== requiredChainId) {
|
|
51
|
-
const signer = await switchChain(requiredChainId);
|
|
52
|
-
if (!signer) {
|
|
53
|
-
throw new Error('Chain was not switched.');
|
|
54
|
-
}
|
|
55
|
-
return signer;
|
|
56
|
-
}
|
|
57
|
-
return account.signer;
|
|
58
|
-
};
|
|
59
45
|
const acceptExchangeRateUpdateHook = async (params) => {
|
|
60
46
|
if (!onAcceptExchangeRateUpdate) {
|
|
61
47
|
return false;
|
|
@@ -63,22 +49,22 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
|
|
|
63
49
|
const accepted = await new Promise((resolve) => onAcceptExchangeRateUpdate(resolve, params));
|
|
64
50
|
return accepted;
|
|
65
51
|
};
|
|
66
|
-
const executeRouteMutation = (0, react_query_1.useMutation)(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
52
|
+
const executeRouteMutation = (0, react_query_1.useMutation)({
|
|
53
|
+
mutationFn: () => {
|
|
54
|
+
if (!account.isConnected) {
|
|
55
|
+
throw Error('Account is not connected.');
|
|
56
|
+
}
|
|
57
|
+
if (!routeExecution?.route) {
|
|
58
|
+
throw Error('Execution route not found.');
|
|
59
|
+
}
|
|
60
|
+
queryClient.removeQueries({ queryKey: ['routes'], exact: false });
|
|
61
|
+
return (0, sdk_1.executeRoute)(routeExecution.route, {
|
|
62
|
+
updateRouteHook,
|
|
63
|
+
acceptExchangeRateUpdateHook,
|
|
64
|
+
infiniteApproval: false,
|
|
65
|
+
executeInBackground,
|
|
66
|
+
});
|
|
67
|
+
},
|
|
82
68
|
onMutate: () => {
|
|
83
69
|
console.log('Execution started.', routeId);
|
|
84
70
|
if (routeExecution) {
|
|
@@ -86,26 +72,26 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
|
|
|
86
72
|
}
|
|
87
73
|
},
|
|
88
74
|
});
|
|
89
|
-
const resumeRouteMutation = (0, react_query_1.useMutation)(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
75
|
+
const resumeRouteMutation = (0, react_query_1.useMutation)({
|
|
76
|
+
mutationFn: (resumedRoute) => {
|
|
77
|
+
if (!account.isConnected) {
|
|
78
|
+
throw Error('Account is not connected.');
|
|
79
|
+
}
|
|
80
|
+
if (!routeExecution?.route) {
|
|
81
|
+
throw Error('Execution route not found.');
|
|
82
|
+
}
|
|
83
|
+
return (0, sdk_1.resumeRoute)(resumedRoute ?? routeExecution.route, {
|
|
84
|
+
updateRouteHook,
|
|
85
|
+
acceptExchangeRateUpdateHook,
|
|
86
|
+
infiniteApproval: false,
|
|
87
|
+
executeInBackground,
|
|
88
|
+
});
|
|
89
|
+
},
|
|
104
90
|
onMutate: () => {
|
|
105
91
|
console.log('Resumed to execution.', routeId);
|
|
106
92
|
},
|
|
107
93
|
});
|
|
108
|
-
const
|
|
94
|
+
const _executeRoute = (0, react_1.useCallback)(() => {
|
|
109
95
|
executeRouteMutation.mutateAsync(undefined, {
|
|
110
96
|
onError: (error) => {
|
|
111
97
|
console.warn('Execution failed!', routeId, error);
|
|
@@ -115,7 +101,7 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
|
|
|
115
101
|
},
|
|
116
102
|
});
|
|
117
103
|
}, [executeRouteMutation, routeId]);
|
|
118
|
-
const
|
|
104
|
+
const _resumeRoute = (0, react_1.useCallback)((route) => {
|
|
119
105
|
resumeRouteMutation.mutateAsync(route, {
|
|
120
106
|
onError: (error) => {
|
|
121
107
|
console.warn('Resumed execution failed.', routeId, error);
|
|
@@ -127,9 +113,9 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
|
|
|
127
113
|
}, [resumeRouteMutation, routeId]);
|
|
128
114
|
const restartRouteMutation = (0, react_1.useCallback)(() => {
|
|
129
115
|
restartRoute(routeId);
|
|
130
|
-
|
|
116
|
+
_resumeRoute(routeExecution?.route);
|
|
131
117
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132
|
-
}, [
|
|
118
|
+
}, [_resumeRoute, routeExecution?.route, routeId]);
|
|
133
119
|
const deleteRouteMutation = (0, react_1.useCallback)(() => {
|
|
134
120
|
deleteRoute(routeId);
|
|
135
121
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -138,26 +124,26 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
|
|
|
138
124
|
(0, react_1.useEffect)(() => {
|
|
139
125
|
// Check if route is eligible for automatic resuming
|
|
140
126
|
if ((0, stores_1.isRouteActive)(routeExecution?.route) &&
|
|
141
|
-
account.
|
|
127
|
+
account.isConnected &&
|
|
142
128
|
!resumedAfterMount.current) {
|
|
143
129
|
resumedAfterMount.current = true;
|
|
144
|
-
|
|
130
|
+
_resumeRoute();
|
|
145
131
|
}
|
|
146
132
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
147
|
-
}, [account.
|
|
133
|
+
}, [account.isConnected]);
|
|
148
134
|
(0, react_1.useEffect)(() => {
|
|
149
135
|
return () => {
|
|
150
136
|
const route = routeExecutionStoreContext.getState().routes[routeId]?.route;
|
|
151
137
|
if (!route || !(0, stores_1.isRouteActive)(route)) {
|
|
152
138
|
return;
|
|
153
139
|
}
|
|
154
|
-
|
|
140
|
+
(0, sdk_1.updateRouteExecution)(route, { executeInBackground: true });
|
|
155
141
|
console.log('Move route execution to background.', routeId);
|
|
156
142
|
resumedAfterMount.current = false;
|
|
157
143
|
};
|
|
158
|
-
}, [
|
|
144
|
+
}, [routeExecutionStoreContext, routeId]);
|
|
159
145
|
return {
|
|
160
|
-
executeRoute,
|
|
146
|
+
executeRoute: _executeRoute,
|
|
161
147
|
restartRoute: restartRouteMutation,
|
|
162
148
|
deleteRoute: deleteRouteMutation,
|
|
163
149
|
route: routeExecution?.route,
|
package/cjs/hooks/useRoutes.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export declare const useRoutes: ({ insurableRoute }?: RoutesProps) => {
|
|
|
9
9
|
isFetched: boolean;
|
|
10
10
|
dataUpdatedAt: number;
|
|
11
11
|
refetchTime: number;
|
|
12
|
-
refetch:
|
|
12
|
+
refetch: (options?: import("@tanstack/query-core/build/legacy/queryClient-IoYjXsnV").Z | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-IoYjXsnV").ac<RoutesResponse, Error>>;
|
|
13
13
|
};
|
|
14
14
|
export {};
|