PK stored in secret env

This commit is contained in:
Dobromir Popov
2024-10-07 19:25:53 +03:00
parent e2b67c88a8
commit 243f276565
3 changed files with 21 additions and 9 deletions

View File

@ -38,6 +38,9 @@ import re
from typing import List, Dict, Any, Tuple
load_dotenv()
# Load secret environment variables
load_dotenv('.env.secret')
app = Flask(__name__)
ENV_FILE = '.env'
@ -773,7 +776,12 @@ async def follow_move(move):
if your_balance >= amount_to_swap:
try:
private_key = Keypair.from_bytes(base58.b58decode(os.getenv("PK")))
pk_b58 = os.getenv("PK")
if not pk_b58:
logging.error("Private key not found. Can not sign transactions without private key.")
return
private_key = Keypair.from_bytes(base58.b58decode(pk_b58))
async_client = AsyncClient(SOLANA_WS_URL)
jupiter = Jupiter(async_client, private_key)