2020-07-08 23:05:09 +02:00
|
|
|
import * as networkEnums from '../../app/scripts/controllers/network/enums'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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:
|
|
|
|
return 'ropsten.'
|
|
|
|
case networkEnums.RINKEBY_NETWORK_ID:
|
|
|
|
return 'rinkeby.'
|
|
|
|
case networkEnums.KOVAN_NETWORK_ID:
|
|
|
|
return 'kovan.'
|
|
|
|
case networkEnums.GOERLI_NETWORK_ID:
|
|
|
|
return 'goerli.'
|
2020-11-03 00:41:28 +01:00
|
|
|
default:
|
|
|
|
// also covers mainnet
|
2020-07-08 23:05:09 +02:00
|
|
|
return ''
|
2017-06-27 23:49:41 +02:00
|
|
|
}
|
|
|
|
}
|