@lifi/widget 3.40.11 → 4.0.0-alpha.2
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/dist/esm/AppDefault.d.ts +8 -0
- package/dist/esm/AppDefault.js +231 -14
- package/dist/esm/AppDefault.js.map +1 -1
- package/dist/esm/AppLayout.d.ts +1 -0
- package/dist/esm/AppLayout.js +19 -0
- package/dist/esm/AppLayout.js.map +1 -0
- package/dist/esm/AppProvider.js +7 -20
- package/dist/esm/AppProvider.js.map +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactionItem.js +9 -6
- package/dist/esm/components/ActiveTransactions/ActiveTransactionItem.js.map +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.js +2 -2
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.js.map +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.d.ts +2 -2
- package/dist/esm/components/AmountInput/AmountInput.js +5 -7
- package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts +2 -2
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts +1 -1
- package/dist/esm/components/AppContainer.d.ts +1 -1
- package/dist/esm/components/Avatar/AccountAvatar.d.ts +1 -1
- package/dist/esm/components/Avatar/AccountAvatar.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.style.d.ts +1 -1
- package/dist/esm/components/Avatar/SmallAvatar.d.ts +1 -1
- package/dist/esm/components/ButtonTertiary.d.ts +1 -1
- package/dist/esm/components/Card/Card.d.ts +1 -1
- package/dist/esm/components/Card/CardButton.style.d.ts +2 -2
- package/dist/esm/components/Card/CardHeader.d.ts +1 -1
- package/dist/esm/components/Card/CardIconButton.d.ts +3 -3
- package/dist/esm/components/Card/CardLabel.d.ts +1 -1
- package/dist/esm/components/Card/CardTitle.d.ts +1 -1
- package/dist/esm/components/Card/InputCard.d.ts +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js +8 -3
- package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts +3 -3
- package/dist/esm/components/Chains/ChainList.style.d.ts +4 -4
- package/dist/esm/components/Chains/VirtualizedChainList.d.ts +1 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js +7 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.js +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.js.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.js +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.js.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.style.d.ts +1 -1
- package/dist/esm/components/Header/BackButton.d.ts +1 -2
- package/dist/esm/components/Header/BackButton.js +16 -2
- package/dist/esm/components/Header/BackButton.js.map +1 -1
- package/dist/esm/components/Header/DisconnectIconButton.d.ts +1 -1
- package/dist/esm/components/Header/DisconnectIconButton.js.map +1 -1
- package/dist/esm/components/Header/Header.js +1 -1
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/Header.style.d.ts +3 -3
- package/dist/esm/components/Header/NavigationHeader.js +7 -13
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.js +3 -3
- package/dist/esm/components/Header/SettingsButton.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.style.d.ts +2 -2
- package/dist/esm/components/Header/TransactionHistoryButton.js +3 -3
- package/dist/esm/components/Header/TransactionHistoryButton.js.map +1 -1
- package/dist/esm/components/Header/WalletHeader.js.map +1 -1
- package/dist/esm/components/ListItem/ListItem.d.ts +1 -1
- package/dist/esm/components/ListItem/ListItemButton.d.ts +1 -1
- package/dist/esm/components/ListItemButton.d.ts +1 -1
- package/dist/esm/components/Messages/GasSufficiencyMessage.js +1 -1
- package/dist/esm/components/Messages/GasSufficiencyMessage.js.map +1 -1
- package/dist/esm/components/PageContainer.d.ts +1 -1
- package/dist/esm/components/PageEntered.js +1 -1
- package/dist/esm/components/PageEntered.js.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.js +0 -9
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.js.map +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/dist/esm/components/RouteCard/RouteCard.js +1 -3
- package/dist/esm/components/RouteCard/RouteCard.js.map +1 -1
- package/dist/esm/components/Routes/Routes.js +3 -4
- package/dist/esm/components/Routes/Routes.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.js +1 -2
- package/dist/esm/components/Routes/RoutesContent.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.js +4 -3
- package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.d.ts +1 -1
- package/dist/esm/components/Search/SearchInput.style.d.ts +1 -1
- package/dist/esm/components/Search/SearchNotFound.style.d.ts +2 -2
- package/dist/esm/components/SelectChainAndToken.js +2 -3
- package/dist/esm/components/SelectChainAndToken.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.js +10 -10
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -3
- package/dist/esm/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js +10 -8
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/SettingsListItemButton.d.ts +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.d.ts +4 -4
- package/dist/esm/components/Step/CircularProgress.d.ts +3 -3
- package/dist/esm/components/Step/CircularProgress.js +8 -8
- package/dist/esm/components/Step/CircularProgress.js.map +1 -1
- package/dist/esm/components/Step/CircularProgress.style.d.ts +2 -2
- package/dist/esm/components/Step/CircularProgress.style.js.map +1 -1
- package/dist/esm/components/Step/Step.js +8 -11
- package/dist/esm/components/Step/Step.js.map +1 -1
- package/dist/esm/components/Step/StepAction.d.ts +5 -0
- package/dist/esm/components/Step/{StepProcess.js → StepAction.js} +16 -12
- package/dist/esm/components/Step/StepAction.js.map +1 -0
- package/dist/esm/components/StepActions/StepActions.js +3 -2
- package/dist/esm/components/StepActions/StepActions.js.map +1 -1
- package/dist/esm/components/StepActions/StepActions.style.d.ts +2 -2
- package/dist/esm/components/StepDivider/StepDivider.style.d.ts +1 -1
- package/dist/esm/components/Tabs/NavigationTabs.d.ts +4 -4
- package/dist/esm/components/Tabs/Tabs.style.d.ts +3 -3
- package/dist/esm/components/Timer/StepTimer.js +26 -74
- package/dist/esm/components/Timer/StepTimer.js.map +1 -1
- package/dist/esm/components/Token/Token.style.d.ts +1 -1
- package/dist/esm/components/TokenList/PinTokenButton.d.ts +6 -0
- package/dist/esm/components/TokenList/PinTokenButton.js +29 -0
- package/dist/esm/components/TokenList/PinTokenButton.js.map +1 -0
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.d.ts +2 -2
- package/dist/esm/components/TokenList/TokenList.js +13 -5
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.style.d.ts +6 -6
- package/dist/esm/components/TokenList/TokenListItem.js +5 -4
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js +63 -38
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/types.d.ts +2 -3
- package/dist/esm/components/TokenList/useTokenSelect.js +2 -3
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.d.ts +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.style.d.ts +1 -1
- package/dist/esm/components/TransactionDetails.js +3 -2
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/useActionMessage.d.ts +5 -0
- package/dist/esm/hooks/useActionMessage.js +18 -0
- package/dist/esm/hooks/useActionMessage.js.map +1 -0
- package/dist/esm/hooks/useAddressActivity.js +18 -9
- package/dist/esm/hooks/useAddressActivity.js.map +1 -1
- package/dist/esm/hooks/useAddressValidation.js +5 -2
- package/dist/esm/hooks/useAddressValidation.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.d.ts +2 -1
- package/dist/esm/hooks/useAvailableChains.js +32 -11
- package/dist/esm/hooks/useAvailableChains.js.map +1 -1
- package/dist/esm/hooks/useExplorer.js +1 -2
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js +3 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useFromTokenSufficiency.d.ts +1 -1
- package/dist/esm/hooks/useFromTokenSufficiency.js +4 -4
- package/dist/esm/hooks/useFromTokenSufficiency.js.map +1 -1
- package/dist/esm/hooks/useGasRecommendation.js +3 -1
- package/dist/esm/hooks/useGasRecommendation.js.map +1 -1
- package/dist/esm/hooks/useGasSufficiency.js +21 -15
- package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
- package/dist/esm/hooks/useHasChainExpansion.d.ts +1 -1
- package/dist/esm/hooks/useHasChainExpansion.js +11 -3
- package/dist/esm/hooks/useHasChainExpansion.js.map +1 -1
- package/dist/esm/hooks/useInitializeSDKProviders.d.ts +1 -0
- package/dist/esm/hooks/useInitializeSDKProviders.js +11 -0
- package/dist/esm/hooks/useInitializeSDKProviders.js.map +1 -0
- package/dist/esm/hooks/useIsBatchingSupported.js +7 -3
- package/dist/esm/hooks/useIsBatchingSupported.js.map +1 -1
- package/dist/esm/hooks/useIsContractAddress.js +12 -9
- package/dist/esm/hooks/useIsContractAddress.js.map +1 -1
- package/dist/esm/hooks/useNavigateBack.d.ts +1 -4
- package/dist/esm/hooks/useNavigateBack.js +9 -23
- package/dist/esm/hooks/useNavigateBack.js.map +1 -1
- package/dist/esm/hooks/useRouteExecution.js +12 -13
- package/dist/esm/hooks/useRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +23 -60
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressAutoPopulate.js +3 -1
- package/dist/esm/hooks/useToAddressAutoPopulate.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js +3 -2
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/hooks/useTokenBalance.d.ts +3 -3
- package/dist/esm/hooks/useTokenBalance.js +8 -6
- package/dist/esm/hooks/useTokenBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.d.ts +1 -0
- package/dist/esm/hooks/useTokenBalances.js +70 -5
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenBalancesQueries.js +4 -2
- package/dist/esm/hooks/useTokenBalancesQueries.js.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +3 -1
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +11 -5
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.js +3 -1
- package/dist/esm/hooks/useTools.js.map +1 -1
- package/dist/esm/hooks/useTransactionDetails.js +3 -1
- package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
- package/dist/esm/hooks/useTransactionHistory.js +3 -1
- package/dist/esm/hooks/useTransactionHistory.js.map +1 -1
- package/dist/esm/hooks/useWidgetChains.d.ts +6 -0
- package/dist/esm/hooks/useWidgetChains.js +5 -0
- package/dist/esm/hooks/useWidgetChains.js.map +1 -0
- package/dist/esm/i18n/bn.json +4 -1
- package/dist/esm/i18n/de.json +4 -1
- package/dist/esm/i18n/en.json +3 -14
- package/dist/esm/i18n/es.json +4 -1
- package/dist/esm/i18n/fr.json +4 -1
- package/dist/esm/i18n/hi.json +4 -1
- package/dist/esm/i18n/id.json +4 -1
- package/dist/esm/i18n/it.json +4 -1
- package/dist/esm/i18n/ja.json +4 -1
- package/dist/esm/i18n/ko.json +4 -1
- package/dist/esm/i18n/pl.json +4 -1
- package/dist/esm/i18n/pt.json +4 -1
- package/dist/esm/i18n/th.json +4 -1
- package/dist/esm/i18n/tr.json +4 -1
- package/dist/esm/i18n/uk.json +4 -1
- package/dist/esm/i18n/vi.json +4 -1
- package/dist/esm/i18n/zh.json +4 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pages/LanguagesPage.js +7 -6
- package/dist/esm/pages/LanguagesPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainPage.js +1 -3
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/MainPage/ReviewButton.js +5 -5
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.d.ts +1 -2
- package/dist/esm/pages/RoutesPage/RoutesPage.js +5 -4
- package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js +2 -13
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js +3 -5
- package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js +1 -1
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js +4 -3
- package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js +4 -7
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js +1 -1
- package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.d.ts +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js +5 -5
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.d.ts +8 -8
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js +4 -2
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/LanguageSetting.js +2 -2
- package/dist/esm/pages/SettingsPage/LanguageSetting.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.d.ts +12 -2
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js +10 -4
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.d.ts +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.js +2 -2
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsPage.js +5 -1
- package/dist/esm/pages/SettingsPage/SettingsPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +3 -3
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.d.ts +3 -3
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +9 -9
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.d.ts +1 -0
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.js +58 -0
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.js.map +1 -0
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +7 -8
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryItem.js +4 -3
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryItem.js.map +1 -1
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.d.ts +1 -2
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.js.map +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js +13 -12
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.d.ts +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.js +13 -6
- package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js +1 -0
- package/dist/esm/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/dist/esm/providers/SDKClientProvider.d.ts +4 -0
- package/dist/esm/providers/SDKClientProvider.js +29 -0
- package/dist/esm/providers/SDKClientProvider.js.map +1 -0
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts +7 -2
- package/dist/esm/providers/WalletProvider/WalletProvider.js +27 -11
- package/dist/esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js +15 -18
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js.map +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js +0 -27
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/dist/esm/stores/StoreProvider.js +2 -1
- package/dist/esm/stores/StoreProvider.js.map +1 -1
- package/dist/esm/stores/bookmarks/types.d.ts +2 -3
- package/dist/esm/stores/chains/ChainOrderStore.js +17 -12
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/createChainOrderStore.d.ts +0 -8
- package/dist/esm/stores/chains/createChainOrderStore.js +1 -5
- package/dist/esm/stores/chains/createChainOrderStore.js.map +1 -1
- package/dist/esm/stores/form/FormStore.js +18 -8
- package/dist/esm/stores/form/FormStore.js.map +1 -1
- package/dist/esm/stores/form/FormUpdater.js +5 -50
- package/dist/esm/stores/form/FormUpdater.js.map +1 -1
- package/dist/esm/stores/form/URLSearchParamsBuilder.js +11 -31
- package/dist/esm/stores/form/URLSearchParamsBuilder.js.map +1 -1
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.d.ts +7 -0
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.js +32 -0
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.js.map +1 -0
- package/dist/esm/stores/form/types.d.ts +2 -3
- package/dist/esm/stores/form/types.js.map +1 -1
- package/dist/esm/stores/header/types.d.ts +5 -3
- package/dist/esm/stores/header/useHeaderStore.js +14 -0
- package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.d.ts +4 -0
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.js +20 -0
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.js.map +1 -0
- package/dist/esm/stores/pinnedTokens/createPinnedTokensStore.d.ts +19 -0
- package/dist/esm/stores/pinnedTokens/createPinnedTokensStore.js +61 -0
- package/dist/esm/stores/pinnedTokens/createPinnedTokensStore.js.map +1 -0
- package/dist/esm/stores/pinnedTokens/types.d.ts +17 -0
- package/dist/esm/stores/pinnedTokens/types.js +2 -0
- package/dist/esm/stores/pinnedTokens/types.js.map +1 -0
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts +2 -3
- package/dist/esm/stores/routes/RouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js +2 -5
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/useExecutingRoutesIds.js +2 -2
- package/dist/esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
- package/dist/esm/stores/routes/utils.d.ts +2 -2
- package/dist/esm/stores/routes/utils.js +15 -15
- package/dist/esm/stores/routes/utils.js.map +1 -1
- package/dist/esm/stores/settings/SettingsStore.d.ts +2 -3
- package/dist/esm/stores/settings/SettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/createSettingsStore.d.ts +2 -0
- package/dist/esm/stores/settings/createSettingsStore.js +2 -1
- package/dist/esm/stores/settings/createSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/types.d.ts +3 -3
- package/dist/esm/stores/settings/types.js.map +1 -1
- package/dist/esm/types/events.d.ts +2 -10
- package/dist/esm/types/events.js +0 -1
- package/dist/esm/types/events.js.map +1 -1
- package/dist/esm/types/token.d.ts +1 -0
- package/dist/esm/types/widget.d.ts +9 -16
- package/dist/esm/types/widget.js +1 -0
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/chainType.d.ts +1 -2
- package/dist/esm/utils/chainType.js +1 -19
- package/dist/esm/utils/chainType.js.map +1 -1
- package/dist/esm/utils/converters.js +11 -18
- package/dist/esm/utils/converters.js.map +1 -1
- package/dist/esm/utils/format.d.ts +1 -0
- package/dist/esm/utils/format.js +2 -1
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/getActionMessage.d.ts +7 -0
- package/dist/esm/utils/getActionMessage.js +111 -0
- package/dist/esm/utils/getActionMessage.js.map +1 -0
- package/dist/esm/utils/getErrorMessage.d.ts +6 -0
- package/dist/esm/utils/getErrorMessage.js +118 -0
- package/dist/esm/utils/getErrorMessage.js.map +1 -0
- package/dist/esm/utils/prepareActions.d.ts +2 -0
- package/dist/esm/utils/prepareActions.js +24 -0
- package/dist/esm/utils/prepareActions.js.map +1 -0
- package/dist/esm/utils/tokenList.d.ts +3 -2
- package/dist/esm/utils/tokenList.js +104 -8
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/package.json +30 -23
- package/src/AppDefault.tsx +279 -31
- package/src/AppLayout.tsx +36 -0
- package/src/AppProvider.tsx +12 -40
- package/src/components/ActiveTransactions/ActiveTransactionItem.tsx +9 -6
- package/src/components/ActiveTransactions/ActiveTransactions.tsx +2 -2
- package/src/components/AmountInput/AmountInput.tsx +6 -8
- package/src/components/AmountInput/AmountInputEndAdornment.tsx +1 -1
- package/src/components/Avatar/AccountAvatar.tsx +1 -1
- package/src/components/ChainSelect/ChainSelect.tsx +8 -4
- package/src/components/Chains/VirtualizedChainList.tsx +7 -3
- package/src/components/ContractComponent/ItemPrice.tsx +1 -2
- package/src/components/ContractComponent/NFT/NFT.tsx +1 -1
- package/src/components/Header/BackButton.tsx +15 -3
- package/src/components/Header/DisconnectIconButton.tsx +2 -1
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Header/NavigationHeader.tsx +23 -46
- package/src/components/Header/SettingsButton.tsx +3 -3
- package/src/components/Header/TransactionHistoryButton.tsx +3 -3
- package/src/components/Header/WalletHeader.tsx +1 -1
- package/src/components/Messages/GasSufficiencyMessage.tsx +1 -1
- package/src/components/PageEntered.ts +1 -1
- package/src/components/ReverseTokensButton/ReverseTokensButton.tsx +0 -10
- package/src/components/RouteCard/RouteCard.tsx +1 -3
- package/src/components/Routes/Routes.tsx +3 -4
- package/src/components/Routes/RoutesContent.tsx +1 -2
- package/src/components/Routes/RoutesExpanded.tsx +4 -3
- package/src/components/SelectChainAndToken.tsx +2 -4
- package/src/components/SelectTokenButton/SelectTokenButton.tsx +11 -13
- package/src/components/SendToWallet/SendToWalletButton.tsx +9 -12
- package/src/components/Step/CircularProgress.style.tsx +3 -3
- package/src/components/Step/CircularProgress.tsx +11 -11
- package/src/components/Step/Step.tsx +13 -14
- package/src/components/Step/{StepProcess.tsx → StepAction.tsx} +20 -15
- package/src/components/StepActions/StepActions.tsx +3 -2
- package/src/components/Timer/StepTimer.tsx +43 -105
- package/src/components/TokenList/PinTokenButton.tsx +50 -0
- package/src/components/TokenList/TokenList.tsx +67 -59
- package/src/components/TokenList/TokenListItem.tsx +20 -11
- package/src/components/TokenList/VirtualizedTokenList.tsx +80 -53
- package/src/components/TokenList/types.ts +2 -3
- package/src/components/TokenList/useTokenSelect.ts +2 -8
- package/src/components/TokenRate/TokenRate.tsx +1 -2
- package/src/components/TransactionDetails.tsx +3 -2
- package/src/config/version.ts +1 -1
- package/src/hooks/useActionMessage.ts +33 -0
- package/src/hooks/useAddressActivity.ts +19 -11
- package/src/hooks/useAddressValidation.ts +9 -2
- package/src/hooks/useAvailableChains.ts +42 -14
- package/src/hooks/useExplorer.ts +1 -2
- package/src/hooks/useFilteredByTokenBalances.ts +3 -1
- package/src/hooks/useFromTokenSufficiency.ts +8 -5
- package/src/hooks/useGasRecommendation.ts +3 -0
- package/src/hooks/useGasSufficiency.ts +23 -13
- package/src/hooks/useHasChainExpansion.ts +13 -3
- package/src/hooks/useInitializeSDKProviders.ts +12 -0
- package/src/hooks/useIsBatchingSupported.ts +11 -5
- package/src/hooks/useIsContractAddress.ts +14 -10
- package/src/hooks/useNavigateBack.ts +11 -29
- package/src/hooks/useRouteExecution.ts +12 -16
- package/src/hooks/useRoutes.ts +26 -74
- package/src/hooks/useToAddressAutoPopulate.ts +3 -1
- package/src/hooks/useToAddressRequirements.ts +3 -2
- package/src/hooks/useTokenBalance.ts +18 -3
- package/src/hooks/useTokenBalances.ts +91 -5
- package/src/hooks/useTokenBalancesQueries.ts +4 -2
- package/src/hooks/useTokenSearch.ts +10 -3
- package/src/hooks/useTokens.ts +11 -6
- package/src/hooks/useTools.ts +3 -1
- package/src/hooks/useTransactionDetails.ts +3 -0
- package/src/hooks/useTransactionHistory.ts +3 -0
- package/src/hooks/useWidgetChains.ts +6 -0
- package/src/index.ts +2 -8
- package/src/pages/LanguagesPage.tsx +2 -1
- package/src/pages/MainPage/MainPage.tsx +1 -3
- package/src/pages/MainPage/ReviewButton.tsx +5 -5
- package/src/pages/RoutesPage/RoutesPage.tsx +6 -6
- package/src/pages/SelectChainPage/SelectChainPage.tsx +1 -1
- package/src/pages/SelectTokenPage/SelectTokenPage.tsx +4 -28
- package/src/pages/SendToWallet/BookmarksPage.tsx +3 -5
- package/src/pages/SendToWallet/ConfirmAddressSheet.tsx +1 -1
- package/src/pages/SendToWallet/ConnectedWalletsPage.tsx +5 -4
- package/src/pages/SendToWallet/RecentWalletsPage.tsx +4 -7
- package/src/pages/SendToWallet/SendToConfiguredWalletPage.tsx +1 -1
- package/src/pages/SendToWallet/SendToWalletPage.tsx +6 -6
- package/src/pages/SettingsPage/BridgeAndExchangeSettings.tsx +4 -2
- package/src/pages/SettingsPage/LanguageSetting.tsx +2 -2
- package/src/pages/SettingsPage/SettingsCard/SettingCardExpandable.tsx +63 -33
- package/src/pages/SettingsPage/SettingsCard/SettingsAccordian.tsx +3 -2
- package/src/pages/SettingsPage/SettingsPage.tsx +7 -0
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.style.tsx +10 -10
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +5 -5
- package/src/pages/SettingsPage/SmallBalanceFilterSettings.tsx +116 -0
- package/src/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +7 -8
- package/src/pages/TransactionHistoryPage/TransactionHistoryItem.tsx +4 -3
- package/src/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +1 -2
- package/src/pages/TransactionPage/StatusBottomSheet.tsx +15 -14
- package/src/pages/TransactionPage/TransactionPage.tsx +14 -7
- package/src/providers/I18nProvider/I18nProvider.tsx +1 -0
- package/src/providers/SDKClientProvider.tsx +41 -0
- package/src/providers/WalletProvider/WalletProvider.tsx +61 -20
- package/src/providers/WalletProvider/useExternalWalletProvider.ts +20 -18
- package/src/providers/WidgetProvider/WidgetProvider.tsx +0 -29
- package/src/stores/StoreProvider.tsx +10 -7
- package/src/stores/bookmarks/types.ts +2 -3
- package/src/stores/chains/ChainOrderStore.tsx +29 -16
- package/src/stores/chains/createChainOrderStore.ts +1 -5
- package/src/stores/form/FormStore.tsx +19 -18
- package/src/stores/form/FormUpdater.tsx +5 -73
- package/src/stores/form/URLSearchParamsBuilder.tsx +12 -39
- package/src/stores/form/getDefaultValuesFromQueryString.ts +48 -0
- package/src/stores/form/types.ts +2 -5
- package/src/stores/header/types.ts +5 -3
- package/src/stores/header/useHeaderStore.tsx +14 -0
- package/src/stores/pinnedTokens/PinnedTokensStore.tsx +38 -0
- package/src/stores/pinnedTokens/createPinnedTokensStore.ts +71 -0
- package/src/stores/pinnedTokens/types.ts +20 -0
- package/src/stores/routes/RouteExecutionStore.tsx +2 -5
- package/src/stores/routes/createRouteExecutionStore.ts +4 -5
- package/src/stores/routes/useExecutingRoutesIds.ts +2 -2
- package/src/stores/routes/utils.ts +21 -19
- package/src/stores/settings/SettingsStore.tsx +2 -3
- package/src/stores/settings/createSettingsStore.ts +2 -1
- package/src/stores/settings/types.ts +3 -5
- package/src/types/events.ts +2 -11
- package/src/types/token.ts +1 -0
- package/src/types/widget.ts +18 -26
- package/src/utils/chainType.ts +1 -24
- package/src/utils/converters.ts +14 -20
- package/src/utils/format.ts +3 -1
- package/src/utils/getActionMessage.ts +168 -0
- package/src/utils/getErrorMessage.ts +144 -0
- package/src/utils/prepareActions.ts +27 -0
- package/src/utils/tokenList.ts +117 -11
- package/CHANGELOG.md +0 -2646
- package/dist/esm/AppRoutes.d.ts +0 -1
- package/dist/esm/AppRoutes.js +0 -111
- package/dist/esm/AppRoutes.js.map +0 -1
- package/dist/esm/components/Step/StepProcess.d.ts +0 -5
- package/dist/esm/components/Step/StepProcess.js.map +0 -1
- package/dist/esm/config/baseAccount.d.ts +0 -2
- package/dist/esm/config/baseAccount.js +0 -6
- package/dist/esm/config/baseAccount.js.map +0 -1
- package/dist/esm/config/coinbase.d.ts +0 -2
- package/dist/esm/config/coinbase.js +0 -6
- package/dist/esm/config/coinbase.js.map +0 -1
- package/dist/esm/config/metaMask.d.ts +0 -2
- package/dist/esm/config/metaMask.js +0 -11
- package/dist/esm/config/metaMask.js.map +0 -1
- package/dist/esm/config/walletConnect.d.ts +0 -2
- package/dist/esm/config/walletConnect.js +0 -4
- package/dist/esm/config/walletConnect.js.map +0 -1
- package/dist/esm/hooks/useExpansionRoutes.d.ts +0 -2
- package/dist/esm/hooks/useExpansionRoutes.js +0 -26
- package/dist/esm/hooks/useExpansionRoutes.js.map +0 -1
- package/dist/esm/hooks/useInternalWalletProvider.d.ts +0 -1
- package/dist/esm/hooks/useInternalWalletProvider.js +0 -6
- package/dist/esm/hooks/useInternalWalletProvider.js.map +0 -1
- package/dist/esm/hooks/useProcessMessage.d.ts +0 -11
- package/dist/esm/hooks/useProcessMessage.js +0 -199
- package/dist/esm/hooks/useProcessMessage.js.map +0 -1
- package/dist/esm/providers/WalletProvider/EVMBaseProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/EVMBaseProvider.js +0 -31
- package/dist/esm/providers/WalletProvider/EVMBaseProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/EVMExternalContext.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/EVMExternalContext.js +0 -3
- package/dist/esm/providers/WalletProvider/EVMExternalContext.js.map +0 -1
- package/dist/esm/providers/WalletProvider/EVMProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/EVMProvider.js +0 -20
- package/dist/esm/providers/WalletProvider/EVMProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SDKProviders.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SDKProviders.js +0 -62
- package/dist/esm/providers/WalletProvider/SDKProviders.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SVMBaseProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/SVMBaseProvider.js +0 -27
- package/dist/esm/providers/WalletProvider/SVMBaseProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SVMExternalContext.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SVMExternalContext.js +0 -3
- package/dist/esm/providers/WalletProvider/SVMExternalContext.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SVMProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/SVMProvider.js +0 -20
- package/dist/esm/providers/WalletProvider/SVMProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.js +0 -17
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SuiExternalContext.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SuiExternalContext.js +0 -3
- package/dist/esm/providers/WalletProvider/SuiExternalContext.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SuiProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/SuiProvider.js +0 -20
- package/dist/esm/providers/WalletProvider/SuiProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/UTXOBaseProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/UTXOBaseProvider.js +0 -18
- package/dist/esm/providers/WalletProvider/UTXOBaseProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/UTXOExternalContext.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/UTXOExternalContext.js +0 -3
- package/dist/esm/providers/WalletProvider/UTXOExternalContext.js.map +0 -1
- package/dist/esm/providers/WalletProvider/UTXOProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/UTXOProvider.js +0 -20
- package/dist/esm/providers/WalletProvider/UTXOProvider.js.map +0 -1
- package/package.json.tmp +0 -100
- package/src/AppRoutes.tsx +0 -112
- package/src/config/baseAccount.ts +0 -7
- package/src/config/coinbase.ts +0 -7
- package/src/config/metaMask.ts +0 -13
- package/src/config/walletConnect.ts +0 -5
- package/src/hooks/useExpansionRoutes.ts +0 -29
- package/src/hooks/useInternalWalletProvider.ts +0 -6
- package/src/hooks/useProcessMessage.ts +0 -273
- package/src/i18n/bn.json +0 -354
- package/src/i18n/de.json +0 -354
- package/src/i18n/en.json +0 -368
- package/src/i18n/es.json +0 -354
- package/src/i18n/fr.json +0 -354
- package/src/i18n/hi.json +0 -354
- package/src/i18n/id.json +0 -354
- package/src/i18n/it.json +0 -354
- package/src/i18n/ja.json +0 -354
- package/src/i18n/ko.json +0 -354
- package/src/i18n/pl.json +0 -354
- package/src/i18n/pt.json +0 -354
- package/src/i18n/th.json +0 -354
- package/src/i18n/tr.json +0 -354
- package/src/i18n/uk.json +0 -354
- package/src/i18n/vi.json +0 -354
- package/src/i18n/zh.json +0 -354
- package/src/providers/WalletProvider/EVMBaseProvider.tsx +0 -41
- package/src/providers/WalletProvider/EVMExternalContext.ts +0 -3
- package/src/providers/WalletProvider/EVMProvider.tsx +0 -28
- package/src/providers/WalletProvider/SDKProviders.tsx +0 -86
- package/src/providers/WalletProvider/SVMBaseProvider.tsx +0 -37
- package/src/providers/WalletProvider/SVMExternalContext.ts +0 -3
- package/src/providers/WalletProvider/SVMProvider.tsx +0 -29
- package/src/providers/WalletProvider/SuiBaseProvider.tsx +0 -31
- package/src/providers/WalletProvider/SuiExternalContext.ts +0 -3
- package/src/providers/WalletProvider/SuiProvider.tsx +0 -28
- package/src/providers/WalletProvider/UTXOBaseProvider.tsx +0 -29
- package/src/providers/WalletProvider/UTXOExternalContext.ts +0 -3
- package/src/providers/WalletProvider/UTXOProvider.tsx +0 -28
- package/src/utils/compactNumberFormatter.test.ts +0 -67
- package/src/utils/format.test.ts +0 -53
- package/tsconfig.json +0 -15
|
@@ -23,6 +23,7 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
23
23
|
isLoading,
|
|
24
24
|
isBalanceLoading,
|
|
25
25
|
showCategories,
|
|
26
|
+
showPinnedTokens,
|
|
26
27
|
onClick,
|
|
27
28
|
isAllNetworks,
|
|
28
29
|
}) => {
|
|
@@ -62,29 +63,33 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
62
63
|
const estimateSize = useCallback(
|
|
63
64
|
(index: number) => {
|
|
64
65
|
const currentToken = tokens[index]
|
|
65
|
-
|
|
66
|
-
// Base size for TokenListItem
|
|
66
|
+
const previousToken = tokens[index - 1]
|
|
67
67
|
let size = tokenItemHeight
|
|
68
68
|
|
|
69
|
-
//
|
|
69
|
+
// Pinned tokens (always shown, even in all networks mode)
|
|
70
|
+
if (currentToken.pinned && index === 0) {
|
|
71
|
+
size += 24
|
|
72
|
+
}
|
|
73
|
+
if (previousToken?.pinned && !currentToken.pinned) {
|
|
74
|
+
size += 32
|
|
75
|
+
}
|
|
76
|
+
|
|
70
77
|
if (!showCategories) {
|
|
71
78
|
return size
|
|
72
79
|
}
|
|
73
80
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// Adjust size for the first featured token
|
|
77
|
-
if (currentToken.featured && index === 0) {
|
|
81
|
+
if (currentToken.featured && !currentToken.pinned && index === 0) {
|
|
78
82
|
size += 24
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
//
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
(previousToken?.
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
// Category transition (excluding pinned tokens)
|
|
86
|
+
const isNotPinned = !currentToken.pinned && !previousToken?.pinned
|
|
87
|
+
if (
|
|
88
|
+
isNotPinned &&
|
|
89
|
+
((previousToken?.amount && !currentToken.amount) ||
|
|
90
|
+
(previousToken?.featured && !currentToken.featured) ||
|
|
91
|
+
(previousToken?.popular && !currentToken.popular))
|
|
92
|
+
) {
|
|
88
93
|
size += 32
|
|
89
94
|
}
|
|
90
95
|
|
|
@@ -93,7 +98,6 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
93
98
|
[tokens, showCategories]
|
|
94
99
|
)
|
|
95
100
|
|
|
96
|
-
// Chunk the tokens for infinite loading simulation
|
|
97
101
|
const virtualizerConfig = useMemo(
|
|
98
102
|
() => ({
|
|
99
103
|
count: tokens.length,
|
|
@@ -135,47 +139,64 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
135
139
|
{getVirtualItems().map((item) => {
|
|
136
140
|
const currentToken = tokens[item.index]
|
|
137
141
|
const previousToken: TokenAmount | undefined = tokens[item.index - 1]
|
|
138
|
-
|
|
139
142
|
const chain = chainsSet?.get(currentToken.chainId)
|
|
140
143
|
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
previousToken?.featured && !currentToken.featured
|
|
144
|
+
const isNotPinned = !currentToken.pinned
|
|
145
|
+
const isFirstPinnedToken = currentToken.pinned && item.index === 0
|
|
146
|
+
const isTransitionFromPinned = previousToken?.pinned && isNotPinned
|
|
145
147
|
|
|
148
|
+
// Category transitions (excluding pinned)
|
|
149
|
+
const isTransitionFromFeatured =
|
|
150
|
+
previousToken?.featured && !currentToken.featured && isNotPinned
|
|
146
151
|
const isTransitionFromMyTokens =
|
|
147
|
-
previousToken?.amount && !currentToken.amount
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
152
|
+
previousToken?.amount && !currentToken.amount && isNotPinned
|
|
153
|
+
const isTransitionFromPopular =
|
|
154
|
+
previousToken?.popular && !currentToken.popular && isNotPinned
|
|
155
|
+
|
|
156
|
+
// Determine which category label to show
|
|
157
|
+
const startAdornmentLabel = (() => {
|
|
158
|
+
if (showPinnedTokens && isFirstPinnedToken) {
|
|
159
|
+
return t('main.pinnedTokens')
|
|
160
|
+
}
|
|
161
|
+
if (showPinnedTokens && !showCategories && isTransitionFromPinned) {
|
|
162
|
+
return t('main.allTokens')
|
|
163
|
+
}
|
|
164
|
+
if (!showCategories) {
|
|
165
|
+
return null
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (
|
|
169
|
+
(isTransitionFromPinned && currentToken.featured) ||
|
|
170
|
+
(currentToken.featured && isNotPinned && item.index === 0)
|
|
171
|
+
) {
|
|
172
|
+
return t('main.featuredTokens')
|
|
173
|
+
}
|
|
174
|
+
if (
|
|
175
|
+
(isTransitionFromFeatured || isTransitionFromPinned) &&
|
|
176
|
+
currentToken.amount &&
|
|
177
|
+
isNotPinned
|
|
178
|
+
) {
|
|
179
|
+
return t('main.myTokens')
|
|
180
|
+
}
|
|
181
|
+
if (
|
|
182
|
+
(isTransitionFromFeatured ||
|
|
183
|
+
isTransitionFromMyTokens ||
|
|
184
|
+
isTransitionFromPinned) &&
|
|
185
|
+
currentToken.popular &&
|
|
186
|
+
isNotPinned
|
|
187
|
+
) {
|
|
188
|
+
return t('main.popularTokens')
|
|
189
|
+
}
|
|
190
|
+
if (
|
|
191
|
+
isTransitionFromMyTokens ||
|
|
192
|
+
isTransitionFromFeatured ||
|
|
193
|
+
isTransitionFromPinned ||
|
|
194
|
+
isTransitionFromPopular
|
|
195
|
+
) {
|
|
196
|
+
return t('main.allTokens')
|
|
197
|
+
}
|
|
198
|
+
return null
|
|
199
|
+
})()
|
|
179
200
|
|
|
180
201
|
const isSelected =
|
|
181
202
|
selectedTokenAddress === currentToken.address &&
|
|
@@ -200,7 +221,13 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
200
221
|
fontWeight: 600,
|
|
201
222
|
lineHeight: '16px',
|
|
202
223
|
px: 1.5,
|
|
203
|
-
pt:
|
|
224
|
+
pt:
|
|
225
|
+
isFirstPinnedToken ||
|
|
226
|
+
(currentToken.featured &&
|
|
227
|
+
isNotPinned &&
|
|
228
|
+
item.index === 0)
|
|
229
|
+
? 0
|
|
230
|
+
: 1,
|
|
204
231
|
pb: 1,
|
|
205
232
|
}}
|
|
206
233
|
>
|
|
@@ -4,10 +4,8 @@ import type { FormType } from '../../stores/form/types.js'
|
|
|
4
4
|
import type { TokenAmount } from '../../types/token.js'
|
|
5
5
|
|
|
6
6
|
export interface TokenListProps {
|
|
7
|
-
parentRef: RefObject<HTMLElement | null>
|
|
8
7
|
formType: FormType
|
|
9
|
-
|
|
10
|
-
onClick?(): void
|
|
8
|
+
headerRef: RefObject<HTMLElement | null>
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
export interface VirtualizedTokenListProps {
|
|
@@ -17,6 +15,7 @@ export interface VirtualizedTokenListProps {
|
|
|
17
15
|
isBalanceLoading: boolean
|
|
18
16
|
chainId?: number
|
|
19
17
|
showCategories?: boolean
|
|
18
|
+
showPinnedTokens?: boolean
|
|
20
19
|
onClick(tokenAddress: string, chainId?: number): void
|
|
21
20
|
selectedTokenAddress?: string
|
|
22
21
|
isAllNetworks: boolean
|
|
@@ -12,12 +12,7 @@ import type { DisabledUI } from '../../types/widget.js'
|
|
|
12
12
|
import { isItemAllowed } from '../../utils/item.js'
|
|
13
13
|
|
|
14
14
|
export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
|
|
15
|
-
const {
|
|
16
|
-
subvariant,
|
|
17
|
-
disabledUI,
|
|
18
|
-
chains: chainsConfig,
|
|
19
|
-
subvariantOptions,
|
|
20
|
-
} = useWidgetConfig()
|
|
15
|
+
const { subvariant, disabledUI, chains: chainsConfig } = useWidgetConfig()
|
|
21
16
|
const splitSubvariant = useSplitSubvariantStore((store) => store.state)
|
|
22
17
|
const emitter = useWidgetEvents()
|
|
23
18
|
const { setFieldValue, getFieldValues } = useFieldActions()
|
|
@@ -63,7 +58,7 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
|
|
|
63
58
|
|
|
64
59
|
if (
|
|
65
60
|
(isSameTokenTransfer || isBridgeToSameChain) &&
|
|
66
|
-
|
|
61
|
+
subvariant !== 'custom'
|
|
67
62
|
) {
|
|
68
63
|
setFieldValue(FormKeyHelper.getTokenKey(oppositeFormType), '', {
|
|
69
64
|
isDirty: true,
|
|
@@ -125,7 +120,6 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
|
|
|
125
120
|
splitSubvariant,
|
|
126
121
|
tokenKey,
|
|
127
122
|
chainsConfig,
|
|
128
|
-
subvariantOptions,
|
|
129
123
|
]
|
|
130
124
|
)
|
|
131
125
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { formatUnits, type RouteExtended } from '@lifi/sdk'
|
|
2
2
|
import type { TypographyProps } from '@mui/material'
|
|
3
3
|
import type { MouseEventHandler } from 'react'
|
|
4
4
|
import { useTranslation } from 'react-i18next'
|
|
5
|
-
import { formatUnits } from 'viem'
|
|
6
5
|
import { create } from 'zustand'
|
|
7
6
|
import { TokenRateTypography } from './TokenRate.style.js'
|
|
8
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteExtended } from '@lifi/sdk'
|
|
2
|
-
import {
|
|
2
|
+
import { useEthereumContext } from '@lifi/widget-provider'
|
|
3
3
|
import ExpandLess from '@mui/icons-material/ExpandLess'
|
|
4
4
|
import ExpandMore from '@mui/icons-material/ExpandMore'
|
|
5
5
|
import LocalGasStationRounded from '@mui/icons-material/LocalGasStationRounded'
|
|
@@ -31,6 +31,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
|
|
|
31
31
|
const [cardExpanded, setCardExpanded] = useState(
|
|
32
32
|
defaultUI?.transactionDetailsExpanded ?? false
|
|
33
33
|
)
|
|
34
|
+
const { isGaslessStep } = useEthereumContext()
|
|
34
35
|
|
|
35
36
|
const toggleCard = () => {
|
|
36
37
|
setCardExpanded((cardExpanded) => !cardExpanded)
|
|
@@ -71,7 +72,7 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
|
|
|
71
72
|
) ?? 0
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
const hasGaslessSupport = route.steps.every((step) => isGaslessStep(step))
|
|
75
|
+
const hasGaslessSupport = route.steps.every((step) => isGaslessStep?.(step))
|
|
75
76
|
|
|
76
77
|
const showIntegratorFeeCollectionDetails =
|
|
77
78
|
(feeAmountUSD || Number.isFinite(feeConfig?.fee)) && !hasGaslessSupport
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget'
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '4.0.0-alpha.2'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ExecutionAction, LiFiStepExtended } from '@lifi/sdk'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
4
|
+
import { getActionMessage } from '../utils/getActionMessage.js'
|
|
5
|
+
import { getErrorMessage } from '../utils/getErrorMessage.js'
|
|
6
|
+
import { useAvailableChains } from './useAvailableChains.js'
|
|
7
|
+
|
|
8
|
+
export const useActionMessage = (
|
|
9
|
+
step?: LiFiStepExtended,
|
|
10
|
+
action?: ExecutionAction
|
|
11
|
+
) => {
|
|
12
|
+
const { subvariant, subvariantOptions } = useWidgetConfig()
|
|
13
|
+
const { t } = useTranslation()
|
|
14
|
+
const { getChainById } = useAvailableChains()
|
|
15
|
+
|
|
16
|
+
if (!step || !action) {
|
|
17
|
+
return {}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (action.status === 'FAILED') {
|
|
21
|
+
return getErrorMessage(t, getChainById, step, action)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return getActionMessage(
|
|
25
|
+
t,
|
|
26
|
+
step,
|
|
27
|
+
action.type,
|
|
28
|
+
action.status,
|
|
29
|
+
action.substatus,
|
|
30
|
+
subvariant,
|
|
31
|
+
subvariantOptions
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ChainType } from '@lifi/sdk'
|
|
2
|
+
import { useEthereumContext } from '@lifi/widget-provider'
|
|
3
|
+
import { useQuery } from '@tanstack/react-query'
|
|
4
4
|
import { useFieldValues } from '../stores/form/useFieldValues.js'
|
|
5
|
+
import { useAvailableChains } from './useAvailableChains.js'
|
|
5
6
|
|
|
6
7
|
interface AddressActivity {
|
|
7
8
|
hasActivity: boolean
|
|
@@ -9,25 +10,32 @@ interface AddressActivity {
|
|
|
9
10
|
isFetched: boolean
|
|
10
11
|
toAddress: string | undefined
|
|
11
12
|
}
|
|
12
|
-
|
|
13
13
|
export const useAddressActivity = (chainId?: number): AddressActivity => {
|
|
14
|
+
const { getChainById } = useAvailableChains()
|
|
14
15
|
const [toAddress, toChainId] = useFieldValues('toAddress', 'toChain')
|
|
16
|
+
const { getTransactionCount } = useEthereumContext()
|
|
15
17
|
|
|
16
18
|
const destinationChainId = chainId ?? toChainId
|
|
19
|
+
const toChain = getChainById(destinationChainId)
|
|
17
20
|
|
|
18
21
|
const {
|
|
19
22
|
data: transactionCount,
|
|
20
23
|
isLoading,
|
|
21
24
|
isFetched,
|
|
22
25
|
error,
|
|
23
|
-
} =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
refetchInterval: 300_000,
|
|
29
|
-
staleTime: 300_000,
|
|
26
|
+
} = useQuery({
|
|
27
|
+
queryKey: ['getTransactionCount', toAddress, destinationChainId],
|
|
28
|
+
queryFn: async () => {
|
|
29
|
+
const count = await getTransactionCount?.(destinationChainId!, toAddress!)
|
|
30
|
+
return count ?? null
|
|
30
31
|
},
|
|
32
|
+
refetchInterval: 300_000,
|
|
33
|
+
staleTime: 300_000,
|
|
34
|
+
enabled:
|
|
35
|
+
toChain?.chainType === ChainType.EVM &&
|
|
36
|
+
!!destinationChainId &&
|
|
37
|
+
!!toAddress &&
|
|
38
|
+
!!getTransactionCount,
|
|
31
39
|
})
|
|
32
40
|
|
|
33
41
|
return {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Chain, ChainType } from '@lifi/sdk'
|
|
2
2
|
import { getNameServiceAddress } from '@lifi/sdk'
|
|
3
|
+
import { useChainTypeFromAddress } from '@lifi/widget-provider'
|
|
3
4
|
import { useMutation } from '@tanstack/react-query'
|
|
4
5
|
import { useTranslation } from 'react-i18next'
|
|
5
|
-
import {
|
|
6
|
+
import { useSDKClient } from '../providers/SDKClientProvider'
|
|
6
7
|
|
|
7
8
|
export enum AddressType {
|
|
8
9
|
Address = 0,
|
|
@@ -29,6 +30,8 @@ type InvalidResponse = {
|
|
|
29
30
|
|
|
30
31
|
export const useAddressValidation = () => {
|
|
31
32
|
const { t } = useTranslation()
|
|
33
|
+
const { getChainTypeFromAddress } = useChainTypeFromAddress()
|
|
34
|
+
const sdkClient = useSDKClient()
|
|
32
35
|
|
|
33
36
|
const { mutateAsync: validateAddress, isPending: isValidating } = useMutation(
|
|
34
37
|
{
|
|
@@ -52,7 +55,11 @@ export const useAddressValidation = () => {
|
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
const address = await getNameServiceAddress(
|
|
58
|
+
const address = await getNameServiceAddress(
|
|
59
|
+
sdkClient,
|
|
60
|
+
value,
|
|
61
|
+
chainType
|
|
62
|
+
)
|
|
56
63
|
|
|
57
64
|
if (address) {
|
|
58
65
|
const _chainType = getChainTypeFromAddress(address)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ExtendedChain } from '@lifi/sdk'
|
|
2
|
-
import { ChainType,
|
|
2
|
+
import { ChainType, createClient, getChains } from '@lifi/sdk'
|
|
3
3
|
import { useQuery } from '@tanstack/react-query'
|
|
4
|
-
import { useCallback } from 'react'
|
|
4
|
+
import { useCallback, useEffect, useMemo } from 'react'
|
|
5
|
+
import { useSDKClient } from '../providers/SDKClientProvider.js'
|
|
5
6
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
7
|
+
import type { WidgetConfig } from '../types/widget.js'
|
|
6
8
|
import { getConfigItemSets, isItemAllowedForSets } from '../utils/item.js'
|
|
7
9
|
import { getQueryKey } from '../utils/queries.js'
|
|
8
10
|
|
|
@@ -18,41 +20,67 @@ const supportedChainTypes = [
|
|
|
18
20
|
ChainType.MVM,
|
|
19
21
|
]
|
|
20
22
|
|
|
21
|
-
export const useAvailableChains = (
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
export const useAvailableChains = (
|
|
24
|
+
chainTypes?: ChainType[],
|
|
25
|
+
widgetConfig?: WidgetConfig
|
|
26
|
+
) => {
|
|
27
|
+
const { chains: internalChains, keyPrefix: internalKeyPrefix } =
|
|
28
|
+
useWidgetConfig()
|
|
29
|
+
const internalClient = useSDKClient()
|
|
30
|
+
|
|
31
|
+
const externalClient = useMemo(() => {
|
|
32
|
+
if (!widgetConfig) {
|
|
33
|
+
return undefined
|
|
34
|
+
}
|
|
35
|
+
return createClient({
|
|
36
|
+
...widgetConfig.sdkConfig,
|
|
37
|
+
apiKey: widgetConfig.apiKey,
|
|
38
|
+
integrator: widgetConfig.integrator ?? window?.location.hostname,
|
|
39
|
+
})
|
|
40
|
+
}, [widgetConfig])
|
|
41
|
+
|
|
42
|
+
// Overwrite widget config if passed as param
|
|
43
|
+
const keyPrefix = widgetConfig?.keyPrefix ?? internalKeyPrefix
|
|
44
|
+
const chains = widgetConfig?.chains ?? internalChains
|
|
24
45
|
|
|
25
46
|
const { data, isLoading } = useQuery({
|
|
26
47
|
queryKey: [
|
|
27
48
|
getQueryKey('chains', keyPrefix),
|
|
28
|
-
// providers,
|
|
29
49
|
chains?.types,
|
|
30
50
|
chains?.allow,
|
|
31
51
|
chains?.deny,
|
|
32
52
|
chains?.from,
|
|
33
53
|
chains?.to,
|
|
54
|
+
!!externalClient,
|
|
34
55
|
] as const,
|
|
35
56
|
queryFn: async ({ queryKey: [, chainTypesConfig] }) => {
|
|
36
57
|
const chainsConfigSets = getConfigItemSets(
|
|
37
58
|
chainTypesConfig,
|
|
38
59
|
(chains) => new Set(chains)
|
|
39
60
|
)
|
|
40
|
-
const chainTypesRequest = supportedChainTypes
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const availableChains = await getChains({
|
|
61
|
+
const chainTypesRequest = supportedChainTypes.filter((chainType) =>
|
|
62
|
+
isItemAllowedForSets(chainType, chainsConfigSets)
|
|
63
|
+
)
|
|
64
|
+
const client = externalClient ?? internalClient
|
|
65
|
+
const availableChains = await getChains(client, {
|
|
47
66
|
chainTypes: chainTypes || chainTypesRequest,
|
|
48
67
|
})
|
|
49
|
-
|
|
68
|
+
client.setChains(availableChains)
|
|
50
69
|
return availableChains
|
|
51
70
|
},
|
|
52
71
|
refetchInterval: 300_000,
|
|
53
72
|
staleTime: 300_000,
|
|
54
73
|
})
|
|
55
74
|
|
|
75
|
+
// Ensure the current internal client always has chains, even when:
|
|
76
|
+
// - the query result came from cache (external call populated it first)
|
|
77
|
+
// - the client was recreated due to config changes (stale closure in queryFn)
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (data && !externalClient) {
|
|
80
|
+
internalClient.setChains(data)
|
|
81
|
+
}
|
|
82
|
+
}, [data, externalClient, internalClient])
|
|
83
|
+
|
|
56
84
|
const getChainById: GetChainById = useCallback(
|
|
57
85
|
(chainId?: number, chains: ExtendedChain[] | undefined = data) => {
|
|
58
86
|
if (!chainId) {
|
package/src/hooks/useExplorer.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Chain } from '@lifi/sdk'
|
|
2
|
-
import { ChainId, ChainType } from '@lifi/sdk'
|
|
3
|
-
import { isHex } from 'viem'
|
|
2
|
+
import { ChainId, ChainType, isHex } from '@lifi/sdk'
|
|
4
3
|
import { internalExplorerUrl } from '../config/constants.js'
|
|
5
4
|
import { useAvailableChains } from '../hooks/useAvailableChains.js'
|
|
6
5
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from '@lifi/sdk'
|
|
8
8
|
import { useQuery } from '@tanstack/react-query'
|
|
9
9
|
import { useMemo } from 'react'
|
|
10
|
+
import { useSDKClient } from '../providers/SDKClientProvider.js'
|
|
10
11
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
11
12
|
import type { FormType } from '../stores/form/types.js'
|
|
12
13
|
import { getConfigItemSets, isFormItemAllowed } from '../utils/item.js'
|
|
@@ -20,6 +21,7 @@ export const useFilteredTokensByBalance = (
|
|
|
20
21
|
formType?: FormType
|
|
21
22
|
) => {
|
|
22
23
|
const { tokens: configTokens } = useWidgetConfig()
|
|
24
|
+
const sdkClient = useSDKClient()
|
|
23
25
|
|
|
24
26
|
const evmAddress = useMemo(() => {
|
|
25
27
|
const evmAccount = Object.entries(accountsWithTokens ?? {}).find(
|
|
@@ -30,7 +32,7 @@ export const useFilteredTokensByBalance = (
|
|
|
30
32
|
|
|
31
33
|
const { data: existingBalances, isLoading } = useQuery({
|
|
32
34
|
queryKey: ['existing-evm-balances', evmAddress],
|
|
33
|
-
queryFn: () => getWalletBalances(evmAddress ?? ''),
|
|
35
|
+
queryFn: () => getWalletBalances(sdkClient, evmAddress ?? ''),
|
|
34
36
|
enabled: !!evmAddress,
|
|
35
37
|
refetchInterval: 30_000, // 30 seconds
|
|
36
38
|
staleTime: 30_000, // 30 seconds
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { parseUnits, type RouteExtended } from '@lifi/sdk'
|
|
2
2
|
import { useAccount } from '@lifi/wallet-management'
|
|
3
3
|
import { keepPreviousData, useQuery } from '@tanstack/react-query'
|
|
4
|
-
import {
|
|
4
|
+
import { useSDKClient } from '../providers/SDKClientProvider.js'
|
|
5
5
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
6
6
|
import { useFieldValues } from '../stores/form/useFieldValues.js'
|
|
7
7
|
import { isRouteDone } from '../stores/routes/utils.js'
|
|
@@ -18,6 +18,7 @@ export const useFromTokenSufficiency = (route?: RouteExtended) => {
|
|
|
18
18
|
'fromAmount'
|
|
19
19
|
)
|
|
20
20
|
const { keyPrefix } = useWidgetConfig()
|
|
21
|
+
const sdkClient = useSDKClient()
|
|
21
22
|
|
|
22
23
|
let chainId = fromChainId
|
|
23
24
|
let tokenAddress = fromTokenAddress
|
|
@@ -67,9 +68,11 @@ export const useFromTokenSufficiency = (route?: RouteExtended) => {
|
|
|
67
68
|
return insufficientFunds
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
const tokenBalances = await getTokenBalancesWithRetry(
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
const tokenBalances = await getTokenBalancesWithRetry(
|
|
72
|
+
sdkClient,
|
|
73
|
+
accountAddress,
|
|
74
|
+
[currentAction.fromToken]
|
|
75
|
+
)
|
|
73
76
|
|
|
74
77
|
currentTokenBalance = tokenBalances?.[0]?.amount ?? 0n
|
|
75
78
|
const insufficientFunds =
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ChainId, getGasRecommendation } from '@lifi/sdk'
|
|
2
2
|
import { useQuery } from '@tanstack/react-query'
|
|
3
|
+
import { useSDKClient } from '../providers/SDKClientProvider.js'
|
|
3
4
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
4
5
|
import { HiddenUI } from '../types/widget.js'
|
|
5
6
|
import { getQueryKey } from '../utils/queries.js'
|
|
@@ -14,6 +15,7 @@ export const useGasRecommendation = (
|
|
|
14
15
|
) => {
|
|
15
16
|
const { chains } = useAvailableChains()
|
|
16
17
|
const { keyPrefix, hiddenUI } = useWidgetConfig()
|
|
18
|
+
const sdkClient = useSDKClient()
|
|
17
19
|
|
|
18
20
|
const checkRecommendationLiFuel =
|
|
19
21
|
Boolean(toChainId) &&
|
|
@@ -39,6 +41,7 @@ export const useGasRecommendation = (
|
|
|
39
41
|
return null
|
|
40
42
|
}
|
|
41
43
|
const gasRecommendation = await getGasRecommendation(
|
|
44
|
+
sdkClient,
|
|
42
45
|
{
|
|
43
46
|
chainId: toChainId as ChainId,
|
|
44
47
|
fromChain: fromChain as ChainId,
|
|
@@ -3,6 +3,7 @@ import { ChainType } from '@lifi/sdk'
|
|
|
3
3
|
import { useAccount } from '@lifi/wallet-management'
|
|
4
4
|
import { useQuery } from '@tanstack/react-query'
|
|
5
5
|
import { useMemo } from 'react'
|
|
6
|
+
import { useSDKClient } from '../providers/SDKClientProvider.js'
|
|
6
7
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
7
8
|
import { HiddenUI } from '../types/widget.js'
|
|
8
9
|
import { getQueryKey } from '../utils/queries.js'
|
|
@@ -27,6 +28,7 @@ export const useGasSufficiency = (route?: RouteExtended) => {
|
|
|
27
28
|
chainType: ChainType.EVM,
|
|
28
29
|
})
|
|
29
30
|
const { keyPrefix, hiddenUI } = useWidgetConfig()
|
|
31
|
+
const sdkClient = useSDKClient()
|
|
30
32
|
|
|
31
33
|
const { relevantAccounts, relevantAccountsQueryKey } = useMemo(() => {
|
|
32
34
|
const chainTypes = route?.steps.reduce((acc, step) => {
|
|
@@ -102,12 +104,14 @@ export const useGasSufficiency = (route?: RouteExtended) => {
|
|
|
102
104
|
amount + BigInt(Number(gasCost.amount).toFixed(0)),
|
|
103
105
|
0n
|
|
104
106
|
)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
if (gasCostAmount > 0n) {
|
|
108
|
+
groupedGasCosts[token.chainId] = {
|
|
109
|
+
gasAmount: groupedGasCosts[token.chainId]
|
|
110
|
+
? groupedGasCosts[token.chainId].gasAmount + gasCostAmount
|
|
111
|
+
: gasCostAmount,
|
|
112
|
+
token,
|
|
113
|
+
chain: getChainById(token.chainId),
|
|
114
|
+
}
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
117
|
// Add fees paid in native tokens to gas sufficiency check (included: false)
|
|
@@ -121,12 +125,14 @@ export const useGasSufficiency = (route?: RouteExtended) => {
|
|
|
121
125
|
amount + BigInt(Number(feeCost.amount).toFixed(0)),
|
|
122
126
|
0n
|
|
123
127
|
)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
if (feeCostAmount > 0n) {
|
|
129
|
+
groupedGasCosts[token.chainId] = {
|
|
130
|
+
gasAmount: groupedGasCosts[token.chainId]
|
|
131
|
+
? groupedGasCosts[token.chainId].gasAmount + feeCostAmount
|
|
132
|
+
: feeCostAmount,
|
|
133
|
+
token,
|
|
134
|
+
chain: getChainById(token.chainId),
|
|
135
|
+
}
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
return groupedGasCosts
|
|
@@ -151,7 +157,11 @@ export const useGasSufficiency = (route?: RouteExtended) => {
|
|
|
151
157
|
.filter((gasCost) => gasCost.chain?.chainType === account.chainType)
|
|
152
158
|
.map((item) => item.token)
|
|
153
159
|
|
|
154
|
-
return getTokenBalancesWithRetry(
|
|
160
|
+
return getTokenBalancesWithRetry(
|
|
161
|
+
sdkClient,
|
|
162
|
+
account.address!,
|
|
163
|
+
relevantTokens
|
|
164
|
+
)
|
|
155
165
|
})
|
|
156
166
|
)
|
|
157
167
|
|