Fix explorer link

This commit is contained in:
Victor Baranov 2019-03-28 01:19:50 +03:00
parent 26c1688ead
commit 2c3bba312b
4 changed files with 8 additions and 5 deletions

View File

@ -24,7 +24,7 @@ const getExplorerAccountLinkFor = (account, network) => {
const prefix = getExplorerPrefix(network)
if (POA_IDs.includes(parseInt(network))) {
return `${blockScoutLink('poa', prefix)}/address/${account}`
} else if (network === CLASSIC_CODE) {
} else if (parseInt(network) === CLASSIC_CODE) {
return `${blockScoutLink('etc', prefix)}/address/${account}`
} else if (ETH_IDs.includes(parseInt(network))) {
return `${blockScoutLink('eth', prefix)}/address/${account}`
@ -39,7 +39,7 @@ const getExplorerTxLinkFor = (hash, network) => {
const prefix = getExplorerPrefix(network)
if (POA_IDs.includes(parseInt(network))) {
return `${blockScoutLink('poa', prefix)}/tx/${hash}`
} else if (network === CLASSIC_CODE) {
} else if (parseInt(network) === CLASSIC_CODE) {
return `${blockScoutLink('etc', prefix)}/tx/${hash}`
} else if (ETH_IDs.includes(parseInt(network))) {
return `${blockScoutLink('eth', prefix)}/tx/${hash}`
@ -54,7 +54,7 @@ const getExplorerTokenLinkFor = (tokenAddress, account, network) => {
const prefix = getExplorerPrefix(network)
if (POA_IDs.includes(parseInt(network))) {
return `${blockScoutLink('poa', prefix)}/tokens/${tokenAddress}`
} else if (network === CLASSIC_CODE) {
} else if (parseInt(network) === CLASSIC_CODE) {
return `${blockScoutLink('etc', prefix)}/tokens/${tokenAddress}`
} else if (ETH_IDs.includes(parseInt(network))) {
return `${blockScoutLink('eth', prefix)}/tokens/${tokenAddress}`

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "eth-net-props",
"version": "1.0.19",
"version": "1.0.20",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "eth-net-props",
"version": "1.0.19",
"version": "1.0.20",
"description": "Get properties of EMV-based network",
"main": "index.js",
"directories": {

View File

@ -41,6 +41,9 @@ describe('eth-net-props', () => {
it(`${claimPrefix} Ethereum Classic`, () => {
assert.equal(explorerLinks.getExplorerAccountLinkFor('0xd8fe15886d2dcbc5d7c06394beb417aadaf1eee0', 61), 'https://blockscout.com/etc/mainnet/address/0xd8fe15886d2dcbc5d7c06394beb417aadaf1eee0')
})
it(`${claimPrefix} Ethereum Classic`, () => {
assert.equal(explorerLinks.getExplorerAccountLinkFor('0xd8fe15886d2dcbc5d7c06394beb417aadaf1eee0', '61'), 'https://blockscout.com/etc/mainnet/address/0xd8fe15886d2dcbc5d7c06394beb417aadaf1eee0')
})
})
describe ('getExplorerTxLinkFor()', () => {