starknet 10.3.1 → 10.3.3

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,15 @@
1
+ ## [10.3.3](https://github.com/starknet-io/starknet.js/compare/v10.3.2...v10.3.3) (2026-06-30)
2
+
3
+ ### Bug Fixes
4
+
5
+ - restore consistency of .toApiRequest() output type ([71c5d90](https://github.com/starknet-io/starknet.js/commit/71c5d90b740648bfa57b388938414dc1f50a9a08))
6
+
7
+ ## [10.3.2](https://github.com/starknet-io/starknet.js/compare/v10.3.1...v10.3.2) (2026-06-16)
8
+
9
+ ### Bug Fixes
10
+
11
+ - surface clear error instead of crashing on empty node reply ([678ca1d](https://github.com/starknet-io/starknet.js/commit/678ca1db2b0f055708b03363688bddf75858a5e4))
12
+
1
13
  ## [10.3.1](https://github.com/starknet-io/starknet.js/compare/v10.3.0...v10.3.1) (2026-06-15)
2
14
 
3
15
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -1150,7 +1150,7 @@ declare abstract class ProviderInterface {
1150
1150
  * // Equivalent to:
1151
1151
  * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: ETransactionType.INVOKE, ...invocation, ...details }], options);
1152
1152
  * ```
1153
- * @alias getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction
1153
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
1154
1154
  */
1155
1155
  abstract getInvokeEstimateFee(invocation: Invocation, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponseOverhead>;
1156
1156
  /**
@@ -1174,7 +1174,7 @@ declare abstract class ProviderInterface {
1174
1174
  * // Equivalent to:
1175
1175
  * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: ETransactionType.DECLARE, ...transaction, ...details }], options);
1176
1176
  * ```
1177
- * @alias getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction
1177
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
1178
1178
  */
1179
1179
  abstract getDeclareEstimateFee(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponseOverhead>;
1180
1180
  /**
@@ -1199,7 +1199,7 @@ declare abstract class ProviderInterface {
1199
1199
  * // Equivalent to:
1200
1200
  * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: ETransactionType.DEPLOY_ACCOUNT, ...transaction, ...details }], options);
1201
1201
  * ```
1202
- * @alias getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction
1202
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
1203
1203
  */
1204
1204
  abstract getDeployAccountEstimateFee(transaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponseOverhead>;
1205
1205
  /**
@@ -1420,7 +1420,7 @@ declare abstract class ProviderInterface {
1420
1420
  * @param {Signature} signature signature of the message.
1421
1421
  * @param {BigNumberish} accountAddress address of the account that has signed the message.
1422
1422
  * @param {string} [signatureVerificationFunctionName] if account contract with non standard account verification function name.
1423
- * @param { okResponse: string[]; nokResponse: string[]; error: string[] } [signatureVerificationResponse] if account contract with non standard response of verification function.
1423
+ * @param [signatureVerificationResponse] if account contract with non standard response of verification function.
1424
1424
  * @returns
1425
1425
  * ```typescript
1426
1426
  * const myTypedMessage: TypedMessage = .... ;
@@ -3612,7 +3612,7 @@ type ParsedEvents = Array<ParsedEvent> & {
3612
3612
  };
3613
3613
  /**
3614
3614
  * Advance formatting used to get js types data as result
3615
- * @description https://starknet-io.github.io/starknet.js/docs/guides/define_call_message/#formatresponse
3615
+ * @see https://starknet-io.github.io/starknet.js/docs/guides/define_call_message/#formatresponse
3616
3616
  * @example
3617
3617
  * ```typescript
3618
3618
  * // assign custom or existing method to resulting data
@@ -9850,10 +9850,6 @@ declare namespace byteArray {
9850
9850
  /**
9851
9851
  * Parse one field of the calldata by using input field from the abi for that method
9852
9852
  *
9853
- * @param argsIterator - Iterator for value of the field
9854
- * @param input - input(field) information from the abi that will be used to parse the data
9855
- * @param structs - structs from abi
9856
- * @param enums - enums from abi
9857
9853
  * @return {string | string[]} - parsed arguments in format that contract is expecting
9858
9854
  *
9859
9855
  * @example
@@ -9899,10 +9895,15 @@ declare namespace byteArray {
9899
9895
  * // parsedField === ['1952805748']
9900
9896
  */
9901
9897
  declare function parseCalldataField({ argsIterator, input, structs, enums, parser, }: {
9898
+ /** Iterator for value of the field */
9902
9899
  argsIterator: Iterator<any>;
9900
+ /** input(field) information from the abi that will be used to parse the data */
9903
9901
  input: AbiEntry;
9902
+ /** structs from abi */
9904
9903
  structs: AbiStructs;
9904
+ /** enums from abi */
9905
9905
  enums: AbiEnums;
9906
+ /** parser used to serialize the value */
9906
9907
  parser: AbiParserInterface;
9907
9908
  }): string | string[];
9908
9909
 
@@ -10025,7 +10026,7 @@ declare function isFileSystemAvailable(): boolean;
10025
10026
  * - Can accept a single .sierra.json or .casm file, or multiple files
10026
10027
  * - If compiledClassHash is provided: .casm file is optional
10027
10028
  *
10028
- * @param {string | File | File[]} input - Path (Node.js) or File/File[] (browser)
10029
+ * @param {string | File | File[]} contractPath - Path (Node.js) or File/File[] (browser)
10029
10030
  * @param {string} [compiledClassHash] - Optional compiled class hash. If provided, .casm file becomes optional
10030
10031
  * @return {LoadedContract | Promise<LoadedContract>} - Contract data (sync in Node.js, async in browser)
10031
10032
  * @throws {Error} - If no .sierra.json file is found, or if .casm is missing when compiledClassHash is not provided
@@ -5591,7 +5591,7 @@ ${indent}}` : "}";
5591
5591
  return addHexPrefix(this.toBigInt().toString(16));
5592
5592
  }
5593
5593
  toApiRequest() {
5594
- return addCompiledFlag([this.toHexString()]);
5594
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
5595
5595
  }
5596
5596
  static assertRange(val) {
5597
5597
  assert(val >= 0n && val < PRIME, `Value ${val} is out of felt252 range [0, ${PRIME})`);
@@ -6221,7 +6221,7 @@ ${indent}}` : "}";
6221
6221
  throw new Error("Invalid input type for CairoBytes31. Expected string, Buffer, or Uint8Array");
6222
6222
  }
6223
6223
  toApiRequest() {
6224
- return addCompiledFlag([this.toHexString()]);
6224
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
6225
6225
  }
6226
6226
  toBigInt() {
6227
6227
  return uint8ArrayToBigInt(this.data);
@@ -6424,7 +6424,7 @@ ${indent}}` : "}";
6424
6424
  return BigInt(data);
6425
6425
  }
6426
6426
  toApiRequest() {
6427
- return addCompiledFlag([this.toHexString()]);
6427
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
6428
6428
  }
6429
6429
  toBigInt() {
6430
6430
  return this.data;
@@ -6544,7 +6544,7 @@ ${indent}}` : "}";
6544
6544
  toApiRequest() {
6545
6545
  this.assertInitialized();
6546
6546
  return addCompiledFlag([
6547
- addHexPrefix(this.data.length.toString(16)),
6547
+ this.data.length.toString(),
6548
6548
  ...this.data.flatMap((bytes31) => bytes31.toApiRequest()),
6549
6549
  ...this.pending_word.toApiRequest(),
6550
6550
  ...this.pending_word_len.toApiRequest()
@@ -6697,7 +6697,7 @@ ${indent}}` : "}";
6697
6697
  return BigInt(data);
6698
6698
  }
6699
6699
  toApiRequest() {
6700
- return addCompiledFlag([this.toHexString()]);
6700
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
6701
6701
  }
6702
6702
  toBigInt() {
6703
6703
  return this.data;
@@ -6755,7 +6755,7 @@ ${indent}}` : "}";
6755
6755
  return BigInt(data);
6756
6756
  }
6757
6757
  toApiRequest() {
6758
- return addCompiledFlag([this.toHexString()]);
6758
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
6759
6759
  }
6760
6760
  toBigInt() {
6761
6761
  return this.data;
@@ -6813,7 +6813,7 @@ ${indent}}` : "}";
6813
6813
  return BigInt(data);
6814
6814
  }
6815
6815
  toApiRequest() {
6816
- return addCompiledFlag([this.toHexString()]);
6816
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
6817
6817
  }
6818
6818
  toBigInt() {
6819
6819
  return this.data;
@@ -6871,7 +6871,7 @@ ${indent}}` : "}";
6871
6871
  return BigInt(data);
6872
6872
  }
6873
6873
  toApiRequest() {
6874
- return addCompiledFlag([this.toHexString()]);
6874
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
6875
6875
  }
6876
6876
  toBigInt() {
6877
6877
  return this.data;
@@ -6929,7 +6929,7 @@ ${indent}}` : "}";
6929
6929
  return BigInt(data);
6930
6930
  }
6931
6931
  toApiRequest() {
6932
- return addCompiledFlag([this.toHexString()]);
6932
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
6933
6933
  }
6934
6934
  toBigInt() {
6935
6935
  return this.data;
@@ -6987,7 +6987,7 @@ ${indent}}` : "}";
6987
6987
  return BigInt(data);
6988
6988
  }
6989
6989
  toApiRequest() {
6990
- return addCompiledFlag([this.toHexString()]);
6990
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
6991
6991
  }
6992
6992
  toBigInt() {
6993
6993
  return this.data;
@@ -7059,7 +7059,7 @@ ${indent}}` : "}";
7059
7059
  return BigInt(data);
7060
7060
  }
7061
7061
  toApiRequest() {
7062
- return addCompiledFlag([this.toHexString()]);
7062
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
7063
7063
  }
7064
7064
  toBigInt() {
7065
7065
  return this.data;
@@ -7131,7 +7131,7 @@ ${indent}}` : "}";
7131
7131
  return BigInt(data);
7132
7132
  }
