Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geth Admin management API's implemented (web3-eth-admin) #2657

Merged
merged 35 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b4f471e
web3-eth-admin added
princesinha19 Apr 6, 2019
1a5ada5
AdminAddPeerMethodTest fix
princesinha19 Apr 6, 2019
8c5745f
package-lock.json commit
princesinha19 Apr 6, 2019
43fb2da
Abstract method factory added
princesinha19 Apr 6, 2019
f0eba8c
AdminStopWSMethodTest updated
princesinha19 Apr 6, 2019
75b09f5
AdminAddPeerMethodTest.js fix
princesinha19 Apr 6, 2019
cfde2f6
Renamed packed AdminStopRpcMethodTest.js
princesinha19 Apr 6, 2019
f4e83a1
Updated type for web3-eth-admin
princesinha19 Apr 6, 2019
e037cf0
Added missing end of line
princesinha19 Apr 6, 2019
f24c2df
Request changes commit
princesinha19 Apr 6, 2019
ff8db24
Build pipeline fix
princesinha19 Apr 6, 2019
3faf7e2
simplified API's name
princesinha19 Apr 6, 2019
dd1d601
Added optional field in startWB & startRPC
princesinha19 Apr 6, 2019
7987dd1
build pipeline fix
princesinha19 Apr 7, 2019
4adc8bc
Type fixed
princesinha19 Apr 7, 2019
ca810b2
Build pipeline fix
princesinha19 Apr 7, 2019
cc77204
Build pipeline fix
princesinha19 Apr 7, 2019
c7e8e33
Method name changes
princesinha19 Apr 8, 2019
d87c541
Merge branch '1.0' into admin_methods
nivida Apr 8, 2019
58bbd5c
Methods renamed
princesinha19 Apr 8, 2019
ce3ee88
Merge branch '1.0' of https://github.com/ethereum/web3.js into admin_…
princesinha19 Apr 8, 2019
21128b8
Merge branch 'admin_methods' of https://github.com/princesinha19/web3…
princesinha19 Apr 8, 2019
b5e4dbb
Some changes
princesinha19 Apr 9, 2019
57c0f2b
startRPC and startWS overloaded
princesinha19 Apr 10, 2019
e01f50c
startRPC and startWS overloaded
princesinha19 Apr 10, 2019
9f5b228
build pipeline fix
princesinha19 Apr 10, 2019
b5db50f
build pipeline fix
princesinha19 Apr 10, 2019
40403d9
fix build
joshstevens19 Apr 12, 2019
b792d6e
typing fix
princesinha19 Apr 12, 2019
d6f31ea
Merge branch 'admin_methods' of https://github.com/princesinha19/web3…
princesinha19 Apr 12, 2019
de14e0a
typing fix
princesinha19 Apr 12, 2019
28df14e
Typing fix
princesinha19 Apr 12, 2019
b5c4889
Name fix
princesinha19 Apr 15, 2019
5c4633a
Name fix
princesinha19 Apr 15, 2019
2b1f122
Merge branch '1.0' into admin_methods
nivida Apr 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/web3-core-method/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
/**
* @file index.js
* @author Samuel Furter <samuel@ethereum.org>
* @author Samuel Furter <samuel@ethereum.org>, Prince Sinha <sinhaprince013@gmail.com>
* @date 2018
*/

Expand Down Expand Up @@ -118,3 +118,14 @@ export PostMethod from './methods/shh/PostMethod';
export SetMaxMessageSizeMethod from './methods/shh/SetMaxMessageSizeMethod';
export SetMinPoWMethod from './methods/shh/SetMinPoWMethod';
export ShhVersionMethod from './methods/shh/ShhVersionMethod';

// Admin
export AddPeerMethod from './methods/admin/AddPeerMethod';
export DataDirectoryMethod from './methods/admin/DataDirectoryMethod';
export NodeInfoMethod from './methods/admin/NodeInfoMethod';
export PeersMethod from './methods/admin/PeersMethod';
export SetSolcMethod from './methods/admin/SetSolcMethod';
export StartRpcMethod from './methods/admin/StartRpcMethod';
export StartWsMethod from './methods/admin/StartWsMethod';
export StopRpcMethod from './methods/admin/StopRpcMethod';
export StopWsMethod from './methods/admin/StopWsMethod';
36 changes: 36 additions & 0 deletions packages/web3-core-method/src/methods/admin/AddPeerMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 AddPeerMethod.js
* @author Prince Sinha <sinhaprince013@gmail.com>
* @date 2019
*/

