def sign_vote_view(request): rjb = request.json_body assert 'vote' in rjb try: vote = instruction_lookup(rjb['vote']['type'])(**rjb['vote']['params']) except EncodingError as e: return {'result': False, 'msg': "Bad Address? -- " + str(e)} stx = make_signed_tx_from_vote(vote, pw_from_r(request)) return {'result': True, 'msg': stx.as_hex()}
def empower_demo_view(request): global saved_password address = request.json_body['address'] if address not in already_empowered: op = instruction_lookup('empower')(1000, address) if 'demo_password' in request.registry.settings: saved_password = request.registry.settings['demo_password'].encode() already_empowered[address] = make_signed_tx_from_vote(op, saved_password, extra_payables=[(op.address_pretty(), 50000)]).as_hex() response = Response(json.dumps({'result': already_empowered[address]}), content_type='applicatoin/json', charset='utf8') response.headerlist.append(('Access-Control-Allow-Origin', '*')) return response