Beispiel #1
0
def colorbalances(public_address=None):
    answer = databases.color_balance(public_address, None)
    jsonresponse = {}
    jsonresponse['public_address'] = public_address
    jsonresponse['assets'] = []
    issuer = ""
    colorname = ""
    for x in answer:
        r = {}
        colordata = databases.dbexecute(
            "select * from colors where color_address='" + str(x) + "';", True)
        if len(colordata) > 0:
            colorname = colordata[0][3]
            issuer = colordata[0][1]
            if colorname == "color_name":
                colorname = ""

        r['issuing_address'] = str(issuer)
        r['color_name'] = colorname
        r['color_address'] = x
        r['quantity'] = answer[x]
        jsonresponse['assets'].append(r)
    jsonresponse = json.dumps(jsonresponse)
    response = make_response(str(jsonresponse), 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin'] = '*'
    return response
Beispiel #2
0
def colorbalances(public_address=None):
  answer=databases.color_balance(public_address, None)
  jsonresponse={}
  jsonresponse['public_address']=public_address
  jsonresponse['assets']=[]
  issuer=""
  colorname=""
  for x in answer:
    r={}
    colordata=databases.dbexecute("select * from colors where color_address='"+str(x)+"';", True)
    if len(colordata)>0:
      colorname=colordata[0][3]
      issuer=colordata[0][1]
      if colorname=="color_name":
        colorname=""

    r['issuing_address']=str(issuer)
    r['color_name']=colorname
    r['color_address']=x
    r['quantity']=answer[x]
    jsonresponse['assets'].append(r)
  jsonresponse=json.dumps(jsonresponse)
  response=make_response(str(jsonresponse), 200)
  response.headers['Content-Type'] = 'application/json'
  response.headers['Access-Control-Allow-Origin']= '*'
  return response
Beispiel #3
0
def colorbalance(public_address=None, color_address=None):
    answer = databases.color_balance(public_address, color_address)
    jsonresponse = {}
    jsonresponse[public_address] = answer
    jsonresponse = json.dumps(jsonresponse)
    response = make_response(str(jsonresponse), 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin'] = '*'
    return response
Beispiel #4
0
def colorbalance(public_address=None, color_address=None):
  answer=databases.color_balance(public_address, color_address)
  jsonresponse={}
  jsonresponse[public_address]=answer
  jsonresponse=json.dumps(jsonresponse)
  response=make_response(str(jsonresponse), 200)
  response.headers['Content-Type'] = 'application/json'
  response.headers['Access-Control-Allow-Origin']= '*'
  return response
Beispiel #5
0
def colorbalances(public_address=None): #show all colors for one address
  answer=databases.color_balance(public_address, None)
  answer=json.dumps(answer)
  response=make_response(str(answer), 200)
  response.headers['Access-Control-Allow-Origin']= '*'
  return response
Beispiel #6
0
def colorbalance(public_address=None, color_address=None):  #WORKS
  answer=databases.color_balance(public_address, color_address)
  response=make_response(str(int(answer)), 200)
  response.headers['Access-Control-Allow-Origin']= '*'
  return response
Beispiel #7
0
def colorbalances(public_address=None):  #show all colors for one address
    answer = databases.color_balance(public_address, None)
    answer = json.dumps(answer)
    response = make_response(str(answer), 200)
    response.headers['Access-Control-Allow-Origin'] = '*'
    return response
Beispiel #8
0
def colorbalance(public_address=None, color_address=None):  #WORKS
    answer = databases.color_balance(public_address, color_address)
    response = make_response(str(int(answer)), 200)
    response.headers['Access-Control-Allow-Origin'] = '*'
    return response