@solana/web3.js 1.48.0 → 1.50.1

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.
@@ -7010,8 +7010,15 @@ class Connection {
7010
7010
  */
7011
7011
 
7012
7012
 
7013
- async getBlock(slot, opts) {
7014
- const args = this._buildArgsAtLeastConfirmed([slot], opts && opts.commitment);
7013
+ async getBlock(slot, rawConfig) {
7014
+ const {
7015
+ commitment,
7016
+ config
7017
+ } = extractCommitmentFromConfig(rawConfig);
7018
+
7019
+ const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined
7020
+ /* encoding */
7021
+ , config);
7015
7022
 
7016
7023
  const unsafeRes = await this._rpcRequest('getBlock', args);
7017
7024
  const res = superstruct.create(unsafeRes, GetBlockRpcResult);
@@ -7097,8 +7104,15 @@ class Connection {
7097
7104
  */
7098
7105
 
7099
7106
 
7100
- async getTransaction(signature, opts) {
7101
- const args = this._buildArgsAtLeastConfirmed([signature], opts && opts.commitment);
7107
+ async getTransaction(signature, rawConfig) {
7108
+ const {
7109
+ commitment,
7110
+ config
7111
+ } = extractCommitmentFromConfig(rawConfig);
7112
+
7113
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
7114
+ /* encoding */
7115
+ , config);
7102
7116
 
7103
7117
  const unsafeRes = await this._rpcRequest('getTransaction', args);
7104
7118
  const res = superstruct.create(unsafeRes, GetTransactionRpcResult);
@@ -7120,8 +7134,13 @@ class Connection {
7120
7134
  */
7121
7135
 
7122
7136
 
7123
- async getParsedTransaction(signature, commitment) {
7124
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7137
+ async getParsedTransaction(signature, commitmentOrConfig) {
7138
+ const {
7139
+ commitment,
7140
+ config
7141
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7142
+
7143
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7125
7144
 
7126
7145
  const unsafeRes = await this._rpcRequest('getTransaction', args);
7127
7146
  const res = superstruct.create(unsafeRes, GetParsedTransactionRpcResult);
@@ -7137,9 +7156,13 @@ class Connection {
7137
7156
  */
7138
7157
 
7139
7158
 
7140
- async getParsedTransactions(signatures, commitment) {
7159
+ async getParsedTransactions(signatures, commitmentOrConfig) {
7160
+ const {
7161
+ commitment,
7162
+ config
7163
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7141
7164
  const batch = signatures.map(signature => {
7142
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7165
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7143
7166
 
7144
7167
  return {
7145
7168
  methodName: 'getTransaction',
@@ -7164,9 +7187,15 @@ class Connection {
7164
7187
  */
7165
7188
 
7166
7189
 
7167
- async getTransactions(signatures, commitment) {
7190
+ async getTransactions(signatures, commitmentOrConfig) {
7191
+ const {
7192
+ commitment,
7193
+ config
7194
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7168
7195
  const batch = signatures.map(signature => {
7169
- const args = this._buildArgsAtLeastConfirmed([signature], commitment);
7196
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
7197
+ /* encoding */
7198
+ , config);
7170
7199
 
7171
7200
  return {
7172
7201
  methodName: 'getTransaction',
@@ -7608,6 +7637,28 @@ class Connection {
7608
7637
  this._pollingBlockhash = false;
7609
7638
  }
7610
7639
  }
7640
+ /**
7641
+ * get the stake minimum delegation
7642
+ */
7643
+
7644
+
7645
+ async getStakeMinimumDelegation(config) {
7646
+ const {
7647
+ commitment,
7648
+ config: configArg
7649
+ } = extractCommitmentFromConfig(config);
7650
+
7651
+ const args = this._buildArgs([], commitment, 'base64', configArg);
7652
+
7653
+ const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);
7654
+ const res = superstruct.create(unsafeRes, jsonRpcResultAndContext(superstruct.number()));
7655
+
7656
+ if ('error' in res) {
7657
+ throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);
7658
+ }
7659
+
7660
+ return res.result;
7661
+ }
7611
7662
  /**
7612
7663
  * Simulate a transaction
7613
7664
  */
@@ -7839,6 +7890,11 @@ class Connection {
7839
7890
  this._rpcWebSocketConnected = false;
7840
7891
  this._rpcWebSocketGeneration++;
7841
7892
 
7893
+ if (this._rpcWebSocketIdleTimeout) {
7894
+ clearTimeout(this._rpcWebSocketIdleTimeout);
7895
+ this._rpcWebSocketIdleTimeout = null;
7896
+ }
7897
+
7842
7898
  if (this._rpcWebSocketHeartbeat) {
7843
7899
  clearInterval(this._rpcWebSocketHeartbeat);
7844
7900
  this._rpcWebSocketHeartbeat = null;