@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.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
@@ -5998,6 +5998,13 @@ const GetInflationRewardResult = jsonRpcResult(array(nullable(type({
5998
5998
  postBalance: number(),
5999
5999
  commission: optional(nullable(number()))
6000
6000
  }))));
6001
+ /**
6002
+ * Expected JSON RPC response for the "getRecentPrioritizationFees" message
6003
+ */
6004
+ const GetRecentPrioritizationFeesResult = array(type({
6005
+ slot: number(),
6006
+ prioritizationFee: number()
6007
+ }));
6001
6008
  /**
6002
6009
  * Expected JSON RPC response for the "getInflationRate" message
6003
6010
  */
@@ -6222,6 +6229,11 @@ const GetInflationGovernorRpcResult = jsonRpcResult(GetInflationGovernorResult);
6222
6229
  */
6223
6230
  const GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult);
6224
6231
 
6232
+ /**
6233
+ * Expected JSON RPC response for the "getRecentPrioritizationFees" message
6234
+ */
6235
+ const GetRecentPrioritizationFeesRpcResult = jsonRpcResult(GetRecentPrioritizationFeesResult);
6236
+
6225
6237
  /**
6226
6238
  * Expected JSON RPC response for the "getEpochInfo" message
6227
6239
  */
@@ -8119,6 +8131,19 @@ class Connection {
8119
8131
  return res.result;
8120
8132
  }
8121
8133
 
8134
+ /**
8135
+ * Fetch a list of prioritization fees from recent blocks.
8136
+ */
8137
+ async getRecentPrioritizationFees(config) {
8138
+ const accounts = config?.lockedWritableAccounts?.map(key => key.toBase58());
8139
+ const args = this._buildArgs(accounts?.length ? [accounts] : []);
8140
+ const unsafeRes = await this._rpcRequest('getRecentPrioritizationFees', args);
8141
+ const res = create(unsafeRes, GetRecentPrioritizationFeesRpcResult);
8142
+ if ('error' in res) {
8143
+ throw new SolanaJSONRPCError(res.error, 'failed to get recent prioritization fees');
8144
+ }
8145
+ return res.result;
8146
+ }
8122
8147
  /**
8123
8148
  * Fetch a recent blockhash from the cluster
8124
8149
  * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}