Fixing bug with getFloAddressTransactions
This commit is contained in:
parent
6ee599af68
commit
79b45e4cec
@ -222,38 +222,39 @@ async def getAddressTransactions():
|
|||||||
if len(tokenNames) != 0:
|
if len(tokenNames) != 0:
|
||||||
allTransactionList = []
|
allTransactionList = []
|
||||||
|
|
||||||
|
for token in tokenNames:
|
||||||
|
token = token[0]
|
||||||
|
dblocation = dbfolder + '/tokens/' + str(token) + '.db'
|
||||||
|
if os.path.exists(dblocation):
|
||||||
|
tempdict = {}
|
||||||
|
conn = sqlite3.connect(dblocation)
|
||||||
|
c = conn.cursor()
|
||||||
|
if limit is None:
|
||||||
|
c.execute('SELECT blockNumber, sourceFloAddress, destFloAddress, transferAmount, blockchainReference, transactionHash FROM transactionHistory ORDER BY id DESC LIMIT 100')
|
||||||
|
else:
|
||||||
|
c.execute('SELECT blockNumber, sourceFloAddress, destFloAddress, transferAmount, blockchainReference, transactionHash FROM transactionHistory ORDER BY id DESC LIMIT {}'.format(limit))
|
||||||
|
latestTransactions = c.fetchall()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
for token in tokenNames:
|
rowarray_list = []
|
||||||
token = token[0]
|
for row in latestTransactions:
|
||||||
dblocation = dbfolder + '/tokens/' + str(token) + '.db'
|
row = list(row)
|
||||||
if os.path.exists(dblocation):
|
d = {}
|
||||||
tempdict = {}
|
d['blockNumber'] = row[0]
|
||||||
conn = sqlite3.connect(dblocation)
|
d['sourceFloAddress'] = row[1]
|
||||||
c = conn.cursor()
|
d['destFloAddress'] = row[2]
|
||||||
if limit is None:
|
d['transferAmount'] = row[3]
|
||||||
c.execute('SELECT blockNumber, sourceFloAddress, destFloAddress, transferAmount, blockchainReference, transactionHash FROM transactionHistory ORDER BY id DESC LIMIT 100')
|
d['blockchainReference'] = row[4]
|
||||||
else:
|
d['transactionHash'] = row[5]
|
||||||
c.execute('SELECT blockNumber, sourceFloAddress, destFloAddress, transferAmount, blockchainReference, transactionHash FROM transactionHistory ORDER BY id DESC LIMIT {}'.format(limit))
|
rowarray_list.append(d)
|
||||||
latestTransactions = c.fetchall()
|
|
||||||
conn.close()
|
|
||||||
|
|
||||||
rowarray_list = []
|
tempdict['token'] = token
|
||||||
for row in latestTransactions:
|
tempdict['transactions'] = rowarray_list
|
||||||
row = list(row)
|
allTransactionList.append(tempdict)
|
||||||
d = {}
|
|
||||||
d['blockNumber'] = row[0]
|
|
||||||
d['sourceFloAddress'] = row[1]
|
|
||||||
d['destFloAddress'] = row[2]
|
|
||||||
d['transferAmount'] = row[3]
|
|
||||||
d['blockchainReference'] = row[4]
|
|
||||||
d['transactionHash'] = row[5]
|
|
||||||
rowarray_list.append(d)
|
|
||||||
|
|
||||||
tempdict['token'] = token
|
return jsonify(result='ok', floAddress=floAddress, allTransactions=allTransactionList)
|
||||||
tempdict['transactions'] = rowarray_list
|
else:
|
||||||
allTransactionList.append(tempdict)
|
return jsonify(result='error', description='No token transactions present present on this address')
|
||||||
|
|
||||||
return jsonify(result='ok', floAddress=floAddress, allTransactions=allTransactionList)
|
|
||||||
|
|
||||||
|
|
||||||
# SMART CONTRACT APIs
|
# SMART CONTRACT APIs
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user