예제 #1
0
def create_wallet():
    my_wallet = wallet.Wallet()
    response = {
        'private_key': my_wallet.private_key,
        'public_key': my_wallet.public_key,
        'blockchain_address': my_wallet.blockchain_address
    }
    return jsonify(response), 200
예제 #2
0
def get_blockchain():
    cached_blockchain = cache.get('blockchain')
    if not cached_blockchain:
        miners_wallet = wallet.Wallet()
        cache['blockchain'] = blockchain.BlockChain(
            blockchain_address=miners_wallet.blockchain_address,
            port=app.config['port']
        )
        app.logger.warning({
            'private_key': miners_wallet.private_key,
            'public_key': miners_wallet.public_key,
            'blockchain_address': miners_wallet.blockchain_address
        })
    return cache['blockchain']
예제 #3
0
def wallet_balance():
    return wallet.Wallet().balance(get_jwt_identity()["email"])
예제 #4
0
def wallet_new():
    return wallet.Wallet().new(get_jwt_identity()["email"])
예제 #5
0
from datetime import datetime
from flask import Flask, request, jsonify, session
from models import staff, customer, awards, access, transaction, wallet
from datetime import timedelta
from flask_cors import CORS

app = Flask(__name__)
CORS(app)
SECRET_KEY = '\xfd{H\xe5<\x95\xf9\xe3\x96.5\xd1\x01O<!\xd5\xa2\xa0\x9fR"\xa1\xa8'
app.secret_key = SECRET_KEY
staff = staff.Staff()
customer = customer.Customer()
wallet = wallet.Wallet()
awards = awards.Awards()
access = access.Access()
transaction = transaction.Transaction()

db_role = "normal"


@app.route('/staff/', methods=['GET'])
def get_staffs():
    return jsonify(staff.find()), 200


@app.route('/staff/<string:staff_id>/', methods=['GET'])
def get_staff(staff_id):
    return staff.find_by_id(staff_id), 200


@app.route('/staff/', methods=['POST'])