add net methods

pull/7/head
Iuri Matias 6 years ago
parent 0412ea4aa6
commit 69baa09eb1
  1. 26
      remix-simulator/src/methods/net.js
  2. 2
      remix-simulator/src/provider.js

@ -0,0 +1,26 @@
var Net = function() {
}
Net.prototype.methods = function() {
return {
net_version: this.net_version,
net_listening: this.net_listening,
net_peerCount: this.net_peerCount
}
}
Net.prototype.net_version = function(payload, cb) {
// should be configured networkId
cb(null, 1337)
}
Net.prototype.net_listening = function(payload, cb) {
cb(null, true)
}
Net.prototype.net_peerCount = function(payload, cb) {
cb(null, 0)
}
module.exports = Net

@ -4,6 +4,7 @@ const merge = require('merge')
const Accounts = require('./methods/accounts.js')
const Blocks = require('./methods/blocks.js')
const Misc = require('./methods/misc.js')
const Net = require('./methods/net.js')
const Transactions = require('./methods/transactions.js')
const Whisper = require('./methods/whisper.js')
@ -14,6 +15,7 @@ var Provider = function () {
this.methods = merge(this.methods, this.Accounts.methods())
this.methods = merge(this.methods, (new Blocks()).methods())
this.methods = merge(this.methods, (new Misc()).methods())
this.methods = merge(this.methods, (new Net()).methods())
this.methods = merge(this.methods, (new Transactions(this.Accounts.accounts)).methods())
this.methods = merge(this.methods, (new Whisper()).methods())
}

Loading…
Cancel
Save