Skip to content

Commit

Permalink
Merge pull request #1 from voith/feature/test-rpc
Browse files Browse the repository at this point in the history
implemented TestRPC using eth-tester
  • Loading branch information
voith authored Aug 13, 2018
2 parents 43675cd + 5c2b5de commit f7e2106
Show file tree
Hide file tree
Showing 11 changed files with 726 additions and 5 deletions.
52 changes: 52 additions & 0 deletions eth_tester_rpc/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import random

import click


from .server import get_application
from .utils.compat_threading import (
make_server,
spawn,
sleep,
)


@click.command()
@click.option(
'--host',
'-h',
default='localhost',
)
@click.option(
'--port',
'-p',
default=8545,
type=int,
)
def runserver(host, port):
application = get_application()

print(application.rpc_methods.web3_clientVersion(None))

print("\nListening on %s:%s" % (host, port))

server = make_server(
host,
port,
application,
)

spawn(server.serve_forever)

try:
while True:
sleep(random.random())
except KeyboardInterrupt:
try:
server.stop()
except AttributeError:
server.shutdown()


if __name__ == "__main__":
runserver()
Loading

0 comments on commit f7e2106

Please sign in to comment.