I'm encountering an issue while trying to execute a transaction on the Solana blockchain.(swaping solana to bonk using jupiter swap api) When attempting to execute the transaction, I receive the following error message: {'jsonrpc': '2.0', 'error': {'code': -32602, 'message': "invalid transaction: Transaction loads an address table account that doesn't exist"}, 'id': 1} here is the code that i"m using
import requests
from solana.rpc.api import Client
from solders.keypair import Keypair
from solders.pubkey import Pubkey
from solana.rpc.api import Client
from solders.transaction import VersionedTransaction
from solana.transaction import Transaction
from solders.system_program import TransferParams, transfer
from solana.rpc.api import Client
import base64
import httpx
import solders
http_client = Client("https://api.devnet.solana.com")
pv_key = "mypvkey"
wallet = Keypair.from_base58_string(pv_key)
print(wallet.pubkey())
r = requests.get('https://quote-api.jup.ag/v6/quote?inputMint=So11111111111111111111111111111111111111112\
&outputMint=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263\
&amount=100000000\
&slippageBps=50')
if r.status_code == 200:
quote_response = r.json()
response = requests.post('https://quote-api.jup.ag/v6/swap', json={
"quoteResponse": quote_response,
"userPublicKey": str(wallet.pubkey()), # Corrected attribute name
"wrapAndUnwrapSol": True
})
if response.status_code == 200:
swap_instruction = response.json()["swapTransaction"]
raw_tx = solders.transaction.VersionedTransaction.from_bytes(base64.b64decode(swap_instruction))
message_to_sign = bytes(raw_tx.message)
signature = wallet.sign_message(message_to_sign)
signed_tx = solders.transaction.VersionedTransaction.populate(raw_tx.message, [signature])
encoded_tx = base64.b64encode(bytes(signed_tx)).decode('utf-8')
headers = {
"Content-Type": "application/json"
}
data = {
"jsonrpc": "2.0",
"id": 1,
"method": "sendTransaction",
"params": [
encoded_tx,
{
"skipPreflight": True,
"preflightCommitment": "finalized",
"encoding": "base64",
"maxRetries": None,
"minContextSlot": None
}
]
}
tx_response = httpx.post("https://api.devnet.solana.com", headers=headers, json=data)
print(tx_response.json())
else :
print("error") ```