@solana/web3.js 1.16.2 → 1.17.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.
package/module.flow.js CHANGED
@@ -1979,6 +1979,11 @@ declare module "@solana/web3.js" {
1979
1979
  * Optional fetch middleware callback
1980
1980
  */
1981
1981
  fetchMiddleware?: FetchMiddleware,
1982
+
1983
+ /**
1984
+ * Optional Disable retring calls when server responds with HTTP 429 (Too Many Requests)
1985
+ */
1986
+ disableRetryOnRateLimit?: boolean,
1982
1987
  ...
1983
1988
  };
1984
1989
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.16.2",
3
+ "version": "1.17.1",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
@@ -102,7 +102,7 @@
102
102
  "nyc": "^15.1.0",
103
103
  "prettier": "^2.3.0",
104
104
  "rimraf": "3.0.2",
105
- "rollup": "2.50.5",
105
+ "rollup": "2.50.6",
106
106
  "rollup-plugin-dts": "^3.0.1",
107
107
  "rollup-plugin-node-polyfills": "^0.2.1",
108
108
  "rollup-plugin-terser": "^7.0.2",
package/src/connection.ts CHANGED
@@ -714,6 +714,7 @@ function createRpcClient(
714
714
  useHttps: boolean,
715
715
  httpHeaders?: HttpHeaders,
716
716
  fetchMiddleware?: FetchMiddleware,
717
+ disableRetryOnRateLimit?: boolean,
717
718
  ): RpcClient {
718
719
  let agentManager: AgentManager | undefined;
719
720
  if (!process.env.BROWSER) {
@@ -764,6 +765,9 @@ function createRpcClient(
764
765
  if (res.status !== 429 /* Too many requests */) {
765
766
  break;
766
767
  }
768
+ if (disableRetryOnRateLimit === true) {
769
+ break;
770
+ }
767
771
  too_many_requests_retries -= 1;
768
772
  if (too_many_requests_retries === 0) {
769
773
  break;
@@ -1924,6 +1928,8 @@ export type ConnectionConfig = {
1924
1928
  httpHeaders?: HttpHeaders;
1925
1929
  /** Optional fetch middleware callback */
1926
1930
  fetchMiddleware?: FetchMiddleware;
1931
+ /** Optional Disable retring calls when server responds with HTTP 429 (Too Many Requests) */
1932
+ disableRetryOnRateLimit?: boolean;
1927
1933
  };
1928
1934
 
1929
1935
  /**
@@ -2010,6 +2016,7 @@ export class Connection {
2010
2016
  let wsEndpoint;
2011
2017
  let httpHeaders;
2012
2018
  let fetchMiddleware;
2019
+ let disableRetryOnRateLimit;
2013
2020
  if (commitmentOrConfig && typeof commitmentOrConfig === 'string') {
2014
2021
  this._commitment = commitmentOrConfig;
2015
2022
  } else if (commitmentOrConfig) {
@@ -2017,6 +2024,7 @@ export class Connection {
2017
2024
  wsEndpoint = commitmentOrConfig.wsEndpoint;
2018
2025
  httpHeaders = commitmentOrConfig.httpHeaders;
2019
2026
  fetchMiddleware = commitmentOrConfig.fetchMiddleware;
2027
+ disableRetryOnRateLimit = commitmentOrConfig.disableRetryOnRateLimit;
2020
2028
  }
2021
2029
 
2022
2030
  this._rpcEndpoint = endpoint;
@@ -2027,6 +2035,7 @@ export class Connection {
2027
2035
  useHttps,
2028
2036
  httpHeaders,
2029
2037
  fetchMiddleware,
2038
+ disableRetryOnRateLimit,
2030
2039
  );
2031
2040
  this._rpcRequest = createRpcRequest(this._rpcClient);
2032
2041
  this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);