@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.
@@ -5657,6 +5657,10 @@ const TokenBalanceResult = superstruct.type({
5657
5657
  owner: superstruct.optional(superstruct.string()),
5658
5658
  uiTokenAmount: TokenAmountResult
5659
5659
  });
5660
+ const LoadedAddressesResult = superstruct.type({
5661
+ writable: superstruct.array(PublicKeyFromString),
5662
+ readonly: superstruct.array(PublicKeyFromString)
5663
+ });
5660
5664
  /**
5661
5665
  * @internal
5662
5666
  */
@@ -5676,7 +5680,8 @@ const ConfirmedTransactionMetaResult = superstruct.type({
5676
5680
  postBalances: superstruct.array(superstruct.number()),
5677
5681
  logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
5678
5682
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5679
- postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult)))
5683
+ postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5684
+ loadedAddresses: superstruct.optional(LoadedAddressesResult)
5680
5685
  });
5681
5686
  /**
5682
5687
  * @internal
@@ -5693,7 +5698,8 @@ const ParsedConfirmedTransactionMetaResult = superstruct.type({
5693
5698
  postBalances: superstruct.array(superstruct.number()),
5694
5699
  logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
5695
5700
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5696
- postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult)))
5701
+ postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5702
+ loadedAddresses: superstruct.optional(LoadedAddressesResult)
5697
5703
  });
5698
5704
  /**
5699
5705
  * Expected JSON RPC response for the "getBlock" message
@@ -7134,8 +7140,13 @@ class Connection {
7134
7140
  */
7135
7141
 
7136
7142
 
7137
- async getParsedTransaction(signature, commitment) {
7138
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7143
+ async getParsedTransaction(signature, commitmentOrConfig) {
7144
+ const {
7145
+ commitment,
7146
+ config
7147
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7148
+
7149
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7139
7150
 
7140
7151
  const unsafeRes = await this._rpcRequest('getTransaction', args);
7141
7152
  const res = superstruct.create(unsafeRes, GetParsedTransactionRpcResult);
@@ -7151,9 +7162,13 @@ class Connection {
7151
7162
  */
7152
7163
 
7153
7164
 
7154
- async getParsedTransactions(signatures, commitment) {
7165
+ async getParsedTransactions(signatures, commitmentOrConfig) {
7166
+ const {
7167
+ commitment,
7168
+ config
7169
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7155
7170
  const batch = signatures.map(signature => {
7156
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7171
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7157
7172
 
7158
7173
  return {
7159
7174
  methodName: 'getTransaction',
@@ -7178,9 +7193,15 @@ class Connection {
7178
7193
  */
7179
7194
 
7180
7195
 
7181
- async getTransactions(signatures, commitment) {
7196
+ async getTransactions(signatures, commitmentOrConfig) {
7197
+ const {
7198
+ commitment,
7199
+ config
7200
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7182
7201
  const batch = signatures.map(signature => {
7183
- const args = this._buildArgsAtLeastConfirmed([signature], commitment);
7202
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
7203
+ /* encoding */
7204
+ , config);
7184
7205
 
7185
7206
  return {
7186
7207
  methodName: 'getTransaction',
@@ -7622,6 +7643,28 @@ class Connection {
7622
7643
  this._pollingBlockhash = false;
7623
7644
  }
7624
7645
  }
7646
+ /**
7647
+ * get the stake minimum delegation
7648
+ */
7649
+
7650
+
7651
+ async getStakeMinimumDelegation(config) {
7652
+ const {
7653
+ commitment,
7654
+ config: configArg
7655
+ } = extractCommitmentFromConfig(config);
7656
+
7657
+ const args = this._buildArgs([], commitment, 'base64', configArg);
7658
+
7659
+ const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);
7660
+ const res = superstruct.create(unsafeRes, jsonRpcResultAndContext(superstruct.number()));
7661
+
7662
+ if ('error' in res) {
7663
+ throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);
7664
+ }
7665
+
7666
+ return res.result;
7667
+ }
7625
7668
  /**
7626
7669
  * Simulate a transaction
7627
7670
  */
@@ -7853,6 +7896,11 @@ class Connection {
7853
7896
  this._rpcWebSocketConnected = false;
7854
7897
  this._rpcWebSocketGeneration++;
7855
7898
 
7899
+ if (this._rpcWebSocketIdleTimeout) {
7900
+ clearTimeout(this._rpcWebSocketIdleTimeout);
7901
+ this._rpcWebSocketIdleTimeout = null;
7902
+ }
7903
+
7856
7904
  if (this._rpcWebSocketHeartbeat) {
7857
7905
  clearInterval(this._rpcWebSocketHeartbeat);
7858
7906
  this._rpcWebSocketHeartbeat = null;