swap works again reliably
This commit is contained in:
@ -10,7 +10,7 @@ from flask_login import LoginManager, UserMixin, login_user, login_required, log
|
||||
import secrets
|
||||
import json
|
||||
# from crypto.sol.config import LIQUIDITY_TOKENS
|
||||
from config import LIQUIDITY_TOKENS
|
||||
from config import LIQUIDITY_TOKENS, YOUR_WALLET
|
||||
|
||||
from modules import storage, utils, SolanaAPI
|
||||
from modules.utils import async_safe_call, decode_instruction_data
|
||||
@ -24,6 +24,8 @@ def init_app(tr_handler=None):
|
||||
global on_transaction
|
||||
on_transaction = tr_handler
|
||||
app = Flask(__name__, template_folder='../templates', static_folder='../static')
|
||||
|
||||
app.secret_key = secrets.token_hex(16)
|
||||
executor = ThreadPoolExecutor(max_workers=10) # Adjust the number of workers as needed
|
||||
login_manager = LoginManager(app)
|
||||
login_manager.login_view = 'login'
|
||||
@ -423,6 +425,11 @@ def init_app(tr_handler=None):
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@login_manager.unauthorized_handler
|
||||
def unauthorized():
|
||||
return redirect('/login?next=' + request.path)
|
||||
# return jsonify({'error': 'Unauthorized'}), 401
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
if request.method == 'POST':
|
||||
@ -460,12 +467,14 @@ def init_app(tr_handler=None):
|
||||
|
||||
@app.route('/wallet/<int:wallet_id>/transactions', methods=['GET'])
|
||||
@login_required
|
||||
@login_required
|
||||
def get_transactions(wallet_id):
|
||||
transactions = storage.get_transactions(wallet_id)
|
||||
return jsonify(transactions)
|
||||
|
||||
@app.route('/wallet/<int:wallet_id>/holdings', methods=['GET'])
|
||||
@login_required
|
||||
@login_required
|
||||
def get_holdings(wallet_id):
|
||||
holdings = storage.get_holdings(wallet_id)
|
||||
return jsonify(holdings)
|
||||
|
Reference in New Issue
Block a user