Skip to content

Commit

Permalink
Added functionality to accept priority fee for a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
SDargarh committed Jul 23, 2024
1 parent 3556e39 commit 2e31237
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- Added functionality to get estimated fee for a transaction
- Added functionality to accept priority fee for a transaction
9 changes: 9 additions & 0 deletions src/helper/generateTransactionObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 2e31237

Please sign in to comment.