log processor

This commit is contained in:
Dobromir Popov
2024-11-06 11:08:59 +02:00
parent fb09daf983
commit 3dd7e315c7
6 changed files with 94 additions and 8 deletions

View File

@ -5,9 +5,7 @@ import websockets
import json
import datetime
import base64
import os
import base58
from dotenv import load_dotenv
@ -22,6 +20,7 @@ from solana.rpc.commitment import Processed
from modules.webui import init_app
from modules.storage import init_db, store_transaction
from modules.utils import telegram_utils, logging, get_pk
from modules.log_processor import watch_for_new_logs
from modules.SolanaAPI import SAPI
@ -31,7 +30,7 @@ load_dotenv('.env.secret')
# Configuration
from config import (FOLLOWED_WALLET, YOUR_WALLET, SOLANA_WS_URL, SOLANA_HTTP_URL, FOLLOW_AMOUNT, SOLANA_ENDPOINTS, logging, error_logger, logger)
from config import (DO_WATCH_WALLET, logging, logger)
@ -412,8 +411,13 @@ async def main():
pk = await get_pk()
await telegram_utils.initialize()
await telegram_utils.send_telegram_message("Solana Agent Started. Connecting to mainnet...")
# Start the log processor
asyncio.create_task(watch_for_new_logs())
# process_transaction
await SAPI.wallet_watch_loop()
if DO_WATCH_WALLET:
await SAPI.wallet_watch_loop()
def run_asyncio_tasks():
asyncio.run(main())
@ -430,7 +434,7 @@ if __name__ == '__main__':
"app:asgi_app",
host="0.0.0.0",
port=3001,
log_level="debug",
log_level="info", # "debug"
reload=True
)