web3-detect-network
Detect network from Web3 provider.
Install
npm install web3-detect-network
API
-
detectNetwork(web3Provider) -> Promise({object})
- {object} web3Provider - Web3 provider object
Returns an object containing
id
(network ID) andtype
(network name).
Usage
const detectNetwork = ;async { const network = await console/*{ "id": "4", "type": "rinkeby"}*/}
Test
npm test
License
MIT