@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/README.md CHANGED
@@ -109,6 +109,10 @@ Each Github release features a tarball containing API documentation and a
109
109
  minified version of the module suitable for direct use in a browser environment
110
110
  (`<script>` tag)
111
111
 
112
+ ## Contributing
113
+
114
+ If you have an issue to report or would like to contribute a pull request, please do so against the monorepo at https://github.com/solana-labs/solana. We are not able to merge pull requests into the mirror repo https://github.com/solana-labs/solana-web3.js and issues filed there may go unnoticed.
115
+
112
116
  ## Disclaimer
113
117
 
114
118
  All claims, content, designs, algorithms, estimates, roadmaps,
@@ -5658,6 +5658,10 @@ const TokenBalanceResult = superstruct.type({
5658
5658
  owner: superstruct.optional(superstruct.string()),
5659
5659
  uiTokenAmount: TokenAmountResult
5660
5660
  });
5661
+ const LoadedAddressesResult = superstruct.type({
5662
+ writable: superstruct.array(PublicKeyFromString),
5663
+ readonly: superstruct.array(PublicKeyFromString)
5664
+ });
5661
5665
  /**
5662
5666
  * @internal
5663
5667
  */
@@ -5677,7 +5681,8 @@ const ConfirmedTransactionMetaResult = superstruct.type({
5677
5681
  postBalances: superstruct.array(superstruct.number()),
5678
5682
  logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
5679
5683
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5680
- postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult)))
5684
+ postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5685
+ loadedAddresses: superstruct.optional(LoadedAddressesResult)
5681
5686
  });
5682
5687
  /**
5683
5688
  * @internal
@@ -5694,7 +5699,8 @@ const ParsedConfirmedTransactionMetaResult = superstruct.type({
5694
5699
  postBalances: superstruct.array(superstruct.number()),
5695
5700
  logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
5696
5701
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5697
- postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult)))
5702
+ postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
5703
+ loadedAddresses: superstruct.optional(LoadedAddressesResult)
5698
5704
  });
5699
5705
  /**
5700
5706
  * Expected JSON RPC response for the "getBlock" message
@@ -7135,8 +7141,13 @@ class Connection {
7135
7141
  */
7136
7142
 
7137
7143
 
7138
- async getParsedTransaction(signature, commitment) {
7139
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7144
+ async getParsedTransaction(signature, commitmentOrConfig) {
7145
+ const {
7146
+ commitment,
7147
+ config
7148
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7149
+
7150
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7140
7151
 
7141
7152
  const unsafeRes = await this._rpcRequest('getTransaction', args);
7142
7153
  const res = superstruct.create(unsafeRes, GetParsedTransactionRpcResult);
@@ -7152,9 +7163,13 @@ class Connection {
7152
7163
  */
7153
7164
 
7154
7165
 
7155
- async getParsedTransactions(signatures, commitment) {
7166
+ async getParsedTransactions(signatures, commitmentOrConfig) {
7167
+ const {
7168
+ commitment,
7169
+ config
7170
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7156
7171
  const batch = signatures.map(signature => {
7157
- const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
7172
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
7158
7173
 
7159
7174
  return {
7160
7175
  methodName: 'getTransaction',
@@ -7179,9 +7194,15 @@ class Connection {
7179
7194
  */
7180
7195
 
7181
7196
 
7182
- async getTransactions(signatures, commitment) {
7197
+ async getTransactions(signatures, commitmentOrConfig) {
7198
+ const {
7199
+ commitment,
7200
+ config
7201
+ } = extractCommitmentFromConfig(commitmentOrConfig);
7183
7202
  const batch = signatures.map(signature => {
7184
- const args = this._buildArgsAtLeastConfirmed([signature], commitment);
7203
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
7204
+ /* encoding */
7205
+ , config);
7185
7206
 
7186
7207
  return {
7187
7208
  methodName: 'getTransaction',
@@ -7623,6 +7644,28 @@ class Connection {
7623
7644
  this._pollingBlockhash = false;
7624
7645
  }
7625
7646
  }
7647
+ /**
7648
+ * get the stake minimum delegation
7649
+ */
7650
+
7651
+
7652
+ async getStakeMinimumDelegation(config) {
7653
+ const {
7654
+ commitment,
7655
+ config: configArg
7656
+ } = extractCommitmentFromConfig(config);
7657
+
7658
+ const args = this._buildArgs([], commitment, 'base64', configArg);
7659
+
7660
+ const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);
7661
+ const res = superstruct.create(unsafeRes, jsonRpcResultAndContext(superstruct.number()));
7662
+
7663
+ if ('error' in res) {
7664
+ throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);
7665
+ }
7666
+
7667
+ return res.result;
7668
+ }
7626
7669
  /**
7627
7670
  * Simulate a transaction
7628
7671
  */
@@ -7854,6 +7897,11 @@ class Connection {
7854
7897
  this._rpcWebSocketConnected = false;
7855
7898
  this._rpcWebSocketGeneration++;
7856
7899
 
7900
+ if (this._rpcWebSocketIdleTimeout) {
7901
+ clearTimeout(this._rpcWebSocketIdleTimeout);
7902
+ this._rpcWebSocketIdleTimeout = null;
7903
+ }
7904
+
7857
7905
  if (this._rpcWebSocketHeartbeat) {
7858
7906
  clearInterval(this._rpcWebSocketHeartbeat);
7859
7907
  this._rpcWebSocketHeartbeat = null;