on 261ea40 help sign in
bridge/src/lib/explorer.js
28 lines 665 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.ROPSTEN:
9 return 'https://ropsten.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}`;
24export function useExploreAddressUrl(address) {
25 const domain = useEtherscanDomain();
27 return `${domain}/address/${address}`;