@quicknode/sdk 2.2.2 → 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 +15 -3
- package/esm/core/chains.js +12 -2
- package/esm/solana/index.d.ts +3 -1
- package/esm/solana/solana.js +4 -2
- package/index.d.ts +3 -1
- package/package.json +2 -2
package/cjs/index.js
CHANGED
|
@@ -275,25 +275,35 @@ const qnChainToViemChain = {
|
|
|
275
275
|
'base-mainnet': chains.base,
|
|
276
276
|
'base-goerli': chains.baseGoerli,
|
|
277
277
|
'base-sepolia': chains.baseSepolia,
|
|
278
|
+
'bera-artio': chains.berachainTestnet,
|
|
279
|
+
'blast-mainnet': chains.blast,
|
|
280
|
+
'blast-sepolia': chains.blastSepolia,
|
|
278
281
|
['bsc']: chains.bsc,
|
|
279
282
|
'bsc-testnet': chains.bscTestnet,
|
|
280
283
|
'celo-mainnet': chains.celo,
|
|
284
|
+
'cyber-mainnet': chains.cyber,
|
|
285
|
+
'cyber-sepolia': chains.cyberTestnet,
|
|
281
286
|
['fantom']: chains.fantom,
|
|
282
287
|
['xdai']: chains.gnosis,
|
|
283
288
|
['gnosis']: chains.gnosis,
|
|
284
289
|
'ethereum-goerli': chains.goerli,
|
|
285
290
|
'harmony-mainnet': chains.harmonyOne,
|
|
286
291
|
[ETH_MAINNET_NETWORK]: chains.mainnet,
|
|
292
|
+
'mantle-mainnet': chains.mantle,
|
|
293
|
+
'mantle-sepolia': chains.mantleSepoliaTestnet,
|
|
287
294
|
['optimism']: chains.optimism,
|
|
288
295
|
'optimism-goerli': chains.optimismGoerli,
|
|
289
296
|
'optimism-sepolia': chains.optimismSepolia,
|
|
290
297
|
['matic']: chains.polygon,
|
|
291
298
|
['polygon']: chains.polygon,
|
|
292
299
|
'scroll-mainnet': chains.scroll,
|
|
293
|
-
'scroll-testnet': chains.
|
|
300
|
+
'scroll-testnet': chains.scrollSepolia,
|
|
294
301
|
'matic-testnet': chains.polygonMumbai,
|
|
302
|
+
'matic-amoy': chains.polygonAmoy,
|
|
295
303
|
'zkevm-mainnet': chains.polygonZkEvm,
|
|
296
304
|
'zkevm-testnet': chains.polygonZkEvmTestnet,
|
|
305
|
+
'sei-pacific': chains.sei,
|
|
306
|
+
'sei-arctic': chains.seiDevnet,
|
|
297
307
|
'ethereum-sepolia': chains.sepolia,
|
|
298
308
|
'ethereum-holesky': chains.holesky,
|
|
299
309
|
};
|
|
@@ -410,7 +420,7 @@ class Solana {
|
|
|
410
420
|
async fetchEstimatePriorityFees(args = {}) {
|
|
411
421
|
const payload = {
|
|
412
422
|
method: 'qn_estimatePriorityFees',
|
|
413
|
-
params: args,
|
|
423
|
+
params: { api_version: 2, ...args },
|
|
414
424
|
id: 1,
|
|
415
425
|
jsonrpc: '2.0',
|
|
416
426
|
};
|
|
@@ -432,7 +442,9 @@ class Solana {
|
|
|
432
442
|
}
|
|
433
443
|
async createDynamicPriorityFeeInstruction(feeType = 'medium') {
|
|
434
444
|
const { result } = await this.fetchEstimatePriorityFees({});
|
|
435
|
-
const priorityFee =
|
|
445
|
+
const priorityFee = feeType === 'recommended'
|
|
446
|
+
? result.recommended
|
|
447
|
+
: result.per_compute_unit[feeType];
|
|
436
448
|
const priorityFeeInstruction = web3_js.ComputeBudgetProgram.setComputeUnitPrice({
|
|
437
449
|
microLamports: priorityFee,
|
|
438
450
|
});
|
package/esm/core/chains.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QNInvalidEndpointUrl } from '../lib/errors/QNInvalidEnpointUrl.js';
|
|
2
2
|
import { QNChainNotSupported } from '../lib/errors/QNChainNotSupported.js';
|
|
3
|
-
import { arbitrum, arbitrumGoerli, arbitrumSepolia, arbitrumNova, avalanche, avalancheFuji, base, baseGoerli, baseSepolia, bsc, bscTestnet, celo, fantom, gnosis, goerli, harmonyOne, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, scroll,
|
|
3
|
+
import { arbitrum, arbitrumGoerli, arbitrumSepolia, arbitrumNova, avalanche, avalancheFuji, base, baseGoerli, baseSepolia, berachainTestnet, blast, blastSepolia, bsc, bscTestnet, celo, cyber, cyberTestnet, fantom, gnosis, goerli, harmonyOne, mainnet, mantle, mantleSepoliaTestnet, optimism, optimismGoerli, optimismSepolia, polygon, scroll, scrollSepolia, polygonMumbai, polygonAmoy, polygonZkEvm, polygonZkEvmTestnet, sei, seiDevnet, sepolia, holesky } from 'viem/chains';
|
|
4
4
|
|
|
5
5
|
const ETH_MAINNET_NETWORK = 'ethereum-mainnet';
|
|
6
6
|
const qnChainToViemChain = {
|
|
@@ -13,25 +13,35 @@ const qnChainToViemChain = {
|
|
|
13
13
|
'base-mainnet': base,
|
|
14
14
|
'base-goerli': baseGoerli,
|
|
15
15
|
'base-sepolia': baseSepolia,
|
|
16
|
+
'bera-artio': berachainTestnet,
|
|
17
|
+
'blast-mainnet': blast,
|
|
18
|
+
'blast-sepolia': blastSepolia,
|
|
16
19
|
['bsc']: bsc,
|
|
17
20
|
'bsc-testnet': bscTestnet,
|
|
18
21
|
'celo-mainnet': celo,
|
|
22
|
+
'cyber-mainnet': cyber,
|
|
23
|
+
'cyber-sepolia': cyberTestnet,
|
|
19
24
|
['fantom']: fantom,
|
|
20
25
|
['xdai']: gnosis,
|
|
21
26
|
['gnosis']: gnosis,
|
|
22
27
|
'ethereum-goerli': goerli,
|
|
23
28
|
'harmony-mainnet': harmonyOne,
|
|
24
29
|
[ETH_MAINNET_NETWORK]: mainnet,
|
|
30
|
+
'mantle-mainnet': mantle,
|
|
31
|
+
'mantle-sepolia': mantleSepoliaTestnet,
|
|
25
32
|
['optimism']: optimism,
|
|
26
33
|
'optimism-goerli': optimismGoerli,
|
|
27
34
|
'optimism-sepolia': optimismSepolia,
|
|
28
35
|
['matic']: polygon,
|
|
29
36
|
['polygon']: polygon,
|
|
30
37
|
'scroll-mainnet': scroll,
|
|
31
|
-
'scroll-testnet':
|
|
38
|
+
'scroll-testnet': scrollSepolia,
|
|
32
39
|
'matic-testnet': polygonMumbai,
|
|
40
|
+
'matic-amoy': polygonAmoy,
|
|
33
41
|
'zkevm-mainnet': polygonZkEvm,
|
|
34
42
|
'zkevm-testnet': polygonZkEvmTestnet,
|
|
43
|
+
'sei-pacific': sei,
|
|
44
|
+
'sei-arctic': seiDevnet,
|
|
35
45
|
'ethereum-sepolia': sepolia,
|
|
36
46
|
'ethereum-holesky': holesky,
|
|
37
47
|
};
|
package/esm/solana/index.d.ts
CHANGED
|
@@ -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;
|
package/esm/solana/solana.js
CHANGED
|
@@ -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 =
|
|
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.
|
|
9
|
+
"version": "2.4.0",
|
|
10
10
|
"main": "./cjs/index.js",
|
|
11
11
|
"module": "./esm/index.js",
|
|
12
12
|
"types": "./index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@solana/web3.js": "^1.91",
|
|
16
16
|
"cross-fetch": "^3.1.6",
|
|
17
17
|
"tslib": "^2.5.3",
|
|
18
|
-
"viem": "^
|
|
18
|
+
"viem": "^2.13.7",
|
|
19
19
|
"zod": "^3.21.4"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|