def wallet(): if request.method == 'GET': username = session['email'] address = multisig_wallet.generate_address(str(username)) balance = multisig_wallet.get_balance(str(username)) return render_template('wallet.html', title='Wallet', address=address, balance=balance) if request.method == 'POST': username = session['email'] address = multisig_wallet.generate_address(str(username)) balance = multisig_wallet.get_balance(str(username)) return render_template('wallet.html', title='Wallet', address=address, balance=balance)
def send_bitcoin(): form = wallet_forms.Send() print(form.errors) if form.is_submitted(): print("submitted") if form.validate(): print("valid") if form.validate_on_submit(): print("THIS WORKS!") print(form.errors) print(type(form.address)) username = session['email'] user = models.User.query.filter_by(email=username).first() print(user.password) address = multisig_wallet.generate_address(str(username)) balance = multisig_wallet.get_balance(str(username)) if request.method == 'POST': if form.validate_on_submit(): print("About to send some money.") tx = multisig_wallet.send_bitcoin(username, form.address, form.amount, user.password) print(tx) if (type(tx) is str): message = 'You just sent ' + str(form.amount.data) + ' Satoshis to: ' + str(form.address.data) + ' - You may view your transaction at: https://btc.blockr.io/tx/info/' + str(tx) flash(message, 'positive') elif (tx == False): flash('Please enter a valid value', 'negative') else: flash(tx['message'], 'negative') return render_template('wallet.html', title='Send Funds', address=address, balance=balance, form=form) return render_template('wallet.html', title='Send Funds', address=address, balance=balance, form=form)
def wallet(): form = wallet_forms.Send() username = session['email'] user = models.User.query.filter_by(email=username).first() address = multisig_wallet.generate_address(str(username)) balance = multisig_wallet.get_balance(str(username)) print(user.password) quote = two1lib.get_quote() if(address == None or balance == None): return render_template('marketplaceerror.html', title='Error loading wallet service') if request.method == 'GET': return render_template('marketplace.html', title='Marketplace', address=address, balance=balance, form=form, market=market, quote=quote) if request.method == 'POST': if form.validate_on_submit(): tx = multisig_wallet.send_bitcoin(username, form.address.data, form.amount.data, user.password) print(tx) # TODO: Use a Bitcoin lib to check if this is a valid hash if (type(tx) is str): message = 'You just sent ' + str(form.amount.data) + ' Satoshis to: ' + str(form.address.data) + ' - You may view your transaction at: https://btc.blockr.io/tx/info/' + str(tx) flash(message, 'positive') elif (tx == False): flash('Please enter a valid value', 'negative') else: flash(tx['message'], 'negative') return render_template('marketplace.html', title='Marketplae', address=address, balance=balance, form=form, market=market) return render_template('marketplace.html', title='Marketplace', address=address, balance=balance, form=form, market=market)
def wallet(): form = wallet_forms.Send() username = session['email'] user = models.User.query.filter_by(email=username).first() address = multisig_wallet.generate_address(str(username)) balance = multisig_wallet.get_balance(str(username)) print(user.password) quote = two1lib.get_quote() if (address == None or balance == None): return render_template('marketplaceerror.html', title='Error loading wallet service') if request.method == 'GET': return render_template('marketplace.html', title='Marketplace', address=address, balance=balance, form=form, market=market, quote=quote) if request.method == 'POST': if form.validate_on_submit(): tx = multisig_wallet.send_bitcoin(username, form.address.data, form.amount.data, user.password) print(tx) # TODO: Use a Bitcoin lib to check if this is a valid hash if (type(tx) is str): message = 'You just sent ' + str( form.amount.data ) + ' Satoshis to: ' + str( form.address.data ) + ' - You may view your transaction at: https://btc.blockr.io/tx/info/' + str( tx) flash(message, 'positive') elif (tx == False): flash('Please enter a valid value', 'negative') else: flash(tx['message'], 'negative') return render_template('marketplace.html', title='Marketplae', address=address, balance=balance, form=form, market=market) return render_template('marketplace.html', title='Marketplace', address=address, balance=balance, form=form, market=market)
def send_bitcoin(): form = wallet_forms.Send() print(form.errors) if form.is_submitted(): print("submitted") if form.validate(): print("valid") if form.validate_on_submit(): print("THIS WORKS!") print(form.errors) print(type(form.address)) username = session['email'] user = models.User.query.filter_by(email=username).first() print(user.password) address = multisig_wallet.generate_address(str(username)) balance = multisig_wallet.get_balance(str(username)) if request.method == 'POST': if form.validate_on_submit(): print("About to send some money.") tx = multisig_wallet.send_bitcoin(username, form.address, form.amount, user.password) print(tx) if (type(tx) is str): message = 'You just sent ' + str( form.amount.data ) + ' Satoshis to: ' + str( form.address.data ) + ' - You may view your transaction at: https://btc.blockr.io/tx/info/' + str( tx) flash(message, 'positive') elif (tx == False): flash('Please enter a valid value', 'negative') else: flash(tx['message'], 'negative') return render_template('wallet.html', title='Send Funds', address=address, balance=balance, form=form) return render_template('wallet.html', title='Send Funds', address=address, balance=balance, form=form)