Changes to the API
This commit is contained in:
parent
0a27fc3422
commit
58cb925e7f
@ -341,10 +341,14 @@ async def getParticipantDetails():
|
|||||||
|
|
||||||
if floaddress in list(activeContracts[0]):
|
if floaddress in list(activeContracts[0]):
|
||||||
c.execute("select contractName from activecontracts where contractAddress=='"+floaddress+"'")
|
c.execute("select contractName from activecontracts where contractAddress=='"+floaddress+"'")
|
||||||
name = c.fetchall()
|
contract_names = c.fetchall()
|
||||||
|
|
||||||
if len(name) != 0:
|
if len(contract_names) != 0:
|
||||||
contractName = '{}-{}.db'.format(name[0][0].strip(),floaddress.strip())
|
|
||||||
|
contractlist = []
|
||||||
|
|
||||||
|
for contract_name in contract_names:
|
||||||
|
contractName = '{}-{}.db'.format(contract_name[0].strip(),floaddress.strip())
|
||||||
filelocation = os.path.join(dbfolder,'smartContracts', contractName)
|
filelocation = os.path.join(dbfolder,'smartContracts', contractName)
|
||||||
|
|
||||||
if os.path.isfile(filelocation):
|
if os.path.isfile(filelocation):
|
||||||
@ -367,6 +371,7 @@ async def getParticipantDetails():
|
|||||||
continue
|
continue
|
||||||
returnval[row[0]] = row[1]
|
returnval[row[0]] = row[1]
|
||||||
|
|
||||||
|
|
||||||
c.execute('select count(participantAddress) from contractparticipants')
|
c.execute('select count(participantAddress) from contractparticipants')
|
||||||
noOfParticipants = c.fetchall()[0][0]
|
noOfParticipants = c.fetchall()[0][0]
|
||||||
returnval['numberOfParticipants'] = noOfParticipants
|
returnval['numberOfParticipants'] = noOfParticipants
|
||||||
@ -374,9 +379,11 @@ async def getParticipantDetails():
|
|||||||
c.execute('select sum(tokenAmount) from contractparticipants')
|
c.execute('select sum(tokenAmount) from contractparticipants')
|
||||||
totalAmount = c.fetchall()[0][0]
|
totalAmount = c.fetchall()[0][0]
|
||||||
returnval['tokenAmountDeposited'] = totalAmount
|
returnval['tokenAmountDeposited'] = totalAmount
|
||||||
|
|
||||||
conn.close()
|
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
|
# Check if its a participant address
|
||||||
queryString = "SELECT id, participantAddress,contractName, contractAddress, tokenAmount, transactionHash FROM contractParticipantMapping where participantAddress=='"+floaddress+"'"
|
queryString = "SELECT id, participantAddress,contractName, contractAddress, tokenAmount, transactionHash FROM contractParticipantMapping where participantAddress=='"+floaddress+"'"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user