@lifi/widget 4.6.0 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -3
- package/dist/esm/App.d.ts +1 -2
- package/dist/esm/App.d.ts.map +1 -1
- package/dist/esm/AppDrawer.d.ts +1 -2
- package/dist/esm/AppDrawer.d.ts.map +1 -1
- package/dist/esm/components/ActionRow/ActionRow.d.ts +1 -2
- package/dist/esm/components/ActionRow/ActionRow.d.ts.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts +2 -2
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.d.ts +1 -2
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.d.ts.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts +1 -2
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts.map +1 -1
- package/dist/esm/components/AmountInputCard/ReceiveAmountCard.js +6 -2
- package/dist/esm/components/AmountInputCard/ReceiveAmountCard.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.d.ts +1 -2
- package/dist/esm/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/esm/components/Avatar/TokenAvatar.d.ts +1 -2
- package/dist/esm/components/Avatar/TokenAvatar.d.ts.map +1 -1
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.d.ts +1 -2
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.d.ts.map +1 -1
- package/dist/esm/components/BaseTransactionButton/types.d.ts +1 -2
- package/dist/esm/components/BaseTransactionButton/types.d.ts.map +1 -1
- package/dist/esm/components/BottomSheet/BottomSheet.js +1 -0
- package/dist/esm/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/esm/components/BottomSheet/types.d.ts +1 -2
- package/dist/esm/components/BottomSheet/types.d.ts.map +1 -1
- package/dist/esm/components/ButtonTertiary.d.ts +1 -2
- package/dist/esm/components/ButtonTertiary.d.ts.map +1 -1
- package/dist/esm/components/Card/CardIconButton.d.ts +1 -2
- package/dist/esm/components/Card/CardIconButton.d.ts.map +1 -1
- package/dist/esm/components/Card/CardTitle.d.ts +1 -2
- package/dist/esm/components/Card/CardTitle.d.ts.map +1 -1
- package/dist/esm/components/Card/InputCard.d.ts +1 -2
- package/dist/esm/components/Card/InputCard.d.ts.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.d.ts +1 -2
- package/dist/esm/components/ChainSelect/ChainSelect.d.ts.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts +1 -2
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/ContractComponent.d.ts +1 -2
- package/dist/esm/components/ContractComponent/ContractComponent.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts +2 -3
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.d.ts +1 -2
- package/dist/esm/components/ContractComponent/NFT/NFT.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFTBase.d.ts +1 -2
- package/dist/esm/components/ContractComponent/NFT/NFTBase.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/types.d.ts +3 -4
- package/dist/esm/components/ContractComponent/NFT/types.d.ts.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/ExecutionStatusCard.d.ts +1 -2
- package/dist/esm/components/ExecutionStatusCard/ExecutionStatusCard.d.ts.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.d.ts +1 -2
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.d.ts.map +1 -1
- package/dist/esm/components/FeeBreakdownTooltip.d.ts +1 -2
- package/dist/esm/components/FeeBreakdownTooltip.d.ts.map +1 -1
- package/dist/esm/components/IconCircle/IconCircle.d.ts +1 -2
- package/dist/esm/components/IconCircle/IconCircle.d.ts.map +1 -1
- package/dist/esm/components/IconCircle/statusIcons.d.ts +1 -2
- package/dist/esm/components/IconCircle/statusIcons.d.ts.map +1 -1
- package/dist/esm/components/IconTypography.d.ts +1 -2
- package/dist/esm/components/IconTypography.d.ts.map +1 -1
- package/dist/esm/components/ListItem/ListItemButton.d.ts +1 -2
- package/dist/esm/components/ListItem/ListItemButton.d.ts.map +1 -1
- package/dist/esm/components/Messages/WarningMessages.d.ts +1 -2
- package/dist/esm/components/Messages/WarningMessages.d.ts.map +1 -1
- package/dist/esm/components/PageContainer.d.ts +2 -3
- package/dist/esm/components/PageContainer.d.ts.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.d.ts +1 -2
- package/dist/esm/components/PoweredBy/PoweredBy.d.ts.map +1 -1
- package/dist/esm/components/ProgressToNextUpdate.d.ts +1 -2
- package/dist/esm/components/ProgressToNextUpdate.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteCard.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteCard.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteCardSkeleton.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteCardSkeleton.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteDetails.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.style.d.ts +5 -6
- package/dist/esm/components/RouteCard/RouteDetails.style.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteNotFoundCard.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteNotFoundCard.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteTokens.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteTokens.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/types.d.ts +2 -3
- package/dist/esm/components/RouteCard/types.d.ts.map +1 -1
- package/dist/esm/components/Search/SearchInput.d.ts +1 -2
- package/dist/esm/components/Search/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.d.ts +1 -2
- package/dist/esm/components/SendToWallet/SendToWalletButton.d.ts.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.d.ts +1 -2
- package/dist/esm/components/Skeleton/WidgetSkeleton.d.ts.map +1 -1
- package/dist/esm/components/StepActions/SentToWalletRow.d.ts +1 -2
- package/dist/esm/components/StepActions/SentToWalletRow.d.ts.map +1 -1
- package/dist/esm/components/StepActions/StepActionRow.style.d.ts +1 -2
- package/dist/esm/components/StepActions/StepActionRow.style.d.ts.map +1 -1
- package/dist/esm/components/StepActions/StepActionsList.d.ts +1 -2
- package/dist/esm/components/StepActions/StepActionsList.d.ts.map +1 -1
- package/dist/esm/components/StepActions/executionRows.d.ts +2 -3
- package/dist/esm/components/StepActions/executionRows.d.ts.map +1 -1
- package/dist/esm/components/Token/Token.d.ts.map +1 -1
- package/dist/esm/components/Token/Token.js +2 -4
- package/dist/esm/components/Token/Token.js.map +1 -1
- package/dist/esm/components/TokenList/RecentTokensHeader.js +44 -0
- package/dist/esm/components/TokenList/RecentTokensHeader.js.map +1 -0
- package/dist/esm/components/TokenList/RecentTokensToggle.js +36 -0
- package/dist/esm/components/TokenList/RecentTokensToggle.js.map +1 -0
- package/dist/esm/components/TokenList/RemoveRecentTokenButton.js +32 -0
- package/dist/esm/components/TokenList/RemoveRecentTokenButton.js.map +1 -0
- package/dist/esm/components/TokenList/TokenList.js +55 -5
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.js +35 -19
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/TokenNotFound.d.ts +1 -2
- package/dist/esm/components/TokenList/TokenNotFound.d.ts.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.d.ts +1 -2
- package/dist/esm/components/TokenList/VirtualizedTokenList.d.ts.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js +55 -42
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/types.d.ts +9 -2
- package/dist/esm/components/TokenList/types.d.ts.map +1 -1
- package/dist/esm/components/TokenList/useTokenSelect.d.ts +1 -2
- package/dist/esm/components/TokenList/useTokenSelect.d.ts.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.d.ts +1 -2
- package/dist/esm/components/TokenRate/TokenRate.d.ts.map +1 -1
- package/dist/esm/components/TransactionCard/TransactionCard.style.d.ts +2 -3
- package/dist/esm/components/TransactionCard/TransactionCard.style.d.ts.map +1 -1
- package/dist/esm/config/constants.d.ts +1 -2
- package/dist/esm/config/constants.d.ts.map +1 -1
- package/dist/esm/config/version.d.ts +2 -3
- package/dist/esm/config/version.d.ts.map +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/useAddressActivity.d.ts +1 -2
- package/dist/esm/hooks/useAddressActivity.d.ts.map +1 -1
- package/dist/esm/hooks/useAddressValidation.d.ts +2 -3
- package/dist/esm/hooks/useAddressValidation.d.ts.map +1 -1
- package/dist/esm/hooks/useAvailableChains.d.ts +1 -2
- package/dist/esm/hooks/useAvailableChains.d.ts.map +1 -1
- package/dist/esm/hooks/useChain.d.ts +1 -2
- package/dist/esm/hooks/useChain.d.ts.map +1 -1
- package/dist/esm/hooks/useContactSupport.d.ts +1 -2
- package/dist/esm/hooks/useContactSupport.d.ts.map +1 -1
- package/dist/esm/hooks/useDebouncedWatch.d.ts +1 -2
- package/dist/esm/hooks/useDebouncedWatch.d.ts.map +1 -1
- package/dist/esm/hooks/useDisplayedTokens.js +6 -4
- package/dist/esm/hooks/useDisplayedTokens.js.map +1 -1
- package/dist/esm/hooks/useExplorer.d.ts +2 -3
- package/dist/esm/hooks/useExplorer.d.ts.map +1 -1
- package/dist/esm/hooks/useExplorer.js +7 -3
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useHeader.d.ts +1 -2
- package/dist/esm/hooks/useHeader.d.ts.map +1 -1
- package/dist/esm/hooks/useListHeight.d.ts +1 -2
- package/dist/esm/hooks/useListHeight.d.ts.map +1 -1
- package/dist/esm/hooks/useNavigateBack.d.ts +1 -2
- package/dist/esm/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/esm/hooks/useRecentTokens.js +46 -0
- package/dist/esm/hooks/useRecentTokens.js.map +1 -0
- package/dist/esm/hooks/useRouteExecution.d.ts +1 -2
- package/dist/esm/hooks/useRouteExecution.d.ts.map +1 -1
- package/dist/esm/hooks/useRouteExecutionMessage.d.ts +1 -2
- package/dist/esm/hooks/useRouteExecutionMessage.d.ts.map +1 -1
- package/dist/esm/hooks/useRoutes.d.ts +1 -2
- package/dist/esm/hooks/useRoutes.d.ts.map +1 -1
- package/dist/esm/hooks/useRoutes.js +7 -2
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.d.ts +1 -2
- package/dist/esm/hooks/useToAddressRequirements.d.ts.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js +8 -2
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/hooks/useToken.d.ts +1 -2
- package/dist/esm/hooks/useToken.d.ts.map +1 -1
- package/dist/esm/hooks/useTokenAddressBalance.d.ts +1 -2
- package/dist/esm/hooks/useTokenAddressBalance.d.ts.map +1 -1
- package/dist/esm/hooks/useTokenBalances.d.ts +3 -2
- package/dist/esm/hooks/useTokenBalances.d.ts.map +1 -1
- package/dist/esm/hooks/useTokenBalances.js +15 -9
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenList.d.ts +1 -2
- package/dist/esm/hooks/useTokenList.d.ts.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +3 -2
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +26 -15
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.d.ts +1 -2
- package/dist/esm/hooks/useTools.d.ts.map +1 -1
- package/dist/esm/hooks/useWidgetChains.d.ts +1 -2
- package/dist/esm/hooks/useWidgetChains.d.ts.map +1 -1
- package/dist/esm/hooks/useWidgetEvents.d.ts +3 -4
- package/dist/esm/hooks/useWidgetEvents.d.ts.map +1 -1
- package/dist/esm/i18n/bn.json +4 -0
- package/dist/esm/i18n/de.json +4 -0
- package/dist/esm/i18n/en.json +4 -0
- package/dist/esm/i18n/es.json +4 -0
- package/dist/esm/i18n/fr.json +4 -0
- package/dist/esm/i18n/hi.json +4 -0
- package/dist/esm/i18n/id.json +4 -0
- package/dist/esm/i18n/it.json +4 -0
- package/dist/esm/i18n/ja.json +4 -0
- package/dist/esm/i18n/ko.json +4 -0
- package/dist/esm/i18n/pl.json +4 -0
- package/dist/esm/i18n/pt.json +4 -0
- package/dist/esm/i18n/th.json +4 -0
- package/dist/esm/i18n/tr.json +4 -0
- package/dist/esm/i18n/uk.json +4 -0
- package/dist/esm/i18n/vi.json +4 -0
- package/dist/esm/i18n/zh.json +4 -0
- package/dist/esm/pages/MainPage/MainWarningMessages.d.ts +1 -2
- package/dist/esm/pages/MainPage/MainWarningMessages.d.ts.map +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.d.ts +1 -2
- package/dist/esm/pages/SelectChainPage/SelectChainPage.d.ts.map +1 -1
- package/dist/esm/pages/SelectChainPage/types.d.ts +1 -2
- package/dist/esm/pages/SelectChainPage/types.d.ts.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -2
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.d.ts.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js +2 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js +2 -1
- package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js +2 -1
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js +2 -1
- package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.d.ts +1 -2
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.d.ts.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +2 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js +2 -1
- package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.d.ts +2 -3
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/StartTransactionButton.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/StartTransactionButton.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js +0 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenVerificationBottomSheet.js +0 -1
- package/dist/esm/pages/TransactionPage/TokenVerificationBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionFailedButtons.js +38 -12
- package/dist/esm/pages/TransactionPage/TransactionFailedButtons.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionReview.js +22 -21
- package/dist/esm/pages/TransactionPage/TransactionReview.js.map +1 -1
- package/dist/esm/pages/TransactionPage/types.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/types.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/utils.d.ts +2 -3
- package/dist/esm/pages/TransactionPage/utils.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/utils.js +23 -1
- package/dist/esm/pages/TransactionPage/utils.js.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.d.ts +1 -2
- package/dist/esm/providers/I18nProvider/I18nProvider.d.ts.map +1 -1
- package/dist/esm/providers/I18nProvider/types.d.ts +4 -5
- package/dist/esm/providers/I18nProvider/types.d.ts.map +1 -1
- package/dist/esm/providers/QueryClientProvider.d.ts +1 -2
- package/dist/esm/providers/QueryClientProvider.d.ts.map +1 -1
- package/dist/esm/providers/SDKClientProvider.d.ts +2 -3
- package/dist/esm/providers/SDKClientProvider.d.ts.map +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts +1 -2
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts.map +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts +2 -3
- package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
- package/dist/esm/providers/WidgetProvider/types.d.ts +2 -3
- package/dist/esm/providers/WidgetProvider/types.d.ts.map +1 -1
- package/dist/esm/shared.d.ts +2 -1
- package/dist/esm/shared.js +2 -1
- package/dist/esm/stores/StoreProvider.d.ts +1 -2
- package/dist/esm/stores/StoreProvider.d.ts.map +1 -1
- package/dist/esm/stores/StoreProvider.js +10 -6
- package/dist/esm/stores/StoreProvider.js.map +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts +1 -2
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts.map +1 -1
- package/dist/esm/stores/bookmarks/types.d.ts +5 -6
- package/dist/esm/stores/bookmarks/types.d.ts.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.d.ts +1 -2
- package/dist/esm/stores/chains/ChainOrderStore.d.ts.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js +11 -5
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/types.d.ts +1 -2
- package/dist/esm/stores/chains/types.d.ts.map +1 -1
- package/dist/esm/stores/form/types.d.ts +20 -21
- package/dist/esm/stores/form/types.d.ts.map +1 -1
- package/dist/esm/stores/form/useFieldActions.d.ts +1 -2
- package/dist/esm/stores/form/useFieldActions.d.ts.map +1 -1
- package/dist/esm/stores/form/useFieldValues.d.ts +1 -2
- package/dist/esm/stores/form/useFieldValues.d.ts.map +1 -1
- package/dist/esm/stores/header/types.d.ts +1 -2
- package/dist/esm/stores/header/types.d.ts.map +1 -1
- package/dist/esm/stores/header/useHeaderStore.d.ts +2 -3
- package/dist/esm/stores/header/useHeaderStore.d.ts.map +1 -1
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts +1 -2
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts.map +1 -1
- package/dist/esm/stores/recentTokens/RecentTokensStore.js +23 -0
- package/dist/esm/stores/recentTokens/RecentTokensStore.js.map +1 -0
- package/dist/esm/stores/recentTokens/createRecentTokensStore.js +54 -0
- package/dist/esm/stores/recentTokens/createRecentTokensStore.js.map +1 -0
- package/dist/esm/stores/recentTokens/utils.js +15 -0
- package/dist/esm/stores/recentTokens/utils.js.map +1 -0
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts +2 -3
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts.map +1 -1
- package/dist/esm/stores/routes/types.d.ts +3 -4
- package/dist/esm/stores/routes/types.d.ts.map +1 -1
- package/dist/esm/stores/routes/utils.d.ts +4 -5
- package/dist/esm/stores/routes/utils.d.ts.map +1 -1
- package/dist/esm/stores/settings/SettingsStore.d.ts +2 -3
- package/dist/esm/stores/settings/SettingsStore.d.ts.map +1 -1
- package/dist/esm/stores/settings/types.d.ts +2 -3
- package/dist/esm/stores/settings/types.d.ts.map +1 -1
- package/dist/esm/stores/types.d.ts +2 -3
- package/dist/esm/stores/types.d.ts.map +1 -1
- package/dist/esm/themes/azureLight.d.ts +1 -2
- package/dist/esm/themes/azureLight.d.ts.map +1 -1
- package/dist/esm/themes/jumper.d.ts +1 -2
- package/dist/esm/themes/jumper.d.ts.map +1 -1
- package/dist/esm/themes/palettes.d.ts +3 -4
- package/dist/esm/themes/palettes.d.ts.map +1 -1
- package/dist/esm/themes/types.d.ts +1 -0
- package/dist/esm/themes/watermelonLight.d.ts +1 -2
- package/dist/esm/themes/watermelonLight.d.ts.map +1 -1
- package/dist/esm/themes/windows95.d.ts +1 -2
- package/dist/esm/themes/windows95.d.ts.map +1 -1
- package/dist/esm/types/events.d.ts +13 -14
- package/dist/esm/types/events.d.ts.map +1 -1
- package/dist/esm/types/token.d.ts +4 -2
- package/dist/esm/types/token.d.ts.map +1 -1
- package/dist/esm/types/widget.d.ts +55 -51
- package/dist/esm/types/widget.d.ts.map +1 -1
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/address.js +19 -0
- package/dist/esm/utils/address.js.map +1 -0
- package/dist/esm/utils/compactNumberFormatter.d.ts +1 -2
- package/dist/esm/utils/compactNumberFormatter.d.ts.map +1 -1
- package/dist/esm/utils/converters.d.ts +1 -2
- package/dist/esm/utils/converters.d.ts.map +1 -1
- package/dist/esm/utils/currencyExtendedFormatter.d.ts +1 -2
- package/dist/esm/utils/currencyExtendedFormatter.d.ts.map +1 -1
- package/dist/esm/utils/customReceiver.js +6 -1
- package/dist/esm/utils/customReceiver.js.map +1 -1
- package/dist/esm/utils/elements.d.ts +2 -3
- package/dist/esm/utils/elements.d.ts.map +1 -1
- package/dist/esm/utils/enum.d.ts +1 -2
- package/dist/esm/utils/enum.d.ts.map +1 -1
- package/dist/esm/utils/fees.d.ts +2 -3
- package/dist/esm/utils/fees.d.ts.map +1 -1
- package/dist/esm/utils/format.d.ts +8 -9
- package/dist/esm/utils/format.d.ts.map +1 -1
- package/dist/esm/utils/getPriceImpact.d.ts +1 -2
- package/dist/esm/utils/getPriceImpact.d.ts.map +1 -1
- package/dist/esm/utils/input.d.ts +1 -2
- package/dist/esm/utils/input.d.ts.map +1 -1
- package/dist/esm/utils/navigationRoutes.d.ts +2 -3
- package/dist/esm/utils/navigationRoutes.d.ts.map +1 -1
- package/dist/esm/utils/percentFormatter.d.ts +1 -2
- package/dist/esm/utils/percentFormatter.d.ts.map +1 -1
- package/dist/esm/utils/recentTokens.js +97 -0
- package/dist/esm/utils/recentTokens.js.map +1 -0
- package/dist/esm/utils/token.js +30 -4
- package/dist/esm/utils/token.js.map +1 -1
- package/dist/esm/utils/tokenList.js +18 -6
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/dist/esm/utils/tokenListBands.js +85 -0
- package/dist/esm/utils/tokenListBands.js.map +1 -0
- package/dist/esm/utils/url.d.ts +5 -0
- package/dist/esm/utils/url.d.ts.map +1 -0
- package/dist/esm/utils/url.js +17 -0
- package/dist/esm/utils/url.js.map +1 -0
- package/dist/esm/utils/wallet.d.ts +1 -2
- package/dist/esm/utils/wallet.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/components/AmountInputCard/ReceiveAmountCard.tsx +16 -3
- package/src/components/BottomSheet/BottomSheet.tsx +3 -0
- package/src/components/Token/Token.tsx +2 -1
- package/src/components/TokenList/RecentTokensHeader.tsx +52 -0
- package/src/components/TokenList/RecentTokensToggle.tsx +45 -0
- package/src/components/TokenList/RemoveRecentTokenButton.tsx +38 -0
- package/src/components/TokenList/TokenList.tsx +92 -3
- package/src/components/TokenList/TokenListItem.tsx +15 -0
- package/src/components/TokenList/VirtualizedTokenList.tsx +84 -125
- package/src/components/TokenList/types.ts +9 -0
- package/src/config/version.ts +1 -1
- package/src/hooks/useDisplayedTokens.ts +17 -3
- package/src/hooks/useExplorer.test.tsx +106 -0
- package/src/hooks/useExplorer.ts +11 -5
- package/src/hooks/useRecentTokens.ts +88 -0
- package/src/hooks/useRoutes.ts +8 -5
- package/src/hooks/useToAddressRequirements.ts +11 -5
- package/src/hooks/useTokenBalances.ts +34 -31
- package/src/hooks/useTokenSearch.ts +5 -14
- package/src/hooks/useTokens.ts +69 -27
- package/src/pages/SendToWallet/BookmarksPage.tsx +3 -3
- package/src/pages/SendToWallet/ConnectedWalletsPage.tsx +3 -3
- package/src/pages/SendToWallet/RecentWalletsPage.tsx +3 -3
- package/src/pages/SendToWallet/SendToConfiguredWalletPage.tsx +3 -3
- package/src/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +5 -5
- package/src/pages/TransactionDetailsPage/TransferIdCard.tsx +2 -1
- package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +1 -1
- package/src/pages/TransactionPage/TokenVerificationBottomSheet.tsx +1 -1
- package/src/pages/TransactionPage/TransactionFailedButtons.tsx +62 -26
- package/src/pages/TransactionPage/TransactionReview.tsx +36 -37
- package/src/pages/TransactionPage/utils.ts +78 -0
- package/src/shared.ts +1 -0
- package/src/stores/StoreProvider.tsx +10 -7
- package/src/stores/chains/ChainOrderStore.test.tsx +298 -0
- package/src/stores/chains/ChainOrderStore.tsx +25 -6
- package/src/stores/recentTokens/RecentTokensStore.tsx +39 -0
- package/src/stores/recentTokens/createRecentTokensStore.ts +107 -0
- package/src/stores/recentTokens/types.ts +37 -0
- package/src/stores/recentTokens/utils.ts +18 -0
- package/src/types/token.ts +2 -0
- package/src/types/widget.ts +5 -0
- package/src/utils/address.ts +21 -0
- package/src/utils/customReceiver.ts +24 -0
- package/src/utils/recentTokens.ts +187 -0
- package/src/utils/token.ts +69 -10
- package/src/utils/tokenList.ts +41 -23
- package/src/utils/tokenListBands.ts +181 -0
- package/src/utils/url.ts +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@emotion/react": "^11.14.0",
|
|
54
54
|
"@emotion/styled": "^11.14.1",
|
|
55
|
-
"@lifi/sdk": "^4.
|
|
56
|
-
"@lifi/wallet-management": "4.
|
|
57
|
-
"@lifi/widget-provider": "4.
|
|
55
|
+
"@lifi/sdk": "^4.8.0",
|
|
56
|
+
"@lifi/wallet-management": "4.3.0",
|
|
57
|
+
"@lifi/widget-provider": "4.5.0",
|
|
58
58
|
"@mui/icons-material": "^9.4.0",
|
|
59
59
|
"@mui/material": "^9.4.0",
|
|
60
60
|
"@mui/system": "^9.4.0",
|
|
61
|
-
"@tanstack/react-router": "^1.170.
|
|
62
|
-
"@tanstack/react-virtual": "^3.14.
|
|
61
|
+
"@tanstack/react-router": "^1.170.38",
|
|
62
|
+
"@tanstack/react-virtual": "^3.14.13",
|
|
63
63
|
"eventemitter3": "^5.0.4",
|
|
64
|
-
"i18next": "^26.4.
|
|
64
|
+
"i18next": "^26.4.2",
|
|
65
65
|
"microdiff": "^1.6.0",
|
|
66
|
-
"motion": "^13.
|
|
67
|
-
"react-i18next": "^17.0.
|
|
66
|
+
"motion": "^13.4.0",
|
|
67
|
+
"react-i18next": "^17.0.14",
|
|
68
68
|
"react-intersection-observer": "^11.0.1",
|
|
69
69
|
"react-transition-group": "^4.4.5",
|
|
70
70
|
"zustand": "^5.0.15"
|
|
@@ -6,12 +6,14 @@ import { Box, Skeleton, Tooltip } from '@mui/material'
|
|
|
6
6
|
import { type JSX, type ReactNode, useLayoutEffect, useRef } from 'react'
|
|
7
7
|
import { useTranslation } from 'react-i18next'
|
|
8
8
|
import { useRoutes } from '../../hooks/useRoutes.js'
|
|
9
|
+
import { useToken } from '../../hooks/useToken.js'
|
|
9
10
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
10
11
|
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
11
12
|
import { useInputModeStore } from '../../stores/inputMode/useInputModeStore.js'
|
|
12
13
|
import { formatTokenAmount, formatTokenPrice } from '../../utils/format.js'
|
|
13
14
|
import { getPriceImpact } from '../../utils/getPriceImpact.js'
|
|
14
15
|
import { fitInputText } from '../../utils/input.js'
|
|
16
|
+
import { mergeFallbackToken } from '../../utils/token.js'
|
|
15
17
|
import { CardTitle } from '../Card/CardTitle.js'
|
|
16
18
|
import { ProgressToNextUpdate } from '../ProgressToNextUpdate.js'
|
|
17
19
|
import { TokenPillButton } from '../TokenPillButton/TokenPillButton.js'
|
|
@@ -128,6 +130,17 @@ export const ReceiveAmountCard: React.FC<ReceiveCardProps> = (
|
|
|
128
130
|
const priceImpact = useReceivePriceImpact(route)
|
|
129
131
|
const showPriceImpact = !hiddenUI?.routeCardPriceImpact
|
|
130
132
|
|
|
133
|
+
// Value the amount the way a quote card does, so the two sides of the screen
|
|
134
|
+
// cannot disagree: the route's own price wins, and the cache fills only a gap
|
|
135
|
+
// the route leaves — a token it could not price arrives as '0' or ''.
|
|
136
|
+
const { token: cachedToken } = useToken(
|
|
137
|
+
route?.toToken.chainId,
|
|
138
|
+
route?.toToken.address
|
|
139
|
+
)
|
|
140
|
+
const pricedToken = route
|
|
141
|
+
? mergeFallbackToken(route.toToken, cachedToken)
|
|
142
|
+
: undefined
|
|
143
|
+
|
|
131
144
|
const receiveAmount = route?.toAmount
|
|
132
145
|
? formatTokenAmount(BigInt(route.toAmount), route.toToken.decimals)
|
|
133
146
|
: undefined
|
|
@@ -135,10 +148,10 @@ export const ReceiveAmountCard: React.FC<ReceiveCardProps> = (
|
|
|
135
148
|
const showSkeleton = isFetching && !receiveAmount
|
|
136
149
|
|
|
137
150
|
const fiatValue =
|
|
138
|
-
receiveAmount &&
|
|
139
|
-
? formatTokenPrice(receiveAmount,
|
|
151
|
+
receiveAmount && pricedToken?.priceUSD
|
|
152
|
+
? formatTokenPrice(receiveAmount, pricedToken.priceUSD)
|
|
140
153
|
: 0
|
|
141
|
-
const canToggle = !!receiveAmount && !!
|
|
154
|
+
const canToggle = !!receiveAmount && !!pricedToken?.priceUSD
|
|
142
155
|
|
|
143
156
|
const mainDisplay = showFiat
|
|
144
157
|
? t('format.currency', { value: fiatValue })
|
|
@@ -27,6 +27,9 @@ export const BottomSheet = ({
|
|
|
27
27
|
const [isInert, setIsInert] = useState(!open)
|
|
28
28
|
|
|
29
29
|
const close = useCallback(() => {
|
|
30
|
+
if (!openRef.current) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
30
33
|
// Set inert first to prevent focus issues
|
|
31
34
|
setIsInert(true)
|
|
32
35
|
// Push the state update to the next event loop tick
|
|
@@ -7,6 +7,7 @@ import { useChain } from '../../hooks/useChain.js'
|
|
|
7
7
|
import { useToken } from '../../hooks/useToken.js'
|
|
8
8
|
import { formatTokenAmount, formatTokenPrice } from '../../utils/format.js'
|
|
9
9
|
import { getPriceImpact } from '../../utils/getPriceImpact.js'
|
|
10
|
+
import { mergeFallbackToken } from '../../utils/token.js'
|
|
10
11
|
import { AvatarBadgedSkeleton } from '../Avatar/Avatar.js'
|
|
11
12
|
import { SmallAvatar } from '../Avatar/SmallAvatar.js'
|
|
12
13
|
import { TokenAvatar } from '../Avatar/TokenAvatar.js'
|
|
@@ -42,7 +43,7 @@ const TokenFallback: FC<TokenProps & BoxProps> = ({
|
|
|
42
43
|
|
|
43
44
|
return (
|
|
44
45
|
<TokenBase
|
|
45
|
-
token={
|
|
46
|
+
token={mergeFallbackToken(token, chainToken)}
|
|
46
47
|
isLoading={isLoading || isLoadingToken}
|
|
47
48
|
{...other}
|
|
48
49
|
/>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material'
|
|
2
|
+
import type { JSX } from 'react'
|
|
3
|
+
import { useTranslation } from 'react-i18next'
|
|
4
|
+
import {
|
|
5
|
+
FooterText,
|
|
6
|
+
ToggleButton,
|
|
7
|
+
} from '../AmountInputCard/AmountInputCard.style.js'
|
|
8
|
+
|
|
9
|
+
interface RecentTokensHeaderProps {
|
|
10
|
+
atListStart: boolean
|
|
11
|
+
onClear?: () => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const RecentTokensHeader = ({
|
|
15
|
+
atListStart,
|
|
16
|
+
onClear,
|
|
17
|
+
}: RecentTokensHeaderProps): JSX.Element => {
|
|
18
|
+
const { t } = useTranslation()
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Box
|
|
22
|
+
sx={{
|
|
23
|
+
// ListItem is a flex container; claim the width for space-between.
|
|
24
|
+
width: '100%',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'space-between',
|
|
28
|
+
px: 1.5,
|
|
29
|
+
pt: atListStart ? 0 : 1,
|
|
30
|
+
pb: 1,
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<Typography sx={{ fontSize: 14, fontWeight: 600, lineHeight: '16px' }}>
|
|
34
|
+
{t('main.recentSearches')}
|
|
35
|
+
</Typography>
|
|
36
|
+
{onClear ? (
|
|
37
|
+
<ToggleButton
|
|
38
|
+
clickable
|
|
39
|
+
// Right-aligned, so the padding hangs past the right edge instead.
|
|
40
|
+
sx={{ px: 0.75, ml: 0, mr: -0.75 }}
|
|
41
|
+
onClick={(e) => {
|
|
42
|
+
e.stopPropagation()
|
|
43
|
+
e.currentTarget.blur()
|
|
44
|
+
onClear()
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
<FooterText>{t('button.clear')}</FooterText>
|
|
48
|
+
</ToggleButton>
|
|
49
|
+
) : null}
|
|
50
|
+
</Box>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import ExpandLessIcon from '@mui/icons-material/ExpandLess'
|
|
2
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
|
|
3
|
+
import { Box } from '@mui/material'
|
|
4
|
+
import type { JSX } from 'react'
|
|
5
|
+
import { useTranslation } from 'react-i18next'
|
|
6
|
+
import {
|
|
7
|
+
FooterText,
|
|
8
|
+
ToggleButton,
|
|
9
|
+
} from '../AmountInputCard/AmountInputCard.style.js'
|
|
10
|
+
|
|
11
|
+
interface RecentTokensToggleProps {
|
|
12
|
+
expanded: boolean
|
|
13
|
+
hiddenCount: number
|
|
14
|
+
onToggle: () => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const RecentTokensToggle = ({
|
|
18
|
+
expanded,
|
|
19
|
+
hiddenCount,
|
|
20
|
+
onToggle,
|
|
21
|
+
}: RecentTokensToggleProps): JSX.Element => {
|
|
22
|
+
const { t } = useTranslation()
|
|
23
|
+
const ExpandIcon = expanded ? ExpandLessIcon : ExpandMoreIcon
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
// 1 + 18 + 7 fills the reserved 26px: text 8px below the band, 18px above the next header.
|
|
27
|
+
<Box sx={{ width: '100%', display: 'flex', px: 1.5, pt: '1px', pb: '7px' }}>
|
|
28
|
+
<ToggleButton
|
|
29
|
+
clickable
|
|
30
|
+
onClick={(e) => {
|
|
31
|
+
e.stopPropagation()
|
|
32
|
+
e.currentTarget.blur()
|
|
33
|
+
onToggle()
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<FooterText>
|
|
37
|
+
{expanded
|
|
38
|
+
? t('button.showLess')
|
|
39
|
+
: t('button.showMore', { count: hiddenCount })}
|
|
40
|
+
</FooterText>
|
|
41
|
+
<ExpandIcon sx={{ fontSize: 14, color: 'text.secondary' }} />
|
|
42
|
+
</ToggleButton>
|
|
43
|
+
</Box>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import CloseIcon from '@mui/icons-material/Close'
|
|
2
|
+
import { IconButton } from '@mui/material'
|
|
3
|
+
import type { JSX } from 'react'
|
|
4
|
+
import { useTranslation } from 'react-i18next'
|
|
5
|
+
import { useRecentTokensStore } from '../../stores/recentTokens/RecentTokensStore.js'
|
|
6
|
+
|
|
7
|
+
interface RemoveRecentTokenButtonProps {
|
|
8
|
+
chainId: number
|
|
9
|
+
tokenAddress: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const RemoveRecentTokenButton = ({
|
|
13
|
+
chainId,
|
|
14
|
+
tokenAddress,
|
|
15
|
+
}: RemoveRecentTokenButtonProps): JSX.Element => {
|
|
16
|
+
const { t } = useTranslation()
|
|
17
|
+
// Selecting the action alone keeps this out of every store update.
|
|
18
|
+
const removeRecentToken = useRecentTokensStore(
|
|
19
|
+
(state) => state.removeRecentToken
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const handleClick = (e: React.MouseEvent) => {
|
|
23
|
+
e.stopPropagation()
|
|
24
|
+
;(e.currentTarget as HTMLElement).blur()
|
|
25
|
+
removeRecentToken(chainId, tokenAddress)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<IconButton
|
|
30
|
+
aria-label={t('button.delete')}
|
|
31
|
+
sx={{ width: 20, height: 20 }}
|
|
32
|
+
size="small"
|
|
33
|
+
onClick={handleClick}
|
|
34
|
+
>
|
|
35
|
+
<CloseIcon sx={{ fontSize: 12, color: 'text.secondary' }} />
|
|
36
|
+
</IconButton>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { Box } from '@mui/material'
|
|
2
|
-
import { type FC, memo, useEffect, useRef } from 'react'
|
|
2
|
+
import { type FC, memo, useCallback, useEffect, useRef, useState } from 'react'
|
|
3
3
|
import { useDebouncedWatch } from '../../hooks/useDebouncedWatch.js'
|
|
4
4
|
import { useListHeight } from '../../hooks/useListHeight.js'
|
|
5
5
|
import { useNavigateBack } from '../../hooks/useNavigateBack.js'
|
|
6
|
+
import { useRecentTokens } from '../../hooks/useRecentTokens.js'
|
|
6
7
|
import { useTokenBalances } from '../../hooks/useTokenBalances.js'
|
|
7
8
|
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js'
|
|
9
|
+
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
8
10
|
import { useChainOrderStore } from '../../stores/chains/ChainOrderStore.js'
|
|
9
11
|
import { FormKeyHelper } from '../../stores/form/types.js'
|
|
10
12
|
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
13
|
+
import { useRecentTokensStore } from '../../stores/recentTokens/RecentTokensStore.js'
|
|
14
|
+
import { toRecentToken } from '../../stores/recentTokens/utils.js'
|
|
11
15
|
import { WidgetEvent } from '../../types/events.js'
|
|
16
|
+
import { collapsedRecentCount } from '../../utils/recentTokens.js'
|
|
12
17
|
import { TokenNotFound } from './TokenNotFound.js'
|
|
13
18
|
import type { TokenListProps } from './types.js'
|
|
14
19
|
import { useTokenSelect } from './useTokenSelect.js'
|
|
15
20
|
import { VirtualizedTokenList } from './VirtualizedTokenList.js'
|
|
16
21
|
|
|
17
22
|
export const TokenList: FC<TokenListProps> = memo(({ formType, headerRef }) => {
|
|
23
|
+
const { hiddenUI } = useWidgetConfig()
|
|
18
24
|
const navigateBack = useNavigateBack()
|
|
19
25
|
const listParentRef = useRef<HTMLUListElement | null>(null)
|
|
20
26
|
const { listHeight } = useListHeight({
|
|
@@ -45,6 +51,7 @@ export const TokenList: FC<TokenListProps> = memo(({ formType, headerRef }) => {
|
|
|
45
51
|
isTokensLoading,
|
|
46
52
|
isBalanceLoading,
|
|
47
53
|
isSearchLoading,
|
|
54
|
+
nativeHoisted,
|
|
48
55
|
} = useTokenBalances(
|
|
49
56
|
selectedChainId,
|
|
50
57
|
formType,
|
|
@@ -52,7 +59,78 @@ export const TokenList: FC<TokenListProps> = memo(({ formType, headerRef }) => {
|
|
|
52
59
|
tokenSearchFilter
|
|
53
60
|
)
|
|
54
61
|
|
|
55
|
-
|
|
62
|
+
// Keyed by scope, so a chain switch collapses the band in the same render.
|
|
63
|
+
const recentScope = `${selectedChainId}-${!!isAllNetworks}`
|
|
64
|
+
const [expandedScope, setExpandedScope] = useState<string>()
|
|
65
|
+
const recentExpanded = expandedScope === recentScope
|
|
66
|
+
|
|
67
|
+
const {
|
|
68
|
+
tokens: tokensWithRecent,
|
|
69
|
+
bandEntries,
|
|
70
|
+
recentStartIndex,
|
|
71
|
+
recentCount,
|
|
72
|
+
totalRecentCount,
|
|
73
|
+
} = useRecentTokens(tokens, {
|
|
74
|
+
selectedChainId,
|
|
75
|
+
isAllNetworks,
|
|
76
|
+
search: tokenSearchFilter,
|
|
77
|
+
expanded: recentExpanded,
|
|
78
|
+
formType,
|
|
79
|
+
isTokensLoading,
|
|
80
|
+
nativeHoisted: !!nativeHoisted,
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const selectToken = useTokenSelect(formType, navigateBack)
|
|
84
|
+
const [addRecentToken, isRecentToken, clearRecentTokens] =
|
|
85
|
+
useRecentTokensStore((state) => [
|
|
86
|
+
state.addRecentToken,
|
|
87
|
+
state.isRecentToken,
|
|
88
|
+
state.clearRecentTokens,
|
|
89
|
+
])
|
|
90
|
+
|
|
91
|
+
// Refs keep onClick stable across refetches and keystrokes for memoized rows.
|
|
92
|
+
const tokensRef = useRef(tokensWithRecent)
|
|
93
|
+
tokensRef.current = tokensWithRecent
|
|
94
|
+
const searchRef = useRef(tokenSearchFilter)
|
|
95
|
+
searchRef.current = tokenSearchFilter
|
|
96
|
+
|
|
97
|
+
const handleTokenClick = useCallback(
|
|
98
|
+
(address: string, chainId?: number) => {
|
|
99
|
+
if (
|
|
100
|
+
chainId &&
|
|
101
|
+
!hiddenUI?.recentSearches &&
|
|
102
|
+
(searchRef.current?.trim() || isRecentToken(chainId, address))
|
|
103
|
+
) {
|
|
104
|
+
// A band row is either a copy of the live row or has no live row.
|
|
105
|
+
const lower = address.toLowerCase()
|
|
106
|
+
const token = tokensRef.current.find(
|
|
107
|
+
(item) =>
|
|
108
|
+
item.chainId === chainId && item.address.toLowerCase() === lower
|
|
109
|
+
)
|
|
110
|
+
if (token) {
|
|
111
|
+
addRecentToken(toRecentToken(token))
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
selectToken(address, chainId)
|
|
115
|
+
},
|
|
116
|
+
[addRecentToken, isRecentToken, selectToken, hiddenUI?.recentSearches]
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
const toggleRecentExpanded = useCallback(
|
|
120
|
+
() =>
|
|
121
|
+
setExpandedScope((scope) =>
|
|
122
|
+
scope === recentScope ? undefined : recentScope
|
|
123
|
+
),
|
|
124
|
+
[recentScope]
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
// The band filters on chain, config and pins; Clear takes its exact entries.
|
|
128
|
+
const bandEntriesRef = useRef(bandEntries)
|
|
129
|
+
bandEntriesRef.current = bandEntries
|
|
130
|
+
const clearRecentBand = useCallback(
|
|
131
|
+
() => clearRecentTokens(bandEntriesRef.current),
|
|
132
|
+
[clearRecentTokens]
|
|
133
|
+
)
|
|
56
134
|
|
|
57
135
|
const showCategories = withCategories && !tokenSearchFilter && !isAllNetworks
|
|
58
136
|
|
|
@@ -72,7 +150,7 @@ export const TokenList: FC<TokenListProps> = memo(({ formType, headerRef }) => {
|
|
|
72
150
|
<TokenNotFound formType={formType} />
|
|
73
151
|
) : null}
|
|
74
152
|
<VirtualizedTokenList
|
|
75
|
-
tokens={
|
|
153
|
+
tokens={tokensWithRecent}
|
|
76
154
|
scrollElementRef={listParentRef}
|
|
77
155
|
chainId={selectedChainId}
|
|
78
156
|
isLoading={isTokensLoading || isSearchLoading}
|
|
@@ -82,6 +160,17 @@ export const TokenList: FC<TokenListProps> = memo(({ formType, headerRef }) => {
|
|
|
82
160
|
onClick={handleTokenClick}
|
|
83
161
|
selectedTokenAddress={selectedTokenAddress}
|
|
84
162
|
isAllNetworks={isAllNetworks}
|
|
163
|
+
nativeHoisted={!!nativeHoisted}
|
|
164
|
+
recentStartIndex={recentStartIndex}
|
|
165
|
+
recentCount={recentCount}
|
|
166
|
+
hiddenRecentCount={totalRecentCount - recentCount}
|
|
167
|
+
recentExpanded={recentExpanded}
|
|
168
|
+
onToggleRecent={
|
|
169
|
+
totalRecentCount > collapsedRecentCount
|
|
170
|
+
? toggleRecentExpanded
|
|
171
|
+
: undefined
|
|
172
|
+
}
|
|
173
|
+
onClearRecent={clearRecentBand}
|
|
85
174
|
/>
|
|
86
175
|
</Box>
|
|
87
176
|
)
|
|
@@ -24,6 +24,7 @@ import { shortenAddress } from '../../utils/wallet.js'
|
|
|
24
24
|
import { TokenAvatar } from '../Avatar/TokenAvatar.js'
|
|
25
25
|
import { ListItemButton } from '../ListItem/ListItemButton.js'
|
|
26
26
|
import { PinTokenButton } from './PinTokenButton.js'
|
|
27
|
+
import { RemoveRecentTokenButton } from './RemoveRecentTokenButton.js'
|
|
27
28
|
import { IconButton, ListItem } from './TokenList.style.js'
|
|
28
29
|
import type {
|
|
29
30
|
TokenListItemAvatarProps,
|
|
@@ -240,6 +241,8 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
240
241
|
sx={{
|
|
241
242
|
height: 60,
|
|
242
243
|
marginBottom: '4px',
|
|
244
|
+
// Not a flex-grow item: a band slot's spare height must not stretch the card.
|
|
245
|
+
flex: 'none',
|
|
243
246
|
}}
|
|
244
247
|
>
|
|
245
248
|
<ListItemAvatar>
|
|
@@ -319,6 +322,12 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
319
322
|
chainId={token.chainId}
|
|
320
323
|
tokenAddress={token.address}
|
|
321
324
|
/>
|
|
325
|
+
{token.recent ? (
|
|
326
|
+
<RemoveRecentTokenButton
|
|
327
|
+
chainId={token.chainId}
|
|
328
|
+
tokenAddress={token.address}
|
|
329
|
+
/>
|
|
330
|
+
) : null}
|
|
322
331
|
</Box>
|
|
323
332
|
</Slide>
|
|
324
333
|
</Box>
|
|
@@ -385,6 +394,12 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
385
394
|
chainId={token.chainId}
|
|
386
395
|
tokenAddress={token.address}
|
|
387
396
|
/>
|
|
397
|
+
{token.recent ? (
|
|
398
|
+
<RemoveRecentTokenButton
|
|
399
|
+
chainId={token.chainId}
|
|
400
|
+
tokenAddress={token.address}
|
|
401
|
+
/>
|
|
402
|
+
) : null}
|
|
388
403
|
</Box>
|
|
389
404
|
</Box>
|
|
390
405
|
</Slide>
|