@solana/web3.js 1.93.2 → 1.93.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.93.2",
3
+ "version": "1.93.4",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
package/src/connection.ts CHANGED
@@ -1007,7 +1007,7 @@ export type TokenBalance = {
1007
1007
  /**
1008
1008
  * Metadata for a parsed confirmed transaction on the ledger
1009
1009
  *
1010
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionMeta} instead.
1010
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionMeta} instead.
1011
1011
  */
1012
1012
  export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
1013
1013
 
@@ -1130,7 +1130,7 @@ type MessageResponse = {
1130
1130
  /**
1131
1131
  * A confirmed transaction on the ledger
1132
1132
  *
1133
- * @deprecated Deprecated since Solana v1.8.0.
1133
+ * @deprecated Deprecated since RPC v1.8.0.
1134
1134
  */
1135
1135
  export type ConfirmedTransaction = {
1136
1136
  /** The slot during which the transaction was processed */
@@ -1220,7 +1220,7 @@ export type ParsedTransaction = {
1220
1220
  /**
1221
1221
  * A parsed and confirmed transaction on the ledger
1222
1222
  *
1223
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
1223
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
1224
1224
  */
1225
1225
  export type ParsedConfirmedTransaction = ParsedTransactionWithMeta;
1226
1226
 
@@ -1427,7 +1427,7 @@ export type VersionedNoneModeBlockResponse = Omit<
1427
1427
  /**
1428
1428
  * A confirmed block on the ledger
1429
1429
  *
1430
- * @deprecated Deprecated since Solana v1.8.0.
1430
+ * @deprecated Deprecated since RPC v1.8.0.
1431
1431
  */
1432
1432
  export type ConfirmedBlock = {
1433
1433
  /** Blockhash of this block */
@@ -2483,7 +2483,7 @@ const GetParsedNoneModeBlockRpcResult = jsonRpcResult(
2483
2483
  /**
2484
2484
  * Expected JSON RPC response for the "getConfirmedBlock" message
2485
2485
  *
2486
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link GetBlockRpcResult} instead.
2486
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetBlockRpcResult} instead.
2487
2487
  */
2488
2488
  const GetConfirmedBlockRpcResult = jsonRpcResult(
2489
2489
  nullable(
@@ -2551,7 +2551,7 @@ const GetParsedTransactionRpcResult = jsonRpcResult(
2551
2551
  /**
2552
2552
  * Expected JSON RPC response for the "getRecentBlockhash" message
2553
2553
  *
2554
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link GetLatestBlockhashRpcResult} instead.
2554
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetLatestBlockhashRpcResult} instead.
2555
2555
  */
2556
2556
  const GetRecentBlockhashAndContextRpcResult = jsonRpcResultAndContext(
2557
2557
  pick({
@@ -2787,6 +2787,39 @@ export type GetNonceAndContextConfig = {
2787
2787
  minContextSlot?: number;
2788
2788
  };
2789
2789
 
2790
+ export type AccountSubscriptionConfig = Readonly<{
2791
+ /** Optional commitment level */
2792
+ commitment?: Commitment;
2793
+ /**
2794
+ * Encoding format for Account data
2795
+ * - `base58` is slow.
2796
+ * - `jsonParsed` encoding attempts to use program-specific state parsers to return more
2797
+ * human-readable and explicit account state data
2798
+ * - If `jsonParsed` is requested but a parser cannot be found, the field falls back to `base64`
2799
+ * encoding, detectable when the `data` field is type `string`.
2800
+ */
2801
+ encoding?: 'base58' | 'base64' | 'base64+zstd' | 'jsonParsed';
2802
+ }>;
2803
+
2804
+ export type ProgramAccountSubscriptionConfig = Readonly<{
2805
+ /** Optional commitment level */
2806
+ commitment?: Commitment;
2807
+ /**
2808
+ * Encoding format for Account data
2809
+ * - `base58` is slow.
2810
+ * - `jsonParsed` encoding attempts to use program-specific state parsers to return more
2811
+ * human-readable and explicit account state data
2812
+ * - If `jsonParsed` is requested but a parser cannot be found, the field falls back to `base64`
2813
+ * encoding, detectable when the `data` field is type `string`.
2814
+ */
2815
+ encoding?: 'base58' | 'base64' | 'base64+zstd' | 'jsonParsed';
2816
+ /**
2817
+ * Filter results using various filter objects
2818
+ * The resultant account must meet ALL filter criteria to be included in the returned results
2819
+ */
2820
+ filters?: GetProgramAccountsFilter[];
2821
+ }>;
2822
+
2790
2823
  /**
2791
2824
  * Information describing an account
2792
2825
  */
@@ -3607,6 +3640,8 @@ export class Connection {
3607
3640
 
3608
3641
  /**
3609
3642
  * Returns epoch activation information for a stake account that has been delegated
3643
+ *
3644
+ * @deprecated Deprecated since RPC v1.18; will be removed in a future version.
3610
3645
  */
3611
3646
  async getStakeActivation(
3612
3647
  publicKey: PublicKey,
@@ -4312,7 +4347,7 @@ export class Connection {
4312
4347
  /**
4313
4348
  * Fetch the current total currency supply of the cluster in lamports
4314
4349
  *
4315
- * @deprecated Deprecated since v1.2.8. Please use {@link getSupply} instead.
4350
+ * @deprecated Deprecated since RPC v1.2.8. Please use {@link getSupply} instead.
4316
4351
  */
4317
4352
  async getTotalSupply(commitment?: Commitment): Promise<number> {
4318
4353
  const result = await this.getSupply({
@@ -4455,7 +4490,7 @@ export class Connection {
4455
4490
  * Fetch a recent blockhash from the cluster, return with context
4456
4491
  * @return {Promise<RpcResponseAndContext<{blockhash: Blockhash, feeCalculator: FeeCalculator}>>}
4457
4492
  *
4458
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
4493
+ * @deprecated Deprecated since RPC v1.9.0. Please use {@link getLatestBlockhash} instead.
4459
4494
  */
4460
4495
  async getRecentBlockhashAndContext(commitment?: Commitment): Promise<
4461
4496
  RpcResponseAndContext<{
@@ -4497,7 +4532,7 @@ export class Connection {
4497
4532
  /**
4498
4533
  * Fetch the fee calculator for a recent blockhash from the cluster, return with context
4499
4534
  *
4500
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getFeeForMessage} instead.
4535
+ * @deprecated Deprecated since RPC v1.9.0. Please use {@link getFeeForMessage} instead.
4501
4536
  */
4502
4537
  async getFeeCalculatorForBlockhash(
4503
4538
  blockhash: Blockhash,
@@ -4566,7 +4601,7 @@ export class Connection {
4566
4601
  * Fetch a recent blockhash from the cluster
4567
4602
  * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
4568
4603
  *
4569
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
4604
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link getLatestBlockhash} instead.
4570
4605
  */
4571
4606
  async getRecentBlockhash(
4572
4607
  commitment?: Commitment,
@@ -5114,7 +5149,7 @@ export class Connection {
5114
5149
  * Fetch a list of Transactions and transaction statuses from the cluster
5115
5150
  * for a confirmed block.
5116
5151
  *
5117
- * @deprecated Deprecated since v1.13.0. Please use {@link getBlock} instead.
5152
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlock} instead.
5118
5153
  */
5119
5154
  async getConfirmedBlock(
5120
5155
  slot: number,
@@ -5212,7 +5247,7 @@ export class Connection {
5212
5247
  /**
5213
5248
  * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
5214
5249
  *
5215
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getBlockSignatures} instead.
5250
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlockSignatures} instead.
5216
5251
  */
5217
5252
  async getConfirmedBlockSignatures(
5218
5253
  slot: number,
@@ -5242,7 +5277,7 @@ export class Connection {
5242
5277
  /**
5243
5278
  * Fetch a transaction details for a confirmed transaction
5244
5279
  *
5245
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getTransaction} instead.
5280
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getTransaction} instead.
5246
5281
  */
5247
5282
  async getConfirmedTransaction(
5248
5283
  signature: TransactionSignature,
@@ -5269,7 +5304,7 @@ export class Connection {
5269
5304
  /**
5270
5305
  * Fetch parsed transaction details for a confirmed transaction
5271
5306
  *
5272
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransaction} instead.
5307
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransaction} instead.
5273
5308
  */
5274
5309
  async getParsedConfirmedTransaction(
5275
5310
  signature: TransactionSignature,
@@ -5294,7 +5329,7 @@ export class Connection {
5294
5329
  /**
5295
5330
  * Fetch parsed transaction details for a batch of confirmed transactions
5296
5331
  *
5297
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransactions} instead.
5332
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransactions} instead.
5298
5333
  */
5299
5334
  async getParsedConfirmedTransactions(
5300
5335
  signatures: TransactionSignature[],
@@ -5331,7 +5366,7 @@ export class Connection {
5331
5366
  * Fetch a list of all the confirmed signatures for transactions involving an address
5332
5367
  * within a specified slot range. Max range allowed is 10,000 slots.
5333
5368
  *
5334
- * @deprecated Deprecated since v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead.
5369
+ * @deprecated Deprecated since RPC v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead.
5335
5370
  *
5336
5371
  * @param address queried address
5337
5372
  * @param startSlot start slot, inclusive
@@ -5402,9 +5437,7 @@ export class Connection {
5402
5437
  * Returns confirmed signatures for transactions involving an
5403
5438
  * address backwards in time from the provided signature or most recent confirmed block
5404
5439
  *
5405
- *
5406
- * @param address queried address
5407
- * @param options
5440
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getSignaturesForAddress} instead.
5408
5441
  */
5409
5442
  async getConfirmedSignaturesForAddress2(
5410
5443
  address: PublicKey,
@@ -6334,18 +6367,34 @@ export class Connection {
6334
6367
  *
6335
6368
  * @param publicKey Public key of the account to monitor
6336
6369
  * @param callback Function to invoke whenever the account is changed
6337
- * @param commitment Specify the commitment level account changes must reach before notification
6370
+ * @param config
6338
6371
  * @return subscription id
6339
6372
  */
6373
+ onAccountChange(
6374
+ publicKey: PublicKey,
6375
+ callback: AccountChangeCallback,
6376
+ config?: AccountSubscriptionConfig,
6377
+ ): ClientSubscriptionId;
6378
+ /** @deprecated Instead, pass in an {@link AccountSubscriptionConfig} */
6379
+ // eslint-disable-next-line no-dupe-class-members
6340
6380
  onAccountChange(
6341
6381
  publicKey: PublicKey,
6342
6382
  callback: AccountChangeCallback,
6343
6383
  commitment?: Commitment,
6384
+ ): ClientSubscriptionId;
6385
+ // eslint-disable-next-line no-dupe-class-members
6386
+ onAccountChange(
6387
+ publicKey: PublicKey,
6388
+ callback: AccountChangeCallback,
6389
+ commitmentOrConfig?: Commitment | AccountSubscriptionConfig,
6344
6390
  ): ClientSubscriptionId {
6391
+ const {commitment, config} =
6392
+ extractCommitmentFromConfig(commitmentOrConfig);
6345
6393
  const args = this._buildArgs(
6346
6394
  [publicKey.toBase58()],
6347
6395
  commitment || this._commitment || 'finalized', // Apply connection/server default.
6348
6396
  'base64',
6397
+ config,
6349
6398
  );
6350
6399
  return this._makeSubscription(
6351
6400
  {
@@ -6394,21 +6443,40 @@ export class Connection {
6394
6443
  *
6395
6444
  * @param programId Public key of the program to monitor
6396
6445
  * @param callback Function to invoke whenever the account is changed
6397
- * @param commitment Specify the commitment level account changes must reach before notification
6398
- * @param filters The program account filters to pass into the RPC method
6446
+ * @param config
6399
6447
  * @return subscription id
6400
6448
  */
6449
+ onProgramAccountChange(
6450
+ programId: PublicKey,
6451
+ callback: ProgramAccountChangeCallback,
6452
+ config?: ProgramAccountSubscriptionConfig,
6453
+ ): ClientSubscriptionId;
6454
+ /** @deprecated Instead, pass in a {@link ProgramAccountSubscriptionConfig} */
6455
+ // eslint-disable-next-line no-dupe-class-members
6401
6456
  onProgramAccountChange(
6402
6457
  programId: PublicKey,
6403
6458
  callback: ProgramAccountChangeCallback,
6404
6459
  commitment?: Commitment,
6405
6460
  filters?: GetProgramAccountsFilter[],
6461
+ ): ClientSubscriptionId;
6462
+ // eslint-disable-next-line no-dupe-class-members
6463
+ onProgramAccountChange(
6464
+ programId: PublicKey,
6465
+ callback: ProgramAccountChangeCallback,
6466
+ commitmentOrConfig?: Commitment | ProgramAccountSubscriptionConfig,
6467
+ maybeFilters?: GetProgramAccountsFilter[],
6406
6468
  ): ClientSubscriptionId {
6469
+ const {commitment, config} =
6470
+ extractCommitmentFromConfig(commitmentOrConfig);
6407
6471
  const args = this._buildArgs(
6408
6472
  [programId.toBase58()],
6409
6473
  commitment || this._commitment || 'finalized', // Apply connection/server default.
6410
6474
  'base64' /* encoding */,
6411
- filters ? {filters: filters} : undefined /* extra */,
6475
+ config
6476
+ ? config
6477
+ : maybeFilters
6478
+ ? {filters: maybeFilters}
6479
+ : undefined /* extra */,
6412
6480
  );
6413
6481
  return this._makeSubscription(
6414
6482
  {