0.1.4 • Published 7 years ago
eth-net-type v0.1.4
eth-net-type
Get infos about your current network type, supported networks so far: mainnet, morden, ropsten, kovan, rinkeby.
npm install eth-net-type --save
Note: Supported Node.js 4.0.0 and above
const ethNetType = require('eth-net-type')
ethNetType.guess(myWeb3Instance.eth.getBlock(0))
// returns (kovan example):
{
'match': true,
'block_hash': '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9',
'network_id': 42,
'name': 'kovan',
'disused': false,
'start_date': 1488459412
}
API
ethNetType.guess(<Number / String>)
Get network type by the network id number or the the genesis block hash.
ethNetType.getByGenBlockHash(<String>)
Get network type by the genesis block hash (block number 0).
ethNetType.getByNetId(<Number>)
Get network type by the network id number.
All methods return a match
parameter, true if there is a match otherwise false.
TESTS
Unit tests (chai+mocha) are included in test/general.js
npm run test
LICENSE
MIT