starknet 11.0.0-beta.4 → 11.0.0-beta.5

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
+ # [11.0.0-beta.5](https://github.com/starknet-io/starknet.js/compare/v11.0.0-beta.4...v11.0.0-beta.5) (2026-08-24)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **calldata:** long string chunks stay text, at any ABI depth ([06638d9](https://github.com/starknet-io/starknet.js/commit/06638d9b7317caf3e20087c9f92a05a499157213))
6
+
1
7
  # [11.0.0-beta.4](https://github.com/starknet-io/starknet.js/compare/v11.0.0-beta.3...v11.0.0-beta.4) (2026-08-21)
2
8
 
3
9
  ### Bug Fixes
@@ -8915,6 +8915,16 @@ ${indent}}` : "}";
8915
8915
  }
8916
8916
 
8917
8917
  // src/utils/calldata/requestParser.ts
8918
+ function acceptsLongString(type) {
8919
+ return isTypeArray(type) && isTypeFelt(getArrayType(type));
8920
+ }
8921
+ function longStringToFeltArray(longStr) {
8922
+ return splitLongString(longStr).map((chunk) => addHexPrefix(buf2hex(utf8ToUint8Array(chunk))));
8923
+ }
8924
+ function arrayInputErrorMessage(subject, type, value) {
8925
+ const expected = acceptsLongString(type) ? "array or long string" : "array";
8926
+ return `ABI expected ${subject} to be ${expected}, got ${value}`;
8927
+ }
8918
8928
  function parseBaseTypes({
8919
8929
  type,
8920
8930
  val,
@@ -9010,6 +9020,18 @@ ${indent}}` : "}";
9010
9020
  );
9011
9021
  }, []);
9012
9022
  }
9023
+ if (isTypeArray(type) && !Array.isArray(element)) {
9024
+ if (!acceptsLongString(type) || !isText(element)) {
9025
+ throw Error(arrayInputErrorMessage(`type ${type}`, type, element));
9026
+ }
9027
+ return parseCalldataValue({
9028
+ element: longStringToFeltArray(element),
9029
+ type,
9030
+ structs,
9031
+ enums,
9032
+ parser
9033
+ });
9034
+ }
9013
9035
  if (Array.isArray(element)) {
9014
9036
  const result = [];
9015
9037
  result.push(felt(element.length));
@@ -9169,7 +9191,7 @@ ${indent}}` : "}";
9169
9191
  parser
9170
9192
  }) {
9171
9193
  const { name, type } = input;
9172
- let { value } = argsIterator.next();
9194
+ const { value } = argsIterator.next();
9173
9195
  switch (true) {
9174
9196
  // Fixed array
9175
9197
  case CairoFixedArray.isTypeFixedArray(type):
@@ -9179,11 +9201,8 @@ ${indent}}` : "}";
9179
9201
  return parseCalldataValue({ element: value, type: input.type, structs, enums, parser });
9180
9202
  // Normal Array
9181
9203
  case isTypeArray(type):
9182
- if (!Array.isArray(value) && !isText(value)) {
9183
- throw Error(`ABI expected parameter ${name} to be array or long string, got ${value}`);
9184
- }
9185
- if (isString(value)) {
9186
- value = splitLongString(value);
9204
+ if (!Array.isArray(value) && !(acceptsLongString(type) && isText(value))) {
9205
+ throw Error(arrayInputErrorMessage(`parameter ${name}`, type, value));
9187
9206
  }
9188
9207
  return parseCalldataValue({ element: value, type: input.type, structs, enums, parser });
9189
9208
  case isTypeNonZero(type):