use the non deprecated prioritization fee ix

This commit is contained in:
tjs 2023-01-05 12:58:14 -05:00
parent 068fad98f7
commit 65a31bcd5c
1 changed files with 4 additions and 9 deletions

View File

@ -23,10 +23,7 @@ export async function sendTransaction(
const payer = (provider as AnchorProvider).wallet; const payer = (provider as AnchorProvider).wallet;
if (opts.prioritizationFee) { if (opts.prioritizationFee) {
ixs = [ ixs = [createComputeBudgetIx(opts.prioritizationFee), ...ixs];
createComputeBudgetIx(opts.prioritizationFee, 200_000 * ixs.length + 1),
...ixs,
];
} }
const message = MessageV0.compile({ const message = MessageV0.compile({
@ -103,12 +100,10 @@ export async function sendTransaction(
} }
export const createComputeBudgetIx = ( export const createComputeBudgetIx = (
prioritizationFee: number, microLamports: number,
units: number,
): TransactionInstruction => { ): TransactionInstruction => {
const computeBudgetIx = ComputeBudgetProgram.requestUnits({ const computeBudgetIx = ComputeBudgetProgram.setComputeUnitPrice({
additionalFee: prioritizationFee, microLamports,
units,
}); });
return computeBudgetIx; return computeBudgetIx;
}; };