@lifi/widget 3.29.1 → 3.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/esm/AppProvider.d.ts +0 -1
- package/dist/esm/AppProvider.js +1 -1
- package/dist/esm/AppProvider.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.d.ts +0 -9
- package/dist/esm/components/AmountInput/AmountInput.js +1 -1
- package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +0 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.js +1 -6
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.d.ts +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js +3 -2
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.d.ts +1 -7
- package/dist/esm/components/AmountInput/PriceFormHelperText.js +4 -3
- package/dist/esm/components/AmountInput/PriceFormHelperText.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.d.ts +0 -4
- package/dist/esm/components/Avatar/Avatar.js +1 -1
- package/dist/esm/components/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/Avatar/TokenAvatar.d.ts +0 -15
- package/dist/esm/components/Avatar/TokenAvatar.js +2 -2
- package/dist/esm/components/Avatar/TokenAvatar.js.map +1 -1
- package/dist/esm/components/Card/CardButton.style.d.ts +0 -1
- package/dist/esm/components/Card/CardButton.style.js +0 -7
- package/dist/esm/components/Card/CardButton.style.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js +35 -18
- package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/dist/esm/components/ChainSelect/useChainSelect.d.ts +1 -1
- package/dist/esm/components/ChainSelect/useChainSelect.js +3 -3
- package/dist/esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/dist/esm/components/Chains/AllChainsAvatar.d.ts +7 -0
- package/dist/esm/components/Chains/AllChainsAvatar.js +77 -0
- package/dist/esm/components/Chains/AllChainsAvatar.js.map +1 -0
- package/dist/esm/components/Chains/ChainList.d.ts +2 -1
- package/dist/esm/components/Chains/ChainList.js +2 -2
- package/dist/esm/components/Chains/ChainList.js.map +1 -1
- package/dist/esm/components/Chains/ChainSearchInput.js +2 -2
- package/dist/esm/components/Chains/ChainSearchInput.js.map +1 -1
- package/dist/esm/components/Chains/SelectChainContent.js +1 -1
- package/dist/esm/components/Chains/SelectChainContent.js.map +1 -1
- package/dist/esm/components/Chains/VirtualizedChainList.d.ts +2 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js +42 -10
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
- package/dist/esm/components/FeeBreakdownTooltip.d.ts +2 -3
- package/dist/esm/components/FeeBreakdownTooltip.js +1 -1
- package/dist/esm/components/FeeBreakdownTooltip.js.map +1 -1
- package/dist/esm/components/Header/Header.d.ts +1 -2
- package/dist/esm/components/Header/Header.js +1 -1
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/WalletHeader.d.ts +0 -1
- package/dist/esm/components/Header/WalletHeader.js +1 -1
- package/dist/esm/components/Header/WalletHeader.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCardEssentials.js +1 -1
- package/dist/esm/components/RouteCard/RouteCardEssentials.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/StepActions/StepActions.d.ts +1 -10
- package/dist/esm/components/StepActions/StepActions.js +6 -6
- package/dist/esm/components/StepActions/StepActions.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.style.d.ts +0 -1
- package/dist/esm/components/Tabs/Tabs.style.js +1 -1
- package/dist/esm/components/Tabs/Tabs.style.js.map +1 -1
- package/dist/esm/components/Timer/TimerContent.js +1 -2
- package/dist/esm/components/Timer/TimerContent.js.map +1 -1
- package/dist/esm/components/Token/Token.d.ts +0 -2
- package/dist/esm/components/Token/Token.js +2 -2
- package/dist/esm/components/Token/Token.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheet.d.ts +1 -5
- package/dist/esm/components/TokenList/TokenDetailsSheet.js +4 -2
- package/dist/esm/components/TokenList/TokenDetailsSheet.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js +2 -2
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.js +11 -53
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.d.ts +1 -4
- package/dist/esm/components/TokenList/TokenListItem.js +30 -26
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js +56 -37
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/types.d.ts +8 -11
- package/dist/esm/components/TokenList/useTokenSelect.d.ts +0 -4
- package/dist/esm/components/TokenList/useTokenSelect.js +3 -4
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js +1 -3
- package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
- package/dist/esm/components/TransactionDetails.js +2 -2
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/hooks/timer/time.d.ts +0 -8
- package/dist/esm/hooks/timer/time.js.map +1 -1
- package/dist/esm/hooks/timer/useTimer.d.ts +3 -2
- package/dist/esm/hooks/useAccountsBalancesData.d.ts +6 -0
- package/dist/esm/hooks/useAccountsBalancesData.js +64 -0
- package/dist/esm/hooks/useAccountsBalancesData.js.map +1 -0
- package/dist/esm/hooks/useAvailableChains.d.ts +2 -1
- package/dist/esm/hooks/useChain.d.ts +1 -1
- package/dist/esm/hooks/useChains.d.ts +1 -1
- package/dist/esm/hooks/useExplorer.d.ts +2 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.d.ts +9 -0
- package/dist/esm/hooks/useFilteredByTokenBalances.js +78 -0
- package/dist/esm/hooks/useFilteredByTokenBalances.js.map +1 -0
- package/dist/esm/hooks/useListHeight.d.ts +0 -3
- package/dist/esm/hooks/useListHeight.js +2 -3
- package/dist/esm/hooks/useListHeight.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +2 -2
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressAutoPopulate.d.ts +2 -1
- package/dist/esm/hooks/useToken.d.ts +2 -2
- package/dist/esm/hooks/useToken.js +13 -10
- package/dist/esm/hooks/useToken.js.map +1 -1
- package/dist/esm/hooks/useTokenAddressBalance.d.ts +3 -3
- package/dist/esm/hooks/useTokenAddressBalance.js +10 -14
- package/dist/esm/hooks/useTokenAddressBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.d.ts +6 -9
- package/dist/esm/hooks/useTokenBalances.js +57 -72
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenBalancesQueries.d.ts +11 -0
- package/dist/esm/hooks/useTokenBalancesQueries.js +74 -0
- package/dist/esm/hooks/useTokenBalancesQueries.js.map +1 -0
- package/dist/esm/hooks/useTokenSearch.js +3 -3
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.d.ts +6 -6
- package/dist/esm/hooks/useTokens.js +98 -69
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/i18n/bn.json +3 -3
- package/dist/esm/i18n/de.json +3 -3
- package/dist/esm/i18n/en.json +3 -3
- package/dist/esm/i18n/es.json +3 -3
- package/dist/esm/i18n/fr.json +3 -3
- package/dist/esm/i18n/hi.json +3 -3
- package/dist/esm/i18n/id.json +3 -3
- package/dist/esm/i18n/it.json +3 -3
- package/dist/esm/i18n/ja.json +3 -3
- package/dist/esm/i18n/ko.json +3 -3
- package/dist/esm/i18n/pl.json +3 -3
- package/dist/esm/i18n/pt.json +5 -5
- package/dist/esm/i18n/th.json +3 -3
- package/dist/esm/i18n/tr.json +3 -3
- package/dist/esm/i18n/uk.json +3 -3
- package/dist/esm/i18n/vi.json +3 -3
- package/dist/esm/i18n/zh.json +3 -3
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js +6 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js +2 -4
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +27 -17
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts +2 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.d.ts +0 -5
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
- package/dist/esm/providers/I18nProvider/types.d.ts +4 -3
- package/dist/esm/providers/WalletProvider/EVMProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/EVMProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/EVMProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/SVMProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SVMProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/SVMProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/SuiProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SuiProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/SuiProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/UTXOProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/UTXOProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/UTXOProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts +1 -2
- package/dist/esm/stores/bookmarks/BookmarkStore.js +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.js.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.d.ts +0 -5
- package/dist/esm/stores/chains/ChainOrderStore.js +2 -2
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/createChainOrderStore.d.ts +3 -2
- package/dist/esm/stores/chains/createChainOrderStore.js +13 -8
- package/dist/esm/stores/chains/createChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/types.d.ts +4 -1
- package/dist/esm/stores/chains/useChainOrder.js +5 -1
- package/dist/esm/stores/chains/useChainOrder.js.map +1 -1
- package/dist/esm/stores/header/types.d.ts +2 -1
- package/dist/esm/stores/header/useHeaderStore.d.ts +1 -4
- package/dist/esm/stores/header/useHeaderStore.js +3 -3
- package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts +1 -1
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts +2 -2
- package/dist/esm/stores/routes/RouteExecutionStore.js +1 -1
- package/dist/esm/stores/routes/RouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/settings/types.d.ts +3 -3
- package/dist/esm/stores/settings/types.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsStore.d.ts +1 -2
- package/dist/esm/stores/settings/useSettingsStore.js +1 -1
- package/dist/esm/stores/settings/useSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/useSplitSubvariantStore.d.ts +1 -4
- package/dist/esm/stores/settings/useSplitSubvariantStore.js +3 -3
- package/dist/esm/stores/settings/useSplitSubvariantStore.js.map +1 -1
- package/dist/esm/types/events.d.ts +0 -4
- package/dist/esm/types/events.js +0 -4
- package/dist/esm/types/events.js.map +1 -1
- package/dist/esm/types/token.d.ts +7 -2
- package/dist/esm/utils/chainType.d.ts +1 -0
- package/dist/esm/utils/chainType.js +2 -0
- package/dist/esm/utils/chainType.js.map +1 -1
- package/dist/esm/utils/fees.d.ts +1 -4
- package/dist/esm/utils/fees.js +3 -3
- package/dist/esm/utils/fees.js.map +1 -1
- package/dist/esm/utils/format.js +1 -1
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/navigationRoutes.d.ts +2 -1
- package/dist/esm/utils/token.d.ts +8 -0
- package/dist/esm/utils/token.js +29 -0
- package/dist/esm/utils/token.js.map +1 -0
- package/dist/esm/utils/tokenList.d.ts +9 -0
- package/dist/esm/utils/tokenList.js +106 -0
- package/dist/esm/utils/tokenList.js.map +1 -0
- package/package.json +10 -10
- package/package.json.tmp +9 -9
- package/src/AppProvider.tsx +1 -1
- package/src/components/AmountInput/AmountInput.tsx +1 -1
- package/src/components/AmountInput/AmountInputAdornment.style.tsx +1 -7
- package/src/components/AmountInput/AmountInputEndAdornment.tsx +3 -2
- package/src/components/AmountInput/PriceFormHelperText.tsx +4 -3
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Avatar/TokenAvatar.tsx +2 -2
- package/src/components/Card/CardButton.style.tsx +0 -8
- package/src/components/ChainSelect/ChainSelect.tsx +112 -40
- package/src/components/ChainSelect/useChainSelect.ts +3 -3
- package/src/components/Chains/AllChainsAvatar.tsx +113 -0
- package/src/components/Chains/ChainList.tsx +3 -0
- package/src/components/Chains/ChainSearchInput.tsx +2 -2
- package/src/components/Chains/SelectChainContent.tsx +1 -0
- package/src/components/Chains/VirtualizedChainList.tsx +80 -12
- package/src/components/FeeBreakdownTooltip.tsx +2 -5
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Header/WalletHeader.tsx +1 -1
- package/src/components/RouteCard/RouteCardEssentials.tsx +1 -1
- package/src/components/SendToWallet/SendToWalletButton.tsx +0 -1
- package/src/components/StepActions/StepActions.tsx +6 -6
- package/src/components/Tabs/Tabs.style.tsx +1 -1
- package/src/components/Timer/TimerContent.tsx +1 -2
- package/src/components/Token/Token.tsx +2 -2
- package/src/components/TokenList/TokenDetailsSheet.tsx +4 -9
- package/src/components/TokenList/TokenDetailsSheetContent.tsx +2 -6
- package/src/components/TokenList/TokenList.tsx +57 -129
- package/src/components/TokenList/TokenListItem.tsx +177 -154
- package/src/components/TokenList/VirtualizedTokenList.tsx +88 -48
- package/src/components/TokenList/types.ts +15 -11
- package/src/components/TokenList/useTokenSelect.ts +3 -9
- package/src/components/TokenRate/TokenRate.tsx +0 -1
- package/src/components/TransactionDetails.tsx +2 -3
- package/src/config/version.ts +1 -1
- package/src/hooks/timer/time.ts +0 -10
- package/src/hooks/timer/useTimer.ts +2 -2
- package/src/hooks/useAccountsBalancesData.ts +101 -0
- package/src/hooks/useAvailableChains.ts +1 -1
- package/src/hooks/useExplorer.ts +1 -1
- package/src/hooks/useFilteredByTokenBalances.ts +130 -0
- package/src/hooks/useListHeight.ts +2 -3
- package/src/hooks/useRoutes.ts +4 -2
- package/src/hooks/useToAddressAutoPopulate.ts +1 -1
- package/src/hooks/useToken.ts +31 -13
- package/src/hooks/useTokenAddressBalance.ts +15 -20
- package/src/hooks/useTokenBalances.ts +81 -80
- package/src/hooks/useTokenBalancesQueries.ts +94 -0
- package/src/hooks/useTokenSearch.ts +4 -7
- package/src/hooks/useTokens.ts +153 -87
- package/src/i18n/bn.json +3 -3
- package/src/i18n/de.json +3 -3
- package/src/i18n/en.json +3 -3
- package/src/i18n/es.json +3 -3
- package/src/i18n/fr.json +3 -3
- package/src/i18n/hi.json +3 -3
- package/src/i18n/id.json +3 -3
- package/src/i18n/it.json +3 -3
- package/src/i18n/ja.json +3 -3
- package/src/i18n/ko.json +3 -3
- package/src/i18n/pl.json +3 -3
- package/src/i18n/pt.json +5 -5
- package/src/i18n/th.json +3 -3
- package/src/i18n/tr.json +3 -3
- package/src/i18n/uk.json +3 -3
- package/src/i18n/vi.json +3 -3
- package/src/i18n/zh.json +3 -3
- package/src/pages/SelectTokenPage/SearchTokenInput.tsx +5 -0
- package/src/pages/SelectTokenPage/SelectTokenPage.tsx +7 -13
- package/src/pages/SettingsPage/SettingsCard/SettingCardExpandable.tsx +0 -1
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +33 -30
- package/src/pages/TransactionPage/RouteTracker.tsx +1 -1
- package/src/pages/TransactionPage/StatusBottomSheet.tsx +5 -3
- package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +1 -1
- package/src/providers/I18nProvider/types.ts +3 -3
- package/src/providers/WalletProvider/EVMProvider.tsx +1 -1
- package/src/providers/WalletProvider/SVMProvider.tsx +1 -1
- package/src/providers/WalletProvider/SuiProvider.tsx +1 -1
- package/src/providers/WalletProvider/UTXOProvider.tsx +1 -1
- package/src/providers/WalletProvider/WalletProvider.tsx +1 -1
- package/src/stores/bookmarks/BookmarkStore.tsx +1 -1
- package/src/stores/chains/ChainOrderStore.tsx +3 -7
- package/src/stores/chains/createChainOrderStore.ts +17 -8
- package/src/stores/chains/types.ts +3 -1
- package/src/stores/chains/useChainOrder.ts +5 -1
- package/src/stores/header/types.ts +1 -1
- package/src/stores/header/useHeaderStore.tsx +3 -3
- package/src/stores/inputMode/useInputModeStore.ts +1 -1
- package/src/stores/routes/RouteExecutionStore.tsx +4 -3
- package/src/stores/settings/types.ts +2 -6
- package/src/stores/settings/useSettingsStore.ts +1 -1
- package/src/stores/settings/useSplitSubvariantStore.tsx +5 -4
- package/src/types/events.ts +0 -4
- package/src/types/token.ts +11 -2
- package/src/utils/chainType.ts +2 -0
- package/src/utils/fees.ts +3 -3
- package/src/utils/format.ts +2 -1
- package/src/utils/navigationRoutes.ts +1 -1
- package/src/utils/token.ts +67 -0
- package/src/utils/tokenList.ts +172 -0
- package/dist/esm/AppDrawer.style.d.ts +0 -1
- package/dist/esm/AppDrawer.style.js +0 -12
- package/dist/esm/AppDrawer.style.js.map +0 -1
- package/dist/esm/components/Select.d.ts +0 -3
- package/dist/esm/components/Select.js +0 -35
- package/dist/esm/components/Select.js.map +0 -1
- package/dist/esm/components/StepActions/StepFees.d.ts +0 -5
- package/dist/esm/components/StepActions/StepFees.js +0 -32
- package/dist/esm/components/StepActions/StepFees.js.map +0 -1
- package/dist/esm/components/TokenList/utils.d.ts +0 -2
- package/dist/esm/components/TokenList/utils.js +0 -35
- package/dist/esm/components/TokenList/utils.js.map +0 -1
- package/dist/esm/pages/MainPage/MainPage.style.d.ts +0 -1
- package/dist/esm/pages/MainPage/MainPage.style.js +0 -8
- package/dist/esm/pages/MainPage/MainPage.style.js.map +0 -1
- package/dist/esm/pages/SelectNativeTokenPage.d.ts +0 -2
- package/dist/esm/pages/SelectNativeTokenPage.js +0 -23
- package/dist/esm/pages/SelectNativeTokenPage.js.map +0 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.style.d.ts +0 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.style.js +0 -6
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.style.js.map +0 -1
- package/dist/esm/pages/SelectTokenPage/types.d.ts +0 -4
- package/dist/esm/pages/SelectTokenPage/types.js +0 -6
- package/dist/esm/pages/SelectTokenPage/types.js.map +0 -1
- package/dist/esm/providers/WidgetProvider/utils.d.ts +0 -5
- package/dist/esm/providers/WidgetProvider/utils.js +0 -17
- package/dist/esm/providers/WidgetProvider/utils.js.map +0 -1
- package/dist/esm/stores/form/useFieldController.d.ts +0 -11
- package/dist/esm/stores/form/useFieldController.js +0 -20
- package/dist/esm/stores/form/useFieldController.js.map +0 -1
- package/dist/esm/stores/form/useValidation.d.ts +0 -2
- package/dist/esm/stores/form/useValidation.js +0 -14
- package/dist/esm/stores/form/useValidation.js.map +0 -1
- package/dist/esm/stores/form/useValidationActions.d.ts +0 -2
- package/dist/esm/stores/form/useValidationActions.js +0 -10
- package/dist/esm/stores/form/useValidationActions.js.map +0 -1
- package/src/AppDrawer.style.tsx +0 -12
- package/src/components/Select.tsx +0 -42
- package/src/components/StepActions/StepFees.tsx +0 -49
- package/src/components/TokenList/utils.ts +0 -42
- package/src/pages/MainPage/MainPage.style.tsx +0 -8
- package/src/pages/SelectNativeTokenPage.tsx +0 -47
- package/src/pages/SelectTokenPage/SearchTokenInput.style.tsx +0 -6
- package/src/pages/SelectTokenPage/types.ts +0 -4
- package/src/providers/WidgetProvider/utils.ts +0 -26
- package/src/stores/form/useFieldController.ts +0 -31
- package/src/stores/form/useValidation.ts +0 -15
- package/src/stores/form/useValidationActions.ts +0 -12
|
@@ -2,8 +2,17 @@ import type { ExtendedChain } from '@lifi/sdk'
|
|
|
2
2
|
import { useVirtualizer } from '@tanstack/react-virtual'
|
|
3
3
|
import type { RefObject } from 'react'
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
5
|
+
import { useTranslation } from 'react-i18next'
|
|
5
6
|
import { useChainOrderStore } from '../../stores/chains/ChainOrderStore.js'
|
|
6
|
-
import {
|
|
7
|
+
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
8
|
+
import { AllChainsAvatar } from './AllChainsAvatar.js'
|
|
9
|
+
import {
|
|
10
|
+
List,
|
|
11
|
+
ListItem,
|
|
12
|
+
ListItemAvatar,
|
|
13
|
+
ListItemButton,
|
|
14
|
+
ListItemText,
|
|
15
|
+
} from './ChainList.style.js'
|
|
7
16
|
import { ChainListItem } from './ChainListItem.js'
|
|
8
17
|
|
|
9
18
|
interface VirtualizedChainListProps {
|
|
@@ -12,23 +21,30 @@ interface VirtualizedChainListProps {
|
|
|
12
21
|
onSelect: (chain: ExtendedChain) => void
|
|
13
22
|
selectedChainId?: number
|
|
14
23
|
itemsSize: 'small' | 'medium'
|
|
24
|
+
hasSearchQuery: boolean
|
|
15
25
|
withPinnedChains: boolean
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
export const VirtualizedChainList = ({
|
|
19
29
|
chains,
|
|
30
|
+
hasSearchQuery,
|
|
20
31
|
onSelect,
|
|
21
32
|
selectedChainId,
|
|
22
33
|
itemsSize,
|
|
23
34
|
scrollElementRef,
|
|
24
35
|
withPinnedChains,
|
|
25
36
|
}: VirtualizedChainListProps) => {
|
|
37
|
+
const { t } = useTranslation()
|
|
38
|
+
const { setFieldValue } = useFieldActions()
|
|
26
39
|
const selectedChainIdRef = useRef(selectedChainId) // Store the initial selected chain ID to scroll to it once chains are loaded
|
|
27
40
|
const hasScrolledRef = useRef(false)
|
|
28
|
-
const [pinnedChains, setPinnedChain] =
|
|
29
|
-
state
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
const [pinnedChains, setPinnedChain, isAllNetworks, setIsAllNetworks] =
|
|
42
|
+
useChainOrderStore((state) => [
|
|
43
|
+
state.pinnedChains,
|
|
44
|
+
state.setPinnedChain,
|
|
45
|
+
state.isAllNetworks,
|
|
46
|
+
state.setIsAllNetworks,
|
|
47
|
+
])
|
|
32
48
|
const onPin = useCallback(
|
|
33
49
|
(chainId: number) => {
|
|
34
50
|
setPinnedChain(chainId)
|
|
@@ -49,16 +65,30 @@ export const VirtualizedChainList = ({
|
|
|
49
65
|
return [...pinned, ...rest]
|
|
50
66
|
}, [chains, pinnedChains])
|
|
51
67
|
|
|
68
|
+
const showAllNetworks = sortedChains.length > 1 && !hasSearchQuery
|
|
69
|
+
|
|
52
70
|
const getItemKey = useCallback(
|
|
53
71
|
(index: number) => {
|
|
54
|
-
|
|
72
|
+
if (showAllNetworks && index === 0) {
|
|
73
|
+
return 'all-chains'
|
|
74
|
+
}
|
|
75
|
+
const chainIndex = index - (showAllNetworks ? 1 : 0)
|
|
76
|
+
return `${sortedChains[chainIndex].id}-${index}`
|
|
77
|
+
},
|
|
78
|
+
[sortedChains, showAllNetworks]
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
const onChainSelect = useCallback(
|
|
82
|
+
(chain: ExtendedChain) => {
|
|
83
|
+
setIsAllNetworks(false)
|
|
84
|
+
onSelect(chain)
|
|
55
85
|
},
|
|
56
|
-
[
|
|
86
|
+
[onSelect, setIsAllNetworks]
|
|
57
87
|
)
|
|
58
88
|
|
|
59
89
|
const { getVirtualItems, getTotalSize, measure, range, getOffsetForIndex } =
|
|
60
90
|
useVirtualizer({
|
|
61
|
-
count: sortedChains.length,
|
|
91
|
+
count: sortedChains.length + (showAllNetworks ? 1 : 0), // +1 for the all networks item
|
|
62
92
|
overscan: 3,
|
|
63
93
|
paddingEnd: 0,
|
|
64
94
|
getScrollElement: () => scrollElementRef.current,
|
|
@@ -96,6 +126,12 @@ export const VirtualizedChainList = ({
|
|
|
96
126
|
)
|
|
97
127
|
|
|
98
128
|
useEffect(() => {
|
|
129
|
+
// Mark as scrolled if "All Networks" is initially selected
|
|
130
|
+
if (isAllNetworks) {
|
|
131
|
+
hasScrolledRef.current = true
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
|
|
99
135
|
// Only scroll if sortedChains is not empty and we haven't scrolled yet
|
|
100
136
|
if (!hasScrolledRef.current && sortedChains.length > 0 && range) {
|
|
101
137
|
const selectedChainIndex = sortedChains.findIndex(
|
|
@@ -113,7 +149,12 @@ export const VirtualizedChainList = ({
|
|
|
113
149
|
}
|
|
114
150
|
hasScrolledRef.current = true // Mark as scrolled (when needed)
|
|
115
151
|
}
|
|
116
|
-
}, [sortedChains, scrollToIndex, range])
|
|
152
|
+
}, [sortedChains, scrollToIndex, range, isAllNetworks])
|
|
153
|
+
|
|
154
|
+
const selectAllNetworks = useCallback(() => {
|
|
155
|
+
setIsAllNetworks(true)
|
|
156
|
+
setFieldValue('tokenSearchFilter', '')
|
|
157
|
+
}, [setIsAllNetworks, setFieldValue])
|
|
117
158
|
|
|
118
159
|
return (
|
|
119
160
|
<List
|
|
@@ -122,13 +163,40 @@ export const VirtualizedChainList = ({
|
|
|
122
163
|
disablePadding
|
|
123
164
|
>
|
|
124
165
|
{getVirtualItems().map((item) => {
|
|
125
|
-
|
|
166
|
+
if (showAllNetworks && item.index === 0) {
|
|
167
|
+
return (
|
|
168
|
+
<ListItem
|
|
169
|
+
key={item.key}
|
|
170
|
+
style={{
|
|
171
|
+
height: `${itemsSize}px`,
|
|
172
|
+
transform: `translateY(${item.start}px)`,
|
|
173
|
+
padding: 0,
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
176
|
+
<ListItemButton
|
|
177
|
+
onClick={selectAllNetworks}
|
|
178
|
+
selected={isAllNetworks}
|
|
179
|
+
size={itemsSize}
|
|
180
|
+
>
|
|
181
|
+
<ListItemAvatar size={itemsSize}>
|
|
182
|
+
<AllChainsAvatar chains={chains} size={itemsSize} />
|
|
183
|
+
</ListItemAvatar>
|
|
184
|
+
<ListItemText
|
|
185
|
+
primary={t('main.allNetworks')}
|
|
186
|
+
size={itemsSize}
|
|
187
|
+
/>
|
|
188
|
+
</ListItemButton>
|
|
189
|
+
</ListItem>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const chain = sortedChains[item.index - (showAllNetworks ? 1 : 0)]
|
|
126
194
|
return (
|
|
127
195
|
<ChainListItem
|
|
128
196
|
key={item.key}
|
|
129
197
|
chain={chain}
|
|
130
|
-
onSelect={
|
|
131
|
-
selected={chain.id === selectedChainId}
|
|
198
|
+
onSelect={onChainSelect}
|
|
199
|
+
selected={!isAllNetworks && chain.id === selectedChainId}
|
|
132
200
|
itemsSize={itemsSize}
|
|
133
201
|
size={item.size}
|
|
134
202
|
start={item.start}
|
|
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
|
|
|
5
5
|
import type { FeesBreakdown } from '../utils/fees.js'
|
|
6
6
|
import { formatTokenAmount } from '../utils/format.js'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface FeeBreakdownTooltipProps {
|
|
9
9
|
gasCosts?: FeesBreakdown[]
|
|
10
10
|
feeCosts?: FeesBreakdown[]
|
|
11
11
|
relayerSupport?: boolean
|
|
@@ -49,10 +49,7 @@ export const FeeBreakdownTooltip: React.FC<FeeBreakdownTooltipProps> = ({
|
|
|
49
49
|
)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
fees: FeesBreakdown[],
|
|
54
|
-
t: TFunction
|
|
55
|
-
) =>
|
|
52
|
+
const getFeeBreakdownTypography = (fees: FeesBreakdown[], t: TFunction) =>
|
|
56
53
|
fees.map((fee, index) => (
|
|
57
54
|
<Typography
|
|
58
55
|
color="inherit"
|
|
@@ -9,7 +9,7 @@ import { Container } from './Header.style.js'
|
|
|
9
9
|
import { NavigationHeader } from './NavigationHeader.js'
|
|
10
10
|
import { WalletHeader } from './WalletHeader.js'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const HeaderContainer: FC<PropsWithChildren> = ({ children }) => {
|
|
13
13
|
const { pathname } = useLocation()
|
|
14
14
|
const elementId = useDefaultElementId()
|
|
15
15
|
const headerRef = useRef<HTMLDivElement>(null)
|
|
@@ -50,7 +50,7 @@ export const WalletHeader: React.FC = () => {
|
|
|
50
50
|
) : null
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
const WalletMenuButton: React.FC = () => {
|
|
54
54
|
const { variant, hiddenUI } = useWidgetConfig()
|
|
55
55
|
const { account, accounts } = useAccount()
|
|
56
56
|
|
|
@@ -133,7 +133,6 @@ export const SendToWalletButton: React.FC<CardProps> = (props) => {
|
|
|
133
133
|
mountOnEnter
|
|
134
134
|
unmountOnExit
|
|
135
135
|
>
|
|
136
|
-
{/** biome-ignore lint/a11y/useSemanticElements: allowed in react */}
|
|
137
136
|
<Card
|
|
138
137
|
role="button"
|
|
139
138
|
onClick={disabledForChanges ? undefined : handleOnClick}
|
|
@@ -120,7 +120,7 @@ export const StepActions: React.FC<StepActionsProps> = ({
|
|
|
120
120
|
)
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
const IncludedSteps: React.FC<IncludedStepsProps> = ({ step }) => {
|
|
124
124
|
const { subvariant, subvariantOptions, feeConfig, hiddenUI } =
|
|
125
125
|
useWidgetConfig()
|
|
126
126
|
|
|
@@ -211,7 +211,7 @@ export const IncludedSteps: React.FC<IncludedStepsProps> = ({ step }) => {
|
|
|
211
211
|
)
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
const StepDetailsContent: React.FC<{
|
|
215
215
|
step: StepExtended
|
|
216
216
|
}> = ({ step }) => {
|
|
217
217
|
const { t } = useTranslation()
|
|
@@ -293,7 +293,7 @@ export const StepDetailsContent: React.FC<{
|
|
|
293
293
|
)
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
|
|
296
|
+
const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps> = ({
|
|
297
297
|
step,
|
|
298
298
|
subvariant,
|
|
299
299
|
subvariantOptions,
|
|
@@ -325,7 +325,7 @@ export const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps> = ({
|
|
|
325
325
|
)
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
|
|
328
|
+
const BridgeStepDetailsLabel: React.FC<
|
|
329
329
|
Omit<StepDetailsLabelProps, 'variant'>
|
|
330
330
|
> = ({ step }) => {
|
|
331
331
|
const { t } = useTranslation()
|
|
@@ -341,7 +341,7 @@ export const BridgeStepDetailsLabel: React.FC<
|
|
|
341
341
|
)
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
|
|
344
|
+
const SwapStepDetailsLabel: React.FC<
|
|
345
345
|
Omit<StepDetailsLabelProps, 'variant'>
|
|
346
346
|
> = ({ step }) => {
|
|
347
347
|
const { t } = useTranslation()
|
|
@@ -356,7 +356,7 @@ export const SwapStepDetailsLabel: React.FC<
|
|
|
356
356
|
)
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
|
|
359
|
+
const ProtocolStepDetailsLabel: React.FC<
|
|
360
360
|
Omit<StepDetailsLabelProps, 'variant'>
|
|
361
361
|
> = ({ step, feeConfig, relayerSupport }) => {
|
|
362
362
|
const { t } = useTranslation()
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import AccessTimeFilled from '@mui/icons-material/AccessTimeFilled'
|
|
2
|
-
import { Tooltip } from '@mui/material'
|
|
3
|
-
import { Box } from '@mui/system'
|
|
2
|
+
import { Box, Tooltip } from '@mui/material'
|
|
4
3
|
import type { FC, PropsWithChildren } from 'react'
|
|
5
4
|
import { useTranslation } from 'react-i18next'
|
|
6
5
|
import { IconTypography } from '../IconTypography.js'
|
|
@@ -30,7 +30,7 @@ export const Token: FC<TokenProps & BoxProps> = ({ token, ...other }) => {
|
|
|
30
30
|
return <TokenBase token={token} {...other} />
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
const TokenFallback: FC<TokenProps & BoxProps> = ({
|
|
34
34
|
token,
|
|
35
35
|
isLoading,
|
|
36
36
|
...other
|
|
@@ -49,7 +49,7 @@ export const TokenFallback: FC<TokenProps & BoxProps> = ({
|
|
|
49
49
|
)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
const TokenBase: FC<TokenProps & BoxProps> = ({
|
|
53
53
|
token,
|
|
54
54
|
impactToken,
|
|
55
55
|
enableImpactTokenTooltip,
|
|
@@ -4,27 +4,22 @@ import type { BottomSheetBase } from '../BottomSheet/types.js'
|
|
|
4
4
|
import { TokenDetailsSheetContent } from './TokenDetailsSheetContent.js'
|
|
5
5
|
import type { TokenDetailsSheetBase } from './types.js'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
chainId: number | undefined
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const TokenDetailsSheet = forwardRef<
|
|
12
|
-
TokenDetailsSheetBase,
|
|
13
|
-
TokenDetailsSheetProps
|
|
14
|
-
>(({ chainId }, ref) => {
|
|
7
|
+
export const TokenDetailsSheet = forwardRef<TokenDetailsSheetBase>((_, ref) => {
|
|
15
8
|
const bottomSheetRef = useRef<BottomSheetBase>(null)
|
|
16
9
|
const [tokenAddress, setTokenAddress] = useState<string | undefined>(
|
|
17
10
|
undefined
|
|
18
11
|
)
|
|
12
|
+
const [chainId, setChainId] = useState<number | undefined>(undefined)
|
|
19
13
|
const [withoutContractAddress, setWithoutContractAddress] = useState(false)
|
|
20
14
|
|
|
21
15
|
useImperativeHandle(
|
|
22
16
|
ref,
|
|
23
17
|
() => ({
|
|
24
18
|
isOpen: () => bottomSheetRef.current?.isOpen(),
|
|
25
|
-
open: (address: string, noContractAddress: boolean) => {
|
|
19
|
+
open: (address: string, noContractAddress: boolean, chainId: number) => {
|
|
26
20
|
setTokenAddress(address)
|
|
27
21
|
setWithoutContractAddress(noContractAddress)
|
|
22
|
+
setChainId(chainId)
|
|
28
23
|
bottomSheetRef.current?.open()
|
|
29
24
|
},
|
|
30
25
|
close: () => {
|
|
@@ -6,7 +6,7 @@ import { forwardRef, type PropsWithChildren, useMemo } from 'react'
|
|
|
6
6
|
import { useTranslation } from 'react-i18next'
|
|
7
7
|
import { useAvailableChains } from '../../hooks/useAvailableChains.js'
|
|
8
8
|
import { useExplorer } from '../../hooks/useExplorer.js'
|
|
9
|
-
import {
|
|
9
|
+
import { useToken } from '../../hooks/useToken.js'
|
|
10
10
|
import { shortenAddress } from '../../utils/wallet.js'
|
|
11
11
|
import { TokenAvatar } from '../Avatar/TokenAvatar.js'
|
|
12
12
|
import { CardIconButton } from '../Card/CardIconButton.js'
|
|
@@ -34,11 +34,7 @@ export const TokenDetailsSheetContent = forwardRef<
|
|
|
34
34
|
const { getAddressLink } = useExplorer()
|
|
35
35
|
const { getChainById } = useAvailableChains()
|
|
36
36
|
|
|
37
|
-
const { token, isLoading } =
|
|
38
|
-
chainId,
|
|
39
|
-
tokenAddress,
|
|
40
|
-
!!tokenAddress
|
|
41
|
-
)
|
|
37
|
+
const { token, isLoading } = useToken(chainId, tokenAddress, true)
|
|
42
38
|
const chain = useMemo(() => getChainById(chainId), [chainId, getChainById])
|
|
43
39
|
|
|
44
40
|
const copyContractAddress = async (e: React.MouseEvent) => {
|
|
@@ -1,151 +1,79 @@
|
|
|
1
|
-
import type { BaseToken } from '@lifi/sdk'
|
|
2
|
-
import { useAccount } from '@lifi/wallet-management'
|
|
3
1
|
import { Box } from '@mui/material'
|
|
4
|
-
import { type FC, useEffect } from 'react'
|
|
5
|
-
import { useChain } from '../../hooks/useChain.js'
|
|
2
|
+
import { type FC, memo, useEffect } from 'react'
|
|
6
3
|
import { useDebouncedWatch } from '../../hooks/useDebouncedWatch.js'
|
|
7
4
|
import { useTokenBalances } from '../../hooks/useTokenBalances.js'
|
|
8
|
-
import { useTokenSearch } from '../../hooks/useTokenSearch.js'
|
|
9
5
|
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js'
|
|
10
|
-
import {
|
|
6
|
+
import { useChainOrderStore } from '../../stores/chains/ChainOrderStore.js'
|
|
11
7
|
import { FormKeyHelper } from '../../stores/form/types.js'
|
|
12
8
|
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
13
9
|
import { WidgetEvent } from '../../types/events.js'
|
|
14
|
-
import type { TokenAmount } from '../../types/token.js'
|
|
15
|
-
import { getConfigItemSets, isFormItemAllowed } from '../../utils/item.js'
|
|
16
10
|
import { TokenNotFound } from './TokenNotFound.js'
|
|
17
11
|
import type { TokenListProps } from './types.js'
|
|
18
12
|
import { useTokenSelect } from './useTokenSelect.js'
|
|
19
|
-
import { filteredTokensComparator } from './utils.js'
|
|
20
13
|
import { VirtualizedTokenList } from './VirtualizedTokenList.js'
|
|
21
14
|
|
|
22
|
-
export const TokenList: FC<TokenListProps> = (
|
|
23
|
-
formType,
|
|
24
|
-
|
|
25
|
-
height,
|
|
26
|
-
onClick,
|
|
27
|
-
}) => {
|
|
28
|
-
const emitter = useWidgetEvents()
|
|
29
|
-
const [selectedChainId, selectedTokenAddress] = useFieldValues(
|
|
30
|
-
FormKeyHelper.getChainKey(formType),
|
|
31
|
-
FormKeyHelper.getTokenKey(formType)
|
|
32
|
-
)
|
|
33
|
-
const [tokenSearchFilter]: string[] = useDebouncedWatch(
|
|
34
|
-
320,
|
|
35
|
-
'tokenSearchFilter'
|
|
36
|
-
)
|
|
15
|
+
export const TokenList: FC<TokenListProps> = memo(
|
|
16
|
+
({ formType, parentRef, height, onClick }) => {
|
|
17
|
+
const emitter = useWidgetEvents()
|
|
37
18
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const { account } = useAccount({
|
|
43
|
-
chainType: selectedChain?.chainType,
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
const {
|
|
47
|
-
tokens: chainTokens,
|
|
48
|
-
tokensWithBalance,
|
|
49
|
-
isLoading: isTokensLoading,
|
|
50
|
-
isBalanceLoading,
|
|
51
|
-
featuredTokens,
|
|
52
|
-
popularTokens,
|
|
53
|
-
} = useTokenBalances(selectedChainId)
|
|
54
|
-
|
|
55
|
-
let filteredTokens = (tokensWithBalance ?? chainTokens ?? []) as TokenAmount[]
|
|
56
|
-
const normalizedSearchFilter = tokenSearchFilter?.replaceAll('$', '')
|
|
57
|
-
const searchFilter = normalizedSearchFilter?.toUpperCase() ?? ''
|
|
58
|
-
|
|
59
|
-
const filteredConfigTokens = getConfigItemSets(
|
|
60
|
-
configTokens,
|
|
61
|
-
(tokens: BaseToken[]) =>
|
|
62
|
-
new Set(
|
|
63
|
-
tokens
|
|
64
|
-
.filter((t) => t.chainId === selectedChainId)
|
|
65
|
-
.map((t) => t.address)
|
|
66
|
-
),
|
|
67
|
-
formType
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
// Get the appropriate allow/deny lists based on formType
|
|
71
|
-
filteredTokens = filteredTokens.filter(
|
|
72
|
-
(token) =>
|
|
73
|
-
token.chainId === selectedChainId &&
|
|
74
|
-
isFormItemAllowed(token, filteredConfigTokens, formType, (t) => t.address)
|
|
75
|
-
)
|
|
19
|
+
const [selectedChainId, selectedTokenAddress] = useFieldValues(
|
|
20
|
+
FormKeyHelper.getChainKey(formType),
|
|
21
|
+
FormKeyHelper.getTokenKey(formType)
|
|
22
|
+
)
|
|
76
23
|
|
|
77
|
-
|
|
78
|
-
? filteredTokens
|
|
79
|
-
.filter(
|
|
80
|
-
(token) =>
|
|
81
|
-
token.name?.toUpperCase().includes(searchFilter) ||
|
|
82
|
-
token.symbol
|
|
83
|
-
.toUpperCase()
|
|
84
|
-
// Replace ₮ with T for USD₮0
|
|
85
|
-
.replaceAll('₮', 'T')
|
|
86
|
-
.includes(searchFilter) ||
|
|
87
|
-
token.address.toUpperCase().includes(searchFilter)
|
|
88
|
-
)
|
|
89
|
-
.sort(filteredTokensComparator(searchFilter))
|
|
90
|
-
: filteredTokens
|
|
24
|
+
const isAllNetworks = useChainOrderStore((state) => state.isAllNetworks)
|
|
91
25
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
!!selectedChainId
|
|
26
|
+
const [tokenSearchFilter]: string[] = useDebouncedWatch(
|
|
27
|
+
320,
|
|
28
|
+
'tokenSearchFilter'
|
|
29
|
+
)
|
|
97
30
|
|
|
98
|
-
|
|
99
|
-
|
|
31
|
+
const {
|
|
32
|
+
tokens,
|
|
33
|
+
withCategories,
|
|
34
|
+
isTokensLoading,
|
|
35
|
+
isBalanceLoading,
|
|
36
|
+
isSearchLoading,
|
|
37
|
+
} = useTokenBalances(
|
|
100
38
|
selectedChainId,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
39
|
+
formType,
|
|
40
|
+
isAllNetworks,
|
|
41
|
+
tokenSearchFilter
|
|
104
42
|
)
|
|
105
43
|
|
|
106
|
-
|
|
107
|
-
isTokensLoading ||
|
|
108
|
-
isSelectedChainLoading ||
|
|
109
|
-
(tokenSearchEnabled && isSearchedTokenLoading)
|
|
44
|
+
const handleTokenClick = useTokenSelect(formType, onClick)
|
|
110
45
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
: searchedToken
|
|
114
|
-
? [searchedToken]
|
|
115
|
-
: filteredTokens
|
|
46
|
+
const showCategories =
|
|
47
|
+
withCategories && !tokenSearchFilter && !isAllNetworks
|
|
116
48
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const normalizedSearchFilter = tokenSearchFilter?.replaceAll('$', '')
|
|
51
|
+
if (normalizedSearchFilter) {
|
|
52
|
+
emitter.emit(WidgetEvent.TokenSearch, {
|
|
53
|
+
value: normalizedSearchFilter,
|
|
54
|
+
tokens,
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, [tokenSearchFilter, tokens, emitter])
|
|
121
59
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
chain={selectedChain}
|
|
143
|
-
isLoading={isLoading}
|
|
144
|
-
isBalanceLoading={isBalanceLoading}
|
|
145
|
-
showCategories={showCategories}
|
|
146
|
-
onClick={handleTokenClick}
|
|
147
|
-
selectedTokenAddress={selectedTokenAddress}
|
|
148
|
-
/>
|
|
149
|
-
</Box>
|
|
150
|
-
)
|
|
151
|
-
}
|
|
60
|
+
return (
|
|
61
|
+
<Box ref={parentRef} style={{ height, overflow: 'auto' }}>
|
|
62
|
+
{!tokens.length && !isTokensLoading && !isSearchLoading ? (
|
|
63
|
+
<TokenNotFound formType={formType} />
|
|
64
|
+
) : null}
|
|
65
|
+
<VirtualizedTokenList
|
|
66
|
+
tokens={tokens}
|
|
67
|
+
scrollElementRef={parentRef}
|
|
68
|
+
chainId={selectedChainId}
|
|
69
|
+
isLoading={isTokensLoading || isSearchLoading}
|
|
70
|
+
isBalanceLoading={isBalanceLoading}
|
|
71
|
+
showCategories={showCategories}
|
|
72
|
+
onClick={handleTokenClick}
|
|
73
|
+
selectedTokenAddress={selectedTokenAddress}
|
|
74
|
+
isAllNetworks={isAllNetworks}
|
|
75
|
+
/>
|
|
76
|
+
</Box>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
)
|