use metamask/etherscan-link (#10580)
parent
91ffb80606
commit
3840a58e82
@ -1,28 +0,0 @@ |
||||
import assert from 'assert'; |
||||
import { getEtherscanNetworkPrefix } from '../../../ui/lib/etherscan-prefix-for-network'; |
||||
|
||||
describe('Etherscan Network Prefix', function () { |
||||
it('returns empty string as default value', function () { |
||||
assert.equal(getEtherscanNetworkPrefix(), ''); |
||||
}); |
||||
|
||||
it('returns empty string as a prefix for networkId of 1', function () { |
||||
assert.equal(getEtherscanNetworkPrefix('1'), ''); |
||||
}); |
||||
|
||||
it('returns ropsten as prefix for networkId of 3', function () { |
||||
assert.equal(getEtherscanNetworkPrefix('3'), 'ropsten.'); |
||||
}); |
||||
|
||||
it('returns rinkeby as prefix for networkId of 4', function () { |
||||
assert.equal(getEtherscanNetworkPrefix('4'), 'rinkeby.'); |
||||
}); |
||||
|
||||
it('returs kovan as prefix for networkId of 42', function () { |
||||
assert.equal(getEtherscanNetworkPrefix('42'), 'kovan.'); |
||||
}); |
||||
|
||||
it('returs goerli as prefix for networkId of 5', function () { |
||||
assert.equal(getEtherscanNetworkPrefix('5'), 'goerli.'); |
||||
}); |
||||
}); |
@ -1,23 +0,0 @@ |
||||
import * as networkEnums from '../../shared/constants/network'; |
||||
|
||||
/** |
||||
* Gets the etherscan.io URL prefix for a given network ID. |
||||
* |
||||
* @param {string} networkId - The network ID to get the prefix for. |
||||
* @returns {string} The etherscan.io URL prefix for the given network ID. |
||||
*/ |
||||
export function getEtherscanNetworkPrefix(networkId) { |
||||
switch (networkId) { |
||||
case networkEnums.ROPSTEN_NETWORK_ID: |
||||
return 'ropsten.'; |
||||
case networkEnums.RINKEBY_NETWORK_ID: |
||||
return 'rinkeby.'; |
||||
case networkEnums.KOVAN_NETWORK_ID: |
||||
return 'kovan.'; |
||||
case networkEnums.GOERLI_NETWORK_ID: |
||||
return 'goerli.'; |
||||
default: |
||||
// also covers mainnet
|
||||
return ''; |
||||
} |
||||
} |
Loading…
Reference in new issue