fix: currency balance for search token (#7471)
This commit is contained in:
parent
740db0fe16
commit
71d3661b22
@ -1,7 +1,7 @@
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { t, Trans } from '@lingui/macro'
|
||||
import { InterfaceEventName, InterfaceModalName } from '@uniswap/analytics-events'
|
||||
import { ChainId, Currency, Token } from '@uniswap/sdk-core'
|
||||
import { ChainId, Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
|
||||
import { useWeb3React } from '@web3-react/core'
|
||||
import { Trace } from 'analytics'
|
||||
import { useCachedPortfolioBalancesQuery } from 'components/PrefetchBalancesWrapper/PrefetchBalancesWrapper'
|
||||
@ -12,6 +12,7 @@ import useToggle from 'hooks/useToggle'
|
||||
import useNativeCurrency from 'lib/hooks/useNativeCurrency'
|
||||
import { getTokenFilter } from 'lib/hooks/useTokenList/filtering'
|
||||
import { TokenBalances, tokenComparator, useSortTokensByQuery } from 'lib/hooks/useTokenList/sorting'
|
||||
import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount'
|
||||
import { ChangeEvent, KeyboardEvent, RefObject, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import AutoSizer from 'react-virtualized-auto-sizer'
|
||||
import { FixedSizeList } from 'react-window'
|
||||
@ -291,6 +292,12 @@ export function CurrencySearch({
|
||||
searchQuery,
|
||||
isAddressSearch
|
||||
)}
|
||||
balance={
|
||||
tryParseCurrencyAmount(
|
||||
String(balances[searchToken.isNative ? 'ETH' : searchToken.address?.toLowerCase()]?.balance ?? 0),
|
||||
searchToken
|
||||
) ?? CurrencyAmount.fromRawAmount(searchToken, 0)
|
||||
}
|
||||
/>
|
||||
</Column>
|
||||
) : searchCurrencies?.length > 0 || filteredInactiveTokens?.length > 0 || isLoading ? (
|
||||
|
Loading…
Reference in New Issue
Block a user