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-05-14 04:09:40 +02:00
|
|
|
return `${rpcPrefs.blockExplorerUrl.replace(/\/+$/, '')}/address/${address}`
|
2019-05-09 19:27:14 +02:00
|
|
|
}
|
|
|
|
|
2016-08-19 01:23:12 +02:00
|
|
|
const net = parseInt(network)
|
|
|
|
let link
|
|
|
|
switch (net) {
|
|
|
|
case 1: // main net
|
2017-09-01 20:03:49 +02:00
|
|
|
link = `https://etherscan.io/address/${address}`
|
2016-08-19 01:23:12 +02:00
|
|
|
break
|
|
|
|
case 2: // morden test net
|
2017-09-01 20:03:49 +02:00
|
|
|
link = `https://morden.etherscan.io/address/${address}`
|
2016-08-19 01:23:12 +02:00
|
|
|
break
|
2016-11-21 19:58:49 +01:00
|
|
|
case 3: // ropsten test net
|
2017-09-01 20:03:49 +02:00
|
|
|
link = `https://ropsten.etherscan.io/address/${address}`
|
2016-11-21 19:58:49 +01:00
|
|
|
break
|
2017-04-25 23:39:01 +02:00
|
|
|
case 4: // rinkeby test net
|
2017-09-01 20:03:49 +02:00
|
|
|
link = `https://rinkeby.etherscan.io/address/${address}`
|
2017-04-25 23:39:01 +02:00
|
|
|
break
|
2017-03-22 21:02:17 +01:00
|
|
|
case 42: // kovan test net
|
2017-09-01 20:03:49 +02:00
|
|
|
link = `https://kovan.etherscan.io/address/${address}`
|
2017-03-22 21:02:17 +01:00
|
|
|
break
|
2019-04-17 19:34:49 +02:00
|
|
|
case 5: // goerli test net
|
|
|
|
link = `https://goerli.etherscan.io/address/${address}`
|
|
|
|
break
|
2016-08-19 01:23:12 +02:00
|
|
|
default:
|
|
|
|
link = ''
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
return link
|
|
|
|
}
|