mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-20 11:45:53 +00:00
add basic account_tx handler
This commit is contained in:
15
test.py
15
test.py
@@ -22,6 +22,16 @@ async def account_info(ip, port):
|
||||
except websockets.exceptions.ConnectionClosedError as e:
|
||||
print(e)
|
||||
|
||||
async def account_tx(ip, port):
|
||||
address = 'ws://' + str(ip) + ':' + str(port)
|
||||
try:
|
||||
async with websockets.connect(address) as ws:
|
||||
await ws.send(json.dumps({"command":"account_tx","account":"rDzTZxa7NwD9vmNf5dvTbW4FQDNSRsfPv6"}))
|
||||
res = json.loads(await ws.recv())
|
||||
print(res)
|
||||
except websockets.exceptions.ConnectionClosedError as e:
|
||||
print(e)
|
||||
|
||||
async def tx(ip, port, tx_hash):
|
||||
address = 'ws://' + str(ip) + ':' + str(port)
|
||||
try:
|
||||
@@ -36,7 +46,7 @@ async def tx(ip, port, tx_hash):
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='test script for xrpl-reporting')
|
||||
parser.add_argument('action', choices=["account_info", "tx"])
|
||||
parser.add_argument('action', choices=["account_info", "tx", "account_tx"])
|
||||
parser.add_argument('--ip', default='127.0.0.1')
|
||||
parser.add_argument('--port', default='8080')
|
||||
parser.add_argument('--hash')
|
||||
@@ -53,6 +63,9 @@ def run(args):
|
||||
if args.action == "tx":
|
||||
asyncio.get_event_loop().run_until_complete(
|
||||
tx(args.ip, args.port, args.hash))
|
||||
if args.action == "account_tx":
|
||||
asyncio.get_event_loop().run_until_complete(
|
||||
account_tx(args.ip, args.port))
|
||||
else:
|
||||
print("incorrect arguments")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user