@solana/web3.js 1.74.0 → 1.75.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/lib/index.browser.cjs.js +25 -0
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +25 -0
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +25 -0
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +20 -0
- package/lib/index.esm.js +25 -0
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +25 -0
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +25 -0
- package/lib/index.native.js.map +1 -1
- package/package.json +4 -4
- package/src/connection.ts +56 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/web3.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.75.0",
|
|
4
4
|
"description": "Solana Javascript API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"test:lint": "eslint src/ test/ --ext .js,.ts",
|
|
48
48
|
"test:lint:fix": "eslint src/ test/ --fix --ext .js,.ts",
|
|
49
49
|
"test:live": "TEST_LIVE=1 pnpm run test:unit:node",
|
|
50
|
-
"test:live-with-test-validator": "start-server-and-test '
|
|
50
|
+
"test:live-with-test-validator": "start-server-and-test '../../scripts/start-shared-test-validator.sh' http://127.0.0.1:8899/health test:live",
|
|
51
51
|
"test:prettier": "prettier --check '{,{src,test}/**/}*.{j,t}s'",
|
|
52
52
|
"test:prettier:fix": "prettier --write '{,{src,test}/**/}*.{j,t}s'",
|
|
53
53
|
"test:typecheck": "tsc --noEmit",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"bn.js": "^5.0.0",
|
|
65
65
|
"borsh": "^0.7.0",
|
|
66
66
|
"bs58": "^4.0.1",
|
|
67
|
-
"buffer": "6.0.
|
|
67
|
+
"buffer": "6.0.3",
|
|
68
68
|
"fast-stable-stringify": "^1.0.0",
|
|
69
69
|
"jayson": "^3.4.4",
|
|
70
70
|
"node-fetch": "^2.6.7",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"semantic-release": "^19.0.3",
|
|
121
121
|
"sinon": "^15.0.1",
|
|
122
122
|
"sinon-chai": "^3.7.0",
|
|
123
|
-
"start-server-and-test": "^
|
|
123
|
+
"start-server-and-test": "^2.0.0",
|
|
124
124
|
"ts-mocha": "^10.0.0",
|
|
125
125
|
"ts-node": "^10.0.0",
|
|
126
126
|
"tsconfig": "workspace:*",
|
package/src/connection.ts
CHANGED
|
@@ -788,6 +788,34 @@ const GetInflationRewardResult = jsonRpcResult(
|
|
|
788
788
|
),
|
|
789
789
|
);
|
|
790
790
|
|
|
791
|
+
export type RecentPrioritizationFees = {
|
|
792
|
+
/** slot in which the fee was observed */
|
|
793
|
+
slot: number;
|
|
794
|
+
/** the per-compute-unit fee paid by at least one successfully landed transaction, specified in increments of 0.000001 lamports*/
|
|
795
|
+
prioritizationFee: number;
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Configuration object for changing `getRecentPrioritizationFees` query behavior
|
|
800
|
+
*/
|
|
801
|
+
export type GetRecentPrioritizationFeesConfig = {
|
|
802
|
+
/**
|
|
803
|
+
* If this parameter is provided, the response will reflect a fee to land a transaction locking
|
|
804
|
+
* all of the provided accounts as writable.
|
|
805
|
+
*/
|
|
806
|
+
lockedWritableAccounts?: PublicKey[];
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Expected JSON RPC response for the "getRecentPrioritizationFees" message
|
|
811
|
+
*/
|
|
812
|
+
const GetRecentPrioritizationFeesResult = array(
|
|
813
|
+
pick({
|
|
814
|
+
slot: number(),
|
|
815
|
+
prioritizationFee: number(),
|
|
816
|
+
}),
|
|
817
|
+
);
|
|
818
|
+
|
|
791
819
|
export type InflationRate = {
|
|
792
820
|
/** total inflation */
|
|
793
821
|
total: number;
|
|
@@ -1662,6 +1690,13 @@ const GetInflationGovernorRpcResult = jsonRpcResult(GetInflationGovernorResult);
|
|
|
1662
1690
|
*/
|
|
1663
1691
|
const GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult);
|
|
1664
1692
|
|
|
1693
|
+
/**
|
|
1694
|
+
* Expected JSON RPC response for the "getRecentPrioritizationFees" message
|
|
1695
|
+
*/
|
|
1696
|
+
const GetRecentPrioritizationFeesRpcResult = jsonRpcResult(
|
|
1697
|
+
GetRecentPrioritizationFeesResult,
|
|
1698
|
+
);
|
|
1699
|
+
|
|
1665
1700
|
/**
|
|
1666
1701
|
* Expected JSON RPC response for the "getEpochInfo" message
|
|
1667
1702
|
*/
|
|
@@ -4468,6 +4503,27 @@ export class Connection {
|
|
|
4468
4503
|
return res.result;
|
|
4469
4504
|
}
|
|
4470
4505
|
|
|
4506
|
+
/**
|
|
4507
|
+
* Fetch a list of prioritization fees from recent blocks.
|
|
4508
|
+
*/
|
|
4509
|
+
async getRecentPrioritizationFees(
|
|
4510
|
+
config?: GetRecentPrioritizationFeesConfig,
|
|
4511
|
+
): Promise<RecentPrioritizationFees[]> {
|
|
4512
|
+
const accounts = config?.lockedWritableAccounts?.map(key => key.toBase58());
|
|
4513
|
+
const args = this._buildArgs(accounts?.length ? [accounts] : []);
|
|
4514
|
+
const unsafeRes = await this._rpcRequest(
|
|
4515
|
+
'getRecentPrioritizationFees',
|
|
4516
|
+
args,
|
|
4517
|
+
);
|
|
4518
|
+
const res = create(unsafeRes, GetRecentPrioritizationFeesRpcResult);
|
|
4519
|
+
if ('error' in res) {
|
|
4520
|
+
throw new SolanaJSONRPCError(
|
|
4521
|
+
res.error,
|
|
4522
|
+
'failed to get recent prioritization fees',
|
|
4523
|
+
);
|
|
4524
|
+
}
|
|
4525
|
+
return res.result;
|
|
4526
|
+
}
|
|
4471
4527
|
/**
|
|
4472
4528
|
* Fetch a recent blockhash from the cluster
|
|
4473
4529
|
* @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
|