@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/lib/index.d.ts CHANGED
@@ -489,6 +489,13 @@ declare module '@solana/web3.js' {
489
489
  /** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
490
490
  maxSupportedTransactionVersion?: number;
491
491
  };
492
+ /**
493
+ * Configuration object for changing `getStakeMinimumDelegation` query behavior
494
+ */
495
+ export type GetStakeMinimumDelegationConfig = {
496
+ /** The level of commitment desired */
497
+ commitment?: Commitment;
498
+ };
492
499
  /**
493
500
  * Configuration object for changing `getBlockHeight` query behavior
494
501
  */
@@ -1776,14 +1783,14 @@ declare module '@solana/web3.js' {
1776
1783
  */
1777
1784
  getParsedTransaction(
1778
1785
  signature: TransactionSignature,
1779
- commitment?: Finality,
1786
+ commitmentOrConfig?: GetTransactionConfig | Finality,
1780
1787
  ): Promise<ParsedConfirmedTransaction | null>;
1781
1788
  /**
1782
1789
  * Fetch parsed transaction details for a batch of confirmed transactions
1783
1790
  */
1784
1791
  getParsedTransactions(
1785
1792
  signatures: TransactionSignature[],
1786
- commitment?: Finality,
1793
+ commitmentOrConfig?: GetTransactionConfig | Finality,
1787
1794
  ): Promise<(ParsedConfirmedTransaction | null)[]>;
1788
1795
  /**
1789
1796
  * Fetch transaction details for a batch of confirmed transactions.
@@ -1791,7 +1798,7 @@ declare module '@solana/web3.js' {
1791
1798
  */
1792
1799
  getTransactions(
1793
1800
  signatures: TransactionSignature[],
1794
- commitment?: Finality,
1801
+ commitmentOrConfig?: GetTransactionConfig | Finality,
1795
1802
  ): Promise<(TransactionResponse | null)[]>;
1796
1803
  /**
1797
1804
  * Fetch a list of Transactions and transaction statuses from the cluster
@@ -1927,6 +1934,12 @@ declare module '@solana/web3.js' {
1927
1934
  to: PublicKey,
1928
1935
  lamports: number,
1929
1936
  ): Promise<TransactionSignature>;
1937
+ /**
1938
+ * get the stake minimum delegation
1939
+ */
1940
+ getStakeMinimumDelegation(
1941
+ config?: GetStakeMinimumDelegationConfig,
1942
+ ): Promise<RpcResponseAndContext<number>>;
1930
1943
  /**
1931
1944
  * Simulate a transaction
1932
1945
  */
package/lib/index.esm.js CHANGED
@@ -7186,8 +7186,13 @@ class Connection {
7186
7186
  */
7187
7187
 
7188
7188
 
7189
- async getParsedTransaction(signature, commitment) {
7190
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7189
+ async getParsedTransaction(signature, commitmentOrConfig) {
7190
+ const {
7191
+ commitment,
7192
+ config
7193
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7194
+
7195
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7191
7196
 
7192
7197
  const unsafeRes = await this._rpcRequest('getTransaction', args);
7193
7198
  const res = create(unsafeRes, GetParsedTransactionRpcResult);
@@ -7203,9 +7208,13 @@ class Connection {
7203
7208
  */
7204
7209
 
7205
7210
 
7206
- async getParsedTransactions(signatures, commitment) {
7211
+ async getParsedTransactions(signatures, commitmentOrConfig) {
7212
+ const {
7213
+ commitment,
7214
+ config
7215
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7207
7216
  const batch = signatures.map(signature => {
7208
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7217
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7209
7218
 
7210
7219
  return {
7211
7220
  methodName: 'getTransaction',
@@ -7230,9 +7239,15 @@ class Connection {
7230
7239
  */
7231
7240
 
7232
7241
 
7233
- async getTransactions(signatures, commitment) {
7242
+ async getTransactions(signatures, commitmentOrConfig) {
7243
+ const {
7244
+ commitment,
7245
+ config
7246
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7234
7247
  const batch = signatures.map(signature => {
7235
- const args = this._buildArgsAtLeastConfirmed([signature], commitment);
7248
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
7249
+ /* encoding */
7250
+ , config);
7236
7251
 
7237
7252
  return {
7238
7253
  methodName: 'getTransaction',
@@ -7674,6 +7689,28 @@ class Connection {
7674
7689
  this._pollingBlockhash = false;
7675
7690
  }
7676
7691
  }
7692
+ /**
7693
+ * get the stake minimum delegation
7694
+ */
7695
+
7696
+
7697
+ async getStakeMinimumDelegation(config) {
7698
+ const {
7699
+ commitment,
7700
+ config: configArg
7701
+ } = extractCommitmentFromConfig(config);
7702
+
7703
+ const args = this._buildArgs([], commitment, 'base64', configArg);
7704
+
7705
+ const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);
7706
+ const res = create(unsafeRes, jsonRpcResultAndContext(number()));
7707
+
7708
+ if ('error' in res) {
7709
+ throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);
7710
+ }
7711
+
7712
+ return res.result;
7713
+ }
7677
7714
  /**
7678
7715
  * Simulate a transaction
7679
7716
  */