@solana/web3.js 1.49.0 → 1.51.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.cjs.js CHANGED
@@ -5743,6 +5743,10 @@ const TokenBalanceResult = superstruct.type({
5743
5743
  owner: superstruct.optional(superstruct.string()),
5744
5744
  uiTokenAmount: TokenAmountResult
5745
5745
  });
5746
+ const LoadedAddressesResult = superstruct.type({
5747
+ writable: superstruct.array(PublicKeyFromString),
5748
+ readonly: superstruct.array(PublicKeyFromString)
5749
+ });
5746
5750
  /**
5747
5751
  * @internal
5748
5752
  */
@@ -5762,7 +5766,8 @@ const ConfirmedTransactionMetaResult = superstruct.type({
5762
5766
  postBalances: superstruct.array(superstruct.number()),
5763
5767
  logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
5764
5768
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5765
- postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult)))
5769
+ postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5770
+ loadedAddresses: superstruct.optional(LoadedAddressesResult)
5766
5771
  });
5767
5772
  /**
5768
5773
  * @internal
@@ -5779,7 +5784,8 @@ const ParsedConfirmedTransactionMetaResult = superstruct.type({
5779
5784
  postBalances: superstruct.array(superstruct.number()),
5780
5785
  logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
5781
5786
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5782
- postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult)))
5787
+ postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5788
+ loadedAddresses: superstruct.optional(LoadedAddressesResult)
5783
5789
  });
5784
5790
  /**
5785
5791
  * Expected JSON RPC response for the "getBlock" message
@@ -7220,8 +7226,13 @@ class Connection {
7220
7226
  */
7221
7227
 
7222
7228
 
7223
- async getParsedTransaction(signature, commitment) {
7224
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7229
+ async getParsedTransaction(signature, commitmentOrConfig) {
7230
+ const {
7231
+ commitment,
7232
+ config
7233
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7234
+
7235
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7225
7236
 
7226
7237
  const unsafeRes = await this._rpcRequest('getTransaction', args);
7227
7238
  const res = superstruct.create(unsafeRes, GetParsedTransactionRpcResult);
@@ -7237,9 +7248,13 @@ class Connection {
7237
7248
  */
7238
7249
 
7239
7250
 
7240
- async getParsedTransactions(signatures, commitment) {
7251
+ async getParsedTransactions(signatures, commitmentOrConfig) {
7252
+ const {
7253
+ commitment,
7254
+ config
7255
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7241
7256
  const batch = signatures.map(signature => {
7242
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7257
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7243
7258
 
7244
7259
  return {
7245
7260
  methodName: 'getTransaction',
@@ -7264,9 +7279,15 @@ class Connection {
7264
7279
  */
7265
7280
 
7266
7281
 
7267
- async getTransactions(signatures, commitment) {
7282
+ async getTransactions(signatures, commitmentOrConfig) {
7283
+ const {
7284
+ commitment,
7285
+ config
7286
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7268
7287
  const batch = signatures.map(signature => {
7269
- const args = this._buildArgsAtLeastConfirmed([signature], commitment);
7288
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
7289
+ /* encoding */
7290
+ , config);
7270
7291
 
7271
7292
  return {
7272
7293
  methodName: 'getTransaction',
@@ -7708,6 +7729,28 @@ class Connection {
7708
7729
  this._pollingBlockhash = false;
7709
7730
  }
7710
7731
  }
7732
+ /**
7733
+ * get the stake minimum delegation
7734
+ */
7735
+
7736
+
7737
+ async getStakeMinimumDelegation(config) {
7738
+ const {
7739
+ commitment,
7740
+ config: configArg
7741
+ } = extractCommitmentFromConfig(config);
7742
+
7743
+ const args = this._buildArgs([], commitment, 'base64', configArg);
7744
+
7745
+ const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);
7746
+ const res = superstruct.create(unsafeRes, jsonRpcResultAndContext(superstruct.number()));
7747
+
7748
+ if ('error' in res) {
7749
+ throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);
7750
+ }
7751
+
7752
+ return res.result;
7753
+ }
7711
7754
  /**
7712
7755
  * Simulate a transaction
7713
7756
  */
@@ -7939,6 +7982,11 @@ class Connection {
7939
7982
  this._rpcWebSocketConnected = false;
7940
7983
  this._rpcWebSocketGeneration++;
7941
7984
 
7985
+ if (this._rpcWebSocketIdleTimeout) {
7986
+ clearTimeout(this._rpcWebSocketIdleTimeout);
7987
+ this._rpcWebSocketIdleTimeout = null;
7988
+ }
7989
+
7942
7990
  if (this._rpcWebSocketHeartbeat) {
7943
7991
  clearInterval(this._rpcWebSocketHeartbeat);
7944
7992
  this._rpcWebSocketHeartbeat = null;