You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that this is a slippage tolerance issue based on Jupiter Swap docs. However I am not sure how to parse this and get the error message in the code.
My code currently looks like this:
asyncdefexecute_swap_trade(swap_data: dict, wallet_keypair: Keypair, client: Client):
"""Execute swap trade with Jupiter API."""print("Executing swap trade...")
success, tx_id, error=awaitsign_and_send_transaction(
swap_data, wallet_keypair, client)
print(f"Success: {success}, tx_id: {tx_id}, error: {error}")
tx_status, tx_err=check_transaction_status(client, tx_id)
iftx_err:
print(f"Transaction error: {tx_err}")
raiseException(tx_err)
returntx_status, tx_id, tx_errdefcheck_transaction_status(client: Client, tx_id: str) ->bool:
# Get the transactiontx=client.get_transaction(tx_sig=Signature.from_string(
tx_id), max_supported_transaction_version=0)
iftx.value.transaction.meta.errisnotNone:
iftx.value.transaction.meta.err.InsufficientFundsForFee:
print("Insufficient funds for fee")
returnFalse, "Insufficient funds for fee. Please top up your account."returnFalse, tx.value.transaction.meta.errreturnTrue, None
Is there a way I can get the error message?
Thanks!
The text was updated successfully, but these errors were encountered:
I am using the RPC client for one of my projects that use the Jupiter Swap API.
I am getting the following transaction error when executing a swap
I know that this is a slippage tolerance issue based on Jupiter Swap docs. However I am not sure how to parse this and get the error message in the code.
My code currently looks like this:
Is there a way I can get the error message?
Thanks!
The text was updated successfully, but these errors were encountered: