otterscan/src/url.ts

37 lines
1.3 KiB
TypeScript
Raw Normal View History

import { BlockTag } from "@ethersproject/abstract-provider";
2021-07-09 16:54:59 +00:00
export const fourBytesURL = (
assetsURLPrefix: string,
fourBytes: string
): string => `${assetsURLPrefix}/signatures/${fourBytes}`;
export const tokenLogoURL = (
assetsURLPrefix: string,
address: string
): string => `${assetsURLPrefix}/assets/${address}/logo.png`;
export const blockURL = (blockNum: BlockTag) => `/block/${blockNum}`;
export const blockTxsURL = (blockNum: BlockTag) => `/block/${blockNum}/txs`;
2021-07-24 23:04:49 +00:00
const sourcifyRootHash =
"k51qzi5uqu5dll0ocge71eudqnrgnogmbr37gsgl12uubsinphjoknl6bbi41p";
const ipfsGatewayPrefix = `https://ipfs.io/ipns/${sourcifyRootHash}`;
2021-09-06 07:14:49 +00:00
// const ipfsGatewayPrefix = `https://repo.sourcify.dev`;
2021-07-24 23:04:49 +00:00
export const sourcifyMetadata = (
checksummedAddress: string,
networkId: number
) =>
`${ipfsGatewayPrefix}/contracts/full_match/${networkId}/${checksummedAddress}/metadata.json`;
2021-07-24 23:33:45 +00:00
export const sourcifySourceFile = (
checksummedAddress: string,
networkId: number,
filepath: string
) =>
`${ipfsGatewayPrefix}/contracts/full_match/${networkId}/${checksummedAddress}/sources/${filepath}`;
2021-09-06 07:14:49 +00:00
export const openInRemixURL = (checksummedAddress: string, networkId: number) =>
`https://remix.ethereum.org/#call=source-verification//fetchAndSave//${checksummedAddress}//${networkId}`;