starknet 8.6.0 → 8.7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # [8.7.0](https://github.com/starknet-io/starknet.js/compare/v8.6.0...v8.7.0) (2025-11-07)
2
+
3
+ ### Bug Fixes
4
+
5
+ - public node hotfix ([#1510](https://github.com/starknet-io/starknet.js/issues/1510)) ([4165a3c](https://github.com/starknet-io/starknet.js/commit/4165a3c74c94053b60ed2aca12d8bebab5b72f68))
6
+
7
+ ### Features
8
+
9
+ - configurable websocket exponential backoff ([#1503](https://github.com/starknet-io/starknet.js/issues/1503)) ([6d0593f](https://github.com/starknet-io/starknet.js/commit/6d0593f2fcdf6da79fb0aaccef42071a8c0e8126))
10
+
1
11
  # [8.6.0](https://github.com/starknet-io/starknet.js/compare/v8.5.5...v8.6.0) (2025-10-17)
2
12
 
3
13
  ### Features
package/dist/index.d.ts CHANGED
@@ -3917,8 +3917,8 @@ declare const DEFAULT_GLOBAL_CONFIG: {
3917
3917
  blake: ((uint8Array: Uint8Array) => Uint8Array) | undefined;
3918
3918
  };
3919
3919
  declare const RPC_DEFAULT_NODES: {
3920
- readonly SN_MAIN: readonly ["https://starknet-mainnet.public.blastapi.io/rpc/"];
3921
- readonly SN_SEPOLIA: readonly ["https://starknet-sepolia.public.blastapi.io/rpc/"];
3920
+ readonly SN_MAIN: readonly ["https://starknet-mainnet.g.alchemy.com/starknet/version/rpc"];
3921
+ readonly SN_SEPOLIA: readonly ["https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/"];
3922
3922
  };
3923
3923
  declare const PAYMASTER_RPC_NODES: {
3924
3924
  readonly SN_MAIN: readonly ["https://starknet.paymaster.avnu.fi"];
@@ -4406,10 +4406,14 @@ type ReconnectOptions = {
4406
4406
  retries?: number;
4407
4407
  /**
4408
4408
  * The initial delay in milliseconds before the first retry.
4409
- * This delay will be doubled for each subsequent retry (exponential backoff).
4410
4409
  * @default 2000
4411
4410
  */
4412
4411
  delay?: number;
4412
+ /**
4413
+ * Whether to use the exponential backoff (delay being doubled for each subsequent retry).
4414
+ * @default true
4415
+ */
4416
+ exponential?: number | boolean;
4413
4417
  };
4414
4418
  /**
4415
4419
  * The type of the WebSocket implementation.
@@ -1179,8 +1179,8 @@ var starknet = (() => {
1179
1179
  blake: void 0
1180
1180
  };
1181
1181
  var RPC_DEFAULT_NODES = {
1182
- SN_MAIN: [`https://starknet-mainnet.public.blastapi.io/rpc/`],
1183
- SN_SEPOLIA: [`https://starknet-sepolia.public.blastapi.io/rpc/`]
1182
+ SN_MAIN: [`https://starknet-mainnet.g.alchemy.com/starknet/version/rpc`],
1183
+ SN_SEPOLIA: [`https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/`]
1184
1184
  };
1185
1185
  var PAYMASTER_RPC_NODES = {
1186
1186
  SN_MAIN: [`https://starknet.paymaster.avnu.fi`],
@@ -14757,6 +14757,12 @@ ${indent}}` : "}";
14757
14757
  const nodes = { ...RPC_DEFAULT_NODES };
14758
14758
  Object.keys(nodes).forEach(function(key, _) {
14759
14759
  nodes[key] = nodes[key].map((it) => {
14760
+ if (it === "https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/") {
14761
+ return `${it}${toApiVersion(rpcVersion)}/uYLxCteYbHTFJpKSoKdVm`;
14762
+ }
14763
+ if (it === "https://starknet-mainnet.g.alchemy.com/starknet/version/rpc/") {
14764
+ return `${it}${toApiVersion(rpcVersion)}/uYLxCteYbHTFJpKSoKdVm`;
14765
+ }
14760
14766
  return `${it}${toApiVersion(rpcVersion)}`;
14761
14767
  });
14762
14768
  });
@@ -16283,7 +16289,8 @@ ${indent}}` : "}";
16283
16289
  this.autoReconnect = options.autoReconnect ?? true;
16284
16290
  this.reconnectOptions = {
16285
16291
  retries: options.reconnectOptions?.retries ?? 5,
16286
- delay: options.reconnectOptions?.delay ?? 2e3
16292
+ delay: options.reconnectOptions?.delay ?? 2e3,
16293
+ exponential: options.reconnectOptions?.exponential ?? true
16287
16294
  };
16288
16295
  this.requestTimeout = options.requestTimeout ?? 6e4;
16289
16296
  this.WsImplementation = options.websocket || config.get("websocket") || ws_default;
@@ -16544,7 +16551,7 @@ ${indent}}` : "}";
16544
16551
  this.events.emit("open", new Event("open"));
16545
16552
  };
16546
16553
  this.websocket.onerror = () => {
16547
- const delay = this.reconnectOptions.delay * 2 ** (this.reconnectAttempts - 1);
16554
+ const delay = this.reconnectOptions.exponential ? this.reconnectOptions.delay * 2 ** (this.reconnectAttempts - 1) : this.reconnectOptions.delay;
16548
16555
  logger.info(`WebSocket: Reconnect attempt failed. Retrying in ${delay}ms.`);
16549
16556
  this.reconnectTimeoutId = setTimeout(tryReconnect, delay);
16550
16557
  };