try fix solana rpc

This commit is contained in:
Dobromir Popov 2024-10-02 16:30:08 +03:00
parent a0c9558e5d
commit 7c9aa26e5d

View File

@ -29,6 +29,7 @@ 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_URL = os.getenv("SOLANA_NET_URL")
# Initialize Telegram Bot
bot = Bot(token=TELEGRAM_BOT_TOKEN)
@ -178,20 +179,21 @@ async def on_logs(logs):
await follow_move(move)
async def subscribe_to_wallet():
uri = "wss://api.mainnet-beta.solana.com"
uri = SOLANA_URL
async with websockets.connect(uri) as websocket:
# Correct the `params` format to be an array
# Correct the `params` format to be an object
request = {
"jsonrpc": "2.0",
"id": 1,
"method": "logsSubscribe",
"params": [
{"mentions": [YOUR_WALLET], "commitment": "confirmed"}
]
"params": {
"mentions": [YOUR_WALLET],
"commitment": "confirmed"
}
}
await websocket.send(json.dumps(request))
# Listen for messages
while True:
response = await websocket.recv()