forked from axiom-team/jaklis
Adding blockstamp to history JSON
This commit is contained in:
parent
b6dbc5f8da
commit
fc587819b0
|
@ -43,6 +43,7 @@ class History:
|
|||
node {
|
||||
currency
|
||||
issuers
|
||||
blockstamp
|
||||
outputs
|
||||
comment
|
||||
writtenTime
|
||||
|
@ -57,13 +58,15 @@ class History:
|
|||
comment
|
||||
outputs
|
||||
receivedTime
|
||||
blockstamp
|
||||
}
|
||||
receiving {
|
||||
sending {
|
||||
currency
|
||||
issuers
|
||||
comment
|
||||
outputs
|
||||
receivedTime
|
||||
blockstamp
|
||||
}
|
||||
}
|
||||
balance(script: $script) {
|
||||
|
@ -119,6 +122,7 @@ class History:
|
|||
trans[i] = []
|
||||
trans[i].append(direction)
|
||||
trans[i].append(transaction['writtenTime'])
|
||||
|
||||
if direction == 'SENT':
|
||||
trans[i].append(outPubkey)
|
||||
amount = int('-' + output.split(':')[0])
|
||||
|
@ -133,12 +137,11 @@ class History:
|
|||
trans[i].append(round(amount/self.UD, 2))
|
||||
trans[i].append(transaction['comment'])
|
||||
trans[i].append(base)
|
||||
trans[i].append(transaction['blockstamp'])
|
||||
i += 1
|
||||
|
||||
# Parse transactions in mempool
|
||||
for direction in self.historyDoc['txsHistoryMp']:
|
||||
resBc = []
|
||||
resBc = self.historyDoc['txsHistoryMp'][direction]
|
||||
for direction, resBc in self.historyDoc['txsHistoryMp'].items():
|
||||
for j, transaction in enumerate(resBc):
|
||||
# print(transaction)
|
||||
transaction = resBc[j]
|
||||
|
@ -147,9 +150,11 @@ class History:
|
|||
# if direction == 'RECEIVING' or self.pubkey != outPubkey:
|
||||
trans.append(i)
|
||||
trans[i] = []
|
||||
trans[i].append(direction)
|
||||
trans[i].append(int(time.time()))
|
||||
if direction == 'SENDING':
|
||||
trans[i].append(direction.upper())
|
||||
trans[i].append(transaction['receivedTime'])
|
||||
|
||||
# trans[i].append(int(time.time()))
|
||||
if direction.upper() == 'SENDING':
|
||||
trans[i].append(outPubkey)
|
||||
amount = int('-' + output.split(':')[0])
|
||||
else:
|
||||
|
@ -163,6 +168,7 @@ class History:
|
|||
trans[i].append(round(amount/self.UD, 2))
|
||||
trans[i].append(transaction['comment'])
|
||||
trans[i].append(base)
|
||||
trans[i].append(transaction['blockstamp'])
|
||||
i += 1
|
||||
|
||||
# Order transactions by date
|
||||
|
@ -263,6 +269,7 @@ class History:
|
|||
dailyJSON[i]['amount'] = trans[3]
|
||||
dailyJSON[i]['amountUD'] = trans[4]
|
||||
dailyJSON[i]['comment'] = trans[5]
|
||||
dailyJSON[i]['blockstamp'] = trans[7]
|
||||
|
||||
dailyJSON = json.dumps(dailyJSON, indent=2)
|
||||
# If we want to write JSON to a file
|
||||
|
|
Loading…
Reference in New Issue