From aacd2fab97c3743e31d07222a15d5fe429f5b314 Mon Sep 17 00:00:00 2001 From: cdetrio Date: Thu, 7 Jun 2018 18:09:03 -0400 Subject: [PATCH 1/2] Add debug_accountRangeAt method --- lib/web3.js | 3 ++- lib/web3/methods/debug.js | 51 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 lib/web3/methods/debug.js diff --git a/lib/web3.js b/lib/web3.js index 6700ab4e59e..13e120977de 100644 --- a/lib/web3.js +++ b/lib/web3.js @@ -39,6 +39,7 @@ var Shh = require('./web3/methods/shh'); var Net = require('./web3/methods/net'); var Personal = require('./web3/methods/personal'); var Swarm = require('./web3/methods/swarm'); +var Debug = require('./web3/methods/debug'); var Settings = require('./web3/settings'); var version = require('./version.json'); var utils = require('./utils/utils'); @@ -60,6 +61,7 @@ function Web3 (provider) { this.shh = new Shh(this); this.net = new Net(this); this.personal = new Personal(this); + this.debug = new Debug(this); this.bzz = new Swarm(this); this.settings = new Settings(); this.version = { @@ -155,4 +157,3 @@ Web3.prototype.createBatch = function () { }; module.exports = Web3; - diff --git a/lib/web3/methods/debug.js b/lib/web3/methods/debug.js new file mode 100644 index 00000000000..54793c1aadf --- /dev/null +++ b/lib/web3/methods/debug.js @@ -0,0 +1,51 @@ +/* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . +*/ +/** + * @file debug.js + * @author ewasm team + * @date 2018 + */ + +"use strict"; + +var Method = require('../method'); + +function Debug(web3) { + this._requestManager = web3._requestManager; + + var self = this; + + methods().forEach(function(method) { + method.attachToObject(self); + method.setRequestManager(self._requestManager); + }); +} + +var methods = function () { + + var accountRangeAt = new Method({ + name: 'accountRangeAt', + call: 'debug_accountRangeAt', + params: 4 + }); + + return [ + accountRangeAt + ]; +}; + +module.exports = Debug; From bebb1bdbf59673502ed6d31616228b5e7087ccd7 Mon Sep 17 00:00:00 2001 From: cdetrio Date: Fri, 15 Jun 2018 14:43:14 -0400 Subject: [PATCH 2/2] Add debug_storageRangeAt method --- lib/web3/methods/debug.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/web3/methods/debug.js b/lib/web3/methods/debug.js index 54793c1aadf..0adaad8d49c 100644 --- a/lib/web3/methods/debug.js +++ b/lib/web3/methods/debug.js @@ -43,8 +43,15 @@ var methods = function () { params: 4 }); + var storageRangeAt = new Method({ + name: 'storageRangeAt', + call: 'debug_storageRangeAt', + params: 5 + }); + return [ - accountRangeAt + accountRangeAt, + storageRangeAt ]; };