2016-06-21 22:18:32 +02:00
|
|
|
module.exports = function (hash, network) {
|
2016-04-27 23:43:09 +02:00
|
|
|
const net = parseInt(network)
|
2016-04-20 03:21:28 +02:00
|
|
|
let prefix
|
2016-04-27 23:43:09 +02:00
|
|
|
switch (net) {
|
2016-04-20 03:21:28 +02:00
|
|
|
case 1: // main net
|
|
|
|
prefix = ''
|
2016-04-27 23:43:09 +02:00
|
|
|
break
|
2017-03-22 21:02:17 +01:00
|
|
|
case 3: // ropsten test net
|
2017-03-27 19:57:04 +02:00
|
|
|
prefix = 'ropsten.'
|
2016-04-27 23:43:09 +02:00
|
|
|
break
|
2017-04-25 23:39:01 +02:00
|
|
|
case 4: // rinkeby test net
|
|
|
|
prefix = 'rinkeby.'
|
|
|
|
break
|
2017-03-22 21:02:17 +01:00
|
|
|
case 42: // kovan test net
|
|
|
|
prefix = 'kovan.'
|
|
|
|
break
|
2016-04-20 03:21:28 +02:00
|
|
|
default:
|
|
|
|
prefix = ''
|
|
|
|
}
|
|
|
|
return `http://${prefix}etherscan.io/tx/${hash}`
|
|
|
|
}
|