aboutsummaryrefslogtreecommitdiff
path: root/utils/python-rpc/framework/daemon.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/python-rpc/framework/daemon.py')
-rw-r--r--utils/python-rpc/framework/daemon.py162
1 files changed, 130 insertions, 32 deletions
diff --git a/utils/python-rpc/framework/daemon.py b/utils/python-rpc/framework/daemon.py
index 1d6c57c56..f811535b1 100644
--- a/utils/python-rpc/framework/daemon.py
+++ b/utils/python-rpc/framework/daemon.py
@@ -37,10 +37,11 @@ class Daemon(object):
self.port = port
self.rpc = JSONRPC('{protocol}://{host}:{port}'.format(protocol=protocol, host=host, port=port if port else 18180+idx))
- def getblocktemplate(self, address, prev_block = ""):
+ def getblocktemplate(self, address, prev_block = "", client = ""):
getblocktemplate = {
'method': 'getblocktemplate',
'params': {
+ 'client': client,
'wallet_address': address,
'reserve_size' : 1,
'prev_block' : prev_block,
@@ -51,8 +52,9 @@ class Daemon(object):
return self.rpc.send_json_rpc_request(getblocktemplate)
get_block_template = getblocktemplate
- def send_raw_transaction(self, tx_as_hex, do_not_relay = False, do_sanity_checks = True):
+ def send_raw_transaction(self, tx_as_hex, do_not_relay = False, do_sanity_checks = True, client = ""):
send_raw_transaction = {
+ 'client': client,
'tx_as_hex': tx_as_hex,
'do_not_relay': do_not_relay,
'do_sanity_checks': do_sanity_checks,
@@ -70,10 +72,11 @@ class Daemon(object):
return self.rpc.send_json_rpc_request(submitblock)
submit_block = submitblock
- def getblock(self, hash = '', height = 0, fill_pow_hash = False):
+ def getblock(self, hash = '', height = 0, fill_pow_hash = False, client = ""):
getblock = {
'method': 'getblock',
'params': {
+ 'client': client,
'hash': hash,
'height': height,
'fill_pow_hash': fill_pow_hash,
@@ -84,10 +87,11 @@ class Daemon(object):
return self.rpc.send_json_rpc_request(getblock)
get_block = getblock
- def getlastblockheader(self):
+ def getlastblockheader(self, client = ""):
getlastblockheader = {
'method': 'getlastblockheader',
'params': {
+ 'client': client,
},
'jsonrpc': '2.0',
'id': '0'
@@ -95,10 +99,11 @@ class Daemon(object):
return self.rpc.send_json_rpc_request(getlastblockheader)
get_last_block_header = getlastblockheader
- def getblockheaderbyhash(self, hash = "", hashes = []):
+ def getblockheaderbyhash(self, hash = "", hashes = [], client = ""):
getblockheaderbyhash = {
'method': 'getblockheaderbyhash',
'params': {
+ 'client': client,
'hash': hash,
'hashes': hashes,
},
@@ -108,10 +113,11 @@ class Daemon(object):
return self.rpc.send_json_rpc_request(getblockheaderbyhash)
get_block_header_by_hash = getblockheaderbyhash
- def getblockheaderbyheight(self, height):
+ def getblockheaderbyheight(self, height, client = ""):
getblockheaderbyheight = {
'method': 'getblockheaderbyheight',
'params': {
+ 'client': client,
'height': height,
},
'jsonrpc': '2.0',
@@ -120,10 +126,11 @@ class Daemon(object):
return self.rpc.send_json_rpc_request(getblockheaderbyheight)
get_block_header_by_height = getblockheaderbyheight
- def getblockheadersrange(self, start_height, end_height, fill_pow_hash = False):
+ def getblockheadersrange(self, start_height, end_height, fill_pow_hash = False, client = ""):
getblockheadersrange = {
'method': 'getblockheadersrange',
'params': {
+ 'client': client,
'start_height': start_height,
'end_height': end_height,
'fill_pow_hash': fill_pow_hash,
@@ -134,28 +141,35 @@ class Daemon(object):
return self.rpc.send_json_rpc_request(getblockheadersrange)
get_block_headers_range = getblockheadersrange
- def get_connections(self):
+ def get_connections(self, client = ""):
get_connections = {
+ 'client': client,
'method': 'get_connections',
'jsonrpc': '2.0',
'id': '0'
}
return self.rpc.send_json_rpc_request(get_connections)
- def get_info(self):
+ def get_info(self, client = ""):
get_info = {
- 'method': 'get_info',
- 'jsonrpc': '2.0',
- 'id': '0'
+ 'method': 'get_info',
+ 'params': {
+ 'client': client,
+ },
+ 'jsonrpc': '2.0',
+ 'id': '0'
}
return self.rpc.send_json_rpc_request(get_info)
getinfo = get_info
- def hard_fork_info(self):
+ def hard_fork_info(self, client = ""):
hard_fork_info = {
- 'method': 'hard_fork_info',
- 'jsonrpc': '2.0',
- 'id': '0'
+ 'method': 'hard_fork_info',
+ 'params': {
+ 'client': client,
+ },
+ 'jsonrpc': '2.0',
+ 'id': '0'
}
return self.rpc.send_json_rpc_request(hard_fork_info)
@@ -174,7 +188,7 @@ class Daemon(object):
}
return self.rpc.send_json_rpc_request(generateblocks)
- def get_height(self):
+ def get_height(self, client = ""):
get_height = {
'method': 'get_height',
'jsonrpc': '2.0',
@@ -208,18 +222,21 @@ class Daemon(object):
}
return self.rpc.send_request('/mining_status', mining_status)
- def get_transaction_pool(self):
+ def get_transaction_pool(self, client = ""):
get_transaction_pool = {
+ 'client': client,
}
return self.rpc.send_request('/get_transaction_pool', get_transaction_pool)
- def get_transaction_pool_hashes(self):
+ def get_transaction_pool_hashes(self, client = ""):
get_transaction_pool_hashes = {
+ 'client': client,
}
return self.rpc.send_request('/get_transaction_pool_hashes', get_transaction_pool_hashes)
- def get_transaction_pool_stats(self):
+ def get_transaction_pool_stats(self, client = ""):
get_transaction_pool_stats = {
+ 'client': client,
}
return self.rpc.send_request('/get_transaction_pool_stats', get_transaction_pool_stats)
@@ -263,8 +280,9 @@ class Daemon(object):
}
return self.rpc.send_json_rpc_request(set_bans)
- def get_transactions(self, txs_hashes = [], decode_as_json = False, prune = False, split = False):
+ def get_transactions(self, txs_hashes = [], decode_as_json = False, prune = False, split = False, client = ""):
get_transactions = {
+ 'client': client,
'txs_hashes': txs_hashes,
'decode_as_json': decode_as_json,
'prune': prune,
@@ -273,17 +291,19 @@ class Daemon(object):
return self.rpc.send_request('/get_transactions', get_transactions)
gettransactions = get_transactions
- def get_outs(self, outputs = [], get_txid = False):
+ def get_outs(self, outputs = [], get_txid = False, client = ""):
get_outs = {
+ 'client': client,
'outputs': outputs,
'get_txid': get_txid,
}
return self.rpc.send_request('/get_outs', get_outs)
- def get_coinbase_tx_sum(self, height, count):
+ def get_coinbase_tx_sum(self, height, count, client = ""):
get_coinbase_tx_sum = {
'method': 'get_coinbase_tx_sum',
'params': {
+ 'client': client,
'height': height,
'count': count,
},
@@ -292,10 +312,11 @@ class Daemon(object):
}
return self.rpc.send_json_rpc_request(get_coinbase_tx_sum)
- def get_output_distribution(self, amounts = [], from_height = 0, to_height = 0, cumulative = False, binary = False, compress = False):
+ def get_output_distribution(self, amounts = [], from_height = 0, to_height = 0, cumulative = False, binary = False, compress = False, client = ""):
get_output_distribution = {
'method': 'get_output_distribution',
'params': {
+ 'client': client,
'amounts': amounts,
'from_height': from_height,
'to_height': to_height,
@@ -308,10 +329,11 @@ class Daemon(object):
}
return self.rpc.send_json_rpc_request(get_output_distribution)
- def get_output_histogram(self, amounts = [], min_count = 0, max_count = 0, unlocked = False, recent_cutoff = 0):
+ def get_output_histogram(self, amounts = [], min_count = 0, max_count = 0, unlocked = False, recent_cutoff = 0, client = ""):
get_output_histogram = {
'method': 'get_output_histogram',
'params': {
+ 'client': client,
'amounts': amounts,
'min_count': min_count,
'max_count': max_count,
@@ -335,15 +357,17 @@ class Daemon(object):
}
return self.rpc.send_request('/set_log_categories', set_log_categories)
- def get_alt_blocks_hashes(self):
+ def get_alt_blocks_hashes(self, client = ""):
get_alt_blocks_hashes = {
+ 'client': client,
}
return self.rpc.send_request('/get_alt_blocks_hashes', get_alt_blocks_hashes)
- def get_alternate_chains(self):
+ def get_alternate_chains(self, client = ""):
get_alternate_chains = {
'method': 'get_alternate_chains',
'params': {
+ 'client': client,
},
'jsonrpc': '2.0',
'id': '0'
@@ -361,9 +385,10 @@ class Daemon(object):
}
return self.rpc.send_json_rpc_request(get_fee_estimate)
- def is_key_image_spent(self, key_images = []):
+ def is_key_image_spent(self, key_images = [], client = ""):
is_key_image_spent = {
'key_images': key_images,
+ 'client': client,
}
return self.rpc.send_request('/is_key_image_spent', is_key_image_spent)
@@ -413,7 +438,7 @@ class Daemon(object):
def in_peers(self, in_peers):
in_peers = {
- 'in_peers': in_peers,
+ 'client': client,
}
return self.rpc.send_request('/in_peers', in_peers)
@@ -446,31 +471,34 @@ class Daemon(object):
on_get_block_hash = get_block_hash
on_getblockhash = get_block_hash
- def relay_tx(self, txids = []):
+ def relay_tx(self, txids = [], client = ""):
relay_tx = {
'method': 'relay_tx',
'params': {
'txids': txids,
+ 'client': client,
},
'jsonrpc': '2.0',
'id': '0'
}
return self.rpc.send_json_rpc_request(relay_tx)
- def sync_info(self):
+ def sync_info(self, client = ""):
sync_info = {
'method': 'sync_info',
'params': {
+ 'client': client,
},
'jsonrpc': '2.0',
'id': '0'
}
return self.rpc.send_json_rpc_request(sync_info)
- def get_txpool_backlog(self):
+ def get_txpool_backlog(self, client = ""):
get_txpool_backlog = {
'method': 'get_txpool_backlog',
'params': {
+ 'client': client,
},
'jsonrpc': '2.0',
'id': '0'
@@ -498,3 +526,73 @@ class Daemon(object):
'id': '0'
}
return self.rpc.send_json_rpc_request(get_block_rate)
+
+ def rpc_access_info(self, client):
+ rpc_access_info = {
+ 'method': 'rpc_access_info',
+ 'params': {
+ 'client': client,
+ },
+ 'jsonrpc': '2.0',
+ 'id': '0'
+ }
+ return self.rpc.send_json_rpc_request(rpc_access_info)
+
+ def rpc_access_submit_nonce(self, client, nonce, cookie):
+ rpc_access_submit_nonce = {
+ 'method': 'rpc_access_submit_nonce',
+ 'params': {
+ 'client': client,
+ 'nonce': nonce,
+ 'cookie': cookie,
+ },
+ 'jsonrpc': '2.0',
+ 'id': '0'
+ }
+ return self.rpc.send_json_rpc_request(rpc_access_submit_nonce)
+
+ def rpc_access_pay(self, client, paying_for, payment):
+ rpc_access_pay = {
+ 'method': 'rpc_access_pay',
+ 'params': {
+ 'client': client,
+ 'paying_for': paying_for,
+ 'payment': payment,
+ },
+ 'jsonrpc': '2.0',
+ 'id': '0'
+ }
+ return self.rpc.send_json_rpc_request(rpc_access_pay)
+
+ def rpc_access_tracking(self, clear = False):
+ rpc_access_tracking = {
+ 'method': 'rpc_access_tracking',
+ 'params': {
+ 'clear': clear,
+ },
+ 'jsonrpc': '2.0',
+ 'id': '0'
+ }
+ return self.rpc.send_json_rpc_request(rpc_access_tracking)
+
+ def rpc_access_data(self):
+ rpc_access_data = {
+ 'method': 'rpc_access_data',
+ 'params': {
+ },
+ 'jsonrpc': '2.0',
+ 'id': '0'
+ }
+ return self.rpc.send_json_rpc_request(rpc_access_data)
+
+ def rpc_access_account(self, client, delta_balance = 0):
+ rpc_access_account = {
+ 'method': 'rpc_access_account',
+ 'params': {
+ 'client': client,
+ 'delta_balance': delta_balance,
+ },
+ 'jsonrpc': '2.0',
+ 'id': '0'
+ }
+ return self.rpc.send_json_rpc_request(rpc_access_account)