Skip to content

Commit

Permalink
Reducing toCheckSum calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex.Karys authored and Alex.Karys committed Jun 17, 2022
1 parent ac9186b commit 09074fe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/list-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ const Chain = styled.span`

export const ListItem = memo(function ListItem({ token }) {
const scanner = lookupScanner(token.chainId);
const scannerUrl = scanner == "" ? "" : scanner + `${toChecksumAddress(token.address)}`;
const tokenAddress = toChecksumAddress(token.address);
const scannerUrl = scanner == "" ? "" : scanner + tokenAddress;
return (
<TokenItem>
<TokenInfo>
Expand All @@ -110,7 +111,7 @@ export const ListItem = memo(function ListItem({ token }) {
/>

<span className="hide-small">
<a style={{ textAlign: 'right' }} href={`https://etherscan.io/address/${toChecksumAddress(token.address)}`}>
<a style={{ textAlign: 'right' }} href={scannerUrl}>
{token.name}
</a>
</span>
Expand All @@ -127,7 +128,7 @@ export const ListItem = memo(function ListItem({ token }) {
</TokenTagWrapper>
<TokenAddress>
<a style={{ textAlign: 'right' }} href={scannerUrl}>
{`${toChecksumAddress(token.address)?.slice(0, 6)}...${toChecksumAddress(token.address)?.slice(38, 42)}`}
{`${tokenAddress?.slice(0, 6)}...${tokenAddress?.slice(38, 42)}`}
</a>
<CopyHelper toCopy={token.address} />
</TokenAddress>
Expand Down

0 comments on commit 09074fe

Please sign in to comment.