Skip to content

Commit 1fdf7e1

Browse files
authored
chore: add api_version (#81)
1 parent 7035073 commit 1fdf7e1

File tree

6 files changed

+15
-3
lines changed

6 files changed

+15
-3
lines changed

solana/priority-fees-addon/app.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { RequestPayload, ResponseData, EstimatePriorityFeesParams } from "./type
1919
async function fetchEstimatePriorityFees({
2020
last_n_blocks,
2121
account,
22+
api_version = 1,
2223
endpoint
2324
}: EstimatePriorityFeesParams): Promise<ResponseData> {
2425
const params: any = {};
@@ -28,6 +29,9 @@ async function fetchEstimatePriorityFees({
2829
if (account !== undefined) {
2930
params.account = account;
3031
}
32+
if (api_version !== undefined) {
33+
params.api_version = api_version;
34+
}
3135

3236
const payload: RequestPayload = {
3337
method: 'qn_estimatePriorityFees',
@@ -60,6 +64,7 @@ async function fetchEstimatePriorityFees({
6064
const params: EstimatePriorityFeesParams = {
6165
last_n_blocks: 100,
6266
account: 'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4',
67+
api_version: 2,
6368
endpoint: 'https://YOUR_QUICKNODE_ADDON_URL/'
6469
};
6570

solana/priority-fees-addon/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ interface RequestPayload {
44
params: {
55
last_n_blocks: number;
66
account: string;
7+
api_version: number;
78
};
89
id: number;
910
jsonrpc: string;
@@ -36,6 +37,8 @@ interface EstimatePriorityFeesParams {
3637
last_n_blocks?: number;
3738
// (Optional) The program account to use for fetching the local estimate (e.g., Jupiter: JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4)
3839
account?: string;
40+
// (optional) The API version to use for the request (default: 1)
41+
api_version?: number;
3942
// Your Add-on Endpoint (found in your QuickNode Dashboard - https://dashboard.quicknode.com/endpoints)
4043
endpoint: string;
4144
}

solana/raydium-swap-ts/src/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ async function fetchPriorityFee(): Promise<number> {
5353
method: 'qn_estimatePriorityFees',
5454
params: {
5555
last_n_blocks: 100,
56-
account: '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'
56+
account: '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8',
57+
api_version: 2
5758
}
5859
});
5960

solana/web3.js-2.0/quicknode-addons/guide1.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ async function main() {
5858

5959
const priorityFees = await quickNodeRpc.qn_estimatePriorityFees({
6060
account: 'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4',
61-
last_n_blocks: 100
61+
last_n_blocks: 100,
62+
api_version: 2,
6263
}).send();
6364

6465
console.log(priorityFees);

solana/web3.js-2.0/quicknode-addons/guide2.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ async function main() {
152152
try {
153153
const priorityFees = await quickNodeRpc.qn_estimatePriorityFees({
154154
account: 'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4',
155-
last_n_blocks: 100
155+
last_n_blocks: 100,
156+
api_version: 2
156157
}).send();
157158
console.log(`Priority Fees (Med Per CU): ${priorityFees.per_compute_unit.medium}`);
158159
} catch (error) {

solana/web3.js-2.0/quicknode-addons/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface EstimatePriorityFeesResponse {
2121
interface EstimatePriorityFeesParams {
2222
last_n_blocks?: number;
2323
account?: string;
24+
api_version?: number;
2425
}
2526

2627
/* -- METIS API -- */

0 commit comments

Comments
 (0)