2020-01-09 04:34:58 +01:00
|
|
|
export default function getAccountLink (address, network, rpcPrefs) {
|
2019-05-15 10:53:09 +02:00
|
|
|
if (rpcPrefs && rpcPrefs.blockExplorerUrl) {
|
2020-08-14 13:48:42 +02:00
|
|
|
return `${rpcPrefs.blockExplorerUrl.replace(/\/+$/u, '')}/address/${address}`
|
2019-05-09 19:27:14 +02:00
|
|
|
}
|
|
|
|
|
2020-08-18 21:08:22 +02:00
|
|
|
// eslint-disable-next-line radix
|
2016-08-19 01:23:12 +02:00
|
|
|
const net = parseInt(network)
|
|
|
|
switch (net) {
|
|
|
|
case 1: // main net
|
2020-08-14 17:01:59 +02:00
|
|
|
return `https://etherscan.io/address/${address}`
|
2016-08-19 01:23:12 +02:00
|
|
|
case 2: // morden test net
|
2020-08-14 17:01:59 +02:00
|
|
|
return `https://morden.etherscan.io/address/${address}`
|
2016-11-21 19:58:49 +01:00
|
|
|
case 3: // ropsten test net
|
2020-08-14 17:01:59 +02:00
|
|
|
return `https://ropsten.etherscan.io/address/${address}`
|
2017-04-25 23:39:01 +02:00
|
|
|
case 4: // rinkeby test net
|
2020-08-14 17:01:59 +02:00
|
|
|
return `https://rinkeby.etherscan.io/address/${address}`
|
2017-03-22 21:02:17 +01:00
|
|
|
case 42: // kovan test net
|
2020-08-14 17:01:59 +02:00
|
|
|
return `https://kovan.etherscan.io/address/${address}`
|
2019-04-17 19:34:49 +02:00
|
|
|
case 5: // goerli test net
|
2020-08-14 17:01:59 +02:00
|
|
|
return `https://goerli.etherscan.io/address/${address}`
|
2016-08-19 01:23:12 +02:00
|
|
|
default:
|
2020-08-14 17:01:59 +02:00
|
|
|
return ''
|
2016-08-19 01:23:12 +02:00
|
|
|
}
|
|
|
|
}
|