@quicknode/sdk 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -420,7 +420,7 @@ class Solana {
420
420
  async fetchEstimatePriorityFees(args = {}) {
421
421
  const payload = {
422
422
  method: 'qn_estimatePriorityFees',
423
- params: args,
423
+ params: { api_version: 2, ...args },
424
424
  id: 1,
425
425
  jsonrpc: '2.0',
426
426
  };
@@ -442,7 +442,9 @@ class Solana {
442
442
  }
443
443
  async createDynamicPriorityFeeInstruction(feeType = 'medium') {
444
444
  const { result } = await this.fetchEstimatePriorityFees({});
445
- const priorityFee = result.per_compute_unit[feeType];
445
+ const priorityFee = feeType === 'recommended'
446
+ ? result.recommended
447
+ : result.per_compute_unit[feeType];
446
448
  const priorityFeeInstruction = web3_js.ComputeBudgetProgram.setComputeUnitPrice({
447
449
  microLamports: priorityFee,
448
450
  });
@@ -2,7 +2,7 @@ import * as _solana_web3_js from '@solana/web3.js';
2
2
  import { Transaction, PublicKey, Keypair, SendOptions, Connection } from '@solana/web3.js';
3
3
 
4
4
  type PercentileRangeUnion = '0' | '5' | '10' | '15' | '20' | '25' | '30' | '35' | '40' | '45' | '50' | '55' | '60' | '65' | '70' | '75' | '80' | '85' | '90' | '95' | '100';
5
- type PriorityFeeLevels = 'low' | 'medium' | 'high' | 'extreme';
5
+ type PriorityFeeLevels = 'low' | 'medium' | 'high' | 'extreme' | 'recommended';
6
6
  interface PriorityFeeRequestPayload {
7
7
  method: string;
8
8
  params: {
@@ -29,12 +29,14 @@ interface PriorityFeeResponseData {
29
29
  };
30
30
  per_compute_unit: PriorityFeeEstimates;
31
31
  per_transaction: PriorityFeeEstimates;
32
+ recommended: number;
32
33
  };
33
34
  id: number;
34
35
  }
35
36
  interface EstimatePriorityFeesParams {
36
37
  last_n_blocks?: number;
37
38
  account?: string;
39
+ api_version?: number;
38
40
  }
39
41
  interface SolanaClientArgs {
40
42
  endpointUrl: string;
@@ -55,7 +55,7 @@ class Solana {
55
55
  async fetchEstimatePriorityFees(args = {}) {
56
56
  const payload = {
57
57
  method: 'qn_estimatePriorityFees',
58
- params: args,
58
+ params: { api_version: 2, ...args },
59
59
  id: 1,
60
60
  jsonrpc: '2.0',
61
61
  };
@@ -77,7 +77,9 @@ class Solana {
77
77
  }
78
78
  async createDynamicPriorityFeeInstruction(feeType = 'medium') {
79
79
  const { result } = await this.fetchEstimatePriorityFees({});
80
- const priorityFee = result.per_compute_unit[feeType];
80
+ const priorityFee = feeType === 'recommended'
81
+ ? result.recommended
82
+ : result.per_compute_unit[feeType];
81
83
  const priorityFeeInstruction = ComputeBudgetProgram.setComputeUnitPrice({
82
84
  microLamports: priorityFee,
83
85
  });
package/index.d.ts CHANGED
@@ -561,7 +561,7 @@ declare class Core {
561
561
  }
562
562
 
563
563
  type PercentileRangeUnion = '0' | '5' | '10' | '15' | '20' | '25' | '30' | '35' | '40' | '45' | '50' | '55' | '60' | '65' | '70' | '75' | '80' | '85' | '90' | '95' | '100';
564
- type PriorityFeeLevels = 'low' | 'medium' | 'high' | 'extreme';
564
+ type PriorityFeeLevels = 'low' | 'medium' | 'high' | 'extreme' | 'recommended';
565
565
  interface PriorityFeeRequestPayload {
566
566
  method: string;
567
567
  params: {
@@ -588,12 +588,14 @@ interface PriorityFeeResponseData {
588
588
  };
589
589
  per_compute_unit: PriorityFeeEstimates;
590
590
  per_transaction: PriorityFeeEstimates;
591
+ recommended: number;
591
592
  };
592
593
  id: number;
593
594
  }
594
595
  interface EstimatePriorityFeesParams {
595
596
  last_n_blocks?: number;
596
597
  account?: string;
598
+ api_version?: number;
597
599
  }
598
600
  interface SolanaClientArgs {
599
601
  endpointUrl: string;
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "directory": "packages/libs/sdk"
7
7
  },
8
8
  "license": "MIT",
9
- "version": "2.3.0",
9
+ "version": "2.4.0",
10
10
  "main": "./cjs/index.js",
11
11
  "module": "./esm/index.js",
12
12
  "types": "./index.d.ts",