Skip to content

Commit

Permalink
update etherscan links for other networks
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashmi-278 committed Aug 6, 2024
1 parent 79e5ab2 commit 9029421
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const DisplayRegistration = ({
case "Stargaze":
return <StargazeAtomScanLink address={address} />;
default:
return <EtherscanLink address={address} />;
return <EtherscanLink address={address} network={network} />;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,35 @@ import { Tooltip2 } from '@blueprintjs/popover2';
import './EtherscanLink.css';

const EtherscanLink = ({
address
address,
network = 'ethereum' // default network is ethereum
}) => {

const url = `https://etherscan.io/address/${address}`;
const getUrl = (network, address) => {
switch (network) {
case 'optimism':
return `https://optimistic.etherscan.io/address/${address}`;
case 'arbitrum':
return `https://arbiscan.io/address/${address}`;
case 'ethereum':
default:
return `https://etherscan.io/address/${address}`;
}
};

const url = getUrl(network, address);

return (
<div className='etherscan-link'>
<a
href={url}
className='no-underline'
target="_blank"
rel="noopener noreferrer"
>
{address}
<Tooltip2
content={'View on Etherscan'}
content={`View on ${network === 'optimism' ? 'Optimistic Etherscan' : 'Etherscan'}`}
placement='top'
>
<Icon
Expand All @@ -33,7 +47,7 @@ const EtherscanLink = ({
</Tooltip2>
</a>
</div>
)
}
);
};

export default EtherscanLink;
export default EtherscanLink;

0 comments on commit 9029421

Please sign in to comment.