skynetcap / solanaj

Solana RPC client written in Java
MIT License
94 stars 50 forks source link

Docking jup problem #33

Closed xiaohua66888 closed 2 months ago

xiaohua66888 commented 6 months ago

// deserialize the transaction const swapTransactionBuf = Buffer.from(swapTransaction, 'base64'); var transaction = VersionedTransaction.deserialize(swapTransactionBuf); console.log(transaction);

// sign the transaction transaction.sign([wallet.payer]);

// Execute the transaction const rawTransaction = transaction.serialize() const txid = await connection.sendRawTransaction(rawTransaction, { skipPreflight: true, maxRetries: 2 }); await connection.confirmTransaction(txid); console.log(https://solscan.io/tx/${txid});

https://station.jup.ag/docs/apis/swap-api

How to achieve it?

Mykke24 commented 6 months ago

check this code and repo https://github.com/itsmelodewyk/java-jup-ag/blob/f0ee3d1bd95a3b0fa18e42ea18d94c96bab814c9/src/main/java/utils/VersionedTransaction.java#L42