From 2c3bba312b80a41e3edad2fed864469b4351106d Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Thu, 28 Mar 2019 01:19:50 +0300 Subject: [PATCH] Fix explorer link --- helpers/get-explorer-links.js | 6 +++--- package-lock.json | 2 +- package.json | 2 +- test/test.js | 3 +++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/helpers/get-explorer-links.js b/helpers/get-explorer-links.js index 3fc16eb..324b967 100644 --- a/helpers/get-explorer-links.js +++ b/helpers/get-explorer-links.js @@ -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}` diff --git a/package-lock.json b/package-lock.json index bcf7eab..1d4d54a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "eth-net-props", - "version": "1.0.19", + "version": "1.0.20", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ae4a900..2ab4a19 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/test/test.js b/test/test.js index 74f7562..3d927ee 100644 --- a/test/test.js +++ b/test/test.js @@ -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()', () => {