starknet 10.6.5 → 10.6.6

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,9 @@
1
+ ## [10.6.6](https://github.com/starknet-io/starknet.js/compare/v10.6.5...v10.6.6) (2026-08-05)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **ws:** reject queued requests instead of hanging ([82ced97](https://github.com/starknet-io/starknet.js/commit/82ced97dc6dc409131bc5650db076efedf467101))
6
+
1
7
  ## [10.6.5](https://github.com/starknet-io/starknet.js/compare/v10.6.4...v10.6.5) (2026-08-05)
2
8
 
3
9
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -5243,6 +5243,16 @@ declare class WebSocketChannel {
5243
5243
  */
5244
5244
  reconnect(): void;
5245
5245
  private _processRequestQueue;
5246
+ /**
5247
+ * Reject every request still waiting in the queue.
5248
+ *
5249
+ * A queued request carries no timeout of its own: the `requestTimeout` timer is only
5250
+ * armed once the request is actually put on the wire. So once the channel reaches a state
5251
+ * where the queue can never be flushed — reconnection gave up, or the user closed the
5252
+ * connection — the queued promises would stay pending forever, and no caller-side timeout
5253
+ * could rescue them. Settling them here is the only way out.
5254
+ */
5255
+ private _rejectRequestQueue;
5246
5256
  private _restoreSubscriptions;
5247
5257
  /**
5248
5258
  * Reset the reconnection attempt counter, but only once the current connection has
@@ -12803,6 +12803,8 @@ ${indent}}` : "}";
12803
12803
  this.reconnectStabilityTimeoutId = null;
12804
12804
  }
12805
12805
  this.userInitiatedClose = true;
12806
+ this.isReconnecting = false;
12807
+ this._rejectRequestQueue("the connection was closed by the user");
12806
12808
  this.websocket.close(code, reason);
12807
12809
  }
12808
12810
  /**
@@ -12876,6 +12878,24 @@ ${indent}}` : "}";
12876
12878
  this.sendReceive(method, params).then(resolve).catch(reject);
12877
12879
  });
12878
12880
  }
12881
+ /**
12882
+ * Reject every request still waiting in the queue.
12883
+ *
12884
+ * A queued request carries no timeout of its own: the `requestTimeout` timer is only
12885
+ * armed once the request is actually put on the wire. So once the channel reaches a state
12886
+ * where the queue can never be flushed — reconnection gave up, or the user closed the
12887
+ * connection — the queued promises would stay pending forever, and no caller-side timeout
12888
+ * could rescue them. Settling them here is the only way out.
12889
+ */
12890
+ _rejectRequestQueue(reason) {
12891
+ if (this.requestQueue.length === 0) return;
12892
+ const pending = this.requestQueue;
12893
+ this.requestQueue = [];
12894
+ logger.info(`WebSocket: Rejecting ${pending.length} queued request(s). Reason: ${reason}.`);
12895
+ pending.forEach(({ method, reject }) => {
12896
+ reject(new WebSocketNotConnectedError(`Request ${method} was never sent: ${reason}`));
12897
+ });
12898
+ }
12879
12899
  async _restoreSubscriptions() {
12880
12900
  const oldSubscriptions = Array.from(this.activeSubscriptions.values());
12881
12901
  this.activeSubscriptions.clear();
@@ -12919,6 +12939,9 @@ ${indent}}` : "}";
12919
12939
  if (this.reconnectAttempts >= this.reconnectOptions.retries) {
12920
12940
  logger.error("WebSocket: Maximum reconnection retries reached. Giving up.");
12921
12941
  this.isReconnecting = false;
12942
+ this._rejectRequestQueue(
12943
+ `reconnection gave up after ${this.reconnectOptions.retries} attempts`
12944
+ );
12922
12945
  return;
12923
12946
  }
12924
12947
  this.reconnectAttempts += 1;