await telegram; prod wallets
This commit is contained in:
parent
7d63f60247
commit
49a78083c4
@ -9,9 +9,8 @@ TELEGRAM_BOT_TOKEN="6805059978:AAHNJKuOeazMSJHc3-BXRCsFfEVyFHeFnjw"
|
|||||||
DISPLAY_CURRENCY=USD
|
DISPLAY_CURRENCY=USD
|
||||||
|
|
||||||
# Niki's to Sync: [PROD]
|
# Niki's to Sync: [PROD]
|
||||||
# FOLLOWED_WALLET="7keSmTZozjmuX66gd9GBSJYEHnMqsyutWpvuuKtXZKDH"
|
FOLLOWED_WALLET="7keSmTZozjmuX66gd9GBSJYEHnMqsyutWpvuuKtXZKDH" YOUR_WALLET="7QXGLRjvyFAmxdRaP9Wk18KwWTMfspF4Na2sr3o3PzxV"
|
||||||
# YOUR_WALLET="7QXGLRjvyFAmxdRaP9Wk18KwWTMfspF4Na2sr3o3PzxV"
|
|
||||||
|
|
||||||
# Sync to main [DEV]
|
# Sync to main [DEV]
|
||||||
FOLLOWED_WALLET="7QXGLRjvyFAmxdRaP9Wk18KwWTMfspF4Na2sr3o3PzxV"
|
# FOLLOWED_WALLET="7QXGLRjvyFAmxdRaP9Wk18KwWTMfspF4Na2sr3o3PzxV"
|
||||||
YOUR_WALLET="65nzyZXTLC81MthTo52a2gRJjqryTizWVqpK2fDKLye5"
|
# YOUR_WALLET="65nzyZXTLC81MthTo52a2gRJjqryTizWVqpK2fDKLye5"
|
@ -940,7 +940,7 @@ async def process_log(log_result):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error aquiring log details and following: {e}")
|
logging.error(f"Error aquiring log details and following: {e}")
|
||||||
send_telegram_message(f"Not followed! Error following move.")
|
await send_telegram_message(f"Not followed! Error following move.")
|
||||||
return
|
return
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -1017,13 +1017,13 @@ async def follow_move(move):
|
|||||||
amount_to_swap = your_balance * (move['percentage_swapped'] / 100)
|
amount_to_swap = your_balance * (move['percentage_swapped'] / 100)
|
||||||
|
|
||||||
# # always get 99% of the amount to swap
|
# # always get 99% of the amount to swap
|
||||||
amount_to_swap = amount_to_swap * 0.95
|
# amount_to_swap = amount_to_swap * 0.95
|
||||||
|
|
||||||
# Convert to lamports
|
# Convert to lamports
|
||||||
# if decimals is 6, then amount = amount * 1e6; if 9, then amount = amount * 1e9
|
# if decimals is 6, then amount = amount * 1e6; if 9, then amount = amount * 1e9
|
||||||
amount = int(amount_to_swap * 10**token_info.get('decimals') )
|
amount = int(amount_to_swap * 10**token_info.get('decimals') )
|
||||||
|
|
||||||
if your_balance >= amount_to_swap:
|
if your_balance < amount_to_swap:
|
||||||
msg = (
|
msg = (
|
||||||
f"<b>Warning:</b>\n"
|
f"<b>Warning:</b>\n"
|
||||||
f"Insufficient balance: {your_balance:.6f} {token_name_in}. We want to swap {amount_to_swap:.6f}\n({move['symbol_in']}, decimals {token_info.get('decimals')} amount {amount}).\n This will probably fail. But we will try anyway."
|
f"Insufficient balance: {your_balance:.6f} {token_name_in}. We want to swap {amount_to_swap:.6f}\n({move['symbol_in']}, decimals {token_info.get('decimals')} amount {amount}).\n This will probably fail. But we will try anyway."
|
||||||
@ -1182,7 +1182,7 @@ async def subscribe_to_wallet():
|
|||||||
if conn_active:
|
if conn_active:
|
||||||
conn_active = False
|
conn_active = False
|
||||||
await send_telegram_message("Connection to Solana network was closed. Not listening for transactions right now.\n Attempting to reconnect...")
|
await send_telegram_message("Connection to Solana network was closed. Not listening for transactions right now.\n Attempting to reconnect...")
|
||||||
break
|
break
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
logger.error(f"Failed to decode JSON: {e}")
|
logger.error(f"Failed to decode JSON: {e}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -1205,29 +1205,31 @@ async def subscribe_to_wallet():
|
|||||||
reconnect_delay = min(reconnect_delay * 2, max_reconnect_delay)
|
reconnect_delay = min(reconnect_delay * 2, max_reconnect_delay)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pk = os.getenv("PK")
|
pk = os.getenv("PK")
|
||||||
if not pk:
|
async def check_PK():
|
||||||
try:
|
global pk
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
if not pk:
|
||||||
with open(os.path.join(script_dir, 'secret.pk'), 'r') as f:
|
try:
|
||||||
pk = f.read().strip()
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
if pk:
|
with open(os.path.join(script_dir, 'secret.pk'), 'r') as f:
|
||||||
logging.info("Private key loaded successfully from file.")
|
pk = f.read().strip()
|
||||||
else:
|
if pk:
|
||||||
logging.warning("Private key file is empty.")
|
logging.info("Private key loaded successfully from file.")
|
||||||
except FileNotFoundError:
|
else:
|
||||||
logging.warning("Private key file not found.")
|
logging.warning("Private key file is empty.")
|
||||||
except Exception as e:
|
except FileNotFoundError:
|
||||||
logging.error(f"Error reading private key file: {str(e)}")
|
logging.warning("Private key file not found.")
|
||||||
if not pk:
|
except Exception as e:
|
||||||
logging.error("Private key not found in environment variables. Will not be able to sign transactions.")
|
logging.error(f"Error reading private key file: {str(e)}")
|
||||||
# send TG warning message
|
if not pk:
|
||||||
send_telegram_message("<b>Warning:</b> Private key not found in environment variables. Will not be able to sign transactions.")
|
logging.error("Private key not found in environment variables. Will not be able to sign transactions.")
|
||||||
|
# send TG warning message
|
||||||
|
await send_telegram_message("<b>Warning:</b> Private key not found in environment variables. Will not be able to sign transactions.")
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
await send_telegram_message("Solana Agent Started. Connecting to mainnet...")
|
await send_telegram_message("Solana Agent Started. Connecting to mainnet...")
|
||||||
|
await check_PK()
|
||||||
await subscribe_to_wallet()
|
await subscribe_to_wallet()
|
||||||
|
|
||||||
def run_flask():
|
def run_flask():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user