diff --git a/CHANGELOG.md b/CHANGELOG.md index 2627ffe..466793c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,4 +10,5 @@ - Added get balance method to fetch SOL balance of an account - Added functionality to sign SOL and fungible tokens transfer transaction - Added functionality to broadcast a signed transaction -- Added functionality to get estimated fee for a transaction \ No newline at end of file +- Added functionality to get estimated fee for a transaction +- Added functionality to accept priority fee for a transaction \ No newline at end of file diff --git a/src/helper/generateTransactionObject.js b/src/helper/generateTransactionObject.js index e3245e3..f4809d7 100644 --- a/src/helper/generateTransactionObject.js +++ b/src/helper/generateTransactionObject.js @@ -48,6 +48,15 @@ async function generateTransactionObject(transaction, signer, connection) { ); } + // set the desired priority fee in microLamport + if(transaction?.priorityFee && transaction?.priorityFee > 0) { + const addPriorityFee = solanaWeb3.ComputeBudgetProgram.setComputeUnitPrice({ + microLamports: transaction.priorityFee, + }); + + rawTransaction.add(addPriorityFee); + } + return rawTransaction; }