OSDN Git Service

change the project readme file.
[bytom/bytom-spanner.git] / utxomerger / UnspentOutputs.py
1 import json
2
3
4 class UnspentOutputs(object):
5
6     @staticmethod
7     def get_block_height(connection):
8         response = connection.request("/get-block-count")
9
10         resp_json = json.loads(response.text)
11
12         if resp_json['status'] == 'success':
13             return resp_json['data']['block_count'], 1
14         elif resp_json['status'] == 'fail':
15             return resp_json['msg'], -1
16         else:
17             return resp_json, 0
18
19     @staticmethod
20     def list_UTXO(connection):
21         response = connection.request("/list-unspent-outputs")
22
23         resp_json = json.loads(response.text)
24
25         if resp_json['status'] == 'success':
26             return resp_json['data'], 1
27         elif resp_json['status'] == 'fail':
28             return resp_json['msg'], -1
29         else:
30             return resp_json, 0