@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.
@@ -6980,8 +6980,15 @@ class Connection {
6980
6980
  */
6981
6981
 
6982
6982
 
6983
- async getBlock(slot, opts) {
6984
- const args = this._buildArgsAtLeastConfirmed([slot], opts && opts.commitment);
6983
+ async getBlock(slot, rawConfig) {
6984
+ const {
6985
+ commitment,
6986
+ config
6987
+ } = extractCommitmentFromConfig(rawConfig);
6988
+
6989
+ const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined
6990
+ /* encoding */
6991
+ , config);
6985
6992
 
6986
6993
  const unsafeRes = await this._rpcRequest('getBlock', args);
6987
6994
  const res = create(unsafeRes, GetBlockRpcResult);
@@ -7067,8 +7074,15 @@ class Connection {
7067
7074
  */
7068
7075
 
7069
7076
 
7070
- async getTransaction(signature, opts) {
7071
- const args = this._buildArgsAtLeastConfirmed([signature], opts && opts.commitment);
7077
+ async getTransaction(signature, rawConfig) {
7078
+ const {
7079
+ commitment,
7080
+ config
7081
+ } = extractCommitmentFromConfig(rawConfig);
7082
+
7083
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
7084
+ /* encoding */
7085
+ , config);
7072
7086
 
7073
7087
  const unsafeRes = await this._rpcRequest('getTransaction', args);
7074
7088
  const res = create(unsafeRes, GetTransactionRpcResult);
@@ -7090,8 +7104,13 @@ class Connection {
7090
7104
  */
7091
7105
 
7092
7106
 
7093
- async getParsedTransaction(signature, commitment) {
7094
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7107
+ async getParsedTransaction(signature, commitmentOrConfig) {
7108
+ const {
7109
+ commitment,
7110
+ config
7111
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7112
+
7113
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7095
7114
 
7096
7115
  const unsafeRes = await this._rpcRequest('getTransaction', args);
7097
7116
  const res = create(unsafeRes, GetParsedTransactionRpcResult);
@@ -7107,9 +7126,13 @@ class Connection {
7107
7126
  */
7108
7127
 
7109
7128
 
7110
- async getParsedTransactions(signatures, commitment) {
7129
+ async getParsedTransactions(signatures, commitmentOrConfig) {
7130
+ const {
7131
+ commitment,
7132
+ config
7133
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7111
7134
  const batch = signatures.map(signature => {
7112
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7135
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7113
7136
 
7114
7137
  return {
7115
7138
  methodName: 'getTransaction',
@@ -7134,9 +7157,15 @@ class Connection {
7134
7157
  */
7135
7158
 
7136
7159
 
7137
- async getTransactions(signatures, commitment) {
7160
+ async getTransactions(signatures, commitmentOrConfig) {
7161
+ const {
7162
+ commitment,
7163
+ config
7164
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7138
7165
  const batch = signatures.map(signature => {
7139
- const args = this._buildArgsAtLeastConfirmed([signature], commitment);
7166
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
7167
+ /* encoding */
7168
+ , config);
7140
7169
 
7141
7170
  return {
7142
7171
  methodName: 'getTransaction',
@@ -7578,6 +7607,28 @@ class Connection {
7578
7607
  this._pollingBlockhash = false;
7579
7608
  }
7580
7609
  }
7610
+ /**
7611
+ * get the stake minimum delegation
7612
+ */
7613
+
7614
+
7615
+ async getStakeMinimumDelegation(config) {
7616
+ const {
7617
+ commitment,
7618
+ config: configArg
7619
+ } = extractCommitmentFromConfig(config);
7620
+
7621
+ const args = this._buildArgs([], commitment, 'base64', configArg);
7622
+
7623
+ const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);
7624
+ const res = create(unsafeRes, jsonRpcResultAndContext(number()));
7625
+
7626
+ if ('error' in res) {
7627
+ throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);
7628
+ }
7629
+
7630
+ return res.result;
7631
+ }
7581
7632
  /**
7582
7633
  * Simulate a transaction
7583
7634
  */
@@ -7809,6 +7860,11 @@ class Connection {
7809
7860
  this._rpcWebSocketConnected = false;
7810
7861
  this._rpcWebSocketGeneration++;
7811
7862
 
7863
+ if (this._rpcWebSocketIdleTimeout) {
7864
+ clearTimeout(this._rpcWebSocketIdleTimeout);
7865
+ this._rpcWebSocketIdleTimeout = null;
7866
+ }
7867
+
7812
7868
  if (this._rpcWebSocketHeartbeat) {
7813
7869
  clearInterval(this._rpcWebSocketHeartbeat);
7814
7870
  this._rpcWebSocketHeartbeat = null;