2021-02-04 19:15:23 +01:00
|
|
|
import * as networkEnums from '../../shared/constants/network';
|
2020-07-08 23:05:09 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the etherscan.io URL prefix for a given network ID.
|
|
|
|
*
|
|
|
|
* @param {string} networkId - The network ID to get the prefix for.
|
|
|
|
* @returns {string} The etherscan.io URL prefix for the given network ID.
|
|
|
|
*/
|
2020-11-03 00:41:28 +01:00
|
|
|
export function getEtherscanNetworkPrefix(networkId) {
|
2020-07-08 23:05:09 +02:00
|
|
|
switch (networkId) {
|
|
|
|
case networkEnums.ROPSTEN_NETWORK_ID:
|
2021-02-04 19:15:23 +01:00
|
|
|
return 'ropsten.';
|
2020-07-08 23:05:09 +02:00
|
|
|
case networkEnums.RINKEBY_NETWORK_ID:
|
2021-02-04 19:15:23 +01:00
|
|
|
return 'rinkeby.';
|
2020-07-08 23:05:09 +02:00
|
|
|
case networkEnums.KOVAN_NETWORK_ID:
|
2021-02-04 19:15:23 +01:00
|
|
|
return 'kovan.';
|
2020-07-08 23:05:09 +02:00
|
|
|
case networkEnums.GOERLI_NETWORK_ID:
|
2021-02-04 19:15:23 +01:00
|
|
|
return 'goerli.';
|
2020-11-03 00:41:28 +01:00
|
|
|
default:
|
|
|
|
// also covers mainnet
|
2021-02-04 19:15:23 +01:00
|
|
|
return '';
|
2017-06-27 23:49:41 +02:00
|
|
|
}
|
|
|
|
}
|