1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/ui/lib/explorer-link.js

22 lines
455 B
JavaScript
Raw Normal View History

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)
let prefix
2016-04-27 23:43:09 +02:00
switch (net) {
case 1: // main net
prefix = ''
2016-04-27 23:43:09 +02:00
break
case 3: // ropsten test net
prefix = 'ropsten.'
2016-04-27 23:43:09 +02:00
break
case 4: // rinkeby test net
prefix = 'rinkeby.'
break
case 42: // kovan test net
prefix = 'kovan.'
break
default:
prefix = ''
}
return `http://${prefix}etherscan.io/tx/${hash}`
}