@solana/web3.js 1.37.1 → 1.39.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
@@ -94,10 +94,11 @@ Example scripts for the Solana Program Library:
94
94
 
95
95
  - [Token Program Examples](https://github.com/solana-labs/solana-program-library/tree/master/token/js/examples)
96
96
 
97
- ## Flow
97
+ ## Flow Support (Discontinued)
98
98
 
99
- A [Flow library definition](https://flow.org/en/docs/libdefs/) is provided at
100
- https://unpkg.com/@solana/web3.js@latest/module.flow.js.
99
+ Flow types are no longer supported in new releases. The last release with Flow support is v1.37.2 and its
100
+ [Flow library definition](https://flow.org/en/docs/libdefs/) is provided at
101
+ https://unpkg.com/@solana/web3.js@v1.37.2/module.flow.js.
101
102
  Download the file and add the following line under the [libs] section of your project's `.flowconfig` to
102
103
  activate it:
103
104
 
@@ -4589,7 +4589,7 @@ exports.Response = ctx.Response;
4589
4589
  module.exports = exports;
4590
4590
  }(browserPonyfill, browserPonyfill.exports));
4591
4591
 
4592
- var fetch = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill.exports);
4592
+ var crossFetch = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill.exports);
4593
4593
 
4594
4594
  const MINIMUM_SLOT_PER_EPOCH = 32; // Returns the number of trailing zeros in the binary representation of self.
4595
4595
 
@@ -4926,7 +4926,8 @@ const BlockProductionResponseStruct = jsonRpcResultAndContext(superstruct.type({
4926
4926
  * A performance sample
4927
4927
  */
4928
4928
 
4929
- function createRpcClient(url, useHttps, httpHeaders, fetchMiddleware, disableRetryOnRateLimit) {
4929
+ function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit) {
4930
+ const fetch = customFetch ? customFetch : crossFetch;
4930
4931
 
4931
4932
  let fetchWithMiddleware;
4932
4933
 
@@ -5728,6 +5729,7 @@ class Connection {
5728
5729
  const useHttps = url.protocol === 'https:';
5729
5730
  let wsEndpoint;
5730
5731
  let httpHeaders;
5732
+ let fetch;
5731
5733
  let fetchMiddleware;
5732
5734
  let disableRetryOnRateLimit;
5733
5735
 
@@ -5738,13 +5740,14 @@ class Connection {
5738
5740
  this._confirmTransactionInitialTimeout = commitmentOrConfig.confirmTransactionInitialTimeout;
5739
5741
  wsEndpoint = commitmentOrConfig.wsEndpoint;
5740
5742
  httpHeaders = commitmentOrConfig.httpHeaders;
5743
+ fetch = commitmentOrConfig.fetch;
5741
5744
  fetchMiddleware = commitmentOrConfig.fetchMiddleware;
5742
5745
  disableRetryOnRateLimit = commitmentOrConfig.disableRetryOnRateLimit;
5743
5746
  }
5744
5747
 
5745
5748
  this._rpcEndpoint = endpoint;
5746
5749
  this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
5747
- this._rpcClient = createRpcClient(url.toString(), useHttps, httpHeaders, fetchMiddleware, disableRetryOnRateLimit);
5750
+ this._rpcClient = createRpcClient(url.toString(), useHttps, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit);
5748
5751
  this._rpcRequest = createRpcRequest(this._rpcClient);
5749
5752
  this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);
5750
5753
  this._rpcWebSocket = new rpcWebsockets.Client(this._rpcWsEndpoint, {
@@ -7250,7 +7253,14 @@ class Connection {
7250
7253
  let transaction;
7251
7254
 
7252
7255
  if (transactionOrMessage instanceof Transaction) {
7253
- transaction = transactionOrMessage;
7256
+ let originalTx = transactionOrMessage;
7257
+ transaction = new Transaction({
7258
+ recentBlockhash: originalTx.recentBlockhash,
7259
+ nonceInfo: originalTx.nonceInfo,
7260
+ feePayer: originalTx.feePayer,
7261
+ signatures: [...originalTx.signatures]
7262
+ });
7263
+ transaction.instructions = transactionOrMessage.instructions;
7254
7264
  } else {
7255
7265
  transaction = Transaction.populate(transactionOrMessage);
7256
7266
  }
@@ -7523,6 +7533,7 @@ class Connection {
7523
7533
 
7524
7534
  _resetSubscriptions() {
7525
7535
  Object.values(this._accountChangeSubscriptions).forEach(s => s.subscriptionId = null);
7536
+ Object.values(this._logsSubscriptions).forEach(s => s.subscriptionId = null);
7526
7537
  Object.values(this._programAccountChangeSubscriptions).forEach(s => s.subscriptionId = null);
7527
7538
  Object.values(this._rootSubscriptions).forEach(s => s.subscriptionId = null);
7528
7539
  Object.values(this._signatureSubscriptions).forEach(s => s.subscriptionId = null);