-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86c4457
commit 8bf365f
Showing
11 changed files
with
115 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
def test_admin_addPeer(web3, skip_if_testrpc): | ||
skip_if_testrpc(web3) | ||
|
||
result = web3.admin.addPeer( | ||
result = web3.geth.admin.addPeer( | ||
'enode://44826a5d6a55f88a18298bca4773fca5749cdc3a5c9f308aa7d810e9b31123f3e7c5fba0b1d70aac5308426f47df2a128a6747040a3815cc7dd7167d03be320d@127.0.0.1:30304', # noqa: E501 | ||
) | ||
assert result is True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
def test_admin_nodeInfo(web3, skip_if_testrpc): | ||
skip_if_testrpc(web3) | ||
|
||
node_info = web3.admin.nodeInfo | ||
node_info = web3.geth.admin.nodeInfo | ||
|
||
assert 'enode' in node_info | ||
assert 'id' in node_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
def test_admin_peers(web3, skip_if_testrpc): | ||
skip_if_testrpc(web3) | ||
|
||
assert web3.admin.peers == [] | ||
assert web3.geth.admin.peers == [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,71 @@ | ||
from web3.module import ( | ||
Module, | ||
from web3.method import ( | ||
Method, | ||
default_root_munger, | ||
) | ||
|
||
|
||
class Admin(Module): | ||
def addPeer(self, node_url): | ||
return self.web3.manager.request_blocking( | ||
"admin_addPeer", [node_url], | ||
) | ||
def admin_start_params_munger(module, host='localhost', port='8546', cors='', apis='eth,net,web3'): | ||
return module, [host, port, cors, apis] | ||
|
||
@property | ||
def datadir(self): | ||
return self.web3.manager.request_blocking("admin_datadir", []) | ||
|
||
@property | ||
def nodeInfo(self): | ||
return self.web3.manager.request_blocking("admin_nodeInfo", []) | ||
def addPeer(): | ||
return Method( | ||
"admin_addPeer", | ||
mungers=[default_root_munger], | ||
) | ||
|
||
@property | ||
def peers(self): | ||
return self.web3.manager.request_blocking("admin_peers", []) | ||
|
||
def setSolc(self, solc_path): | ||
return self.web3.manager.request_blocking( | ||
"admin_setSolc", [solc_path], | ||
) | ||
def datadir(): | ||
return Method( | ||
"admin_datadir", | ||
mungers=None, | ||
) | ||
|
||
def startRPC(self, host='localhost', port='8545', cors="", apis="eth,net,web3"): | ||
return self.web3.manager.request_blocking( | ||
"admin_startRPC", | ||
[host, port, cors, apis], | ||
) | ||
|
||
def startWS(self, host='localhost', port='8546', cors="", apis="eth,net,web3"): | ||
return self.web3.manager.request_blocking( | ||
"admin_startWS", | ||
[host, port, cors, apis], | ||
) | ||
def nodeInfo(): | ||
return Method( | ||
"admin_nodeInfo", | ||
mungers=None, | ||
) | ||
|
||
def stopRPC(self): | ||
return self.web3.manager.request_blocking("admin_stopRPC", []) | ||
|
||
def stopWS(self): | ||
return self.web3.manager.request_blocking("admin_stopWS", []) | ||
def peers(): | ||
return Method( | ||
"admin_peers", | ||
mungers=None, | ||
) | ||
|
||
|
||
def setSolc(): | ||
return Method( | ||
"admin_setSolc", | ||
mungers=[default_root_munger], | ||
) | ||
|
||
|
||
def startRPC(): | ||
return Method( | ||
"admin_startRPC", | ||
mungers=[admin_start_params_munger], | ||
) | ||
|
||
|
||
def startWS(): | ||
return Method( | ||
"admin_startWS", | ||
mungers=[admin_start_params_munger], | ||
) | ||
|
||
|
||
def stopRPC(): | ||
return Method( | ||
"admin_stopRPC", | ||
mungers=None, | ||
) | ||
|
||
|
||
def stopWS(): | ||
return Method( | ||
"admin_stopWS", | ||
mungers=None, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters