Setting Priority Fee

Set Priority Fee for your transaction

If transactions are expiring without confirmation on-chain, this might mean that you have to pay additional fees to prioritise your transaction. To do so, you can set the computeUnitPriceMicroLamports parameter.

const transaction = await (
  await fetch('https://api.jup.ag/swap/v6/transaction', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      // quoteResponse from /quote api
      quoteResponse,
      // user public key to be used for the swap
      userPublicKey: wallet.publicKey.toString(),
      dynamicComputeUnitLimit: true, // allow dynamic compute limit instead of max 1,400,000
      // custom priority fee
      prioritizationFeeLamports: 'auto' // or custom lamports: 1000
    })
  })
).json();

If 'auto' is used, Jupiter will automatically set a priority fee for the transaction, it will be capped at 5,000,000 lamports / 0.005 SOL.