Commit 05977f95 authored by Brendan Wong's avatar Brendan Wong Committed by GitHub

fix: updated celo logo (#6676)

* fix: updated celo logo

* fix: use celo logo from local fs

* fix: removed outdated comments

* fix: combine if statements in celo check

* fix: fix lint
parent 5ac36d41
import bnbCircleLogoUrl from 'assets/images/bnbCircle.svg' import bnbCircleLogoUrl from 'assets/images/bnbCircle.svg'
import celoCircleLogoUrl from 'assets/images/celoCircle.png'
import ethereumLogoUrl from 'assets/images/ethereum-logo.png' import ethereumLogoUrl from 'assets/images/ethereum-logo.png'
import polygonCircleLogoUrl from 'assets/images/polygonCircle.png' import polygonCircleLogoUrl from 'assets/images/polygonCircle.png'
import { default as arbitrumCircleLogoUrl, default as arbitrumLogoUrl } from 'assets/svg/arbitrum_logo.svg' import { default as arbitrumCircleLogoUrl, default as arbitrumLogoUrl } from 'assets/svg/arbitrum_logo.svg'
...@@ -190,7 +189,7 @@ const CHAIN_INFO: ChainInfoMap = { ...@@ -190,7 +189,7 @@ const CHAIN_INFO: ChainInfoMap = {
infoLink: 'https://info.uniswap.org/#/celo/', infoLink: 'https://info.uniswap.org/#/celo/',
label: 'Celo', label: 'Celo',
logoUrl: celoLogo, logoUrl: celoLogo,
circleLogoUrl: celoCircleLogoUrl, circleLogoUrl: celoLogo,
squareLogoUrl: celoSquareLogoUrl, squareLogoUrl: celoSquareLogoUrl,
nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 }, nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
defaultListUrl: CELO_LIST, defaultListUrl: CELO_LIST,
......
import TokenLogoLookupTable from 'constants/TokenLogoLookupTable' import TokenLogoLookupTable from 'constants/TokenLogoLookupTable'
import { isCelo, nativeOnChain } from 'constants/tokens'
import { chainIdToNetworkName, getNativeLogoURI } from 'lib/hooks/useCurrencyLogoURIs' import { chainIdToNetworkName, getNativeLogoURI } from 'lib/hooks/useCurrencyLogoURIs'
import uriToHttp from 'lib/utils/uriToHttp' import uriToHttp from 'lib/utils/uriToHttp'
import { useCallback, useEffect, useState } from 'react' import { useCallback, useEffect, useState } from 'react'
import { isAddress } from 'utils' import { isAddress } from 'utils'
import celoLogo from '../assets/svg/celo_logo.svg'
import { checkWarning } from '../constants/tokenSafety' import { checkWarning } from '../constants/tokenSafety'
const BAD_SRCS: { [tokenAddress: string]: true } = {} const BAD_SRCS: { [tokenAddress: string]: true } = {}
...@@ -41,6 +43,11 @@ function getInitialUrl(address?: string | null, chainId?: number | null, isNativ ...@@ -41,6 +43,11 @@ function getInitialUrl(address?: string | null, chainId?: number | null, isNativ
const networkName = chainId ? chainIdToNetworkName(chainId) : 'ethereum' const networkName = chainId ? chainIdToNetworkName(chainId) : 'ethereum'
const checksummedAddress = isAddress(address) const checksummedAddress = isAddress(address)
if (chainId && isCelo(chainId) && address === nativeOnChain(chainId).wrapped.address) {
return celoLogo
}
if (checksummedAddress) { if (checksummedAddress) {
return `https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/${networkName}/assets/${checksummedAddress}/logo.png` return `https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/${networkName}/assets/${checksummedAddress}/logo.png`
} else { } else {
......
...@@ -9,7 +9,7 @@ import CeloLogo from '../../assets/svg/celo_logo.svg' ...@@ -9,7 +9,7 @@ import CeloLogo from '../../assets/svg/celo_logo.svg'
import MaticLogo from '../../assets/svg/matic-token-icon.svg' import MaticLogo from '../../assets/svg/matic-token-icon.svg'
import { isCelo, NATIVE_CHAIN_ID, nativeOnChain } from '../../constants/tokens' import { isCelo, NATIVE_CHAIN_ID, nativeOnChain } from '../../constants/tokens'
type Network = 'ethereum' | 'arbitrum' | 'optimism' | 'polygon' | 'smartchain' type Network = 'ethereum' | 'arbitrum' | 'optimism' | 'polygon' | 'smartchain' | 'celo'
export function chainIdToNetworkName(networkId: SupportedChainId): Network { export function chainIdToNetworkName(networkId: SupportedChainId): Network {
switch (networkId) { switch (networkId) {
...@@ -23,6 +23,8 @@ export function chainIdToNetworkName(networkId: SupportedChainId): Network { ...@@ -23,6 +23,8 @@ export function chainIdToNetworkName(networkId: SupportedChainId): Network {
return 'polygon' return 'polygon'
case SupportedChainId.BNB: case SupportedChainId.BNB:
return 'smartchain' return 'smartchain'
case SupportedChainId.CELO:
return 'celo'
default: default:
return 'ethereum' return 'ethereum'
} }
...@@ -51,15 +53,12 @@ function getTokenLogoURI(address: string, chainId: SupportedChainId = SupportedC ...@@ -51,15 +53,12 @@ function getTokenLogoURI(address: string, chainId: SupportedChainId = SupportedC
SupportedChainId.OPTIMISM, SupportedChainId.OPTIMISM,
SupportedChainId.BNB, SupportedChainId.BNB,
] ]
if (networksWithUrls.includes(chainId)) { if (isCelo(chainId) && address === nativeOnChain(chainId).wrapped.address) {
return `https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/${networkName}/assets/${address}/logo.png` return CeloLogo
} }
// Celo logo logo is hosted elsewhere. if (networksWithUrls.includes(chainId)) {
if (isCelo(chainId)) { return `https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/${networkName}/assets/${address}/logo.png`
if (address === nativeOnChain(chainId).wrapped.address) {
return 'https://raw.githubusercontent.com/ubeswap/default-token-list/master/assets/asset_CELO.png'
}
} }
} }
......
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