Beispiel #1
0
def get_cachetime():
    """
    TODO: configurable
    """
    cachetime_min = int(get_setting('cachetime_min', 5))
    cachetime_max = int(get_setting('cachetime_max', 15))
    return random.randint(cachetime_min, cachetime_max)
Beispiel #2
0
def get_cachetime():
    """
    TODO: configurable
    """
    cachetime_min = int(get_setting('cachetime_min', 5))
    cachetime_max = int(get_setting('cachetime_max', 15))
    return random.randint(cachetime_min, cachetime_max)
Beispiel #3
0
 def dispatch_request(self):
     wallets = Wallet.query.order_by('testnet').order_by('coin').all()
     index_connect = int(get_setting('index_connect', 1))
     if index_connect:
         for wallet in wallets:
             wallet.info = get_wallet_info(wallet)
     otp_secret = get_setting('otpsecret', False)
     if otp_secret:
         show_otp = False
     else:
         show_otp = True
     return render_template('wallet/wallet/list.html', wallets=wallets,
                            show_otp=show_otp)
Beispiel #4
0
 def dispatch_request(self):
     wallets = Wallet.query.order_by('testnet').order_by('coin').all()
     index_connect = int(get_setting('index_connect', 1))
     if index_connect:
         for wallet in wallets:
             wallet.info = get_wallet_info(wallet)
     otp_secret = get_setting('otpsecret', False)
     if otp_secret:
         show_otp = False
     else:
         show_otp = True
     return render_template('wallet/wallet/list.html',
                            wallets=wallets,
                            show_otp=show_otp)
Beispiel #5
0
 def dispatch_request(self, id):
     super(WalletMoveView, self).dispatch_request(id)
     form = AccountMoveForm(request.form)
     choices = get_accounts(self.conn, getchoice=True)
     form.fromaccount.choices = choices
     form.toaccount.choices = choices
     accounts = get_accounts(self.conn, getbalance=True)
     fromaccount = urllib.unquote_plus(form.data['fromaccount'])
     toaccount = urllib.unquote_plus(form.data['toaccount'])
     fromaccount = real_format(fromaccount)
     toaccount = real_format(toaccount)
     if request.method == 'POST' and form.validate():
         amount = strtofloat(form.data['amount'])
         self.conn.move(
             fromaccount,
             toaccount,
             amount,
             int(get_setting('minconf', 6)),
             form.data['comment'],
         )
         flash(u"%f coins moved from %s to %s" % (amount,
               human_format(fromaccount), human_format(toaccount)),
               'success')
         return redirect(url_for('wallet.wallet_detail', id=id))
     return render_template("wallet/wallet/move.html", wallet=self.wallet,
                            form=form, accounts=accounts)
Beispiel #6
0
 def dispatch_request(self, id):
     super(WalletMoveView, self).dispatch_request(id)
     form = AccountMoveForm(request.form)
     choices = get_accounts(self.conn, getchoice=True)
     form.fromaccount.choices = choices
     form.toaccount.choices = choices
     accounts = get_accounts(self.conn, getbalance=True)
     fromaccount = urllib.unquote_plus(form.data['fromaccount'])
     toaccount = urllib.unquote_plus(form.data['toaccount'])
     fromaccount = real_format(fromaccount)
     toaccount = real_format(toaccount)
     if request.method == 'POST' and form.validate():
         amount = strtofloat(form.data['amount'])
         self.conn.move(
             fromaccount,
             toaccount,
             amount,
             int(get_setting('minconf', 6)),
             form.data['comment'],
         )
         flash(
             u"%f coins moved from %s to %s" %
             (amount, human_format(fromaccount), human_format(toaccount)),
             'success')
         return redirect(url_for('wallet.wallet_detail', id=id))
     return render_template("wallet/wallet/move.html",
                            wallet=self.wallet,
                            form=form,
                            accounts=accounts)
Beispiel #7
0
 def dispatch_request(self, id):
     super(WalletDetailView, self).dispatch_request(id)
     data = {}
     data['info'] = self.conn.getinfo()
     data['accounts'] = get_accounts(self.conn, getbalance=True)
     data['global_send'] = int(get_setting('global_send', 1))
     data['forms'] = {}
     data['forms']['account'] = CreateAccountForm()
     data['forms']['txfee'] = SetTXFeeForm()
     form = CreateAccountForm(request.form)
     return render_template("wallet/wallet/detail.html", wallet=self.wallet,
                            data=data, form=form)
Beispiel #8
0
 def dispatch_request(self, id):
     super(WalletDetailView, self).dispatch_request(id)
     data = {}
     data['info'] = self.conn.getinfo()
     data['accounts'] = get_accounts(self.conn, getbalance=True)
     data['global_send'] = int(get_setting('global_send', 1))
     data['forms'] = {}
     data['forms']['account'] = CreateAccountForm()
     data['forms']['txfee'] = SetTXFeeForm()
     form = CreateAccountForm(request.form)
     return render_template("wallet/wallet/detail.html",
                            wallet=self.wallet,
                            data=data,
                            form=form)
Beispiel #9
0
 def dispatch_request(self, id, account):
     super(AccountSendView, self).dispatch_request(id, account)
     form = SendForm(request.form)
     balance = self.conn.getbalance(self.account)
     if request.method == 'POST' and form.validate():
         amount = strtofloat(form.data['amount'])
         txid = self.conn.sendfrom(
             self.account,
             form.toaddress.data,
             amount,
             int(get_setting('minconf', 6)),
             form.comment.data,
             form.to.data
         )
         flash(u"%f coins sent to from %s to %s" % (amount,
               self.account, form.toaddress.data), 'success')
         return redirect(url_for("wallet.tx_detail", id=id, txid=txid))
     return render_template('wallet/account/send.html', wallet=self.wallet,
                            form=form, balance=balance, account=self.account)