starknet 11.10.4 → 11.10.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.10.5](https://github.com/starknet-io/starknet.js/compare/v11.10.4...v11.10.5) (2026-12-02)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **provider:** refuse a Block identifier that names no block ([#1775](https://github.com/starknet-io/starknet.js/issues/1775)) ([bd3556c](https://github.com/starknet-io/starknet.js/commit/bd3556ca9f972417ebc831ef0ccf30b62d6f157f))
6
+
1
7
  ## [11.10.4](https://github.com/starknet-io/starknet.js/compare/v11.10.3...v11.10.4) (2026-12-01)
2
8
 
3
9
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -18492,29 +18492,52 @@ declare function addAddressPadding(address: BigNumberish): string;
18492
18492
  */
18493
18493
  declare function validateAndParseAddress(address: BigNumberish): string;
18494
18494
  /**
18495
- * Convert an address to her checksum representation which uses a specific pattern of uppercase and lowercase letters within
18496
- * a given address to reduce the risk of errors introduced from typing an address or cut and paste issues.
18495
+ * Add a checksum to an address.
18496
+ * The checksum is the choice of the letters that are written in uppercase.
18497
+ * This choice depends on the address.
18498
+ * If one character is typed wrong, the uppercase letters do not match in most cases,
18499
+ * and {@link validateChecksumAddress} detects the error.
18500
+ *
18501
+ * A string is read as hexadecimal, with or without its `0x` prefix: `'31'` is 0x31.
18502
+ * This is the same rule as in {@link validateAndParseAddress}.
18497
18503
  * @param {BigNumberish} address
18498
- * @returns {string} Hex string : 0x followed by 64 characters. Mix of uppercase and lowercase
18504
+ * @returns {string} the address with its checksum: 0x, then 64 characters with the leading zeros.
18505
+ * @throws {Error} when the address is not a valid Starknet address (same checks as
18506
+ * {@link validateAndParseAddress})
18499
18507
  * @example
18500
18508
  * ```typescript
18501
18509
  * const address = "0x90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf";
18502
18510
  * const result = getChecksumAddress(address);
18503
18511
  * // result = "0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF"
18512
+ * // the same address without its 0x prefix gives the same result
18513
+ * const result2 = getChecksumAddress("90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf");
18514
+ * // result2 = "0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF"
18504
18515
  * ```
18505
18516
  */
18506
18517
  declare function getChecksumAddress(address: BigNumberish): string;
18507
18518
  /**
18508
- * If the casing of an address is mixed, it is a Checksum Address, which uses a specific pattern of uppercase and lowercase letters within
18509
- * a given address to reduce the risk of errors introduced from typing an address or cut and paste issues.
18510
- *
18511
- * @param address string
18512
- * @returns true if the ChecksumAddress is valid
18519
+ * Check that an address is written exactly as {@link getChecksumAddress} writes it:
18520
+ * 0x, then 64 characters with the leading zeros, and the uppercase letters of the checksum.
18521
+ *
18522
+ * For any other way to write the address, the result is false, even if the address is valid.
18523
+ * For example, the result is false for an address in lowercase, without its leading zeros,
18524
+ * or without its 0x prefix. The RPC specification writes addresses without their leading zeros.
18525
+ * In most cases, the result is also false when there is a typing error.
18526
+ * To only check that an address is valid, use {@link validateAndParseAddress}.
18527
+ * @param {string} address
18528
+ * @returns {boolean} true only if the address is written exactly with its checksum
18529
+ * @throws {Error} when the address is not a valid Starknet address (same checks as
18530
+ * {@link validateAndParseAddress})
18513
18531
  * @example
18514
18532
  * ```typescript
18515
- * const address = "0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF";
18516
- * const result = validateChecksumAddress(address);
18517
- * // result = true
18533
+ * const result1 = validateChecksumAddress("0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF");
18534
+ * // result1 = true
18535
+ * const result2 = validateChecksumAddress("0x90591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF");
18536
+ * // result2 = false, because the leading zeros are missing
18537
+ * const result3 = validateChecksumAddress("0x0000090591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf");
18538
+ * // result3 = false, because all the letters are in lowercase
18539
+ * validateChecksumAddress("test");
18540
+ * // throws Error("Invalid Address Format")
18518
18541
  * ```
18519
18542
  */
18520
18543
  declare function validateChecksumAddress(address: string): boolean;
@@ -18227,10 +18227,13 @@ ${indent}}` : "}";
18227
18227
  */
18228
18228
  tag = null;
18229
18229
  setIdentifier(__identifier) {
18230
+ this.hash = null;
18231
+ this.number = null;
18232
+ this.tag = null;
18230
18233
  if (isString(__identifier)) {
18231
- if (isDecimalString2(__identifier)) {
18234
+ if (__identifier !== "" && isDecimalString2(__identifier)) {
18232
18235
  this.number = parseInt(__identifier, 10);
18233
- } else if (isHex2(__identifier)) {
18236
+ } else if (isHex2(__identifier) && !isEmptyHex(__identifier)) {
18234
18237
  this.hash = __identifier;
18235
18238
  } else if (validBlockTags.includes(__identifier)) {
18236
18239
  this.tag = __identifier;
@@ -18247,6 +18250,11 @@ ${indent}}` : "}";
18247
18250
  if (isNumber2(this.number) && this.number < 0) {
18248
18251
  throw TypeError(`Block number (${this.number}) can't be negative`);
18249
18252
  }
18253
+ if (isNumber2(this.number) && !Number.isSafeInteger(this.number)) {
18254
+ throw TypeError(
18255
+ `Block number (${__identifier}) must be a whole number no larger than Number.MAX_SAFE_INTEGER`
18256
+ );
18257
+ }
18250
18258
  }
18251
18259
  /**
18252
18260
  * Create a Block instance