Example #1
0
 def get_address_info(self, address, date_from=None, date_to=None,
                      rows_per_page=rows_per_page_default):
     result = self.graph_db.address_stats_query(address).single_row()
     if result['num_transactions'] == 0:
         return {'transactions': 0}
     if date_from is None and date_to is None:
         count = result['num_transactions']
     else:
         count = self.graph_db.address_count_query(address, date_from, date_to).single_result()
     entity = self.graph_db.entity_query(address).single_result()
     return {'transactions': result['num_transactions'],
             'first': to_time(result['first'], True),
             'last': to_time(result['last'], True),
             'entity': entity,
             'pages': (count + rows_per_page - 1) // rows_per_page}
Example #2
0
 def transaction_relations(self, address1, address2, date_from, date_to):
     trs = self.graph_db.transaction_relations(address1, address2, date_from, date_to)
     transaction_relations = [{'txid': tr['txid'], 'in': round_value(tr['in']),
                               'out': round_value(tr['out']),
                               'timestamp': to_time(tr['timestamp'])}
                              for tr in trs]
     return transaction_relations
Example #3
0
 def __init__(self, address, identities, outputs):
     self.address = address
     self.identities = identities
     self.outputs = [{
         'txid': o['txid'],
         'value': round_value(o['value']),
         'timestamp': to_time(o['timestamp'])
     } for o in outputs]
Example #4
0
 def transaction_relations(self, address1, address2, date_from, date_to):
     trs = self.graph_db.transaction_relations(address1, address2,
                                               date_from, date_to)
     transaction_relations = [{
         'txid': tr['txid'],
         'in': round_value(tr['in']),
         'out': round_value(tr['out']),
         'timestamp': to_time(tr['timestamp'])
     } for tr in trs]
     return transaction_relations
Example #5
0
 def get_address_info(self,
                      address,
                      date_from=None,
                      date_to=None,
                      rows_per_page=rows_per_page_default):
     result = self.graph_db.address_stats_query(address).single_row()
     if result['num_transactions'] == 0:
         return {'transactions': 0}
     if date_from is None and date_to is None:
         count = result['num_transactions']
     else:
         count = self.graph_db.address_count_query(address, date_from,
                                                   date_to).single_result()
     entity = self.graph_db.entity_query(address).single_result()
     return {
         'transactions': result['num_transactions'],
         'first': to_time(result['first'], True),
         'last': to_time(result['last'], True),
         'entity': entity,
         'pages': (count + rows_per_page - 1) // rows_per_page
     }
Example #6
0
 def __init__(self, address, identities, outputs):
     self.address = address
     self.identities = identities
     self.outputs = [{'txid': o['txid'], 'value': round_value(o['value']),
                      'timestamp': to_time(o['timestamp'])}
                     for o in outputs]
Example #7
0
 def formatted_time(self):
     return to_time(self.timestamp)