diff --git a/testing.py b/testing.py index ab87751..427a34c 100644 --- a/testing.py +++ b/testing.py @@ -33,6 +33,19 @@ functions = { "type": "text" } } + }, + "txCount":{ + "name": "Count TXs", + "type": "default", + "description": "Get the number of TXs", + "params": {}, + "returns": { + "txs": + { + "name": "Transactions", + "type": "text" + } + } } } @@ -50,4 +63,19 @@ def generate(params, authentication): print(f"Generating {number} blocks to {address}") blocks = account.hsd.rpc_generateToAddress(address,number) return {"status": f"Successfully generated {number} blocks to {address}"} + + + +def txCount(params, authentication): + wallet = authentication.split(":")[0] + txCount = 0 + page = 1 + while True: + txs = account.getTransactions(wallet,page) + if len(txs) == 0: + break + txCount += len(txs) + page += 1 + + return {"txs": f'Total TXs: {txCount}'} \ No newline at end of file