Commit f3331b29 authored by yann300's avatar yann300

add VM type

parent 45607696
...@@ -95,6 +95,9 @@ function ExecutionContext () { ...@@ -95,6 +95,9 @@ function ExecutionContext () {
} }
this.detectNetwork = function (callback) { this.detectNetwork = function (callback) {
if (this.isVM()) {
callback(null, { id: '-', name: 'VM' })
} else {
this.web3().version.getNetwork((err, id) => { this.web3().version.getNetwork((err, id) => {
var name = null var name = null
if (err) name = 'Unknown' if (err) name = 'Unknown'
...@@ -104,10 +107,11 @@ function ExecutionContext () { ...@@ -104,10 +107,11 @@ function ExecutionContext () {
else if (id === '3') name = 'Ropsten' else if (id === '3') name = 'Ropsten'
else if (id === '4') name = 'Rinkeby' else if (id === '4') name = 'Rinkeby'
else if (id === '42') name = 'Kovan' else if (id === '42') name = 'Kovan'
else name = 'Unknown' else name = 'Custom'
callback(err, { id, name }) callback(err, { id, name })
}) })
} }
}
this.internalWeb3 = function () { this.internalWeb3 = function () {
return web3 return web3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment