@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.d.ts CHANGED
@@ -2101,6 +2101,22 @@ type InflationReward = {
2101
2101
  /** vote account commission when the reward was credited */
2102
2102
  commission?: number | null;
2103
2103
  };
2104
+ type RecentPrioritizationFees = {
2105
+ /** slot in which the fee was observed */
2106
+ slot: number;
2107
+ /** the per-compute-unit fee paid by at least one successfully landed transaction, specified in increments of 0.000001 lamports*/
2108
+ prioritizationFee: number;
2109
+ };
2110
+ /**
2111
+ * Configuration object for changing `getRecentPrioritizationFees` query behavior
2112
+ */
2113
+ type GetRecentPrioritizationFeesConfig = {
2114
+ /**
2115
+ * If this parameter is provided, the response will reflect a fee to land a transaction locking
2116
+ * all of the provided accounts as writable.
2117
+ */
2118
+ lockedWritableAccounts?: PublicKey[];
2119
+ };
2104
2120
  type InflationRate = {
2105
2121
  /** total inflation */
2106
2122
  total: number;
@@ -3286,6 +3302,10 @@ export class Connection {
3286
3302
  * Fetch the fee for a message from the cluster, return with context
3287
3303
  */
3288
3304
  getFeeForMessage(message: VersionedMessage, commitment?: Commitment): Promise<RpcResponseAndContext<number | null>>;
3305
+ /**
3306
+ * Fetch a list of prioritization fees from recent blocks.
3307
+ */
3308
+ getRecentPrioritizationFees(config?: GetRecentPrioritizationFeesConfig): Promise<RecentPrioritizationFees[]>;
3289
3309
  /**
3290
3310
  * Fetch a recent blockhash from the cluster
3291
3311
  * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
package/lib/index.esm.js CHANGED
@@ -6018,6 +6018,13 @@ const GetInflationRewardResult = jsonRpcResult(array(nullable(type({
6018
6018
  postBalance: number(),
6019
6019
  commission: optional(nullable(number()))
6020
6020
  }))));
6021
+ /**
6022
+ * Expected JSON RPC response for the "getRecentPrioritizationFees" message
6023
+ */
6024
+ const GetRecentPrioritizationFeesResult = array(type({
6025
+ slot: number(),
6026
+ prioritizationFee: number()
6027
+ }));
6021
6028
  /**
6022
6029
  * Expected JSON RPC response for the "getInflationRate" message
6023
6030
  */
@@ -6242,6 +6249,11 @@ const GetInflationGovernorRpcResult = jsonRpcResult(GetInflationGovernorResult);
6242
6249
  */
6243
6250
  const GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult);
6244
6251
 
6252
+ /**
6253
+ * Expected JSON RPC response for the "getRecentPrioritizationFees" message
6254
+ */
6255
+ const GetRecentPrioritizationFeesRpcResult = jsonRpcResult(GetRecentPrioritizationFeesResult);
6256
+
6245
6257
  /**
6246
6258
  * Expected JSON RPC response for the "getEpochInfo" message
6247
6259
  */
@@ -6933,7 +6945,7 @@ const LogsNotificationResult = type({
6933
6945
 
6934
6946
  /** @internal */
6935
6947
  const COMMON_HTTP_HEADERS = {
6936
- 'solana-client': `js/${"1.74.1" }`
6948
+ 'solana-client': `js/${"1.75.1" }`
6937
6949
  };
6938
6950
 
6939
6951
  /**
@@ -8139,6 +8151,19 @@ class Connection {
8139
8151
  return res.result;
8140
8152
  }
8141
8153
 
8154
+ /**
8155
+ * Fetch a list of prioritization fees from recent blocks.
8156
+ */
8157
+ async getRecentPrioritizationFees(config) {
8158
+ const accounts = config?.lockedWritableAccounts?.map(key => key.toBase58());
8159
+ const args = this._buildArgs(accounts?.length ? [accounts] : []);
8160
+ const unsafeRes = await this._rpcRequest('getRecentPrioritizationFees', args);
8161
+ const res = create(unsafeRes, GetRecentPrioritizationFeesRpcResult);
8162
+ if ('error' in res) {
8163
+ throw new SolanaJSONRPCError(res.error, 'failed to get recent prioritization fees');
8164
+ }
8165
+ return res.result;
8166
+ }
8142
8167
  /**
8143
8168
  * Fetch a recent blockhash from the cluster
8144
8169
  * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}