starknet 10.0.2 → 10.0.4
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 +13 -0
- package/dist/index.d.ts +10 -9
- package/dist/index.global.js +35 -26
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +35 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [10.0.4](https://github.com/starknet-io/starknet.js/compare/v10.0.3...v10.0.4) (2026-06-04)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- add validation to cairofelt to ensure numbers are valid felt252 numbers ([f056836](https://github.com/starknet-io/starknet.js/commit/f0568369781e602a8a47dee76bb7ac13d152faaf))
|
|
6
|
+
|
|
7
|
+
## [10.0.3](https://github.com/starknet-io/starknet.js/compare/v10.0.2...v10.0.3) (2026-05-29)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- accept provider options in connectSilent ([754d9e0](https://github.com/starknet-io/starknet.js/commit/754d9e093c11d8cb7e4832aa075353aea5977e7c))
|
|
12
|
+
- **wallet:** accept provider options in WalletAccountV5.connect ([9e78659](https://github.com/starknet-io/starknet.js/commit/9e7865995a12e07edb0f3abbceda84c6dceec9d8))
|
|
13
|
+
|
|
1
14
|
## [10.0.2](https://github.com/starknet-io/starknet.js/compare/v10.0.1...v10.0.2) (2026-04-30)
|
|
2
15
|
|
|
3
16
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -5771,7 +5771,7 @@ declare class WalletAccount extends Account {
|
|
|
5771
5771
|
deploy(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]): Promise<MultiDeployContractResponse>;
|
|
5772
5772
|
signMessage(typedData: TypedData): Promise<Signature$1>;
|
|
5773
5773
|
static connect(provider: ProviderOptions | ProviderInterface, walletProvider: StarknetWalletProvider, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface, silentMode?: boolean): Promise<WalletAccount>;
|
|
5774
|
-
static connectSilent(provider: ProviderInterface, walletProvider: StarknetWalletProvider, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface): Promise<WalletAccount>;
|
|
5774
|
+
static connectSilent(provider: ProviderOptions | ProviderInterface, walletProvider: StarknetWalletProvider, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface): Promise<WalletAccount>;
|
|
5775
5775
|
}
|
|
5776
5776
|
|
|
5777
5777
|
/**
|
|
@@ -5806,8 +5806,8 @@ declare class WalletAccountV5 extends Account {
|
|
|
5806
5806
|
declare(payload: DeclareContractPayload): Promise<RPCSPEC0101.AddDeclareTransactionResult>;
|
|
5807
5807
|
deploy(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]): Promise<MultiDeployContractResponse>;
|
|
5808
5808
|
signMessage(typedData: TypedData): Promise<Signature$1>;
|
|
5809
|
-
static connect(provider: ProviderInterface, walletProvider: WalletWithStarknetFeatures, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface, silentMode?: boolean): Promise<WalletAccountV5>;
|
|
5810
|
-
static connectSilent(provider: ProviderInterface, walletProvider: WalletWithStarknetFeatures, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface): Promise<WalletAccountV5>;
|
|
5809
|
+
static connect(provider: ProviderOptions | ProviderInterface, walletProvider: WalletWithStarknetFeatures, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface, silentMode?: boolean): Promise<WalletAccountV5>;
|
|
5810
|
+
static connectSilent(provider: ProviderOptions | ProviderInterface, walletProvider: WalletWithStarknetFeatures, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface): Promise<WalletAccountV5>;
|
|
5811
5811
|
}
|
|
5812
5812
|
|
|
5813
5813
|
declare module 'abi-wan-kanabi' {
|
|
@@ -9325,12 +9325,6 @@ declare class CairoBytes31 {
|
|
|
9325
9325
|
static factoryFromApiResponse(responseIterator: Iterator<string>): CairoBytes31;
|
|
9326
9326
|
}
|
|
9327
9327
|
|
|
9328
|
-
/**
|
|
9329
|
-
* @deprecated use the CairoFelt252 class instead, this one is limited to ASCII strings
|
|
9330
|
-
* Create felt Cairo type (cairo type helper)
|
|
9331
|
-
* @returns format: felt-string
|
|
9332
|
-
*/
|
|
9333
|
-
declare function CairoFelt(it: BigNumberish): string;
|
|
9334
9328
|
/**
|
|
9335
9329
|
* felt252 is the basic field element used in Cairo.
|
|
9336
9330
|
* It corresponds to an integer in the range 0 ≤ x < P where P is a very large prime number currently equal to 2^251 + 17⋅2^192 + 1.
|
|
@@ -9349,11 +9343,18 @@ declare class CairoFelt252 {
|
|
|
9349
9343
|
decodeUtf8(): string;
|
|
9350
9344
|
toHexString(): string;
|
|
9351
9345
|
toApiRequest(): string[];
|
|
9346
|
+
static assertRange(val: bigint): void;
|
|
9352
9347
|
static validate(data: BigNumberish | boolean | unknown): void;
|
|
9353
9348
|
static is(data: BigNumberish | boolean | unknown): boolean;
|
|
9354
9349
|
static isAbiType(abiType: string): boolean;
|
|
9355
9350
|
static factoryFromApiResponse(responseIterator: Iterator<string>): CairoFelt252;
|
|
9356
9351
|
}
|
|
9352
|
+
/**
|
|
9353
|
+
* @deprecated use the CairoFelt252 class instead, this one is limited to ASCII strings
|
|
9354
|
+
* Create felt Cairo type (cairo type helper)
|
|
9355
|
+
* @returns format: felt-string
|
|
9356
|
+
*/
|
|
9357
|
+
declare function CairoFelt(it: BigNumberish): string;
|
|
9357
9358
|
|
|
9358
9359
|
declare class CairoUint32 {
|
|
9359
9360
|
data: bigint;
|
package/dist/index.global.js
CHANGED
|
@@ -5547,31 +5547,6 @@ ${indent}}` : "}";
|
|
|
5547
5547
|
}
|
|
5548
5548
|
|
|
5549
5549
|
// src/utils/cairoDataTypes/felt.ts
|
|
5550
|
-
function CairoFelt(it) {
|
|
5551
|
-
if (isBigInt(it) || Number.isInteger(it)) {
|
|
5552
|
-
return it.toString();
|
|
5553
|
-
}
|
|
5554
|
-
if (isString(it)) {
|
|
5555
|
-
if (isHex2(it)) {
|
|
5556
|
-
return BigInt(it).toString();
|
|
5557
|
-
}
|
|
5558
|
-
if (isText(it)) {
|
|
5559
|
-
if (!isShortString(it)) {
|
|
5560
|
-
throw new Error(
|
|
5561
|
-
`${it} is a long string > 31 chars. Please split it into an array of short strings.`
|
|
5562
|
-
);
|
|
5563
|
-
}
|
|
5564
|
-
return BigInt(encodeShortString(it)).toString();
|
|
5565
|
-
}
|
|
5566
|
-
if (isStringWholeNumber(it)) {
|
|
5567
|
-
return it;
|
|
5568
|
-
}
|
|
5569
|
-
}
|
|
5570
|
-
if (isBoolean(it)) {
|
|
5571
|
-
return `${+it}`;
|
|
5572
|
-
}
|
|
5573
|
-
throw new Error(`${it} can't be computed by felt()`);
|
|
5574
|
-
}
|
|
5575
5550
|
var CairoFelt252 = class _CairoFelt252 {
|
|
5576
5551
|
/**
|
|
5577
5552
|
* byte representation of the felt252
|
|
@@ -5610,6 +5585,9 @@ ${indent}}` : "}";
|
|
|
5610
5585
|
toApiRequest() {
|
|
5611
5586
|
return addCompiledFlag([this.toHexString()]);
|
|
5612
5587
|
}
|
|
5588
|
+
static assertRange(val) {
|
|
5589
|
+
assert(val >= 0n && val < PRIME, `Value ${val} is out of felt252 range [0, ${PRIME})`);
|
|
5590
|
+
}
|
|
5613
5591
|
static validate(data) {
|
|
5614
5592
|
assert(data !== null, "null value is not allowed for felt252");
|
|
5615
5593
|
assert(data !== void 0, "undefined value is not allowed for felt252");
|
|
@@ -5619,7 +5597,7 @@ ${indent}}` : "}";
|
|
|
5619
5597
|
);
|
|
5620
5598
|
const value = _CairoFelt252.__processData(data);
|
|
5621
5599
|
const bn = uint8ArrayToBigInt(value);
|
|
5622
|
-
|
|
5600
|
+
_CairoFelt252.assertRange(bn);
|
|
5623
5601
|
}
|
|
5624
5602
|
static is(data) {
|
|
5625
5603
|
try {
|
|
@@ -5636,6 +5614,37 @@ ${indent}}` : "}";
|
|
|
5636
5614
|
return new _CairoFelt252(getNext(responseIterator));
|
|
5637
5615
|
}
|
|
5638
5616
|
};
|
|
5617
|
+
function CairoFelt(it) {
|
|
5618
|
+
if (isBigInt(it) || Number.isInteger(it)) {
|
|
5619
|
+
const val = BigInt(it);
|
|
5620
|
+
CairoFelt252.assertRange(val);
|
|
5621
|
+
return val.toString();
|
|
5622
|
+
}
|
|
5623
|
+
if (isString(it)) {
|
|
5624
|
+
if (isHex2(it)) {
|
|
5625
|
+
const val = BigInt(it);
|
|
5626
|
+
CairoFelt252.assertRange(val);
|
|
5627
|
+
return val.toString();
|
|
5628
|
+
}
|
|
5629
|
+
if (isText(it)) {
|
|
5630
|
+
if (!isShortString(it)) {
|
|
5631
|
+
throw new Error(
|
|
5632
|
+
`${it} is a long string > 31 chars. Please split it into an array of short strings.`
|
|
5633
|
+
);
|
|
5634
|
+
}
|
|
5635
|
+
return BigInt(encodeShortString(it)).toString();
|
|
5636
|
+
}
|
|
5637
|
+
if (isStringWholeNumber(it)) {
|
|
5638
|
+
const val = BigInt(it);
|
|
5639
|
+
CairoFelt252.assertRange(val);
|
|
5640
|
+
return val.toString();
|
|
5641
|
+
}
|
|
5642
|
+
}
|
|
5643
|
+
if (isBoolean(it)) {
|
|
5644
|
+
return `${+it}`;
|
|
5645
|
+
}
|
|
5646
|
+
throw new Error(`${it} can't be computed by felt()`);
|
|
5647
|
+
}
|
|
5639
5648
|
|
|
5640
5649
|
// src/utils/cairoDataTypes/uint256.ts
|
|
5641
5650
|
var UINT_128_MAX = (1n << 128n) - 1n;
|