move whisper methods

pull/7/head
Iuri Matias 7 years ago
parent 807ca5aaf1
commit c95fb04af4
  1. 16
      remix-simulator/src/methods/whisper.js
  2. 9
      remix-simulator/src/provider.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;

@ -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',

Loading…
Cancel
Save