Skip to content

Commit

Permalink
small update
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpmitsch committed Mar 19, 2024
1 parent d34509c commit 94ff395
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions packages/libs/sdk/src/solana/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,8 @@ export class Solana {
return transaction;
}

private async createDynamicPriorityFeeInstruction(
feeType: PriorityFeeLevels = 'medium'
) {
const { result } = await this.fetchEstimatePriorityFees({});
const priorityFee = result.per_compute_unit[feeType];
const priorityFeeInstruction = ComputeBudgetProgram.setComputeUnitPrice({
microLamports: priorityFee,
});
return priorityFeeInstruction;
}

private async fetchEstimatePriorityFees({
// Get the priority fee averages based on fee data from the latest blocks
async fetchEstimatePriorityFees({
last_n_blocks = 100,
account = undefined,
}: EstimatePriorityFeesParams): Promise<PriorityFeeResponseData> {
Expand Down Expand Up @@ -138,6 +128,17 @@ export class Solana {
return data;
}

private async createDynamicPriorityFeeInstruction(
feeType: PriorityFeeLevels = 'medium'
) {
const { result } = await this.fetchEstimatePriorityFees({});
const priorityFee = result.per_compute_unit[feeType];
const priorityFeeInstruction = ComputeBudgetProgram.setComputeUnitPrice({
microLamports: priorityFee,
});
return priorityFeeInstruction;
}

private async getSimulationUnits(
connection: Connection,
instructions: TransactionInstruction[],
Expand Down

0 comments on commit 94ff395

Please sign in to comment.