@solana/web3.js 1.74.1 → 1.75.1
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 +26 -1
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +26 -1
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +26 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +20 -0
- package/lib/index.esm.js +26 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +26 -1
- 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 +26 -1
- 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.1",
|
|
4
4
|
"description": "Solana Javascript API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"bn.js": "^5.0.0",
|
|
48
48
|
"borsh": "^0.7.0",
|
|
49
49
|
"bs58": "^4.0.1",
|
|
50
|
-
"buffer": "6.0.
|
|
50
|
+
"buffer": "6.0.3",
|
|
51
51
|
"fast-stable-stringify": "^1.0.0",
|
|
52
52
|
"jayson": "^3.4.4",
|
|
53
53
|
"node-fetch": "^2.6.7",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"semantic-release": "^19.0.3",
|
|
104
104
|
"sinon": "^15.0.1",
|
|
105
105
|
"sinon-chai": "^3.7.0",
|
|
106
|
-
"start-server-and-test": "^
|
|
106
|
+
"start-server-and-test": "^2.0.0",
|
|
107
107
|
"ts-mocha": "^10.0.0",
|
|
108
108
|
"ts-node": "^10.0.0",
|
|
109
109
|
"tslib": "^2.1.0",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"test:lint": "eslint src/ test/ --ext .js,.ts",
|
|
123
123
|
"test:lint:fix": "eslint src/ test/ --fix --ext .js,.ts",
|
|
124
124
|
"test:live": "TEST_LIVE=1 pnpm run test:unit:node",
|
|
125
|
-
"test:live-with-test-validator": "start-server-and-test '
|
|
125
|
+
"test:live-with-test-validator": "start-server-and-test '../../scripts/start-shared-test-validator.sh' http://127.0.0.1:8899/health test:live",
|
|
126
126
|
"test:prettier": "prettier --check '{,{src,test}/**/}*.{j,t}s'",
|
|
127
127
|
"test:prettier:fix": "prettier --write '{,{src,test}/**/}*.{j,t}s'",
|
|
128
128
|
"test:typecheck": "tsc --noEmit",
|
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}>}
|