"No data" after sending tx Jupiter Swap Python

57 Views Asked by At

I have a python script that is connected to the Jupiter API and I am trying to ensure the transaction goes through. However I've been having a lot of trouble trying to figure out why sometimes it goes through with no Issue and other times it gives me a tx hash back but the tx hash just shows No data on solscan/explorer

swap_instruction = response_data["swapTransaction"]
raw_tx = VersionedTransaction.from_bytes(base64.b64decode(swap_instruction))
signature = keypair.sign_message(solders.message.to_bytes_versioned(raw_tx.message))
signed_tx = 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"
        }
    ]
}
tx_response = requests.post(rpc_url, headers=headers, json=data)

The swapTransaction comes directly from the Juputer quote API and that is all being pushed into the payload.

I've tried adding prioritizationFeeLamports up to 1000000 I've also done the same and tried computeUnitPriceMicroLamports instead of the prioritizationFeeLamports but still some txs just go through and some appear to go through but have no data on solscan. I've also never had a tx actually physically fail, just either success or a no show.

0

There are 0 best solutions below