diff --git a/remix-simulator/src/methods/whisper.js b/remix-simulator/src/methods/whisper.js new file mode 100644 index 0000000000..f7ffccf6ae --- /dev/null +++ b/remix-simulator/src/methods/whisper.js @@ -0,0 +1,16 @@ + +var Whisper = function() { +} + +Whisper.prototype.methods = function() { + return { + shh_version: this.shh_version.bind(this) + } +} + +Whisper.prototype.shh_version = function(payload, cb) { + cb(null, 5) +} + +module.exports = Whisper; + diff --git a/remix-simulator/src/provider.js b/remix-simulator/src/provider.js index 040d104462..e966f7d80e 100644 --- a/remix-simulator/src/provider.js +++ b/remix-simulator/src/provider.js @@ -2,6 +2,7 @@ var Web3 = require('web3') var RemixLib = require('remix-lib') const log = require('fancy-log') const Transactions = require('./methods/transactions.js') +const Whisper = require('./methods/whisper.js') const merge = require('merge') function jsonRPCResponse (id, result) { @@ -16,10 +17,11 @@ var Provider = function () { this.accounts[this.accounts[0].address.toLowerCase()] = this.accounts[0] this.accounts[this.accounts[0].address.toLowerCase()].privateKey = Buffer.from(this.accounts[this.accounts[0].address.toLowerCase()].privateKey.slice(2), 'hex') - this.Transactions = new Transactions(this.accounts); + this.Transactions = ; this.methods = {} - this.methods = merge(this.methods, this.Transactions.methods()) + this.methods = merge(this.methods, (new Transactions(this.accounts)).methods()) + this.methods = merge(this.methods, (new Whisper()).methods()) log.dir(this.methods) } @@ -41,9 +43,6 @@ Provider.prototype.sendAsync = function (payload, callback) { if (payload.method === 'web3_clientVersion') { callback(null, jsonRPCResponse(payload.id, 'Remix Simulator/0.0.1')) } - if (payload.method === 'shh_version') { - callback(null, jsonRPCResponse(payload.id, 5)) - } if (payload.method === 'eth_getBlockByNumber') { let b = { 'difficulty': '0x0',