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
This commit is contained in:
parent
aaf105ef51
commit
19f175ba89
@ -1,4 +1,6 @@
|
|||||||
|
import { NATIVE_CHAIN_ID } from 'analytics/constants'
|
||||||
import { SupportedChainId } from 'constants/chains'
|
import { SupportedChainId } from 'constants/chains'
|
||||||
|
import { ZERO_ADDRESS } from 'constants/misc'
|
||||||
import { useAppSelector } from 'state/hooks'
|
import { useAppSelector } from 'state/hooks'
|
||||||
|
|
||||||
import { Chain, HistoryDuration } from './__generated__/TokenQuery.graphql'
|
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) {
|
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}`
|
return `/tokens/${chainName.toLowerCase()}/${address}`
|
||||||
} else if (chainId) {
|
} else if (chainId) {
|
||||||
const chainName = CHAIN_ID_TO_BACKEND_NAME[chainId]
|
const chainName = CHAIN_ID_TO_BACKEND_NAME[chainId]
|
||||||
|
Loading…
Reference in New Issue
Block a user