Skip to content

Commit 09074fe

Browse files
Alex.KarysAlex.Karys
authored andcommitted
Reducing toCheckSum calls
1 parent ac9186b commit 09074fe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/list-tokens.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ const Chain = styled.span`
8787

8888
export const ListItem = memo(function ListItem({ token }) {
8989
const scanner = lookupScanner(token.chainId);
90-
const scannerUrl = scanner == "" ? "" : scanner + `${toChecksumAddress(token.address)}`;
90+
const tokenAddress = toChecksumAddress(token.address);
91+
const scannerUrl = scanner == "" ? "" : scanner + tokenAddress;
9192
return (
9293
<TokenItem>
9394
<TokenInfo>
@@ -110,7 +111,7 @@ export const ListItem = memo(function ListItem({ token }) {
110111
/>
111112

112113
<span className="hide-small">
113-
<a style={{ textAlign: 'right' }} href={`https://etherscan.io/address/${toChecksumAddress(token.address)}`}>
114+
<a style={{ textAlign: 'right' }} href={scannerUrl}>
114115
{token.name}
115116
</a>
116117
</span>
@@ -127,7 +128,7 @@ export const ListItem = memo(function ListItem({ token }) {
127128
</TokenTagWrapper>
128129
<TokenAddress>
129130
<a style={{ textAlign: 'right' }} href={scannerUrl}>
130-
{`${toChecksumAddress(token.address)?.slice(0, 6)}...${toChecksumAddress(token.address)?.slice(38, 42)}`}
131+
{`${tokenAddress?.slice(0, 6)}...${tokenAddress?.slice(38, 42)}`}
131132
</a>
132133
<CopyHelper toCopy={token.address} />
133134
</TokenAddress>

0 commit comments

Comments
 (0)