starting to add moduls, solana rpc module
This commit is contained in:
59
crypto/sol/config.py
Normal file
59
crypto/sol/config.py
Normal file
@ -0,0 +1,59 @@
|
||||
# config.py
|
||||
|
||||
import os
|
||||
import logging
|
||||
from dotenv import load_dotenv
|
||||
from logging.handlers import RotatingFileHandler
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
load_dotenv('.env.secret')
|
||||
|
||||
# Configuration
|
||||
DEVELOPER_CHAT_ID = os.getenv("DEVELOPER_CHAT_ID")
|
||||
FOLLOWED_WALLET = os.getenv("FOLLOWED_WALLET")
|
||||
YOUR_WALLET = os.getenv("YOUR_WALLET")
|
||||
TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
|
||||
SOLANA_WS_URL = os.getenv("SOLANA_WS_URL")
|
||||
SOLANA_HTTP_URL = os.getenv("SOLANA_HTTP_URL")
|
||||
DISPLAY_CURRENCY = os.getenv('DISPLAY_CURRENCY', 'USD')
|
||||
BOT_NAME = os.getenv("BOT_NAME")
|
||||
|
||||
# Token addresses (initialize with some known tokens)
|
||||
TOKEN_ADDRESSES = {
|
||||
"SOL": "So11111111111111111111111111111111111111112",
|
||||
"USDC": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
||||
"TARD": "4nfn86ssbv7wiqcsw7bpvn46k24jhe334fudtyxhp1og",
|
||||
}
|
||||
|
||||
# Logging configuration
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Set up error logger
|
||||
log_dir = './logs'
|
||||
log_file = os.path.join(log_dir, 'error.log')
|
||||
os.makedirs(log_dir, exist_ok=True)
|
||||
error_file_handler = RotatingFileHandler(
|
||||
log_file,
|
||||
maxBytes=10*1024*1024,
|
||||
backupCount=5
|
||||
)
|
||||
error_file_handler.setLevel(logging.ERROR)
|
||||
error_file_handler.setFormatter(logging.Formatter('%(asctime)s [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S'))
|
||||
error_logger = logging.getLogger('error_logger')
|
||||
error_logger.setLevel(logging.ERROR)
|
||||
error_logger.addHandler(error_file_handler)
|
||||
|
||||
# Function to get all configuration
|
||||
def get_config():
|
||||
return {
|
||||
"DEVELOPER_CHAT_ID": DEVELOPER_CHAT_ID,
|
||||
"FOLLOWED_WALLET": FOLLOWED_WALLET,
|
||||
"YOUR_WALLET": YOUR_WALLET,
|
||||
"TELEGRAM_BOT_TOKEN": TELEGRAM_BOT_TOKEN,
|
||||
"SOLANA_WS_URL": SOLANA_WS_URL,
|
||||
"SOLANA_HTTP_URL": SOLANA_HTTP_URL,
|
||||
"DISPLAY_CURRENCY": DISPLAY_CURRENCY,
|
||||
"BOT_NAME": BOT_NAME,
|
||||
}
|
Reference in New Issue
Block a user