starknet 11.10.3 → 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 +12 -0
- package/dist/index.d.ts +37 -14
- package/dist/index.global.js +13 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
|
|
7
|
+
## [11.10.4](https://github.com/starknet-io/starknet.js/compare/v11.10.3...v11.10.4) (2026-12-01)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **address:** hash the parsed address in getChecksumAddress() ([#1773](https://github.com/starknet-io/starknet.js/issues/1773)) ([90bf72c](https://github.com/starknet-io/starknet.js/commit/90bf72c391b5bdeb4b004493103b6a24b231daf7))
|
|
12
|
+
|
|
1
13
|
## [11.10.3](https://github.com/starknet-io/starknet.js/compare/v11.10.2...v11.10.3) (2026-12-01)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -9492,7 +9492,7 @@ declare class RpcProvider implements ProviderInterface {
|
|
|
9492
9492
|
getBlock(blockIdentifier: 'pre_confirmed'): Promise<PreConfirmedBlock>;
|
|
9493
9493
|
getBlock(blockIdentifier: 'latest'): Promise<Block$1>;
|
|
9494
9494
|
getBlock(blockIdentifier: BlockIdentifier): Promise<GetBlockResponse>;
|
|
9495
|
-
getBlockLatestAccepted(): Promise<RPC
|
|
9495
|
+
getBlockLatestAccepted(): Promise<RPC.BlockHashAndNumber>;
|
|
9496
9496
|
getBlockNumber(): Promise<number>;
|
|
9497
9497
|
getBlockWithTxHashes(blockIdentifier?: BlockIdentifier): Promise<({
|
|
9498
9498
|
status: RPC.BLOCK_STATUS;
|
|
@@ -9640,7 +9640,7 @@ declare class RpcProvider implements ProviderInterface {
|
|
|
9640
9640
|
getTransactionReceipt(txHash: BigNumberish): Promise<GetTransactionReceiptResponse>;
|
|
9641
9641
|
getTransactionTrace<V extends _SupportedRpcVersion = _SupportedRpcVersion>(txHash: BigNumberish): Promise<V extends SupportedRpcVersion0_10 ? RPCSPEC0105.TRANSACTION_TRACE : RPC.TRANSACTION_TRACE>;
|
|
9642
9642
|
getTransactionTrace(txHash: BigNumberish): Promise<RPCSPEC0105.TRANSACTION_TRACE | RPC.TRANSACTION_TRACE>;
|
|
9643
|
-
getTransactionStatus(transactionHash: BigNumberish): Promise<RPC
|
|
9643
|
+
getTransactionStatus(transactionHash: BigNumberish): Promise<RPC.TXN_STATUS_RESULT>;
|
|
9644
9644
|
getSimulateTransaction(invocations: AccountInvocations, options?: getSimulateTransactionOptions): Promise<SimulateTransactionOverheadResponse>;
|
|
9645
9645
|
waitForTransaction(txHash: BigNumberish, options?: waitForTransactionOptions): Promise<GetTransactionReceiptResponse>;
|
|
9646
9646
|
getStorageAt(contractAddress: BigNumberish, key: BigNumberish, blockIdentifier?: BlockIdentifier, responseFlags?: RPCSPEC0105.STORAGE_RESPONSE_FLAG[]): Promise<STORAGE_RESULT>;
|
|
@@ -9770,7 +9770,7 @@ declare class RpcProvider implements ProviderInterface {
|
|
|
9770
9770
|
callContract(call: Call, blockIdentifier?: BlockIdentifier): Promise<string[]>;
|
|
9771
9771
|
estimateMessageFee<V extends _SupportedRpcVersion = _SupportedRpcVersion>(message: RPC.L1Message, blockIdentifier?: BlockIdentifier): Promise<V extends SupportedRpcVersion0_10 ? RPCSPEC0105.FEE_ESTIMATE : RPC.MESSAGE_FEE_ESTIMATE>;
|
|
9772
9772
|
estimateMessageFee(message: RPC.L1Message, blockIdentifier?: BlockIdentifier): Promise<RPCSPEC0105.FEE_ESTIMATE | RPC.MESSAGE_FEE_ESTIMATE>;
|
|
9773
|
-
getSyncingStats(): Promise<RPC
|
|
9773
|
+
getSyncingStats(): Promise<RPC.Syncing>;
|
|
9774
9774
|
getEvents<V extends _SupportedRpcVersion = _SupportedRpcVersion>(eventFilter: V extends SupportedRpcVersion0_10 ? RPCSPEC0105.EventFilter : RPC.EventFilter): Promise<V extends SupportedRpcVersion0_10 ? RPCSPEC0105.EVENTS_CHUNK : RPC.EVENTS_CHUNK>;
|
|
9775
9775
|
getEvents(eventFilter: RPCSPEC0105.EventFilter | RPC.EventFilter): Promise<RPCSPEC0105.EVENTS_CHUNK | RPC.EVENTS_CHUNK>;
|
|
9776
9776
|
verifyMessageInStarknet(message: BigNumberish | TypedData, signature: Signature, accountAddress: BigNumberish, signatureVerificationFunctionName?: string, signatureVerificationResponse?: {
|
|
@@ -18492,29 +18492,52 @@ declare function addAddressPadding(address: BigNumberish): string;
|
|
|
18492
18492
|
*/
|
|
18493
18493
|
declare function validateAndParseAddress(address: BigNumberish): string;
|
|
18494
18494
|
/**
|
|
18495
|
-
*
|
|
18496
|
-
*
|
|
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}
|
|
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
|
-
*
|
|
18509
|
-
*
|
|
18510
|
-
*
|
|
18511
|
-
*
|
|
18512
|
-
*
|
|
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
|
|
18516
|
-
*
|
|
18517
|
-
*
|
|
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;
|
package/dist/index.global.js
CHANGED
|
@@ -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
|
|
@@ -24611,8 +24619,9 @@ ${indent}}` : "}";
|
|
|
24611
24619
|
return result;
|
|
24612
24620
|
}
|
|
24613
24621
|
function getChecksumAddress(address) {
|
|
24614
|
-
const
|
|
24615
|
-
const
|
|
24622
|
+
const parsedAddress = validateAndParseAddress(address);
|
|
24623
|
+
const chars = removeHexPrefix(parsedAddress).toLowerCase().split("");
|
|
24624
|
+
const hex = removeHexPrefix(keccakBn(parsedAddress));
|
|
24616
24625
|
const hashed = hexToBytes2(hex.padStart(64, "0"));
|
|
24617
24626
|
for (let i = 0; i < chars.length; i += 2) {
|
|
24618
24627
|
if (hashed[i >> 1] >> 4 >= 8) {
|