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