starknet 11.0.0-beta.7 → 11.0.0-beta.8

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,17 @@
1
+ # [11.0.0-beta.8](https://github.com/starknet-io/starknet.js/compare/v11.0.0-beta.7...v11.0.0-beta.8) (2026-08-27)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **starknetId:** accept bigAlphabet characters in isStarkDomain ([f508984](https://github.com/starknet-io/starknet.js/commit/f5089848f4b4bf526cc814f20fef1918bc67879f)), closes [#1668](https://github.com/starknet-io/starknet.js/issues/1668)
6
+ - **starknetId:** reject names the encoder cannot represent ([76fe9b1](https://github.com/starknet-io/starknet.js/commit/76fe9b1df174d295374417a018e425ee652258c8)), closes [#1668](https://github.com/starknet-io/starknet.js/issues/1668)
7
+
8
+ ### BREAKING CHANGES
9
+
10
+ - **starknetId:** `useEncoded` throws on any character outside the Starknet.id alphabets
11
+ instead of silently ignoring it, and `encodeBrotherDomain`, which calls it with no guard,
12
+ throws on the same input. `isStarkDomain` also rejects labels whose encoding overflows the
13
+ field, including every 48-character label it used to accept.
14
+
1
15
  # [11.0.0-beta.7](https://github.com/starknet-io/starknet.js/compare/v11.0.0-beta.6...v11.0.0-beta.7) (2026-08-26)
2
16
 
3
17
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -9401,14 +9401,22 @@ declare namespace typedData {
9401
9401
  */
9402
9402
  declare function useDecoded(encoded: bigint[]): string;
9403
9403
  /**
9404
- * Encodes a string into a bigint value.
9404
+ * Encodes a single Starknet.id label into a bigint value.
9405
9405
  *
9406
- * @param {string} decoded The string to be encoded.
9406
+ * Only the characters of the Starknet.id alphabets are accepted: `a-z`, `0-9`, `-` and the two
9407
+ * `bigAlphabet` characters. Any other character throws, so a mistyped name can never be silently
9408
+ * encoded as a different, existing one.
9409
+ *
9410
+ * @param {string} decoded The label to be encoded, without any `.` separator nor `.stark` suffix.
9407
9411
  * @returns {bigint} The encoded bigint value.
9412
+ * @throws {Error} If the label holds a character outside the Starknet.id alphabets.
9408
9413
  * @example
9409
9414
  * ```typescript
9410
- * const result = starknetId.useEncoded("starknet.js");
9415
+ * const result = starknetId.useEncoded("starknetjs");
9411
9416
  * // result = 3015206943634620n
9417
+ *
9418
+ * starknetId.useEncoded("Starknetjs");
9419
+ * // throws an Error: the uppercase "S" is not a Starknet.id character
9412
9420
  * ```
9413
9421
  */
9414
9422
  declare function useEncoded(decoded: string): bigint;
@@ -15800,6 +15800,10 @@ ${indent}}` : "}";
15800
15800
  const newid = (i === decoded.length - 1 ? 1 : 0) + bigAlphabet.indexOf(char);
15801
15801
  encoded += multiplier * BigInt(newid);
15802
15802
  multiplier *= bigAlphabetSize;
15803
+ } else {
15804
+ throw new Error(
15805
+ `Invalid character "${char}" in a Starknet.id name: allowed characters are "${basicAlphabet}" and "${bigAlphabet}"`
15806
+ );
15803
15807
  }
15804
15808
  }
15805
15809
  return encoded;
@@ -15919,9 +15923,14 @@ ${indent}}` : "}";
15919
15923
  return false;
15920
15924
  }
15921
15925
  return name.split(".").every((label) => {
15922
- return label.length > 0 && label.length <= 48 && [...label].every((char) => {
15923
- return char >= "a" && char <= "z" || char >= "0" && char <= "9" || char === "-";
15924
- });
15926
+ if (label.length === 0 || label.length > 48) {
15927
+ return false;
15928
+ }
15929
+ try {
15930
+ return useEncoded(label) < PRIME;
15931
+ } catch {
15932
+ return false;
15933
+ }
15925
15934
  });
15926
15935
  }
15927
15936