import AbstractMethod from '../../../lib/methods/AbstractMethod';

export default class AddPeerMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('admin_addPeer', 1, utils, formatters, moduleInstance);
}
}
36 changes: 36 additions & 0 deletions packages/web3-core-method/src/methods/admin/DataDirectoryMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 DataDirectoryMethod.js
* @author Prince Sinha <sinhaprince013@gmail.com>
* @date 2019
*/

import AbstractMethod from '../../../lib/methods/AbstractMethod';

export default class DataDirectoryMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('admin_datadir', 0, utils, formatters, moduleInstance);
}
}
36 changes: 36 additions & 0 deletions packages/web3-core-method/src/methods/admin/NodeInfoMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 NodeInfoMethod.js
* @author Prince Sinha <sinhaprince013@gmail.com>
* @date 2019
*/

import AbstractMethod from '../../../lib/methods/AbstractMethod';

export default class NodeInfoMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('admin_nodeInfo', 0, utils, formatters, moduleInstance);
}
}
36 changes: 36 additions & 0 deletions packages/web3-core-method/src/methods/admin/PeersMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 PeersMethod.js
* @author Prince Sinha <sinhaprince013@gmail.com>
* @date 2019
*/

import AbstractMethod from '../../../lib/methods/AbstractMethod';

export default class PeersMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('admin_peers', 0, utils, formatters, moduleInstance);
}
}
36 changes: 36 additions & 0 deletions packages/web3-core-method/src/methods/admin/SetSolcMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 SetSolcMethod.js
* @author Prince Sinha <sinhaprince013@gmail.com>
* @date 2019
*/

import AbstractMethod from '../../../lib/methods/AbstractMethod';

export default class SetSolcMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('admin_setSolc', 1, utils, formatters, moduleInstance);
}
}
36 changes: 36 additions & 0 deletions packages/web3-core-method/src/methods/admin/StartRpcMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 StartRpcMethod.js
* @author Prince Sinha <sinhaprince013@gmail.com>
* @date 2019
*/

import AbstractMethod from '../../../lib/methods/AbstractMethod';

export default class StartRpcMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('admin_startRPC', 4, utils, formatters, moduleInstance);
}
}
36 changes: 36 additions & 0 deletions packages/web3-core-method/src/methods/admin/StartWsMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 StartWsMethod.js
* @author Prince Sinha <sinhaprince013@gmail.com>
* @date 2019
*/

import AbstractMethod from '../../../lib/methods/AbstractMethod';

export default class StartWsMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('admin_startWS', 4, utils, formatters, moduleInstance);
}
}
36 changes: 36 additions & 0 deletions packages/web3-core-method/src/methods/admin/StopRpcMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 StopRpcMethod.js
* @author Prince Sinha <sinhaprince013@gmail.com>
* @date 2019
*/

import AbstractMethod from '../../../lib/methods/AbstractMethod';

export default class StopRpcMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('admin_stopRPC', 0, utils, formatters, moduleInstance);
}
}
36 changes: 36 additions & 0 deletions packages/web3-core-method/src/methods/admin/StopWsMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 StopWsMethod.js
* @author Prince Sinha <sinhaprince013@gmail.com>
* @date 2019
*/

import AbstractMethod from '../../../lib/methods/AbstractMethod';

export default class StopWsMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('admin_stopWS', 0, utils, formatters, moduleInstance);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {formatters} from 'web3-core-helpers';
import AbstractMethod from '../../../../lib/methods/AbstractMethod';
import AddPeerMethod from '../../../../src/methods/admin/AddPeerMethod';

// Mocks
jest.mock('web3-core-helpers');

/**
* AddPeerMethod test
*/
describe('AdminAddPeerMethodTest', () => {
let method;

beforeEach(() => {
method = new AddPeerMethod(null, formatters, {});
});

it('constructor check', () => {
expect(method).toBeInstanceOf(AbstractMethod);

expect(method.rpcMethod).toEqual('admin_addPeer');

expect(method.parametersAmount).toEqual(1);

expect(method.utils).toEqual(null);

expect(method.formatters).toEqual(formatters);
});
});
Loading