starknet 11.10.4 → 11.10.6

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
+ ## [11.10.6](https://github.com/starknet-io/starknet.js/compare/v11.10.5...v11.10.6) (2026-12-02)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **provider:** make Block read-only and throw an Error for an identifier that names no block ([cbf39cb](https://github.com/starknet-io/starknet.js/commit/cbf39cb714775f05b96c833836567689fc8ee43a))
6
+
7
+ ## [11.10.5](https://github.com/starknet-io/starknet.js/compare/v11.10.4...v11.10.5) (2026-12-02)
8
+
9
+ ### Bug Fixes
10
+
11
+ - **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))
12
+
1
13
  ## [11.10.4](https://github.com/starknet-io/starknet.js/compare/v11.10.3...v11.10.4) (2026-12-01)
2
14
 
3
15
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as RPCSPEC0105 from '@starknet-io/starknet-types-0105';
2
- import { PAYMASTER_API, CONTRACT, ETransactionType, EDataAvailabilityMode as EDataAvailabilityMode$1, SUBSCRIPTION_BLOCK_ID, TypedData, CONTRACT_STORAGE_KEYS, StorageProof, CASM_COMPILED_CONTRACT_CLASS, OutsideExecutionTypedData, IsSucceeded, TransactionReceipt as TransactionReceipt$1, IsReverted, BLOCK_WITH_TX_HASHES, PRE_CONFIRMED_BLOCK_WITH_TX_HASHES, IsType, ETransactionVersion3 as ETransactionVersion3$1, SUBSCRIPTION_ID, NewHeadsEvent, TXN_FINALITY_STATUS, STATUS_ACCEPTED_ON_L1, StarknetEventsEvent, TransactionsStatusEvent, NewTransactionReceiptsEvent, TXN_STATUS_WITHOUT_L1, NewTransactionEvent, TransactionHash, BlockHash, FAILED_TO_RECEIVE_TXN, NO_TRACE_AVAILABLE, CONTRACT_NOT_FOUND, ENTRYPOINT_NOT_FOUND, BLOCK_NOT_FOUND, INVALID_TXN_INDEX, CLASS_HASH_NOT_FOUND, TXN_HASH_NOT_FOUND, PAGE_SIZE_TOO_BIG, NO_BLOCKS, INVALID_CONTINUATION_TOKEN, TOO_MANY_KEYS_IN_FILTER, CONTRACT_ERROR, TRANSACTION_EXECUTION_ERROR, STORAGE_PROOF_NOT_SUPPORTED, CLASS_ALREADY_DECLARED, INVALID_TRANSACTION_NONCE, INSUFFICIENT_RESOURCES_FOR_VALIDATE, INSUFFICIENT_ACCOUNT_BALANCE, VALIDATION_FAILURE, COMPILATION_FAILED, CONTRACT_CLASS_SIZE_IS_TOO_LARGE, NON_ACCOUNT, DUPLICATE_TX, COMPILED_CLASS_HASH_MISMATCH, UNSUPPORTED_TX_VERSION, UNSUPPORTED_CONTRACT_CLASS_VERSION, UNEXPECTED_ERROR, REPLACEMENT_TRANSACTION_UNDERPRICED, FEE_BELOW_MINIMUM, INVALID_SUBSCRIPTION_ID, TOO_MANY_ADDRESSES_IN_FILTER, TOO_MANY_BLOCKS_BACK, COMPILATION_ERROR, ETransactionVersion as ETransactionVersion$1, STORAGE_RESULT, INVOKE_TXN_V3, StarknetWindowObject, AccountChangeEventHandler, NetworkChangeEventHandler, WatchAssetParameters, AddStarknetChainParameters, Signature as Signature$1, STRK20_REGISTER_ACTION, STRK20_DEPOSIT_ACTION, STRK20_WITHDRAW_ACTION, STRK20_TRANSFER_ACTION, STRK20_INVOKE_ACTION, STRK20_SHADOW_ACCOUNT_INVOKE_ACTION as STRK20_SHADOW_ACCOUNT_INVOKE_ACTION$1, STRK20_CALL_AND_PROOF as STRK20_CALL_AND_PROOF$1, STRK20_PROOF, Address, STRK20_BALANCE_ENTRY, STRK20_DAPP_NAME, FELT as FELT$1, EDAMode as EDAMode$1, TypedDataRevision, StarknetType, StarknetMerkleType, OutsideCallV1, OutsideCallV2, Event as Event$2, EmittedEvent as EmittedEvent$1, AddDeclareTransactionParameters, AddDeclareTransactionResult, AddInvokeTransactionParameters, AddInvokeTransactionResult, AccountDeploymentData, Permission, ChainId, SpecVersion, API_VERSION as API_VERSION$1, STRK20_ACTION as STRK20_ACTION$1 } from '@starknet-io/starknet-types-0105';
2
+ import { PAYMASTER_API, CONTRACT, ETransactionType, EDataAvailabilityMode as EDataAvailabilityMode$1, SUBSCRIPTION_BLOCK_ID, TypedData, CONTRACT_STORAGE_KEYS, StorageProof, CASM_COMPILED_CONTRACT_CLASS, OutsideExecutionTypedData, IsSucceeded, TransactionReceipt as TransactionReceipt$1, IsReverted, BLOCK_WITH_TX_HASHES, PRE_CONFIRMED_BLOCK_WITH_TX_HASHES, IsType, ETransactionVersion3 as ETransactionVersion3$1, SUBSCRIPTION_ID, NewHeadsEvent, TXN_FINALITY_STATUS, STATUS_ACCEPTED_ON_L1, StarknetEventsEvent, TransactionsStatusEvent, NewTransactionReceiptsEvent, TXN_STATUS_WITHOUT_L1, NewTransactionEvent, TransactionHash, BlockHash, FAILED_TO_RECEIVE_TXN, NO_TRACE_AVAILABLE, CONTRACT_NOT_FOUND, ENTRYPOINT_NOT_FOUND, BLOCK_NOT_FOUND, INVALID_TXN_INDEX, CLASS_HASH_NOT_FOUND, TXN_HASH_NOT_FOUND, PAGE_SIZE_TOO_BIG, NO_BLOCKS, INVALID_CONTINUATION_TOKEN, TOO_MANY_KEYS_IN_FILTER, CONTRACT_ERROR, TRANSACTION_EXECUTION_ERROR, STORAGE_PROOF_NOT_SUPPORTED, CLASS_ALREADY_DECLARED, INVALID_TRANSACTION_NONCE, INSUFFICIENT_RESOURCES_FOR_VALIDATE, INSUFFICIENT_ACCOUNT_BALANCE, VALIDATION_FAILURE, COMPILATION_FAILED, CONTRACT_CLASS_SIZE_IS_TOO_LARGE, NON_ACCOUNT, DUPLICATE_TX, COMPILED_CLASS_HASH_MISMATCH, UNSUPPORTED_TX_VERSION, UNSUPPORTED_CONTRACT_CLASS_VERSION, UNEXPECTED_ERROR, REPLACEMENT_TRANSACTION_UNDERPRICED, FEE_BELOW_MINIMUM, INVALID_SUBSCRIPTION_ID, TOO_MANY_ADDRESSES_IN_FILTER, TOO_MANY_BLOCKS_BACK, COMPILATION_ERROR, ETransactionVersion as ETransactionVersion$1, STORAGE_RESULT, INVOKE_TXN_V3, StarknetWindowObject, AccountChangeEventHandler, NetworkChangeEventHandler, WatchAssetParameters, AddStarknetChainParameters, Signature as Signature$1, STRK20_REGISTER_ACTION, STRK20_DEPOSIT_ACTION, STRK20_WITHDRAW_ACTION, STRK20_TRANSFER_ACTION, STRK20_INVOKE_ACTION, STRK20_SHADOW_ACCOUNT_INVOKE_ACTION as STRK20_SHADOW_ACCOUNT_INVOKE_ACTION$1, STRK20_CALL_AND_PROOF as STRK20_CALL_AND_PROOF$1, STRK20_PROOF, Address, STRK20_BALANCE_ENTRY, STRK20_DAPP_NAME, FELT as FELT$1, EDAMode as EDAMode$1, TypedDataRevision, StarknetType, StarknetMerkleType, OutsideCallV1, OutsideCallV2, BLOCK_ID, Event as Event$2, EmittedEvent as EmittedEvent$1, AddDeclareTransactionParameters, AddDeclareTransactionResult, AddInvokeTransactionParameters, AddInvokeTransactionResult, AccountDeploymentData, Permission, ChainId, SpecVersion, API_VERSION as API_VERSION$1, STRK20_ACTION as STRK20_ACTION$1 } from '@starknet-io/starknet-types-0105';
3
3
  export { STRK20_BALANCE_ENTRY, STRK20_CALLDATA_ITEM, STRK20_CALLDATA_PLACEHOLDER, STRK20_COLLECT_POLICY, STRK20_DAPP_NAME, STRK20_DEPOSIT_ACTION, STRK20_INVOKE_ACTION, STRK20_PROOF, STRK20_REGISTER_ACTION, STRK20_TRANSFER_ACTION, STRK20_WITHDRAW_ACTION, StarknetDomain, StarknetEnumType, StarknetMerkleType, StarknetType, TypedData, TypedDataRevision } from '@starknet-io/starknet-types-0105';
