diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-06-28 05:49:41 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-06-28 05:53:27 +0800 |
commit | 5440ed23d621c9ebcd24f89d54701f978e1c086e (patch) | |
tree | 694282fa94d6d60ef578ec8477f956404a815ef6 /ui/lib | |
parent | 81ec53a814596be6b4ae9dc351e999e8844780dd (diff) | |
download | tangerine-wallet-browser-5440ed23d621c9ebcd24f89d54701f978e1c086e.tar tangerine-wallet-browser-5440ed23d621c9ebcd24f89d54701f978e1c086e.tar.gz tangerine-wallet-browser-5440ed23d621c9ebcd24f89d54701f978e1c086e.tar.bz2 tangerine-wallet-browser-5440ed23d621c9ebcd24f89d54701f978e1c086e.tar.lz tangerine-wallet-browser-5440ed23d621c9ebcd24f89d54701f978e1c086e.tar.xz tangerine-wallet-browser-5440ed23d621c9ebcd24f89d54701f978e1c086e.tar.zst tangerine-wallet-browser-5440ed23d621c9ebcd24f89d54701f978e1c086e.zip |
Support other network links
Diffstat (limited to 'ui/lib')
-rw-r--r-- | ui/lib/etherscan-prefix-for-network.js | 21 | ||||
-rw-r--r-- | ui/lib/explorer-link.js | 21 |
2 files changed, 24 insertions, 18 deletions
diff --git a/ui/lib/etherscan-prefix-for-network.js b/ui/lib/etherscan-prefix-for-network.js new file mode 100644 index 000000000..2c1904f1c --- /dev/null +++ b/ui/lib/etherscan-prefix-for-network.js @@ -0,0 +1,21 @@ +module.exports = function (network) { + const net = parseInt(network) + let prefix + switch (net) { + case 1: // main net + prefix = '' + break + case 3: // ropsten test net + prefix = 'ropsten.' + break + case 4: // rinkeby test net + prefix = 'rinkeby.' + break + case 42: // kovan test net + prefix = 'kovan.' + break + default: + prefix = '' + } + return prefix +} diff --git a/ui/lib/explorer-link.js b/ui/lib/explorer-link.js index e11249551..3b82ecd5f 100644 --- a/ui/lib/explorer-link.js +++ b/ui/lib/explorer-link.js @@ -1,21 +1,6 @@ +const prefixForNetwork = require('./etherscan-prefix-for-network') + module.exports = function (hash, network) { - const net = parseInt(network) - let prefix - switch (net) { - case 1: // main net - prefix = '' - break - case 3: // ropsten test net - prefix = 'ropsten.' - break - case 4: // rinkeby test net - prefix = 'rinkeby.' - break - case 42: // kovan test net - prefix = 'kovan.' - break - default: - prefix = '' - } + const prefix = prefixForNetwork(network) return `http://${prefix}etherscan.io/tx/${hash}` } |