@lifi/widget 4.5.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/AppDrawer.js +2 -1
- package/dist/esm/AppDrawer.js.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.js +13 -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/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/AmountInputEndAdornment.js +2 -13
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.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/PercentageChips.js +2 -13
- package/dist/esm/components/AmountInputCard/PercentageChips.js.map +1 -1
- package/dist/esm/components/AmountInputCard/PercentageChips.style.js +1 -1
- package/dist/esm/components/AmountInputCard/PercentageChips.style.js.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/AmountInputCard/SendAmountCard.js +13 -6
- package/dist/esm/components/AmountInputCard/SendAmountCard.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/Chains/AllChainsAvatar.js +7 -1
- package/dist/esm/components/Chains/AllChainsAvatar.js.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/Dialog/Dialog.js +2 -1
- package/dist/esm/components/Dialog/Dialog.js.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/Expansion/Expansion.js +4 -3
- package/dist/esm/components/Expansion/Expansion.js.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/Header/SettingsButton.js +2 -1
- package/dist/esm/components/Header/SettingsButton.js.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/IconCircle.js +2 -1
- package/dist/esm/components/IconCircle/IconCircle.js.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/UnsupportedToAddressMessage.js +27 -0
- package/dist/esm/components/Messages/UnsupportedToAddressMessage.js.map +1 -0
- 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/Messages/WarningMessages.js +2 -0
- package/dist/esm/components/Messages/WarningMessages.js.map +1 -1
- package/dist/esm/components/Messages/useMessageQueue.js +6 -1
- package/dist/esm/components/Messages/useMessageQueue.js.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.js +2 -1
- package/dist/esm/components/RouteCard/RouteDetails.js.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/Routes/LimitOrderRoutes.js +2 -2
- package/dist/esm/components/Routes/LimitOrderRoutes.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.js +2 -2
- package/dist/esm/components/Routes/RoutesContent.js.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/SendToWallet/SendToWalletExpandButton.js +2 -2
- package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js.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/Skeleton/WidgetSkeleton.js +2 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
- package/dist/esm/components/Step/StepActions.js +18 -16
- package/dist/esm/components/Step/StepActions.js.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.js +2 -1
- package/dist/esm/components/StepActions/StepActionRow.js.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/Switch.js +1 -1
- package/dist/esm/components/Switch.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.style.js +4 -2
- package/dist/esm/components/Tabs/Tabs.style.js.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 +81 -27
- 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 +63 -37
- 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/TokenRate/TokenRate.js +2 -1
- package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js +22 -21
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js.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/timer/time.js +2 -2
- package/dist/esm/hooks/timer/time.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/useAvailableChains.js +2 -1
- package/dist/esm/hooks/useAvailableChains.js.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 +1 -2
- package/dist/esm/hooks/useExplorer.d.ts.map +1 -1
- package/dist/esm/hooks/useExplorer.js +4 -0
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useFlaggedTokenGuard.js +28 -0
- package/dist/esm/hooks/useFlaggedTokenGuard.js.map +1 -0
- package/dist/esm/hooks/useGasSufficiency.js +3 -1
- package/dist/esm/hooks/useGasSufficiency.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/useMaxSendAmount.js +15 -0
- package/dist/esm/hooks/useMaxSendAmount.js.map +1 -0
- package/dist/esm/hooks/useNavigateBack.d.ts +1 -2
- package/dist/esm/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/esm/hooks/usePacedRouteExecution.js +3 -2
- package/dist/esm/hooks/usePacedRouteExecution.js.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/useRouteExecutionMessage.js +3 -2
- package/dist/esm/hooks/useRouteExecutionMessage.js.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 +8 -1
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.d.ts +3 -2
- package/dist/esm/hooks/useToAddressRequirements.d.ts.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js +13 -1
- 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 +19 -8
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenBalancesQueries.js +29 -28
- package/dist/esm/hooks/useTokenBalancesQueries.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 +5 -6
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +40 -25
- 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/useWideVariant.js +2 -1
- package/dist/esm/hooks/useWideVariant.js.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 +7 -1
- package/dist/esm/i18n/de.json +7 -1
- package/dist/esm/i18n/en.json +16 -3
- package/dist/esm/i18n/es.json +7 -1
- package/dist/esm/i18n/fr.json +7 -1
- package/dist/esm/i18n/hi.json +7 -1
- package/dist/esm/i18n/id.json +7 -1
- package/dist/esm/i18n/it.json +7 -1
- package/dist/esm/i18n/ja.json +7 -1
- package/dist/esm/i18n/ko.json +7 -1
- package/dist/esm/i18n/pl.json +7 -1
- package/dist/esm/i18n/pt.json +7 -1
- package/dist/esm/i18n/th.json +7 -1
- package/dist/esm/i18n/tr.json +7 -1
- package/dist/esm/i18n/uk.json +7 -1
- package/dist/esm/i18n/vi.json +7 -1
- package/dist/esm/i18n/zh.json +7 -1
- package/dist/esm/pages/MainPage/MainPage.js +2 -1
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- 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/MainPage/ReviewButton.js +2 -2
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.js +2 -2
- package/dist/esm/pages/RoutesPage/RoutesPage.js.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/SelectChainPage.js +13 -12
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js.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/SelectEnabledToolsPage.js +8 -5
- package/dist/esm/pages/SelectEnabledToolsPage.js.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/SelectTokenPage/SelectTokenPage.js +2 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.js +2 -1
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.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/ContactSupportButton.js +2 -1
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.js.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/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/StartTransactionButton.js +4 -3
- package/dist/esm/pages/TransactionPage/StartTransactionButton.js.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 +63 -0
- package/dist/esm/pages/TransactionPage/TokenVerificationBottomSheet.js.map +1 -0
- 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/TransactionExecutionContent.js +19 -16
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionFailedButtons.js +38 -10
- package/dist/esm/pages/TransactionPage/TransactionFailedButtons.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionReview.js +32 -9
- 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/I18nProvider.js +37 -36
- package/dist/esm/providers/I18nProvider/I18nProvider.js.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/ThemeProvider/ThemeProvider.js +2 -1
- package/dist/esm/providers/ThemeProvider/ThemeProvider.js.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/WalletProvider/WalletProvider.js +10 -9
- package/dist/esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js +7 -3
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js.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/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/useRouteExecutionIndicator.js +4 -3
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js.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 +6 -1
- 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/compactNumberFormatter.js +1 -3
- package/dist/esm/utils/compactNumberFormatter.js.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 +12 -0
- package/dist/esm/utils/customReceiver.js.map +1 -0
- 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/gas.js +24 -0
- package/dist/esm/utils/gas.js.map +1 -0
- package/dist/esm/utils/getErrorMessage.js +0 -1
- package/dist/esm/utils/getErrorMessage.js.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/limitOrder.js +1 -1
- package/dist/esm/utils/limitOrder.js.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 +50 -7
- package/dist/esm/utils/token.js.map +1 -1
- package/dist/esm/utils/tokenList.js +54 -25
- 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/wallet.d.ts +1 -2
- package/dist/esm/utils/wallet.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/components/AmountInput/AmountInputEndAdornment.tsx +2 -21
- package/src/components/AmountInputCard/PercentageChips.tsx +2 -18
- package/src/components/AmountInputCard/ReceiveAmountCard.tsx +16 -3
- package/src/components/BottomSheet/BottomSheet.tsx +3 -0
- package/src/components/Chains/AllChainsAvatar.tsx +7 -1
- package/src/components/Messages/UnsupportedToAddressMessage.tsx +24 -0
- package/src/components/Messages/WarningMessages.tsx +3 -0
- package/src/components/Messages/useMessageQueue.ts +9 -0
- package/src/components/Routes/LimitOrderRoutes.tsx +5 -2
- package/src/components/Routes/RoutesContent.tsx +5 -2
- package/src/components/SendToWallet/SendToWalletExpandButton.tsx +2 -1
- 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 +83 -9
- package/src/components/TokenList/VirtualizedTokenList.tsx +86 -103
- package/src/components/TokenList/types.ts +13 -0
- package/src/config/version.ts +1 -1
- package/src/hooks/useAvailableChains.ts +1 -0
- package/src/hooks/useDisplayedTokens.ts +17 -3
- package/src/hooks/useExplorer.ts +2 -0
- package/src/hooks/useFlaggedTokenGuard.ts +33 -0
- package/src/hooks/useGasSufficiency.ts +9 -1
- package/src/hooks/useMaxSendAmount.ts +21 -0
- package/src/hooks/useRecentTokens.ts +88 -0
- package/src/hooks/useRoutes.ts +10 -0
- package/src/hooks/useToAddressRequirements.ts +23 -1
- package/src/hooks/useTokenBalances.ts +38 -19
- package/src/hooks/useTokenSearch.ts +6 -19
- package/src/hooks/useTokens.ts +97 -40
- package/src/pages/MainPage/ReviewButton.tsx +6 -2
- package/src/pages/RoutesPage/RoutesPage.tsx +5 -2
- package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +1 -1
- package/src/pages/TransactionPage/TokenVerificationBottomSheet.tsx +93 -0
- package/src/pages/TransactionPage/TransactionFailedButtons.tsx +62 -26
- package/src/pages/TransactionPage/TransactionReview.tsx +51 -25
- package/src/pages/TransactionPage/utils.ts +78 -0
- package/src/providers/WalletProvider/useExternalWalletProvider.ts +9 -1
- 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 +8 -3
- package/src/types/widget.ts +5 -0
- package/src/utils/address.ts +21 -0
- package/src/utils/customReceiver.ts +31 -0
- package/src/utils/gas.ts +41 -0
- package/src/utils/recentTokens.ts +187 -0
- package/src/utils/token.ts +122 -19
- package/src/utils/tokenList.ts +60 -14
- package/src/utils/tokenListBands.ts +181 -0
|
@@ -17,7 +17,8 @@ export const LimitOrderRoutes: React.FC<CardProps> = (props) => {
|
|
|
17
17
|
'selectedRouteId'
|
|
18
18
|
)
|
|
19
19
|
const { setFieldValue } = useFieldActions()
|
|
20
|
-
const { requiredToAddress } =
|
|
20
|
+
const { requiredToAddress, unsupportedReceiverBlocking } =
|
|
21
|
+
useToAddressRequirements()
|
|
21
22
|
|
|
22
23
|
const currentRoute = routes?.[0]
|
|
23
24
|
|
|
@@ -25,7 +26,9 @@ export const LimitOrderRoutes: React.FC<CardProps> = (props) => {
|
|
|
25
26
|
return null
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
const toAddressUnsatisfied =
|
|
29
|
+
const toAddressUnsatisfied =
|
|
30
|
+
currentRoute &&
|
|
31
|
+
(unsupportedReceiverBlocking || (requiredToAddress && !toAddress))
|
|
29
32
|
const allowInteraction = !toAddressUnsatisfied
|
|
30
33
|
|
|
31
34
|
const activeRouteId =
|
|
@@ -43,12 +43,15 @@ export const RoutesContent: React.NamedExoticComponent<RoutesContentProps> =
|
|
|
43
43
|
|
|
44
44
|
const { account } = useAccount({ chainType: fromChain?.chainType })
|
|
45
45
|
const [toAddress] = useFieldValues('toAddress')
|
|
46
|
-
const { requiredToAddress } =
|
|
46
|
+
const { requiredToAddress, unsupportedReceiverBlocking } =
|
|
47
|
+
useToAddressRequirements()
|
|
47
48
|
|
|
48
49
|
const currentRoute = routes?.[0]
|
|
49
50
|
|
|
50
51
|
const routeNotFound = !currentRoute && !isLoading && !isFetching
|
|
51
|
-
const toAddressUnsatisfied =
|
|
52
|
+
const toAddressUnsatisfied =
|
|
53
|
+
currentRoute &&
|
|
54
|
+
(unsupportedReceiverBlocking || (requiredToAddress && !toAddress))
|
|
52
55
|
const allowInteraction = account.isConnected && !toAddressUnsatisfied
|
|
53
56
|
|
|
54
57
|
const title =
|
|
@@ -16,12 +16,13 @@ export const SendToWalletExpandButton = (): JSX.Element => {
|
|
|
16
16
|
const { toAddresses, disabledUI, hiddenUI } = useWidgetConfig()
|
|
17
17
|
const hiddenToAddress = hiddenUI?.toAddress
|
|
18
18
|
const disabledToAddress = disabledUI?.toAddress
|
|
19
|
-
const { requiredToAddress } = useToAddressRequirements()
|
|
19
|
+
const { requiredToAddress, unsupportedToAddress } = useToAddressRequirements()
|
|
20
20
|
const [toAddressValue] = useFieldValues('toAddress')
|
|
21
21
|
|
|
22
22
|
const visible =
|
|
23
23
|
!hiddenToAddress &&
|
|
24
24
|
!disabledToAddress &&
|
|
25
|
+
!unsupportedToAddress &&
|
|
25
26
|
!toAddressValue &&
|
|
26
27
|
!requiredToAddress
|
|
27
28
|
|
|
@@ -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
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { StaticToken } from '@lifi/sdk'
|
|
2
2
|
import { ChainType } from '@lifi/sdk'
|
|
3
3
|
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'
|
|
4
|
-
import
|
|
4
|
+
import ReportRoundedIcon from '@mui/icons-material/ReportRounded'
|
|
5
|
+
import VerifiedIcon from '@mui/icons-material/Verified'
|
|
5
6
|
import {
|
|
6
7
|
Avatar,
|
|
7
8
|
Box,
|
|
@@ -18,10 +19,12 @@ import { memo, useMemo, useRef, useState } from 'react'
|
|
|
18
19
|
import { useTranslation } from 'react-i18next'
|
|
19
20
|
import { useLongPress } from '../../hooks/useLongPress.js'
|
|
20
21
|
import { formatTokenAmount, formatTokenPrice } from '../../utils/format.js'
|
|
22
|
+
import { getTokenVerificationProvider } from '../../utils/token.js'
|
|
21
23
|
import { shortenAddress } from '../../utils/wallet.js'
|
|
22
24
|
import { TokenAvatar } from '../Avatar/TokenAvatar.js'
|
|
23
25
|
import { ListItemButton } from '../ListItem/ListItemButton.js'
|
|
24
26
|
import { PinTokenButton } from './PinTokenButton.js'
|
|
27
|
+
import { RemoveRecentTokenButton } from './RemoveRecentTokenButton.js'
|
|
25
28
|
import { IconButton, ListItem } from './TokenList.style.js'
|
|
26
29
|
import type {
|
|
27
30
|
TokenListItemAvatarProps,
|
|
@@ -36,6 +39,7 @@ export const TokenListItem: React.FC<TokenListItemProps> = memo(
|
|
|
36
39
|
start,
|
|
37
40
|
token,
|
|
38
41
|
chain,
|
|
42
|
+
chainName,
|
|
39
43
|
isBalanceLoading,
|
|
40
44
|
startAdornment,
|
|
41
45
|
endAdornment,
|
|
@@ -56,6 +60,7 @@ export const TokenListItem: React.FC<TokenListItemProps> = memo(
|
|
|
56
60
|
isBalanceLoading={isBalanceLoading}
|
|
57
61
|
onClick={onClick}
|
|
58
62
|
chain={chain}
|
|
63
|
+
chainName={chainName}
|
|
59
64
|
selected={selected}
|
|
60
65
|
onShowTokenDetails={onShowTokenDetails}
|
|
61
66
|
/>
|
|
@@ -121,6 +126,7 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
121
126
|
onClick,
|
|
122
127
|
token,
|
|
123
128
|
chain,
|
|
129
|
+
chainName,
|
|
124
130
|
isBalanceLoading,
|
|
125
131
|
selected,
|
|
126
132
|
onShowTokenDetails,
|
|
@@ -166,6 +172,64 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
166
172
|
onShowTokenDetails(token.address, withoutContractAddress, token.chainId)
|
|
167
173
|
)
|
|
168
174
|
|
|
175
|
+
// The native token is badged ahead of any verdict: the provider screens
|
|
176
|
+
// the native-address convention and calls it a scam on some chains.
|
|
177
|
+
// A token the main list or the integrator vouches for needs no warning;
|
|
178
|
+
// anything else without a clean verdict keeps the amber one.
|
|
179
|
+
let verificationBadge:
|
|
180
|
+
| { Icon: typeof VerifiedIcon; color: string; title: string }
|
|
181
|
+
| undefined
|
|
182
|
+
if (token.native) {
|
|
183
|
+
verificationBadge = {
|
|
184
|
+
Icon: VerifiedIcon,
|
|
185
|
+
color: 'info.main',
|
|
186
|
+
title: chainName
|
|
187
|
+
? t('tooltip.tokenNativeOnChain', {
|
|
188
|
+
tokenSymbol: token.symbol,
|
|
189
|
+
chainName,
|
|
190
|
+
})
|
|
191
|
+
: t('tooltip.tokenNative', { tokenSymbol: token.symbol }),
|
|
192
|
+
}
|
|
193
|
+
} else if (token.verificationStatus === 'flagged') {
|
|
194
|
+
verificationBadge = {
|
|
195
|
+
Icon: ReportRoundedIcon,
|
|
196
|
+
color: 'error.main',
|
|
197
|
+
title: t('warning.message.tokenFlagged', {
|
|
198
|
+
tokenSymbol: token.symbol,
|
|
199
|
+
}),
|
|
200
|
+
}
|
|
201
|
+
} else if (token.verificationStatus === 'verified') {
|
|
202
|
+
const provider = getTokenVerificationProvider(token)
|
|
203
|
+
verificationBadge = {
|
|
204
|
+
Icon: VerifiedIcon,
|
|
205
|
+
color: 'success.main',
|
|
206
|
+
title: provider
|
|
207
|
+
? t('tooltip.tokenVerifiedByProvider', {
|
|
208
|
+
tokenSymbol: token.symbol,
|
|
209
|
+
provider,
|
|
210
|
+
})
|
|
211
|
+
: t('tooltip.tokenVerified', { tokenSymbol: token.symbol }),
|
|
212
|
+
}
|
|
213
|
+
} else if (
|
|
214
|
+
token.verificationStatus === 'unverified' &&
|
|
215
|
+
!token.listed &&
|
|
216
|
+
!token.verified
|
|
217
|
+
) {
|
|
218
|
+
verificationBadge = {
|
|
219
|
+
Icon: ReportRoundedIcon,
|
|
220
|
+
color: 'warning.main',
|
|
221
|
+
title: t('warning.message.tokenUnverifiedByProvider', {
|
|
222
|
+
tokenSymbol: token.symbol,
|
|
223
|
+
}),
|
|
224
|
+
}
|
|
225
|
+
} else if (!token.verificationStatus && !token.listed && !token.verified) {
|
|
226
|
+
verificationBadge = {
|
|
227
|
+
Icon: ReportRoundedIcon,
|
|
228
|
+
color: 'warning.main',
|
|
229
|
+
title: t('warning.message.tokenUnverified'),
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
169
233
|
return (
|
|
170
234
|
<ListItemButton
|
|
171
235
|
onClick={handleClick}
|
|
@@ -177,6 +241,8 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
177
241
|
sx={{
|
|
178
242
|
height: 60,
|
|
179
243
|
marginBottom: '4px',
|
|
244
|
+
// Not a flex-grow item: a band slot's spare height must not stretch the card.
|
|
245
|
+
flex: 'none',
|
|
180
246
|
}}
|
|
181
247
|
>
|
|
182
248
|
<ListItemAvatar>
|
|
@@ -195,17 +261,13 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
195
261
|
primary={
|
|
196
262
|
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
|
|
197
263
|
{token.symbol}
|
|
198
|
-
{
|
|
199
|
-
<Tooltip
|
|
200
|
-
|
|
201
|
-
placement="top"
|
|
202
|
-
arrow
|
|
203
|
-
>
|
|
204
|
-
<WarningRounded
|
|
264
|
+
{verificationBadge && (
|
|
265
|
+
<Tooltip title={verificationBadge.title} placement="top" arrow>
|
|
266
|
+
<verificationBadge.Icon
|
|
205
267
|
sx={{
|
|
206
268
|
display: 'flex',
|
|
207
269
|
fontSize: 16,
|
|
208
|
-
color:
|
|
270
|
+
color: verificationBadge.color,
|
|
209
271
|
cursor: 'help',
|
|
210
272
|
}}
|
|
211
273
|
/>
|
|
@@ -260,6 +322,12 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
260
322
|
chainId={token.chainId}
|
|
261
323
|
tokenAddress={token.address}
|
|
262
324
|
/>
|
|
325
|
+
{token.recent ? (
|
|
326
|
+
<RemoveRecentTokenButton
|
|
327
|
+
chainId={token.chainId}
|
|
328
|
+
tokenAddress={token.address}
|
|
329
|
+
/>
|
|
330
|
+
) : null}
|
|
263
331
|
</Box>
|
|
264
332
|
</Slide>
|
|
265
333
|
</Box>
|
|
@@ -326,6 +394,12 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
326
394
|
chainId={token.chainId}
|
|
327
395
|
tokenAddress={token.address}
|
|
328
396
|
/>
|
|
397
|
+
{token.recent ? (
|
|
398
|
+
<RemoveRecentTokenButton
|
|
399
|
+
chainId={token.chainId}
|
|
400
|
+
tokenAddress={token.address}
|
|
401
|
+
/>
|
|
402
|
+
) : null}
|
|
329
403
|
</Box>
|
|
330
404
|
</Box>
|
|
331
405
|
</Slide>
|