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