Changed api/v2/latestTransactionDetails parameter to v2
This commit is contained in:
parent
c46c45e6b9
commit
26444acca9
@ -2020,9 +2020,9 @@ async def transactiondetails1(transactionHash):
|
|||||||
|
|
||||||
@app.route('/api/v2/latestTransactionDetails', methods=['GET'])
|
@app.route('/api/v2/latestTransactionDetails', methods=['GET'])
|
||||||
async def latestTransactionDetails():
|
async def latestTransactionDetails():
|
||||||
numberOfLatestBlocks = request.args.get('numberOfLatestBlocks')
|
limit = request.args.get('limit')
|
||||||
if numberOfLatestBlocks is not None and not check_integer(numberOfLatestBlocks):
|
if limit is not None and not check_integer(limit):
|
||||||
return jsonify(description='numberOfLatestBlocks validation failed'), 400
|
return jsonify(description='limit validation failed'), 400
|
||||||
|
|
||||||
dblocation = dbfolder + '/latestCache.db'
|
dblocation = dbfolder + '/latestCache.db'
|
||||||
if os.path.exists(dblocation):
|
if os.path.exists(dblocation):
|
||||||
@ -2031,8 +2031,8 @@ async def latestTransactionDetails():
|
|||||||
else:
|
else:
|
||||||
return jsonify(description='Latest transactions db doesn\'t exist. This is unusual, please report on https://github.com/ranchimall/ranchimallflo-api'), 500
|
return jsonify(description='Latest transactions db doesn\'t exist. This is unusual, please report on https://github.com/ranchimall/ranchimallflo-api'), 500
|
||||||
|
|
||||||
if numberOfLatestBlocks is not None:
|
if limit is not None:
|
||||||
c.execute('SELECT * FROM latestTransactions WHERE blockNumber IN (SELECT DISTINCT blockNumber FROM latestTransactions ORDER BY blockNumber DESC LIMIT {}) ORDER BY id ASC;'.format(int(numberOfLatestBlocks)))
|
c.execute('SELECT * FROM latestTransactions WHERE blockNumber IN (SELECT DISTINCT blockNumber FROM latestTransactions ORDER BY blockNumber DESC LIMIT {}) ORDER BY id ASC;'.format(int(limit)))
|
||||||
else:
|
else:
|
||||||
c.execute('''SELECT * FROM latestTransactions WHERE blockNumber IN (SELECT DISTINCT blockNumber FROM latestTransactions ORDER BY blockNumber DESC) ORDER BY id ASC;''')
|
c.execute('''SELECT * FROM latestTransactions WHERE blockNumber IN (SELECT DISTINCT blockNumber FROM latestTransactions ORDER BY blockNumber DESC) ORDER BY id ASC;''')
|
||||||
latestTransactions = c.fetchall()
|
latestTransactions = c.fetchall()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user