4
4
  import * as RPC$1 from '@starknet-io/starknet-types-0101';
5
5
  import { WatchAssetParameters as WatchAssetParameters$1, AddStarknetChainParameters as AddStarknetChainParameters$1, Signature as Signature$2, AddDeclareTransactionParameters as AddDeclareTransactionParameters$1, AddDeclareTransactionResult as AddDeclareTransactionResult$1, AddInvokeTransactionParameters as AddInvokeTransactionParameters$1, AddInvokeTransactionResult as AddInvokeTransactionResult$1, AccountDeploymentData as AccountDeploymentData$1, Permission as Permission$1, Address as Address$1, ChainId as ChainId$1, TypedData as TypedData$1, SpecVersion as SpecVersion$1, API_VERSION as API_VERSION$2 } from '@starknet-io/starknet-types-0101';
@@ -14130,74 +14130,57 @@ declare function getDefaultNodes(rpcVersion: _SupportedRpcVersion): {
14130
14130
  declare function getSupportedRpcVersions(): _SupportedRpcVersion[];
14131
14131
  declare const validBlockTags: ("latest" | "pre_confirmed" | "l1_accepted")[];
14132
14132
  /**
14133
- * This class is formatting the identifier of a block.
14133
+ * A Block reads the identifier of a block, and gives it in the form that an RPC request expects.
14134
14134
  *
14135
- * hex string and BigInt are detected as block hashes. identifier return { block_hash: hash }
14135
+ * - A number, or a string of digits, is a block number. `identifier` returns `{ block_number: 631581 }`.
14136
+ * - A hex string or a bigint is a block hash. A block hash is a felt. `identifier` returns
14137
+ * `{ block_hash: '0x…' }`, with a lowercase `0x` and without leading zeros, as the RPC
14138
+ * specification asks.
14139
+ * - A block tag (`'latest'`, `'pre_confirmed'` or `'l1_accepted'`) stays a tag. `identifier` returns it.
14140
+ * - `null` and `undefined` mean `'latest'`.
14136
14141
  *
14137
- * decimal string and number are detected as block numbers. identifier return { block_number: number }
14138
- *
14139
- * text string are detected as block tag. identifier return tag
14140
- *
14141
- * null is detected as 'latest' block tag. identifier return 'latest'
14142
+ * A Block cannot be changed after its creation. For another block, create a new Block.
14142
14143
  * @example
14143
14144
  * ```typescript
14144
- * const result = new provider.Block(null).identifier;
14145
- * // result = "latest"
14145
+ * const result = new provider.Block('631581').identifier;
14146
+ * // result = { block_number: 631581 }
14146
14147
  * ```
14147
14148
  */
14148
14149
  declare class Block {
14150
+ /** It holds the block hash when the block is given by its hash. Otherwise, it is null. */
14151
+ readonly hash: string | null;
14152
+ /** It holds the block number when the block is given by its number. Otherwise, it is null. */
14153
+ readonly number: number | null;
14154
+ /** It holds the block tag when the block is given by a tag. Otherwise, it is null. */
14155
+ readonly tag: BlockTag | null;
14149
14156
  /**
14150
- * @param {BlockIdentifier} hash if not null, contains the block hash
14151
- */
14152
- hash: BlockIdentifier;
14153
- /**
14154
- * @param {BlockIdentifier} number if not null, contains the block number
14155
- */
14156
- number: BlockIdentifier;
14157
- /**
14158
- * @param {BlockIdentifier} tag if not null, contains "pre_confirmed" or "latest"
14159
- */
14160
- tag: BlockIdentifier;
14161
- private setIdentifier;
14162
- /**
14163
- * Create a Block instance
14164
- * @param {BlockIdentifier} _identifier hex string and BigInt are detected as block hashes.
14165
- * decimal string and number are detected as block numbers.
14166
- * text string are detected as block tag.
14167
- * null is considered as a 'latest' block tag.
14168
- */
14169
- constructor(_identifier: BlockIdentifier);
14170
- /**
14171
- * @returns {any} the identifier as a string
14157
+ * Create a Block.
14158
+ * @param {BlockIdentifier} _identifier the block number, the block hash or the block tag.
14159
+ * `null` and `undefined` mean `'latest'`.
14160
+ * @throws {Error} The identifier names no block. It is an empty string, a text that is not a
14161
+ * block tag, a hash that is not a felt (`'0x'`, a negative bigint, or a value larger than the
14162
+ * largest felt), a number that is not an integer, a negative number, a number larger than
14163
+ * `Number.MAX_SAFE_INTEGER`, or a value that is not a string, a number or a bigint.
14172
14164
  * @example
14173
14165
  * ```typescript
14174
- * const result = new provider.Block(123456n).queryIdentifier;
14175
- * // result = "blockHash=0x1e240"
14166
+ * const result = new provider.Block('0X0abc').identifier;
14167
+ * // result = { block_hash: '0xabc' }
14168
+ *
14169
+ * new provider.Block(1.5);
14170
+ * // throws Error: Block number (1.5) must be an integer
14176
14171
  * ```
14177
14172
  */
14178
- get queryIdentifier(): any;
14173
+ constructor(_identifier: BlockIdentifier);
14179
14174
  /**
14180
- * @returns {any} the identifier as an object
14175
+ * @returns {RPC.BLOCK_ID} the block in the form of the `block_id` of an RPC request:
14176
+ * `{ block_number: number }`, `{ block_hash: string }` or a block tag.
14181
14177
  * @example
14182
14178
  * ```typescript
14183
14179
  * const result = new provider.Block(56789).identifier;
14184
14180
  * // result = { block_number: 56789 }
14185
14181
  * ```
14186
14182
  */
14187
- get identifier(): any;
14188
- /**
14189
- * change the identifier of an existing Block instance
14190
- * @example
14191
- * ```typescript
14192
- * const myBlock = new provider.Block("latest");
14193
- * myBlock.identifier ="0x3456789abc";
14194
- * const result = myBlock.identifier;
14195
- * // result = { block_hash: '0x3456789abc' }
14196
- * ```
14197
- */
14198
- set identifier(_identifier: BlockIdentifier);
14199
- valueOf: () => BlockIdentifier;
14200
- toString: () => BlockIdentifier;
14183
+ get identifier(): BLOCK_ID;
14201
14184
  }
14202
14185
 
14203
14186
  type provider_Block = Block;
@@ -18492,29 +18475,52 @@ declare function addAddressPadding(address: BigNumberish): string;
18492
18475
  */
18493
18476
  declare function validateAndParseAddress(address: BigNumberish): string;
18494
18477
  /**
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.
18478
+ * Add a checksum to an address.
18479
+ * The checksum is the choice of the letters that are written in uppercase.
18480
+ * This choice depends on the address.
18481
+ * If one character is typed wrong, the uppercase letters do not match in most cases,
18482
+ * and {@link validateChecksumAddress} detects the error.
18483
+ *
18484
+ * A string is read as hexadecimal, with or without its `0x` prefix: `'31'` is 0x31.
18485
+ * This is the same rule as in {@link validateAndParseAddress}.
18497
18486
  * @param {BigNumberish} address
18498
- * @returns {string} Hex string : 0x followed by 64 characters. Mix of uppercase and lowercase
18487
+ * @returns {string} the address with its checksum: 0x, then 64 characters with the leading zeros.
18488
+ * @throws {Error} when the address is not a valid Starknet address (same checks as
18489
+ * {@link validateAndParseAddress})
18499
18490
  * @example
18500
18491
  * ```typescript
18501
18492
  * const address = "0x90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf";
18502
18493
  * const result = getChecksumAddress(address);
18503
18494
  * // result = "0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF"
18495
+ * // the same address without its 0x prefix gives the same result
18496
+ * const result2 = getChecksumAddress("90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf");
18497
+ * // result2 = "0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF"
18504
18498
  * ```
18505
18499
  */
18506
18500
  declare function getChecksumAddress(address: BigNumberish): string;
18507
18501
  /**
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
18502
+ * Check that an address is written exactly as {@link getChecksumAddress} writes it:
18503
+ * 0x, then 64 characters with the leading zeros, and the uppercase letters of the checksum.
18504
+ *
18505
+ * For any other way to write the address, the result is false, even if the address is valid.
18506
+ * For example, the result is false for an address in lowercase, without its leading zeros,
18507
+ * or without its 0x prefix. The RPC specification writes addresses without their leading zeros.
18508
+ * In most cases, the result is also false when there is a typing error.
18509
+ * To only check that an address is valid, use {@link validateAndParseAddress}.
18510
+ * @param {string} address
18511
+ * @returns {boolean} true only if the address is written exactly with its checksum
18512
+ * @throws {Error} when the address is not a valid Starknet address (same checks as
18513
+ * {@link validateAndParseAddress})
18513
18514
  * @example
18514
18515
  * ```typescript
18515
- * const address = "0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF";
18516
- * const result = validateChecksumAddress(address);
18517
- * // result = true
18516
+ * const result1 = validateChecksumAddress("0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF");
18517
+ * // result1 = true
18518
+ * const result2 = validateChecksumAddress("0x90591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF");
18519
+ * // result2 = false, because the leading zeros are missing
18520
+ * const result3 = validateChecksumAddress("0x0000090591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf");
18521
+ * // result3 = false, because all the letters are in lowercase
18522
+ * validateChecksumAddress("test");
18523
+ * // throws Error("Invalid Address Format")
18518
18524
  * ```
18519
18525
  */
18520
18526
  declare function validateChecksumAddress(address: string): boolean;