on 94ccbdb help sign in
bridge/src/lib/explorer.js
33 lines 814 B history raw
1import { useNetwork } from 'store/network';
2import { NETWORK_TYPES } from './network';
4function useEtherscanDomain() {
5 const { networkType } = useNetwork();
7 switch (networkType) {
8 case NETWORK_TYPES.GOERLI:
9 return 'https://goerli.etherscan.io';
10 case NETWORK_TYPES.OFFLINE:
11 case NETWORK_TYPES.MAINNET:
12 case NETWORK_TYPES.LOCAL:
13 default:
14 return 'https://etherscan.io';
15 }
18export function useExploreTxUrl(txHash) {
19 const domain = useEtherscanDomain();
21 return `${domain}/tx/${txHash}`;
23export function useExploreTxUrls(txHashes = []) {
24 const domain = useEtherscanDomain();
26 return txHashes.map(txHash => `${domain}/tx/${txHash}`);
29export function useExploreAddressUrl(address) {
30 const domain = useEtherscanDomain();
32 return `${domain}/address/${address}`;