@solana/web3.js 1.49.0 → 1.50.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.49.0",
3
+ "version": "1.50.0",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
package/src/connection.ts CHANGED
@@ -453,6 +453,14 @@ export type GetBlockConfig = {
453
453
  maxSupportedTransactionVersion?: number;
454
454
  };
455
455
 
456
+ /**
457
+ * Configuration object for changing `getStakeMinimumDelegation` query behavior
458
+ */
459
+ export type GetStakeMinimumDelegationConfig = {
460
+ /** The level of commitment desired */
461
+ commitment?: Commitment;
462
+ };
463
+
456
464
  /**
457
465
  * Configuration object for changing `getBlockHeight` query behavior
458
466
  */
@@ -3739,12 +3747,15 @@ export class Connection {
3739
3747
  */
3740
3748
  async getParsedTransaction(
3741
3749
  signature: TransactionSignature,
3742
- commitment?: Finality,
3750
+ commitmentOrConfig?: GetTransactionConfig | Finality,
3743
3751
  ): Promise<ParsedConfirmedTransaction | null> {
3752
+ const {commitment, config} =
3753
+ extractCommitmentFromConfig(commitmentOrConfig);
3744
3754
  const args = this._buildArgsAtLeastConfirmed(
3745
3755
  [signature],
3746
- commitment,
3756
+ commitment as Finality,
3747
3757
  'jsonParsed',
3758
+ config,
3748
3759
  );
3749
3760
  const unsafeRes = await this._rpcRequest('getTransaction', args);
3750
3761
  const res = create(unsafeRes, GetParsedTransactionRpcResult);
@@ -3759,13 +3770,16 @@ export class Connection {
3759
3770
  */
3760
3771
  async getParsedTransactions(
3761
3772
  signatures: TransactionSignature[],
3762
- commitment?: Finality,
3773
+ commitmentOrConfig?: GetTransactionConfig | Finality,
3763
3774
  ): Promise<(ParsedConfirmedTransaction | null)[]> {
3775
+ const {commitment, config} =
3776
+ extractCommitmentFromConfig(commitmentOrConfig);
3764
3777
  const batch = signatures.map(signature => {
3765
3778
  const args = this._buildArgsAtLeastConfirmed(
3766
3779
  [signature],
3767
- commitment,
3780
+ commitment as Finality,
3768
3781
  'jsonParsed',
3782
+ config,
3769
3783
  );
3770
3784
  return {
3771
3785
  methodName: 'getTransaction',
@@ -3791,10 +3805,17 @@ export class Connection {
3791
3805
  */
3792
3806
  async getTransactions(
3793
3807
  signatures: TransactionSignature[],
3794
- commitment?: Finality,
3808
+ commitmentOrConfig?: GetTransactionConfig | Finality,
3795
3809
  ): Promise<(TransactionResponse | null)[]> {
3810
+ const {commitment, config} =
3811
+ extractCommitmentFromConfig(commitmentOrConfig);
3796
3812
  const batch = signatures.map(signature => {
3797
- const args = this._buildArgsAtLeastConfirmed([signature], commitment);
3813
+ const args = this._buildArgsAtLeastConfirmed(
3814
+ [signature],
3815
+ commitment as Finality,
3816
+ undefined /* encoding */,
3817
+ config,
3818
+ );
3798
3819
  return {
3799
3820
  methodName: 'getTransaction',
3800
3821
  args,
@@ -4304,6 +4325,25 @@ export class Connection {
4304
4325
  }
4305
4326
  }
4306
4327
 
4328
+ /**
4329
+ * get the stake minimum delegation
4330
+ */
4331
+ async getStakeMinimumDelegation(
4332
+ config?: GetStakeMinimumDelegationConfig,
4333
+ ): Promise<RpcResponseAndContext<number>> {
4334
+ const {commitment, config: configArg} = extractCommitmentFromConfig(config);
4335
+ const args = this._buildArgs([], commitment, 'base64', configArg);
4336
+ const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);
4337
+ const res = create(unsafeRes, jsonRpcResultAndContext(number()));
4338
+ if ('error' in res) {
4339
+ throw new SolanaJSONRPCError(
4340
+ res.error,
4341
+ `failed to get stake minimum delegation`,
4342
+ );
4343
+ }
4344
+ return res.result;
4345
+ }
4346
+
4307
4347
  /**
4308
4348
  * Simulate a transaction
4309
4349
  */