eth-net-props/helpers/get-net-properties.js

52 lines
833 B
JavaScript
Raw Normal View History

function getNetworkDisplayName(network) {
const netID = parseInt(network)
switch (netID) {
2018-10-29 05:20:11 -07:00
case 1:
return 'Main Ethereum Network'
case 3:
return 'Ropsten Test Network'
case 4:
return 'Rinkeby Test Network'
case 42:
return 'Kovan Test Network'
case 77:
return 'POA Sokol Test Network'
case 99:
return 'POA Network'
case 100:
return 'xDai Chain'
default:
return 'Unknown Private Network'
}
}
2018-10-11 10:40:59 -07:00
function getNetworkCoinName(network) {
const netID = parseInt(network)
switch (netID) {
2018-10-29 05:20:11 -07:00
case 77:
case 99:
return 'POA'
case 100:
return 'xDAI'
default:
return 'ETH'
2018-10-11 10:40:59 -07:00
}
}
function isTestnet(network) {
const netID = parseInt(network)
switch (netID) {
2018-10-29 05:20:11 -07:00
case 1:
case 99:
case 100:
return false
default:
return true
}
}
module.exports = {
2018-10-11 10:40:59 -07:00
getNetworkDisplayName,
getNetworkCoinName,
isTestnet
}