Skip to content

Commit 3806ff1

Browse files
committed
Etherscan link for contracts
1 parent 0101a12 commit 3806ff1

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

components/SubgraphEditor/SubgraphConfig/SelectedContract/SelectedContract.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@ const ActionButton = styled.button`
8989
font-weight: bold;
9090
`
9191

92+
const EtherscanLink = styled.a`
93+
display: inline-block;
94+
background-image: url(/etherscan-logo-light-circle.svg);
95+
height: 16px;
96+
width: 16px;
97+
opacity: 0.5;
98+
background-size: 100%;
99+
margin-left: 6px;
100+
vertical-align: middle;
101+
102+
&:hover {
103+
opacity: 0.8;
104+
}
105+
`
106+
92107
const CHAIN_ID = 1
93108

94109
function parseEventsFromAbi(abi: any[]) {
@@ -261,7 +276,10 @@ export const SelectedContract = (props: SelectedContractProps) => {
261276
</div>
262277
{!isTemplate && (
263278
<>
264-
<span className="address">{addresses[CHAIN_ID]}</span>
279+
<span className="address">
280+
{addresses[CHAIN_ID]}
281+
<EtherscanLink href={`https://etherscan.io/address/${addresses[CHAIN_ID]}`} target="etherscan" />
282+
</span>
265283
{metadataLoading ? <span>Fetching contract metadata...</span> : null}
266284
{startBlocks[CHAIN_ID] ? (
267285
<span className="address">Deployed on block {startBlocks[CHAIN_ID]}</span>
Lines changed: 6 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)