diff --git a/src/address/Contracts.tsx b/src/address/Contracts.tsx index 5237320..9e8eaef 100644 --- a/src/address/Contracts.tsx +++ b/src/address/Contracts.tsx @@ -6,6 +6,8 @@ import InfoRow from "../components/InfoRow"; import Contract from "./Contract"; import { RuntimeContext } from "../useRuntime"; import { Metadata } from "../useSourcify"; +import ExternalLink from "../components/ExternalLink"; +import { openInRemixURL } from "../url"; type ContractsProps = { checksummedAddress: string; @@ -57,6 +59,18 @@ const Contracts: React.FC = ({ )} {rawMetadata !== undefined && rawMetadata !== null && (
+ {provider && ( +
+ + Open in Remix + +
+ )} {Object.entries(rawMetadata.sources).map(([k]) => ( diff --git a/src/url.ts b/src/url.ts index 1c01cc9..8aaa6f0 100644 --- a/src/url.ts +++ b/src/url.ts @@ -17,6 +17,7 @@ export const blockTxsURL = (blockNum: BlockTag) => `/block/${blockNum}/txs`; const sourcifyRootHash = "k51qzi5uqu5dll0ocge71eudqnrgnogmbr37gsgl12uubsinphjoknl6bbi41p"; const ipfsGatewayPrefix = `https://ipfs.io/ipns/${sourcifyRootHash}`; +// const ipfsGatewayPrefix = `https://repo.sourcify.dev`; export const sourcifyMetadata = ( checksummedAddress: string, @@ -30,3 +31,6 @@ export const sourcifySourceFile = ( filepath: string ) => `${ipfsGatewayPrefix}/contracts/full_match/${networkId}/${checksummedAddress}/sources/${filepath}`; + +export const openInRemixURL = (checksummedAddress: string, networkId: number) => + `https://remix.ethereum.org/#call=source-verification//fetchAndSave//${checksummedAddress}//${networkId}`;