encode timestamp and confirmations into file list

This commit is contained in:
Victor Shyba 2019-04-29 00:37:18 -03:00 committed by Lex Berezhny
parent 9f83cce574
commit 7cf245a0e9

View file

@ -206,9 +206,16 @@ class JSONResponseEncoder(JSONEncoder):
result['is_default'] = self.ledger.accounts[0] == account result['is_default'] = self.ledger.accounts[0] == account
return result return result
@staticmethod def encode_file(self, managed_stream):
def encode_file(managed_stream): file = managed_stream.as_dict()
return managed_stream.as_dict() tx_height = managed_stream.stream_claim_info.height
best_height = self.ledger.headers.height
file.update({
'height': tx_height,
'confirmations': (best_height+1) - tx_height if tx_height > 0 else tx_height,
'timestamp': self.ledger.headers[tx_height]['timestamp'] if tx_height > 0 else None
})
return file
@staticmethod @staticmethod
def encode_claim(claim): def encode_claim(claim):