fixes
This commit is contained in:
parent
d4a7c0b653
commit
cd3e9e79ec
@ -22,7 +22,7 @@ DEVELOPER_CHAT_ID="777826553"
|
|||||||
TELEGRAM_BOT_TOKEN="6749075936:AAHUHiPTDEIu6JH7S2fQdibwsu6JVG3FNG0"
|
TELEGRAM_BOT_TOKEN="6749075936:AAHUHiPTDEIu6JH7S2fQdibwsu6JVG3FNG0"
|
||||||
|
|
||||||
DISPLAY_CURRENCY=USD
|
DISPLAY_CURRENCY=USD
|
||||||
FOLLOW_AMOUNT=2
|
FOLLOW_AMOUNT=3
|
||||||
#FOLLOW_AMOUNT=percentage
|
#FOLLOW_AMOUNT=percentage
|
||||||
|
|
||||||
LIQUIDITY_TOKENS=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,So11111111111111111111111111111111111111112
|
LIQUIDITY_TOKENS=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,So11111111111111111111111111111111111111112
|
||||||
|
@ -769,7 +769,10 @@ class SolanaAPI:
|
|||||||
)
|
)
|
||||||
logging.info(f"Initiating move. Transaction data:\n {transaction_data}")
|
logging.info(f"Initiating move. Transaction data:\n {transaction_data}")
|
||||||
|
|
||||||
fee = async_client.get_fee_for_message(transaction_data.message)
|
raw_transaction = VersionedTransaction.from_bytes(base64.b64decode(transaction_data))
|
||||||
|
priority_fee = await async_client.get_fee_for_message(raw_transaction.message)
|
||||||
|
|
||||||
|
# fee = await async_client.get_fee_for_message(transaction_data)
|
||||||
# priority_fee = 0
|
# priority_fee = 0
|
||||||
# if PRIORITY:
|
# if PRIORITY:
|
||||||
# priority_fee = 100 * PRIORITY # defalt if we can't get current rate
|
# priority_fee = 100 * PRIORITY # defalt if we can't get current rate
|
||||||
@ -779,9 +782,16 @@ class SolanaAPI:
|
|||||||
# logging.warning(f"Failed to get priority fee. Using default value: {priority_fee}")
|
# logging.warning(f"Failed to get priority fee. Using default value: {priority_fee}")
|
||||||
|
|
||||||
# error_logger.info(f"Initiating move. Transaction data:\n {transaction_data}")
|
# error_logger.info(f"Initiating move. Transaction data:\n {transaction_data}")
|
||||||
raw_transaction = VersionedTransaction.from_bytes(base64.b64decode(transaction_data))
|
|
||||||
# message = raw_transaction.message
|
# message = raw_transaction.message
|
||||||
|
|
||||||
|
# Add compute budget instruction to set priority fee
|
||||||
|
from solders.compute_budget import set_compute_unit_price
|
||||||
|
compute_budget_instruction = set_compute_unit_price(priority_fee)
|
||||||
|
|
||||||
|
# Add compute budget instruction to the transaction
|
||||||
|
raw_transaction.message.add_instruction(compute_budget_instruction)
|
||||||
|
|
||||||
|
|
||||||
# signature = private_key.sign_message( bytes(message) )
|
# signature = private_key.sign_message( bytes(message) )
|
||||||
signature = private_key.sign_message(message.to_bytes_versioned(raw_transaction.message))
|
signature = private_key.sign_message(message.to_bytes_versioned(raw_transaction.message))
|
||||||
signed_txn = VersionedTransaction.populate(raw_transaction.message, [signature])
|
signed_txn = VersionedTransaction.populate(raw_transaction.message, [signature])
|
||||||
@ -789,16 +799,16 @@ class SolanaAPI:
|
|||||||
skip_preflight=False,
|
skip_preflight=False,
|
||||||
preflight_commitment=Processed,
|
preflight_commitment=Processed,
|
||||||
# max_retries=10,
|
# max_retries=10,
|
||||||
# priority_fee =priority_fee
|
# priority_fee =fee.value
|
||||||
)
|
)
|
||||||
# send the transaction
|
# send the transaction
|
||||||
result = await async_client.send_raw_transaction(txn=bytes(signed_txn), opts=opts)
|
result = await async_client.send_raw_transaction(txn=bytes(signed_txn), opts=opts )
|
||||||
|
|
||||||
transaction_id = json.loads(result.to_json())['result']
|
transaction_id = json.loads(result.to_json())['result']
|
||||||
notification = f"Follow Transaction Sent:\n<b>Transaction:</b> <a href='https://solscan.io/tx/{transaction_id}'>swapping {amount_to_swap:.2f} {token_name_in}</a>"
|
notification = f"Follow Transaction Sent:\n<b>Transaction:</b> <a href='https://solscan.io/tx/{transaction_id}'>swapping {amount_to_swap:.2f} {token_name_in}</a>"
|
||||||
logging.info(notification)
|
logging.info(notification)
|
||||||
await telegram_utils.send_telegram_message(notification)
|
await telegram_utils.send_telegram_message(notification)
|
||||||
tx_details = await SAPI.get_transaction_details_with_retry(transaction_id, retry_delay=5, max_retries=6, backoff=False)
|
tx_details = await SAPI.get_transaction_details_with_retry(transaction_id, retry_delay=5, max_retries=10, backoff=False)
|
||||||
|
|
||||||
if tx_details is not None:
|
if tx_details is not None:
|
||||||
break
|
break
|
||||||
|
@ -237,6 +237,7 @@ def init_app(tr_handler=None):
|
|||||||
token_out = token_outputs[0]
|
token_out = token_outputs[0]
|
||||||
tr["token_out"] = token_out["mint"]
|
tr["token_out"] = token_out["mint"]
|
||||||
tr["token_out_decimals"] = get_decimals(token_out)
|
tr["token_out_decimals"] = get_decimals(token_out)
|
||||||
|
tr["amount_out"] = calculate_amount(token_out)
|
||||||
|
|
||||||
# Store transaction in database
|
# Store transaction in database
|
||||||
if tr["type"] in ["BUY", "SELL"]:
|
if tr["type"] in ["BUY", "SELL"]:
|
||||||
|
0
modules/log_processor.py
Normal file
0
modules/log_processor.py
Normal file
Loading…
x
Reference in New Issue
Block a user