starknet 10.3.1 → 10.3.2

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.3.2](https://github.com/starknet-io/starknet.js/compare/v10.3.1...v10.3.2) (2026-06-16)
2
+
3
+ ### Bug Fixes
4
+
5
+ - surface clear error instead of crashing on empty node reply ([678ca1d](https://github.com/starknet-io/starknet.js/commit/678ca1db2b0f055708b03363688bddf75858a5e4))
6
+
1
7
  ## [10.3.1](https://github.com/starknet-io/starknet.js/compare/v10.3.0...v10.3.1) (2026-06-15)
2
8
 
3
9
  ### Bug Fixes
@@ -11277,18 +11277,20 @@ ${indent}}` : "}";
11277
11277
  }
11278
11278
  async fetchEndpoint(method, params) {
11279
11279
  try {
11280
+ let error;
11281
+ let result;
11280
11282
  if (this.batchClient) {
11281
- const { error: error2, result: result2 } = await this.batchClient.fetch(
11282
- method,
11283
- params,
11284
- this.requestId += 1
11285
- );
11286
- this.errorHandler(method, params, error2);
11287
- return result2;
11283
+ ({ error, result } = await this.batchClient.fetch(method, params, this.requestId += 1));
11284
+ } else {
11285
+ const rawResult = await this.fetch(method, params, this.requestId += 1);
11286
+ ({ error, result } = await rawResult.json());
11288
11287
  }
11289
- const rawResult = await this.fetch(method, params, this.requestId += 1);
11290
- const { error, result } = await rawResult.json();
11291
11288
  this.errorHandler(method, params, error);
11289
+ if (result === void 0) {
11290
+ throw new LibraryError(
11291
+ `RPC: '${method}' returned an empty response (no result and no error). The node reply is malformed or not a valid JSON-RPC response.`
11292
+ );
11293
+ }
11292
11294
  return result;
11293
11295
  } catch (error) {
11294
11296
  this.errorHandler(method, params, error?.response?.data, error);
@@ -11916,18 +11918,20 @@ ${indent}}` : "}";
11916
11918
  }
11917
11919
  async fetchEndpoint(method, params) {
11918
11920
  try {
11921
+ let error;
11922
+ let result;
11919
11923
  if (this.batchClient) {
11920
- const { error: error2, result: result2 } = await this.batchClient.fetch(
11921
- method,
11922
- params,
11923
- this.requestId += 1
11924
- );
11925
- this.errorHandler(method, params, error2);
11926
- return result2;
11924
+ ({ error, result } = await this.batchClient.fetch(method, params, this.requestId += 1));
11925
+ } else {
11926
+ const rawResult = await this.fetch(method, params, this.requestId += 1);
11927
+ ({ error, result } = await rawResult.json());
11927
11928
  }
11928
- const rawResult = await this.fetch(method, params, this.requestId += 1);
11929
- const { error, result } = await rawResult.json();
11930
11929
  this.errorHandler(method, params, error);
11930
+ if (result === void 0) {
11931
+ throw new LibraryError(
11932
+ `RPC: '${method}' returned an empty response (no result and no error). The node reply is malformed or not a valid JSON-RPC response.`
11933
+ );
11934
+ }
11931
11935
  return result;
11932
11936
  } catch (error) {
11933
11937
  this.errorHandler(method, params, error?.response?.data, error);