fixes
This commit is contained in:
@ -768,8 +768,11 @@ class SolanaAPI:
|
||||
slippage_bps=300, # Increased to 3%
|
||||
)
|
||||
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
|
||||
# if PRIORITY:
|
||||
# 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}")
|
||||
|
||||
# error_logger.info(f"Initiating move. Transaction data:\n {transaction_data}")
|
||||
raw_transaction = VersionedTransaction.from_bytes(base64.b64decode(transaction_data))
|
||||
# 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(message.to_bytes_versioned(raw_transaction.message))
|
||||
signed_txn = VersionedTransaction.populate(raw_transaction.message, [signature])
|
||||
@ -789,16 +799,16 @@ class SolanaAPI:
|
||||
skip_preflight=False,
|
||||
preflight_commitment=Processed,
|
||||
# max_retries=10,
|
||||
# priority_fee =priority_fee
|
||||
# priority_fee =fee.value
|
||||
)
|
||||
# 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']
|
||||
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)
|
||||
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:
|
||||
break
|
||||
|
Reference in New Issue
Block a user