Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Recommended Priority Fee #130

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/libs/sdk/src/solana/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ export class Solana {
feeType: PriorityFeeLevels = 'medium'
) {
const { result } = await this.fetchEstimatePriorityFees({});
const priorityFee = result.per_compute_unit[feeType];
const priorityFee = feeType === 'recommended'
? result.recommended
: result.per_compute_unit[feeType];

const priorityFeeInstruction = ComputeBudgetProgram.setComputeUnitPrice({
microLamports: priorityFee,
});
Expand Down
3 changes: 2 additions & 1 deletion packages/libs/sdk/src/solana/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type PercentileRangeUnion =
| '95'
| '100';

export type PriorityFeeLevels = 'low' | 'medium' | 'high' | 'extreme';
export type PriorityFeeLevels = 'low' | 'medium' | 'high' | 'extreme' | 'recommended';

export interface PriorityFeeRequestPayload {
method: string;
Expand Down Expand Up @@ -53,6 +53,7 @@ export interface PriorityFeeResponseData {
};
per_compute_unit: PriorityFeeEstimates;
per_transaction: PriorityFeeEstimates;
recommended: number;
};
id: number;
}
Expand Down
Loading