Changes to the API

This commit is contained in:
Vivek Teega 2019-06-11 21:56:59 +05:30
parent 0a27fc3422
commit 58cb925e7f

View File

@ -341,10 +341,14 @@ async def getParticipantDetails():
if floaddress in list(activeContracts[0]):
c.execute("select contractName from activecontracts where contractAddress=='"+floaddress+"'")
name = c.fetchall()
contract_names = c.fetchall()
if len(name) != 0:
contractName = '{}-{}.db'.format(name[0][0].strip(),floaddress.strip())
if len(contract_names) != 0:
contractlist = []
for contract_name in contract_names:
contractName = '{}-{}.db'.format(contract_name[0].strip(),floaddress.strip())
filelocation = os.path.join(dbfolder,'smartContracts', contractName)
if os.path.isfile(filelocation):
@ -367,6 +371,7 @@ async def getParticipantDetails():
continue
returnval[row[0]] = row[1]
c.execute('select count(participantAddress) from contractparticipants')
noOfParticipants = c.fetchall()[0][0]
returnval['numberOfParticipants'] = noOfParticipants
@ -374,9 +379,11 @@ async def getParticipantDetails():
c.execute('select sum(tokenAmount) from contractparticipants')
totalAmount = c.fetchall()[0][0]
returnval['tokenAmountDeposited'] = totalAmount
conn.close()
return jsonify(result='ok', address=floaddress, type='contract', contractInfo=returnval)
contractlist.append(returnval)
return jsonify(result='ok', address=floaddress, type='contract', contractList=contractlist)
# Check if its a participant address
queryString = "SELECT id, participantAddress,contractName, contractAddress, tokenAmount, transactionHash FROM contractParticipantMapping where participantAddress=='"+floaddress+"'"