etherscan-link
Advanced tools
Comparing version 1.0.1 to 1.0.2
const prefixForNetwork = require('./prefix-for-network') | ||
module.exports = function (hash, network) { | ||
module.exports = function (address, network) { | ||
const net = parseInt(network) | ||
const prefix = prefixForNetwork(network) | ||
return `http://${prefix}etherscan.io/tx/${hash}` | ||
return `http://${prefix}etherscan.io/address/${address}` | ||
} | ||
29
index.js
@@ -1,27 +0,8 @@ | ||
module.exports = function (address, network) { | ||
const net = parseInt(network) | ||
let link | ||
switch (net) { | ||
case 1: // main net | ||
link = `https://etherscan.io/address/${address}` | ||
break | ||
case 2: // morden test net | ||
link = `https://morden.etherscan.io/address/${address}` | ||
break | ||
case 3: // ropsten test net | ||
link = `https://ropsten.etherscan.io/address/${address}` | ||
break | ||
case 4: // rinkeby test net | ||
link = `https://rinkeby.etherscan.io/address/${address}` | ||
break | ||
case 42: // kovan test net | ||
link = `https://kovan.etherscan.io/address/${address}` | ||
break | ||
default: | ||
link = '' | ||
break | ||
} | ||
const createExplorerLink = require('./explorer-link') | ||
const createAccountLink = require('./account-link') | ||
return link | ||
module.exports = { | ||
createExplorerLink, | ||
createAccountLink, | ||
} | ||
{ | ||
"name": "etherscan-link", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A library for generating etherscan links.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node test" | ||
"test": "mocha" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
3535
61