From 98bab65dc6074c04acb2a50dd704501625841d28 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 29 Aug 2018 11:11:00 -0400 Subject: [PATCH] add net methods --- remix-simulator/src/methods/net.js | 26 ++++++++++++++++++++++++++ remix-simulator/src/provider.js | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 remix-simulator/src/methods/net.js diff --git a/remix-simulator/src/methods/net.js b/remix-simulator/src/methods/net.js new file mode 100644 index 0000000000..70db0d73cb --- /dev/null +++ b/remix-simulator/src/methods/net.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 diff --git a/remix-simulator/src/provider.js b/remix-simulator/src/provider.js index 6a4327f7b5..65d3043e24 100644 --- a/remix-simulator/src/provider.js +++ b/remix-simulator/src/provider.js @@ -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()) }