Commit 19f175ba authored by lynn's avatar lynn Committed by GitHub

fix: make eth in search bar navigate to eth token details (#4812)

* make eth in search bar navigate to eth token details

* use local resolving functions
parent aaf105ef
import { NATIVE_CHAIN_ID } from 'analytics/constants'
import { SupportedChainId } from 'constants/chains'
import { ZERO_ADDRESS } from 'constants/misc'
import { useAppSelector } from 'state/hooks'
import { Chain, HistoryDuration } from './__generated__/TokenQuery.graphql'
......@@ -79,7 +81,9 @@ export function isValidBackendChainName(chainName: string | undefined): chainNam
}
export function getTokenDetailsURL(address: string, chainName?: Chain, chainId?: number) {
if (chainName) {
if (address === ZERO_ADDRESS && chainId && chainId === SupportedChainId.MAINNET) {
return `/tokens/${CHAIN_ID_TO_BACKEND_NAME[chainId].toLowerCase()}/${NATIVE_CHAIN_ID}`
} else if (chainName) {
return `/tokens/${chainName.toLowerCase()}/${address}`
} else if (chainId) {
const chainName = CHAIN_ID_TO_BACKEND_NAME[chainId]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment