Skip to content

Commit

Permalink
Add debug_accountRangeAt/debug_storageRangeAt methods (#1799)
Browse files Browse the repository at this point in the history
* Add debug_accountRangeAt method

* Add debug_storageRangeAt method
  • Loading branch information
axic authored and frozeman committed Aug 8, 2018
1 parent a80d2a0 commit 822cf8d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/web3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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 = {
Expand Down Expand Up @@ -155,4 +157,3 @@ Web3.prototype.createBatch = function () {
};

module.exports = Web3;

58 changes: 58 additions & 0 deletions lib/web3/methods/debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
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 <http://www.gnu.org/licenses/>.
*/
/**
* @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
});

var storageRangeAt = new Method({
name: 'storageRangeAt',
call: 'debug_storageRangeAt',
params: 5
});

return [
accountRangeAt,
storageRangeAt
];
};

module.exports = Debug;

0 comments on commit 822cf8d

Please sign in to comment.