7133
7133
  toApiRequest() {
7134
- return addCompiledFlag([this.toHexString()]);
7134
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
7135
7135
  }
7136
7136
  toBigInt() {
7137
7137
  return this.data;
@@ -7203,7 +7203,7 @@ ${indent}}` : "}";
7203
7203
  return BigInt(data);
7204
7204
  }
7205
7205
  toApiRequest() {
7206
- return addCompiledFlag([this.toHexString()]);
7206
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
7207
7207
  }
7208
7208
  toBigInt() {
7209
7209
  return this.data;
@@ -7275,7 +7275,7 @@ ${indent}}` : "}";
7275
7275
  return BigInt(data);
7276
7276
  }
7277
7277
  toApiRequest() {
7278
- return addCompiledFlag([this.toHexString()]);
7278
+ return addCompiledFlag([BigInt(this.toHexString()).toString()]);
7279
7279
  }
7280
7280
  toBigInt() {
7281
7281
  return this.data;
@@ -7439,7 +7439,7 @@ ${indent}}` : "}";
7439
7439
  return new CairoByteArray(val).toApiRequest();
7440
7440
  },
7441
7441
  [CairoFelt252.abiSelector]: (val) => {
7442
- return felt(val);
7442
+ return new CairoFelt252(val).toApiRequest();
7443
7443
  },
7444
7444
  [CairoUint256.abiSelector]: (val) => {
7445
7445
  return new CairoUint256(val).toApiRequest();
@@ -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);