Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7881

Transaction sent with txid in log but no swap happened on Jupiter

$
0
0

I got the quote answer and swap answer and even the signed transaction sent but there's no swap and if i check transaction with solana explorer it says the transaction didnt exists (example of transaction through inspecor - tinyurl.com/33n6xmv3):

                    # Get quote and execute swap                    async with aiohttp.ClientSession() as session:                        quote_url = f"https://quote-api.jup.ag/v6/quote?inputMint=So11111111111111111111111111111111111111112&outputMint={contract_address}&amount={amount_lamports}&slippageBps=30"                        async with session.get(quote_url) as response:                            quote_response = await response.json()                            logger.info(f"Ответквоты: {quote_response}")                            if 'error' in quote_response:                                continue                        # Execute swap                        swap_request = {"quoteResponse": quote_response,"userPublicKey": address,"wrapAndUnwrapSol": True,                        }                        async with session.post("https://quote-api.jup.ag/v6/swap",                            headers={'Content-Type': 'application/json'},                            json=swap_request                        ) as response:                            swap_response = await response.json()                            logger.info(f"Ответсвопа: {swap_response}")                            if 'swapTransaction' not in swap_response:                                logger.error(f"'swapTransaction'ненайденвответесвопа: {swap_response}")                                continue                            try:                                # Process transaction                                transaction_bytes = base64.b64decode(swap_response['swapTransaction'])                                raw_tx = VersionedTransaction.from_bytes(transaction_bytes)                                signature = keypair.sign_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")                                logger.info(f"Транзакцияподписанадлякошелька {address}.")                                try:                                    async with aiohttp.ClientSession() as session:                                        async with session.post(                                            SOLDERS_RPC_URL,                                            json={"jsonrpc": "2.0","id": 1,"method": "sendTransaction","params": [                                                      encoded_tx,                                                      {"skipPreflight": True,"preflightCommitment": "finalized","encoding": "base64","maxRetries": None,"minContextSlot": None,                                                      }                                                  ]                                                 }                                        ) as response:                                            tx_response = await response.json()                                            logger.info(f"Ответнаотправкутранзакции: {tx_response}")                                            if 'result' in tx_response:                                                tx_id = tx_response['result']                                                await call.message.answer(                                                    f"Транзакцияуспешноотправлена:\n"                                                    f"<code>{tx_id}</code>\n\n"                                                    f"explorer.solana.com/tx/{tx_id}",                                                    parse_mode=ParseMode.HTML                                                )

Viewing all articles
Browse latest Browse all 7881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>