add VM type

pull/1/head
yann300 7 years ago
parent 45607696a8
commit f3331b29d4
  1. 28
      src/execution-context.js

@ -95,18 +95,22 @@ function ExecutionContext () {
} }
this.detectNetwork = function (callback) { this.detectNetwork = function (callback) {
this.web3().version.getNetwork((err, id) => { if (this.isVM()) {
var name = null callback(null, { id: '-', name: 'VM' })
if (err) name = 'Unknown' } else {
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md this.web3().version.getNetwork((err, id) => {
else if (id === '1') name = 'Main' var name = null
else if (id === '2') name = 'Morden (deprecated)' if (err) name = 'Unknown'
else if (id === '3') name = 'Ropsten' // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
else if (id === '4') name = 'Rinkeby' else if (id === '1') name = 'Main'
else if (id === '42') name = 'Kovan' else if (id === '2') name = 'Morden (deprecated)'
else name = 'Unknown' else if (id === '3') name = 'Ropsten'
callback(err, { id, name }) else if (id === '4') name = 'Rinkeby'
}) else if (id === '42') name = 'Kovan'
else name = 'Custom'
callback(err, { id, name })
})
}
} }
this.internalWeb3 = function () { this.internalWeb3 = function () {

Loading…
Cancel
Save