@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
|
@@ -4,7 +4,11 @@ import type { FC } from 'react'
|
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
5
5
|
import { useTranslation } from 'react-i18next'
|
|
6
6
|
import { useAvailableChains } from '../../hooks/useAvailableChains.js'
|
|
7
|
-
import
|
|
7
|
+
import { getTokenKey } from '../../stores/recentTokens/utils.js'
|
|
8
|
+
import { isHoistableNative } from '../../utils/tokenList.js'
|
|
9
|
+
import { createBandResolver } from '../../utils/tokenListBands.js'
|
|
10
|
+
import { RecentTokensHeader } from './RecentTokensHeader.js'
|
|
11
|
+
import { RecentTokensToggle } from './RecentTokensToggle.js'
|
|
8
12
|
import { TokenDetailsSheet } from './TokenDetailsSheet.js'
|
|
9
13
|
import { List } from './TokenList.style.js'
|
|
10
14
|
import { TokenListItem, TokenListItemSkeleton } from './TokenListItem.js'
|
|
@@ -26,6 +30,13 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
26
30
|
showPinnedTokens,
|
|
27
31
|
onClick,
|
|
28
32
|
isAllNetworks,
|
|
33
|
+
recentStartIndex = 0,
|
|
34
|
+
recentCount = 0,
|
|
35
|
+
hiddenRecentCount = 0,
|
|
36
|
+
recentExpanded = false,
|
|
37
|
+
onToggleRecent,
|
|
38
|
+
onClearRecent,
|
|
39
|
+
nativeHoisted,
|
|
29
40
|
}) => {
|
|
30
41
|
const { t } = useTranslation()
|
|
31
42
|
|
|
@@ -52,50 +63,65 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
52
63
|
[]
|
|
53
64
|
)
|
|
54
65
|
|
|
66
|
+
// Rows below the band keep their key as it changes size, so none remount.
|
|
55
67
|
const getItemKey = useCallback(
|
|
56
68
|
(index: number) => {
|
|
57
69
|
const token = tokens[index]
|
|
58
|
-
|
|
70
|
+
if (token.recent) {
|
|
71
|
+
return `recent-${token.chainId}-${token.address}`
|
|
72
|
+
}
|
|
73
|
+
const shift = index >= recentStartIndex + recentCount ? recentCount : 0
|
|
74
|
+
return `${token.chainId}-${token.address}-${index - shift}`
|
|
59
75
|
},
|
|
60
|
-
[tokens]
|
|
76
|
+
[tokens, recentStartIndex, recentCount]
|
|
61
77
|
)
|
|
62
78
|
|
|
63
|
-
const
|
|
64
|
-
(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
let size = tokenItemHeight
|
|
68
|
-
|
|
69
|
-
// Pinned tokens (always shown, even in all networks mode)
|
|
70
|
-
if (currentToken.pinned && index === 0) {
|
|
71
|
-
size += 24
|
|
72
|
-
}
|
|
73
|
-
if (previousToken?.pinned && !currentToken.pinned) {
|
|
74
|
-
size += 32
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (!showCategories) {
|
|
78
|
-
return size
|
|
79
|
-
}
|
|
79
|
+
const resolvedNativeHoisted = useMemo(
|
|
80
|
+
() => nativeHoisted ?? isHoistableNative(tokens[0]),
|
|
81
|
+
[nativeHoisted, tokens]
|
|
82
|
+
)
|
|
80
83
|
|
|
81
|
-
|
|
82
|
-
size += 24
|
|
83
|
-
}
|
|
84
|
+
const showRecentToggle = recentCount > 0 && !!onToggleRecent
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
// The band copy is on screen; its list row may be far below the fold.
|
|
87
|
+
const bandKeys = useMemo(() => {
|
|
88
|
+
if (!recentCount) {
|
|
89
|
+
return undefined
|
|
90
|
+
}
|
|
91
|
+
const keys = new Set<string>()
|
|
92
|
+
for (let i = recentStartIndex; i < recentStartIndex + recentCount; i++) {
|
|
93
|
+
const token = tokens[i]
|
|
94
|
+
if (token) {
|
|
95
|
+
keys.add(getTokenKey(token.chainId, token.address))
|
|
94
96
|
}
|
|
97
|
+
}
|
|
98
|
+
return keys
|
|
99
|
+
}, [tokens, recentStartIndex, recentCount])
|
|
100
|
+
|
|
101
|
+
const bands = useMemo(
|
|
102
|
+
() =>
|
|
103
|
+
createBandResolver(tokens, {
|
|
104
|
+
showCategories: !!showCategories,
|
|
105
|
+
showPinnedTokens: !!showPinnedTokens,
|
|
106
|
+
nativeHoisted: resolvedNativeHoisted,
|
|
107
|
+
recentStartIndex,
|
|
108
|
+
recentCount,
|
|
109
|
+
showRecentToggle,
|
|
110
|
+
}),
|
|
111
|
+
[
|
|
112
|
+
tokens,
|
|
113
|
+
showCategories,
|
|
114
|
+
showPinnedTokens,
|
|
115
|
+
resolvedNativeHoisted,
|
|
116
|
+
recentStartIndex,
|
|
117
|
+
recentCount,
|
|
118
|
+
showRecentToggle,
|
|
119
|
+
]
|
|
120
|
+
)
|
|
95
121
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
[
|
|
122
|
+
const estimateSize = useCallback(
|
|
123
|
+
(index: number) => tokenItemHeight + bands.getRowExtraHeight(index),
|
|
124
|
+
[bands]
|
|
99
125
|
)
|
|
100
126
|
|
|
101
127
|
const virtualizerConfig = useMemo(
|
|
@@ -139,69 +165,16 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
139
165
|
>
|
|
140
166
|
{getVirtualItems().map((item) => {
|
|
141
167
|
const currentToken = tokens[item.index]
|
|
142
|
-
const previousToken: TokenAmount | undefined = tokens[item.index - 1]
|
|
143
168
|
const chain = chainsSet?.get(currentToken.chainId)
|
|
144
|
-
|
|
145
|
-
const isNotPinned = !currentToken.pinned
|
|
146
|
-
const isFirstPinnedToken = currentToken.pinned && item.index === 0
|
|
147
|
-
const isTransitionFromPinned = previousToken?.pinned && isNotPinned
|
|
148
|
-
|
|
149
|
-
// Category transitions (excluding pinned)
|
|
150
|
-
const isTransitionFromFeatured =
|
|
151
|
-
previousToken?.featured && !currentToken.featured && isNotPinned
|
|
152
|
-
const isTransitionFromMyTokens =
|
|
153
|
-
previousToken?.amount && !currentToken.amount && isNotPinned
|
|
154
|
-
const isTransitionFromPopular =
|
|
155
|
-
previousToken?.popular && !currentToken.popular && isNotPinned
|
|
156
|
-
|
|
157
|
-
// Determine which category label to show
|
|
158
|
-
const startAdornmentLabel = (() => {
|
|
159
|
-
if (showPinnedTokens && isFirstPinnedToken) {
|
|
160
|
-
return t('main.pinnedTokens')
|
|
161
|
-
}
|
|
162
|
-
if (showPinnedTokens && !showCategories && isTransitionFromPinned) {
|
|
163
|
-
return t('main.allTokens')
|
|
164
|
-
}
|
|
165
|
-
if (!showCategories) {
|
|
166
|
-
return null
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (
|
|
170
|
-
(isTransitionFromPinned && currentToken.featured) ||
|
|
171
|
-
(currentToken.featured && isNotPinned && item.index === 0)
|
|
172
|
-
) {
|
|
173
|
-
return t('main.featuredTokens')
|
|
174
|
-
}
|
|
175
|
-
if (
|
|
176
|
-
(isTransitionFromFeatured || isTransitionFromPinned) &&
|
|
177
|
-
currentToken.amount &&
|
|
178
|
-
isNotPinned
|
|
179
|
-
) {
|
|
180
|
-
return t('main.myTokens')
|
|
181
|
-
}
|
|
182
|
-
if (
|
|
183
|
-
(isTransitionFromFeatured ||
|
|
184
|
-
isTransitionFromMyTokens ||
|
|
185
|
-
isTransitionFromPinned) &&
|
|
186
|
-
currentToken.popular &&
|
|
187
|
-
isNotPinned
|
|
188
|
-
) {
|
|
189
|
-
return t('main.popularTokens')
|
|
190
|
-
}
|
|
191
|
-
if (
|
|
192
|
-
isTransitionFromMyTokens ||
|
|
193
|
-
isTransitionFromFeatured ||
|
|
194
|
-
isTransitionFromPinned ||
|
|
195
|
-
isTransitionFromPopular
|
|
196
|
-
) {
|
|
197
|
-
return t('main.allTokens')
|
|
198
|
-
}
|
|
199
|
-
return null
|
|
200
|
-
})()
|
|
169
|
+
const band = bands.getRowBandLabel(item.index)
|
|
201
170
|
|
|
202
171
|
const isSelected =
|
|
203
172
|
selectedTokenAddress === currentToken.address &&
|
|
204
|
-
chainId === currentToken.chainId
|
|
173
|
+
chainId === currentToken.chainId &&
|
|
174
|
+
(!!currentToken.recent ||
|
|
175
|
+
!bandKeys?.has(
|
|
176
|
+
getTokenKey(currentToken.chainId, currentToken.address)
|
|
177
|
+
))
|
|
205
178
|
|
|
206
179
|
return (
|
|
207
180
|
<TokenListItem
|
|
@@ -211,31 +184,41 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
211
184
|
start={item.start}
|
|
212
185
|
token={currentToken}
|
|
213
186
|
chain={isAllNetworks ? chain : undefined}
|
|
187
|
+
chainName={chain?.name}
|
|
214
188
|
selected={isSelected}
|
|
215
189
|
onShowTokenDetails={onShowTokenDetails}
|
|
216
190
|
isBalanceLoading={isBalanceLoading}
|
|
217
191
|
startAdornment={
|
|
218
|
-
|
|
192
|
+
band?.kind === 'recent' ? (
|
|
193
|
+
// Unconditional: the resolver always reserves this height.
|
|
194
|
+
<RecentTokensHeader
|
|
195
|
+
atListStart={band.atListStart}
|
|
196
|
+
onClear={onClearRecent}
|
|
197
|
+
/>
|
|
198
|
+
) : band?.kind === 'text' ? (
|
|
219
199
|
<Typography
|
|
220
200
|
sx={{
|
|
221
201
|
fontSize: 14,
|
|
222
202
|
fontWeight: 600,
|
|
223
203
|
lineHeight: '16px',
|
|
224
204
|
px: 1.5,
|
|
225
|
-
pt:
|
|
226
|
-
isFirstPinnedToken ||
|
|
227
|
-
(currentToken.featured &&
|
|
228
|
-
isNotPinned &&
|
|
229
|
-
item.index === 0)
|
|
230
|
-
? 0
|
|
231
|
-
: 1,
|
|
205
|
+
pt: band.atListStart ? 0 : 1,
|
|
232
206
|
pb: 1,
|
|
233
207
|
}}
|
|
234
208
|
>
|
|
235
|
-
{
|
|
209
|
+
{t(band.key)}
|
|
236
210
|
</Typography>
|
|
237
211
|
) : null
|
|
238
212
|
}
|
|
213
|
+
endAdornment={
|
|
214
|
+
onToggleRecent && bands.isToggleRow(item.index) ? (
|
|
215
|
+
<RecentTokensToggle
|
|
216
|
+
expanded={recentExpanded}
|
|
217
|
+
hiddenCount={hiddenRecentCount}
|
|
218
|
+
onToggle={onToggleRecent}
|
|
219
|
+
/>
|
|
220
|
+
) : null
|
|
221
|
+
}
|
|
239
222
|
/>
|
|
240
223
|
)
|
|
241
224
|
})}
|
|
@@ -19,6 +19,15 @@ export interface VirtualizedTokenListProps {
|
|
|
19
19
|
onClick(tokenAddress: string, chainId?: number): void
|
|
20
20
|
selectedTokenAddress?: string
|
|
21
21
|
isAllNetworks: boolean
|
|
22
|
+
// Optional: public via shared.ts, and widget-checkout passes none of these.
|
|
23
|
+
recentStartIndex?: number
|
|
24
|
+
recentCount?: number
|
|
25
|
+
hiddenRecentCount?: number
|
|
26
|
+
recentExpanded?: boolean
|
|
27
|
+
onToggleRecent?: () => void
|
|
28
|
+
onClearRecent?: () => void
|
|
29
|
+
/** Defaults to this component's own `isHoistableNative(tokens[0])`. */
|
|
30
|
+
nativeHoisted?: boolean
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
interface TokenListItemBaseProps {
|
|
@@ -35,6 +44,8 @@ export interface TokenListItemProps extends TokenListItemBaseProps {
|
|
|
35
44
|
chainId: number
|
|
36
45
|
) => void
|
|
37
46
|
chain?: ExtendedChain
|
|
47
|
+
/** Resolved for every row, unlike `chain`, which the list passes only in all-networks mode. */
|
|
48
|
+
chainName?: string
|
|
38
49
|
isBalanceLoading?: boolean
|
|
39
50
|
startAdornment?: React.ReactNode
|
|
40
51
|
endAdornment?: React.ReactNode
|
|
@@ -50,6 +61,8 @@ export interface TokenListItemButtonProps {
|
|
|
50
61
|
onClick?(tokenAddress: string, chainId?: number): void
|
|
51
62
|
token: TokenAmount
|
|
52
63
|
chain?: ExtendedChain
|
|
64
|
+
/** Resolved for every row, unlike `chain`, which the list passes only in all-networks mode. */
|
|
65
|
+
chainName?: string
|
|
53
66
|
isBalanceLoading?: boolean
|
|
54
67
|
selected?: boolean
|
|
55
68
|
}
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget'
|
|
2
|
-
export const version = '4.
|
|
2
|
+
export const version = '4.7.0'
|
|
@@ -2,11 +2,13 @@ import type { TokenExtended } from '@lifi/sdk'
|
|
|
2
2
|
import { useMemo } from 'react'
|
|
3
3
|
import type { FormType } from '../stores/form/types.js'
|
|
4
4
|
import { usePinnedTokensStore } from '../stores/pinnedTokens/PinnedTokensStore.js'
|
|
5
|
-
import {
|
|
5
|
+
import { createSearchMatcher } from '../utils/tokenList.js'
|
|
6
6
|
import { useTokens } from './useTokens.js'
|
|
7
7
|
|
|
8
8
|
export type IsPinnedToken = (chainId: number, tokenAddress: string) => boolean
|
|
9
9
|
|
|
10
|
+
export type MatchesSearch = ReturnType<typeof createSearchMatcher>
|
|
11
|
+
|
|
10
12
|
// Balance-free core shared by useTokenList and useTokenBalances.
|
|
11
13
|
export const useDisplayedTokens = (
|
|
12
14
|
selectedChainId?: number,
|
|
@@ -17,6 +19,11 @@ export const useDisplayedTokens = (
|
|
|
17
19
|
allTokens: Record<number, TokenExtended[]> | undefined
|
|
18
20
|
displayedTokensList: TokenExtended[]
|
|
19
21
|
isPinnedToken: IsPinnedToken | undefined
|
|
22
|
+
/**
|
|
23
|
+
* The filter this search applies, built once here so every list that shows
|
|
24
|
+
* the same search — with balances or without — cannot disagree with it.
|
|
25
|
+
*/
|
|
26
|
+
matchesSearch: MatchesSearch
|
|
20
27
|
isTokensLoading: boolean
|
|
21
28
|
isSearchLoading: boolean
|
|
22
29
|
} => {
|
|
@@ -24,6 +31,7 @@ export const useDisplayedTokens = (
|
|
|
24
31
|
allTokens,
|
|
25
32
|
isLoading: isTokensLoading,
|
|
26
33
|
isSearchLoading,
|
|
34
|
+
isAddressSearch,
|
|
27
35
|
} = useTokens(formType, search, isAllNetworks ? undefined : selectedChainId)
|
|
28
36
|
|
|
29
37
|
const pinnedTokens = usePinnedTokensStore((state) => state.pinnedTokens)
|
|
@@ -51,19 +59,25 @@ export const useDisplayedTokens = (
|
|
|
51
59
|
return undefined
|
|
52
60
|
}, [isAllNetworks, selectedChainId, pinnedTokens])
|
|
53
61
|
|
|
62
|
+
const matchesSearch = useMemo<MatchesSearch>(
|
|
63
|
+
() => createSearchMatcher(search, isAddressSearch),
|
|
64
|
+
[search, isAddressSearch]
|
|
65
|
+
)
|
|
66
|
+
|
|
54
67
|
const displayedTokensList = useMemo(() => {
|
|
55
68
|
const tokensByChain = isAllNetworks
|
|
56
69
|
? Object.values(allTokens ?? {}).flat()
|
|
57
70
|
: selectedChainId
|
|
58
71
|
? allTokens?.[selectedChainId]
|
|
59
72
|
: undefined
|
|
60
|
-
return tokensByChain?.filter(
|
|
61
|
-
}, [allTokens, isAllNetworks, selectedChainId,
|
|
73
|
+
return tokensByChain?.filter(matchesSearch) ?? []
|
|
74
|
+
}, [allTokens, isAllNetworks, selectedChainId, matchesSearch])
|
|
62
75
|
|
|
63
76
|
return {
|
|
64
77
|
allTokens,
|
|
65
78
|
displayedTokensList,
|
|
66
79
|
isPinnedToken,
|
|
80
|
+
matchesSearch,
|
|
67
81
|
isTokensLoading,
|
|
68
82
|
isSearchLoading,
|
|
69
83
|
}
|
package/src/hooks/useExplorer.ts
CHANGED
|
@@ -13,6 +13,8 @@ const explorerPathOverrides: Partial<
|
|
|
13
13
|
[ChainId.SUI]: { txPath: 'txblock', addressPath: 'coin' },
|
|
14
14
|
[ChainId.LTR]: { txPath: 'logs', addressPath: 'accounts' },
|
|
15
15
|
[ChainType.TVM]: { txPath: '#/transaction', addressPath: '#/address' },
|
|
16
|
+
// StellarExpert and steexp both route accounts at /account, never /address.
|
|
17
|
+
[ChainType.STL]: { txPath: 'tx', addressPath: 'account' },
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
type TransactionLinkProps = {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RouteExtended, Token } from '@lifi/sdk'
|
|
2
|
+
import type { RefObject } from 'react'
|
|
3
|
+
import { useMemo, useRef } from 'react'
|
|
4
|
+
import type { BottomSheetBase } from '../components/BottomSheet/types.js'
|
|
5
|
+
import { getNativeTokenAddresses } from '../utils/token.js'
|
|
6
|
+
import { useAvailableChains } from './useAvailableChains.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Route tokens the screening provider flagged, and the sheet that warns about
|
|
10
|
+
* them before the transaction starts. A native token is exempt: the provider
|
|
11
|
+
* screens the native-address convention and calls it a scam on some chains.
|
|
12
|
+
*/
|
|
13
|
+
export const useFlaggedTokenGuard = (
|
|
14
|
+
route: RouteExtended
|
|
15
|
+
): {
|
|
16
|
+
flaggedTokens: Token[]
|
|
17
|
+
flaggedTokenSheetRef: RefObject<BottomSheetBase | null>
|
|
18
|
+
} => {
|
|
19
|
+
const { chains } = useAvailableChains()
|
|
20
|
+
const flaggedTokenSheetRef = useRef<BottomSheetBase>(null)
|
|
21
|
+
|
|
22
|
+
const flaggedTokens = useMemo(() => {
|
|
23
|
+
const nativeTokenAddresses = getNativeTokenAddresses(chains)
|
|
24
|
+
return [route.fromToken, route.toToken].filter(
|
|
25
|
+
(token) =>
|
|
26
|
+
token.verificationStatus === 'flagged' &&
|
|
27
|
+
nativeTokenAddresses.get(token.chainId)?.toLowerCase() !==
|
|
28
|
+
token.address.toLowerCase()
|
|
29
|
+
)
|
|
30
|
+
}, [chains, route.fromToken, route.toToken])
|
|
31
|
+
|
|
32
|
+
return { flaggedTokens, flaggedTokenSheetRef }
|
|
33
|
+
}
|
|
@@ -5,6 +5,7 @@ import { useQuery } from '@tanstack/react-query'
|
|
|
5
5
|
import { useMemo } from 'react'
|
|
6
6
|
import { useSDKClient } from '../providers/SDKClientProvider.js'
|
|
7
7
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
8
|
+
import { getSelfFundedGasAmount } from '../utils/gas.js'
|
|
8
9
|
import { getQueryKey } from '../utils/queries.js'
|
|
9
10
|
import { useAvailableChains } from './useAvailableChains.js'
|
|
10
11
|
import { useIsContractAddress } from './useIsContractAddress.js'
|
|
@@ -108,7 +109,14 @@ export const useGasSufficiency = (
|
|
|
108
109
|
amount + BigInt(Number(gasCost.amount).toFixed(0)),
|
|
109
110
|
0n
|
|
110
111
|
)
|
|
111
|
-
|
|
112
|
+
// A previous step can deliver this step's gas token (XLM bridged to
|
|
113
|
+
// Stellar), so the user does not have to hold it up front
|
|
114
|
+
const selfFundedGasAmount = getSelfFundedGasAmount(
|
|
115
|
+
route,
|
|
116
|
+
step,
|
|
117
|
+
getChainById(token.chainId)?.chainType
|
|
118
|
+
)
|
|
119
|
+
if (gasCostAmount > 0n && gasCostAmount > selfFundedGasAmount) {
|
|
112
120
|
groupedGasCosts[token.chainId] = {
|
|
113
121
|
gasAmount: groupedGasCosts[token.chainId]
|
|
114
122
|
? groupedGasCosts[token.chainId].gasAmount + gasCostAmount
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useGasRecommendation } from './useGasRecommendation.js'
|
|
2
|
+
import { useTokenAddressBalance } from './useTokenAddressBalance.js'
|
|
3
|
+
|
|
4
|
+
// Largest amount of the token the wallet can send: for the native token that is
|
|
5
|
+
// the balance less the gas the chain recommends keeping back.
|
|
6
|
+
export const useMaxSendAmount = (
|
|
7
|
+
chainId?: number,
|
|
8
|
+
tokenAddress?: string
|
|
9
|
+
): bigint => {
|
|
10
|
+
const { token, chain } = useTokenAddressBalance(chainId, tokenAddress)
|
|
11
|
+
const { data } = useGasRecommendation(chainId)
|
|
12
|
+
|
|
13
|
+
if (!token?.amount) {
|
|
14
|
+
return 0n
|
|
15
|
+
}
|
|
16
|
+
if (chain?.nativeToken.address !== tokenAddress) {
|
|
17
|
+
return token.amount
|
|
18
|
+
}
|
|
19
|
+
const reserved = BigInt(data?.recommended?.amount ?? 0)
|
|
20
|
+
return token.amount > reserved ? token.amount - reserved : token.amount
|
|
21
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
3
|
+
import type { FormType } from '../stores/form/types.js'
|
|
4
|
+
import { useRecentTokensStore } from '../stores/recentTokens/RecentTokensStore.js'
|
|
5
|
+
import type { RecentTokenId } from '../stores/recentTokens/types.js'
|
|
6
|
+
import type { TokenAmount } from '../types/token.js'
|
|
7
|
+
import type { RecentTokensResult } from '../utils/recentTokens.js'
|
|
8
|
+
import { resolveRecentRows, spliceRecentRows } from '../utils/recentTokens.js'
|
|
9
|
+
import { useChains } from './useChains.js'
|
|
10
|
+
|
|
11
|
+
export interface UseRecentTokensOptions {
|
|
12
|
+
selectedChainId?: number
|
|
13
|
+
isAllNetworks?: boolean
|
|
14
|
+
search?: string
|
|
15
|
+
expanded: boolean
|
|
16
|
+
formType: FormType
|
|
17
|
+
isTokensLoading: boolean
|
|
18
|
+
nativeHoisted: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface UseRecentTokensResult extends RecentTokensResult {
|
|
22
|
+
bandEntries: RecentTokenId[]
|
|
23
|
+
recentStartIndex: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const useRecentTokens = (
|
|
27
|
+
tokens: TokenAmount[],
|
|
28
|
+
{
|
|
29
|
+
selectedChainId,
|
|
30
|
+
isAllNetworks,
|
|
31
|
+
search,
|
|
32
|
+
expanded,
|
|
33
|
+
formType,
|
|
34
|
+
isTokensLoading,
|
|
35
|
+
nativeHoisted,
|
|
36
|
+
}: UseRecentTokensOptions
|
|
37
|
+
): UseRecentTokensResult => {
|
|
38
|
+
const { hiddenUI, tokens: configTokens } = useWidgetConfig()
|
|
39
|
+
// useChains, not useAvailableChains: only it applies chains.allow/deny.
|
|
40
|
+
const { chains } = useChains(formType)
|
|
41
|
+
const recentTokens = useRecentTokensStore((state) => state.recentTokens)
|
|
42
|
+
|
|
43
|
+
const availableChainIds = useMemo(
|
|
44
|
+
() => new Set(chains?.map((chain) => chain.id)),
|
|
45
|
+
[chains]
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
// Untrimmed, like the list layout; wait for tokens (no amber flash) and chains.
|
|
49
|
+
const disabled =
|
|
50
|
+
!!search || !!hiddenUI?.recentSearches || isTokensLoading || !chains
|
|
51
|
+
|
|
52
|
+
const resolved = useMemo(
|
|
53
|
+
() =>
|
|
54
|
+
resolveRecentRows(tokens, {
|
|
55
|
+
recentTokens,
|
|
56
|
+
availableChainIds,
|
|
57
|
+
configTokens,
|
|
58
|
+
formType,
|
|
59
|
+
selectedChainId,
|
|
60
|
+
isAllNetworks,
|
|
61
|
+
nativeHoisted,
|
|
62
|
+
disabled,
|
|
63
|
+
}),
|
|
64
|
+
[
|
|
65
|
+
tokens,
|
|
66
|
+
recentTokens,
|
|
67
|
+
availableChainIds,
|
|
68
|
+
configTokens,
|
|
69
|
+
formType,
|
|
70
|
+
selectedChainId,
|
|
71
|
+
isAllNetworks,
|
|
72
|
+
nativeHoisted,
|
|
73
|
+
disabled,
|
|
74
|
+
]
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
// Separate, so a Show more/less click redoes the slice but not the scan.
|
|
78
|
+
const spliced = useMemo(
|
|
79
|
+
() => spliceRecentRows(tokens, resolved, expanded),
|
|
80
|
+
[tokens, resolved, expanded]
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
...spliced,
|
|
85
|
+
bandEntries: resolved.bandEntries,
|
|
86
|
+
recentStartIndex: resolved.recentStartIndex,
|
|
87
|
+
}
|
|
88
|
+
}
|
package/src/hooks/useRoutes.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { defaultSlippage } from '../stores/settings/createSettingsStore.js'
|
|
|
29
29
|
import { useSettings } from '../stores/settings/useSettings.js'
|
|
30
30
|
import { WidgetEvent } from '../types/events.js'
|
|
31
31
|
import type { TokensByChain } from '../types/token.js'
|
|
32
|
+
import { isCustomReceiverBlocked } from '../utils/customReceiver.js'
|
|
32
33
|
import { getQueryKey } from '../utils/queries.js'
|
|
33
34
|
import { updateTokenInCache } from '../utils/token.js'
|
|
34
35
|
import { useChain } from './useChain.js'
|
|
@@ -177,6 +178,14 @@ export const useRoutes = ({
|
|
|
177
178
|
? hasToAddressAndChainTypeSatisfied
|
|
178
179
|
: true
|
|
179
180
|
|
|
181
|
+
// Not `effectiveFromAddress`: a quote placeholder must never match a receiver.
|
|
182
|
+
const customReceiverBlocked = isCustomReceiverBlocked({
|
|
183
|
+
fromChainType: fromChain?.chainType,
|
|
184
|
+
toChainType: toChain?.chainType,
|
|
185
|
+
toAddress,
|
|
186
|
+
signerAddress: account.address,
|
|
187
|
+
})
|
|
188
|
+
|
|
180
189
|
// toAddress might be an empty string, but we need to pass undefined if there is no value
|
|
181
190
|
const toWalletAddress = toAddress || undefined
|
|
182
191
|
|
|
@@ -197,6 +206,7 @@ export const useRoutes = ({
|
|
|
197
206
|
!Number.isNaN(slippage) &&
|
|
198
207
|
hasAmount &&
|
|
199
208
|
isToAddressSatisfied &&
|
|
209
|
+
!customReceiverBlocked &&
|
|
200
210
|
contractCallQuoteEnabled &&
|
|
201
211
|
!isBatchingSupportedLoading
|
|
202
212
|
|
|
@@ -4,12 +4,18 @@ import { useEthereumContext } from '@lifi/widget-provider'
|
|
|
4
4
|
import { useChain } from '../hooks/useChain.js'
|
|
5
5
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
6
6
|
import { useFieldValues } from '../stores/form/useFieldValues.js'
|
|
7
|
+
import {
|
|
8
|
+
isCustomReceiverBlocked,
|
|
9
|
+
isCustomReceiverUnsupported,
|
|
10
|
+
} from '../utils/customReceiver.js'
|
|
7
11
|
import { useIsContractAddress } from './useIsContractAddress.js'
|
|
8
12
|
|
|
9
13
|
export const useToAddressRequirements = (
|
|
10
14
|
route?: RouteExtended
|
|
11
15
|
): {
|
|
12
16
|
requiredToAddress: boolean
|
|
17
|
+
unsupportedToAddress: boolean
|
|
18
|
+
unsupportedReceiverBlocking: boolean
|
|
13
19
|
requiredToChainType: ChainType | undefined
|
|
14
20
|
accountNotDeployedAtDestination: boolean
|
|
15
21
|
accountDeployedAtDestination: boolean
|
|
@@ -68,11 +74,25 @@ export const useToAddressRequirements = (
|
|
|
68
74
|
fromChainId !== toChainId &&
|
|
69
75
|
!fromContractCodeHasDelegationIndicator
|
|
70
76
|
|
|
77
|
+
const unsupportedToAddress = isCustomReceiverUnsupported(
|
|
78
|
+
fromChain?.chainType,
|
|
79
|
+
toChain?.chainType
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
const unsupportedReceiverBlocking = isCustomReceiverBlocked({
|
|
83
|
+
fromChainType: fromChain?.chainType,
|
|
84
|
+
toChainType: toChain?.chainType,
|
|
85
|
+
toAddress,
|
|
86
|
+
signerAddress: fromAddress,
|
|
87
|
+
receiverRequired: requiredUI?.toAddress,
|
|
88
|
+
})
|
|
89
|
+
|
|
71
90
|
const requiredToAddress = Boolean(
|
|
72
91
|
(isDifferentChainType ||
|
|
73
92
|
isCrossChainContractAddress ||
|
|
74
93
|
requiredUI?.toAddress) &&
|
|
75
|
-
!hiddenUI?.toAddress
|
|
94
|
+
!hiddenUI?.toAddress &&
|
|
95
|
+
!unsupportedToAddress
|
|
76
96
|
)
|
|
77
97
|
|
|
78
98
|
const accountNotDeployedAtDestination = Boolean(
|
|
@@ -91,6 +111,8 @@ export const useToAddressRequirements = (
|
|
|
91
111
|
|
|
92
112
|
return {
|
|
93
113
|
requiredToAddress,
|
|
114
|
+
unsupportedToAddress,
|
|
115
|
+
unsupportedReceiverBlocking,
|
|
94
116
|
requiredToChainType: toChain?.chainType,
|
|
95
117
|
accountNotDeployedAtDestination,
|
|
96
118
|
accountDeployedAtDestination,
|