@solana/web3.js 1.48.0 → 1.49.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.48.0",
3
+ "version": "1.49.0",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
package/src/connection.ts CHANGED
@@ -443,6 +443,16 @@ export type GetBalanceConfig = {
443
443
  minContextSlot?: number;
444
444
  };
445
445
 
446
+ /**
447
+ * Configuration object for changing `getBlock` query behavior
448
+ */
449
+ export type GetBlockConfig = {
450
+ /** The level of finality desired */
451
+ commitment?: Finality;
452
+ /** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
453
+ maxSupportedTransactionVersion?: number;
454
+ };
455
+
446
456
  /**
447
457
  * Configuration object for changing `getBlockHeight` query behavior
448
458
  */
@@ -505,6 +515,16 @@ export type GetSlotLeaderConfig = {
505
515
  minContextSlot?: number;
506
516
  };
507
517
 
518
+ /**
519
+ * Configuration object for changing `getTransaction` query behavior
520
+ */
521
+ export type GetTransactionConfig = {
522
+ /** The level of finality desired */
523
+ commitment?: Finality;
524
+ /** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
525
+ maxSupportedTransactionVersion?: number;
526
+ };
527
+
508
528
  /**
509
529
  * Configuration object for changing `getLargestAccounts` query behavior
510
530
  */
@@ -3592,11 +3612,14 @@ export class Connection {
3592
3612
  */
3593
3613
  async getBlock(
3594
3614
  slot: number,
3595
- opts?: {commitment?: Finality},
3615
+ rawConfig?: GetBlockConfig,
3596
3616
  ): Promise<BlockResponse | null> {
3617
+ const {commitment, config} = extractCommitmentFromConfig(rawConfig);
3597
3618
  const args = this._buildArgsAtLeastConfirmed(
3598
3619
  [slot],
3599
- opts && opts.commitment,
3620
+ commitment as Finality,
3621
+ undefined /* encoding */,
3622
+ config,
3600
3623
  );
3601
3624
  const unsafeRes = await this._rpcRequest('getBlock', args);
3602
3625
  const res = create(unsafeRes, GetBlockRpcResult);
@@ -3684,11 +3707,14 @@ export class Connection {
3684
3707
  */
3685
3708
  async getTransaction(
3686
3709
  signature: string,
3687
- opts?: {commitment?: Finality},
3710
+ rawConfig?: GetTransactionConfig,
3688
3711
  ): Promise<TransactionResponse | null> {
3712
+ const {commitment, config} = extractCommitmentFromConfig(rawConfig);
3689
3713
  const args = this._buildArgsAtLeastConfirmed(
3690
3714
  [signature],
3691
- opts && opts.commitment,
3715
+ commitment as Finality,
3716
+ undefined /* encoding */,
3717
+ config,
3692
3718
  );
3693
3719
  const unsafeRes = await this._rpcRequest('getTransaction', args);
3694
3720
  const res = create(unsafeRes, GetTransactionRpcResult);