starknet 11.0.0 → 11.0.2
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 +344 -115
- package/dist/index.global.js +304 -115
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +304 -115
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +304 -115
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -7
package/dist/index.d.ts
CHANGED
|
@@ -615,6 +615,21 @@ declare const BlockTag: {
|
|
|
615
615
|
type WeierstrassSignatureType = weierstrass.ECDSASignature;
|
|
616
616
|
type ArraySignatureType = string[];
|
|
617
617
|
type Signature = ArraySignatureType | WeierstrassSignatureType;
|
|
618
|
+
/**
|
|
619
|
+
* A number, in any of the three forms JavaScript carries one : a `number`, a `bigint`, or a
|
|
620
|
+
* `string` spelling it in decimal or in `0x` hexadecimal.
|
|
621
|
+
*
|
|
622
|
+
* The type itself accepts any string ; `num.isBigNumberish` is the check made at runtime. A number
|
|
623
|
+
* or a bigint may be negative, whereas a string is unsigned : `'-1'` is text to the library, except
|
|
624
|
+
* for the signed integer types `i8` to `i128`, which read it as -1.
|
|
625
|
+
* @example
|
|
626
|
+
* ```typescript
|
|
627
|
+
* const decimals: BigNumberish = 18;
|
|
628
|
+
* const amount: BigNumberish = 10n ** 18n;
|
|
629
|
+
* // the selector of balanceOf
|
|
630
|
+
* const selector: BigNumberish = '0x2e4263afad30923c891518314c3c95dbe830a16874e8abc5777a9a20b54c76e';
|
|
631
|
+
* ```
|
|
632
|
+
*/
|
|
618
633
|
type BigNumberish = string | number | bigint;
|
|
619
634
|
type ByteArray = {
|
|
620
635
|
data: BigNumberish[];
|
|
@@ -4167,7 +4182,7 @@ declare class CairoBool {
|
|
|
4167
4182
|
/**
|
|
4168
4183
|
* Build from a boolean, or from the numbers 0 and 1.
|
|
4169
4184
|
* @param {BigNumberish | boolean} data the value to carry : a boolean, 0 or 1
|
|
4170
|
-
* @throws {Error} when the value is text,
|
|
4185
|
+
* @throws {Error} when the value is text, a decimal number, not a felt252 input, or a number other than 0 or 1
|
|
4171
4186
|
* @example
|
|
4172
4187
|
* ```typescript
|
|
4173
4188
|
* const result = new CairoBool(false).toApiRequest();
|
|
@@ -4226,16 +4241,19 @@ declare class CairoBool {
|
|
|
4226
4241
|
/**
|
|
4227
4242
|
* Throw unless the value can be carried by a bool.
|
|
4228
4243
|
*
|
|
4229
|
-
* Text is refused first, then
|
|
4230
|
-
*
|
|
4231
|
-
*
|
|
4244
|
+
* Text is refused first, then a number with a decimal part. A number or a bigint is read as it
|
|
4245
|
+
* is, so that a negative one reaches the last check. Anything else is read as a felt252 — which
|
|
4246
|
+
* is what refuses a null, an object or an unsupported type. The value is finally checked to be
|
|
4247
|
+
* one of the only two numbers a bool can hold.
|
|
4232
4248
|
* @param {BigNumberish | boolean} data the value to check
|
|
4233
|
-
* @throws {Error} when the value is text,
|
|
4249
|
+
* @throws {Error} when the value is text, a decimal number, not a felt252 input, or a number other than 0 or 1
|
|
4234
4250
|
* @example
|
|
4235
4251
|
* ```typescript
|
|
4236
4252
|
* CairoBool.validate(true); // passes
|
|
4237
4253
|
* CairoBool.validate(2);
|
|
4238
4254
|
* // throws Error("Only values 0 or 1 are possible in a core::bool, received 2")
|
|
4255
|
+
* CairoBool.validate(-1);
|
|
4256
|
+
* // throws Error("Only values 0 or 1 are possible in a core::bool, received -1")
|
|
4239
4257
|
* ```
|
|
4240
4258
|
*/
|
|
4241
4259
|
static validate(data: BigNumberish | boolean | unknown): void;
|
|
@@ -4378,7 +4396,7 @@ declare class CairoUint512 {
|
|
|
4378
4396
|
* A `Uint512` object is accepted here too : it already carries the four limbs, and each is
|
|
4379
4397
|
* checked as a u128 rather than the whole being cut again.
|
|
4380
4398
|
* @param {BigNumberish | Uint512} bigNumberish the value to carry, within [0, 2^512 - 1]
|
|
4381
|
-
* @throws {Error} when the value is null, undefined, of an unread type, or out of range
|
|
4399
|
+
* @throws {Error} when the value is null, undefined, text, `'0x'`, of an unread type, a decimal number, or out of range
|
|
4382
4400
|
* @example
|
|
4383
4401
|
* ```typescript
|
|
4384
4402
|
* const result = new CairoUint512(255).toApiRequest();
|
|
@@ -4392,7 +4410,7 @@ declare class CairoUint512 {
|
|
|
4392
4410
|
* @param {BigNumberish} limb1 bits 128 to 255
|
|
4393
4411
|
* @param {BigNumberish} limb2 bits 256 to 383
|
|
4394
4412
|
* @param {BigNumberish} limb3 bits 384 to 511
|
|
4395
|
-
* @throws {Error} when any limb is
|
|
4413
|
+
* @throws {Error} when any limb is null, undefined, text, `'0x'`, not a number, a decimal number, or outside the u128 range
|
|
4396
4414
|
* @example
|
|
4397
4415
|
* ```typescript
|
|
4398
4416
|
* const result = new CairoUint512(7, 0, 0, 64).toBigInt() === 2n ** 390n + 7n;
|
|
@@ -4404,16 +4422,22 @@ declare class CairoUint512 {
|
|
|
4404
4422
|
* Throw unless a whole value can be represented as a u512, and give back its number.
|
|
4405
4423
|
*
|
|
4406
4424
|
* A string is only accepted while it spells a number, in base 10 or 16 : one that does not is
|
|
4407
|
-
* refused
|
|
4425
|
+
* refused as text, and `'0x'`, which holds no digit, is refused too. So is an object, a `Uint512`
|
|
4426
|
+
* one included : its four limbs are checked by {@link CairoUint512.validateProps}, which is what
|
|
4427
|
+
* the constructor calls for it.
|
|
4408
4428
|
* @param {BigNumberish} bigNumberish the value to check
|
|
4409
4429
|
* @returns {bigint} the value as a number, once accepted
|
|
4410
|
-
* @throws {Error} when the value is null, undefined, of an unread type, or out of range
|
|
4430
|
+
* @throws {Error} when the value is null, undefined, text, `'0x'`, of an unread type, a decimal number, or out of range
|
|
4411
4431
|
* @example
|
|
4412
4432
|
* ```typescript
|
|
4413
4433
|
* const result = CairoUint512.validate(255);
|
|
4414
4434
|
* // result = 255n
|
|
4415
4435
|
* CairoUint512.validate(-1);
|
|
4416
4436
|
* // throws Error("bigNumberish is smaller than UINT_512_MIN.")
|
|
4437
|
+
* CairoUint512.validate('abc');
|
|
4438
|
+
* // throws Error("Invalid input: a u512 cannot be built from text")
|
|
4439
|
+
* CairoUint512.validate(1.5);
|
|
4440
|
+
* // throws Error("Invalid input: decimal numbers are not supported, only integers")
|
|
4417
4441
|
* ```
|
|
4418
4442
|
*/
|
|
4419
4443
|
static validate(bigNumberish: BigNumberish | unknown): bigint;
|
|
@@ -4427,13 +4451,17 @@ declare class CairoUint512 {
|
|
|
4427
4451
|
* @param {BigNumberish} limb2 bits 256 to 383
|
|
4428
4452
|
* @param {BigNumberish} limb3 bits 384 to 511
|
|
4429
4453
|
* @returns {{limb0: bigint, limb1: bigint, limb2: bigint, limb3: bigint}} the four limbs as numbers
|
|
4430
|
-
* @throws {Error} when any limb is outside the u128 range
|
|
4454
|
+
* @throws {Error} when any limb is null, undefined, text, `'0x'`, not a number, a decimal number, or outside the u128 range
|
|
4431
4455
|
* @example
|
|
4432
4456
|
* ```typescript
|
|
4433
4457
|
* const result = CairoUint512.validateProps(7, 0, 0, 64);
|
|
4434
4458
|
* // result = { limb0: 7n, limb1: 0n, limb2: 0n, limb3: 64n }
|
|
4435
4459
|
* CairoUint512.validateProps(-1, 0, 0, 0);
|
|
4436
4460
|
* // throws Error("limb0 is not in the range of a u128 number")
|
|
4461
|
+
* CairoUint512.validateProps(1.5, 0, 0, 0);
|
|
4462
|
+
* // throws Error("limb0 must be an integer")
|
|
4463
|
+
* CairoUint512.validateProps('abc', 0, 0, 0);
|
|
4464
|
+
* // throws Error("limb0 cannot be built from text")
|
|
4437
4465
|
* ```
|
|
4438
4466
|
*/
|
|
4439
4467
|
static validateProps(limb0: BigNumberish, limb1: BigNumberish, limb2: BigNumberish, limb3: BigNumberish): {
|
|
@@ -4582,7 +4610,7 @@ declare class CairoUint8 {
|
|
|
4582
4610
|
* otherwise. Text therefore only fits here while it is a single ASCII character : two characters
|
|
4583
4611
|
* already make a number past 255.
|
|
4584
4612
|
* @param {BigNumberish | boolean} data the value to carry, within [0, 255]
|
|
4585
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
4613
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
4586
4614
|
* @example
|
|
4587
4615
|
* ```typescript
|
|
4588
4616
|
* const result = new CairoUint8('a').toApiRequest();
|
|
@@ -4656,11 +4684,11 @@ declare class CairoUint8 {
|
|
|
4656
4684
|
/**
|
|
4657
4685
|
* Throw unless the value can be carried by a u8.
|
|
4658
4686
|
*
|
|
4659
|
-
*
|
|
4660
|
-
* an array, a number with a decimal part, and a value outside [0, 255]. A text string reaches
|
|
4687
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
4688
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [0, 255]. A text string reaches
|
|
4661
4689
|
* that last check as the number its bytes spell, so `'ab'` is refused for being out of range.
|
|
4662
4690
|
* @param {BigNumberish | boolean} data the value to check
|
|
4663
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
4691
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
4664
4692
|
* @example
|
|
4665
4693
|
* ```typescript
|
|
4666
4694
|
* CairoUint8.validate(44); // passes
|
|
@@ -4760,7 +4788,7 @@ declare class CairoUint16 {
|
|
|
4760
4788
|
* otherwise. Text therefore only fits here up to 2 ASCII characters : one more already
|
|
4761
4789
|
* makes a number past 65535.
|
|
4762
4790
|
* @param {BigNumberish | boolean} data the value to carry, within [0, 65535]
|
|
4763
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
4791
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
4764
4792
|
* @example
|
|
4765
4793
|
* ```typescript
|
|
4766
4794
|
* const result = new CairoUint16('ab').toApiRequest();
|
|
@@ -4832,11 +4860,11 @@ declare class CairoUint16 {
|
|
|
4832
4860
|
/**
|
|
4833
4861
|
* Throw unless the value can be carried by a u16.
|
|
4834
4862
|
*
|
|
4835
|
-
*
|
|
4836
|
-
* an array, a number with a decimal part, and a value outside [0, 65535]. A text string reaches
|
|
4863
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
4864
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [0, 65535]. A text string reaches
|
|
4837
4865
|
* that last check as the number its bytes spell, so `'abc'` is refused for being out of range.
|
|
4838
4866
|
* @param {BigNumberish | boolean} data the value to check
|
|
4839
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
4867
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
4840
4868
|
* @example
|
|
4841
4869
|
* ```typescript
|
|
4842
4870
|
* CairoUint16.validate(300); // passes
|
|
@@ -4936,7 +4964,7 @@ declare class CairoUint32 {
|
|
|
4936
4964
|
* otherwise. Text therefore only fits here up to 4 ASCII characters : one more already
|
|
4937
4965
|
* makes a number past 4294967295.
|
|
4938
4966
|
* @param {BigNumberish | boolean} data the value to carry, within [0, 4294967295]
|
|
4939
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
4967
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
4940
4968
|
* @example
|
|
4941
4969
|
* ```typescript
|
|
4942
4970
|
* const result = new CairoUint32('abcd').toApiRequest();
|
|
@@ -5008,11 +5036,11 @@ declare class CairoUint32 {
|
|
|
5008
5036
|
/**
|
|
5009
5037
|
* Throw unless the value can be carried by a u32.
|
|
5010
5038
|
*
|
|
5011
|
-
*
|
|
5012
|
-
* an array, a number with a decimal part, and a value outside [0, 4294967295]. A text string reaches
|
|
5039
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
5040
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [0, 4294967295]. A text string reaches
|
|
5013
5041
|
* that last check as the number its bytes spell, so `'abcde'` is refused for being out of range.
|
|
5014
5042
|
* @param {BigNumberish | boolean} data the value to check
|
|
5015
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5043
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5016
5044
|
* @example
|
|
5017
5045
|
* ```typescript
|
|
5018
5046
|
* CairoUint32.validate(70000); // passes
|
|
@@ -5112,7 +5140,7 @@ declare class CairoUint64 {
|
|
|
5112
5140
|
* otherwise. Text therefore only fits here up to 8 ASCII characters : one more already
|
|
5113
5141
|
* makes a number past 18446744073709551615.
|
|
5114
5142
|
* @param {BigNumberish | boolean} data the value to carry, within [0, 18446744073709551615]
|
|
5115
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5143
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5116
5144
|
* @example
|
|
5117
5145
|
* ```typescript
|
|
5118
5146
|
* const result = new CairoUint64('abcdefgh').toApiRequest();
|
|
@@ -5184,11 +5212,11 @@ declare class CairoUint64 {
|
|
|
5184
5212
|
/**
|
|
5185
5213
|
* Throw unless the value can be carried by a u64.
|
|
5186
5214
|
*
|
|
5187
|
-
*
|
|
5188
|
-
* an array, a number with a decimal part, and a value outside [0, 18446744073709551615]. A text string reaches
|
|
5215
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
5216
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [0, 18446744073709551615]. A text string reaches
|
|
5189
5217
|
* that last check as the number its bytes spell, so `'abcdefghi'` is refused for being out of range.
|
|
5190
5218
|
* @param {BigNumberish | boolean} data the value to check
|
|
5191
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5219
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5192
5220
|
* @example
|
|
5193
5221
|
* ```typescript
|
|
5194
5222
|
* CairoUint64.validate(5000000000); // passes
|
|
@@ -5301,7 +5329,7 @@ declare class CairoUint96 {
|
|
|
5301
5329
|
* otherwise. Text therefore only fits here up to 12 ASCII characters : one more already
|
|
5302
5330
|
* makes a number past 79228162514264337593543950335.
|
|
5303
5331
|
* @param {BigNumberish | boolean} data the value to carry, within [0, 79228162514264337593543950335]
|
|
5304
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5332
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5305
5333
|
* @example
|
|
5306
5334
|
* ```typescript
|
|
5307
5335
|
* const result = new CairoUint96('abcdefghijkl').toApiRequest();
|
|
@@ -5373,11 +5401,11 @@ declare class CairoUint96 {
|
|
|
5373
5401
|
/**
|
|
5374
5402
|
* Throw unless the value can be carried by a u96.
|
|
5375
5403
|
*
|
|
5376
|
-
*
|
|
5377
|
-
* an array, a number with a decimal part, and a value outside [0, 79228162514264337593543950335]. A text string reaches
|
|
5404
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
5405
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [0, 79228162514264337593543950335]. A text string reaches
|
|
5378
5406
|
* that last check as the number its bytes spell, so `'abcdefghijklm'` is refused for being out of range.
|
|
5379
5407
|
* @param {BigNumberish | boolean} data the value to check
|
|
5380
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5408
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5381
5409
|
* @example
|
|
5382
5410
|
* ```typescript
|
|
5383
5411
|
* CairoUint96.validate(5000000000); // passes
|
|
@@ -5484,7 +5512,7 @@ declare class CairoUint128 {
|
|
|
5484
5512
|
* otherwise. Text therefore only fits here up to 16 ASCII characters : one more already
|
|
5485
5513
|
* makes a number past 340282366920938463463374607431768211455.
|
|
5486
5514
|
* @param {BigNumberish | boolean} data the value to carry, within [0, 340282366920938463463374607431768211455]
|
|
5487
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5515
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5488
5516
|
* @example
|
|
5489
5517
|
* ```typescript
|
|
5490
5518
|
* const result = new CairoUint128('abcdefghijklmnop').toApiRequest();
|
|
@@ -5556,11 +5584,11 @@ declare class CairoUint128 {
|
|
|
5556
5584
|
/**
|
|
5557
5585
|
* Throw unless the value can be carried by a u128.
|
|
5558
5586
|
*
|
|
5559
|
-
*
|
|
5560
|
-
* an array, a number with a decimal part, and a value outside [0, 340282366920938463463374607431768211455]. A text string reaches
|
|
5587
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
5588
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [0, 340282366920938463463374607431768211455]. A text string reaches
|
|
5561
5589
|
* that last check as the number its bytes spell, so `'abcdefghijklmnopq'` is refused for being out of range.
|
|
5562
5590
|
* @param {BigNumberish | boolean} data the value to check
|
|
5563
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5591
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5564
5592
|
* @example
|
|
5565
5593
|
* ```typescript
|
|
5566
5594
|
* CairoUint128.validate(5000000000); // passes
|
|
@@ -5622,6 +5650,10 @@ declare class CairoUint128 {
|
|
|
5622
5650
|
* `'97'` and `'0x61'` give the same i8. A string that reads as text rather than as a
|
|
5623
5651
|
* number is taken for its UTF-8 bytes, which is why `'a'` is 97 and not a rejected input.
|
|
5624
5652
|
*
|
|
5653
|
+
* A minus sign in front of a number is read as a sign, not as text : `'-5'` is -5, as `-5` and
|
|
5654
|
+
* `-5n` are. Only the signed integers read a string this way — for every other type, `'-5'` is
|
|
5655
|
+
* text, encoded or refused as such.
|
|
5656
|
+
*
|
|
5625
5657
|
* An already built instance is **not** an accepted input : handed back to the constructor it is
|
|
5626
5658
|
* seen as an object and refused. Inside the library it is `unwrapCairoScalar` that reduces an
|
|
5627
5659
|
* instance to its number before an abi slot receives it.
|
|
@@ -5632,6 +5664,11 @@ declare class CairoUint128 {
|
|
|
5632
5664
|
* new CairoInt8('97').toBigInt(); // 97n
|
|
5633
5665
|
* new CairoInt8('0x61').toBigInt(); // 97n
|
|
5634
5666
|
* new CairoInt8('a').toBigInt(); // 97n the UTF-8 bytes of the text
|
|
5667
|
+
*
|
|
5668
|
+
* // a negative value, reached three ways
|
|
5669
|
+
* new CairoInt8(-5).toBigInt(); // -5n
|
|
5670
|
+
* new CairoInt8('-5').toBigInt(); // -5n
|
|
5671
|
+
* new CairoInt8('-0x5').toBigInt(); // -5n a sign, not the text "-0x5"
|
|
5635
5672
|
* ```
|
|
5636
5673
|
*/
|
|
5637
5674
|
declare class CairoInt8 {
|
|
@@ -5656,15 +5693,17 @@ declare class CairoInt8 {
|
|
|
5656
5693
|
/**
|
|
5657
5694
|
* Build from a number, a string or a boolean, refusing anything out of the i8 range.
|
|
5658
5695
|
*
|
|
5659
|
-
* A string is read as a number when it spells one — decimal or hexadecimal
|
|
5660
|
-
* otherwise. Text therefore only fits here up to a single
|
|
5661
|
-
* makes a number past 127.
|
|
5696
|
+
* A string is read as a number when it spells one — decimal or hexadecimal, with or without a
|
|
5697
|
+
* leading minus sign — and as UTF-8 text otherwise. Text therefore only fits here up to a single
|
|
5698
|
+
* ASCII character : one more already makes a number past 127.
|
|
5662
5699
|
* @param {BigNumberish | boolean} data the value to carry, within [-128, 127]
|
|
5663
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5700
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5664
5701
|
* @example
|
|
5665
5702
|
* ```typescript
|
|
5666
5703
|
* const result = new CairoInt8('a').toApiRequest();
|
|
5667
5704
|
* // result = ["97"]
|
|
5705
|
+
* const result2 = new CairoInt8('-5').toApiRequest();
|
|
5706
|
+
* // result2 = ["3618502788666131213697322783095070105623107215331596699973092056135872020476"]
|
|
5668
5707
|
* ```
|
|
5669
5708
|
*/
|
|
5670
5709
|
constructor(data: BigNumberish | boolean | unknown);
|
|
@@ -5673,6 +5712,9 @@ declare class CairoInt8 {
|
|
|
5673
5712
|
*
|
|
5674
5713
|
* Nothing here refuses a value : `validate` is what reads this number and decides. So an input
|
|
5675
5714
|
* far outside the i8 range comes back untouched rather than raising.
|
|
5715
|
+
*
|
|
5716
|
+
* A minus sign in front of a number makes it negative rather than text : `'-5'` and `'-0x5'` are
|
|
5717
|
+
* both -5. This holds for the signed integers only — for any other type, such a string is text.
|
|
5676
5718
|
* @param {BigNumberish | boolean} data the value to convert
|
|
5677
5719
|
* @returns {bigint} the number the input spells, of whatever size
|
|
5678
5720
|
* @example
|
|
@@ -5681,6 +5723,8 @@ declare class CairoInt8 {
|
|
|
5681
5723
|
* // result = 97n
|
|
5682
5724
|
* const result2 = CairoInt8.__processData('ab');
|
|
5683
5725
|
* // result2 = 24930n (past the i8 range, and returned all the same)
|
|
5726
|
+
* const result3 = CairoInt8.__processData('-0x5');
|
|
5727
|
+
* // result3 = -5n (a negative number, not the text "-0x5")
|
|
5684
5728
|
* ```
|
|
5685
5729
|
*/
|
|
5686
5730
|
static __processData(data: BigNumberish | boolean | unknown): bigint;
|
|
@@ -5742,11 +5786,12 @@ declare class CairoInt8 {
|
|
|
5742
5786
|
/**
|
|
5743
5787
|
* Throw unless the value can be carried by an i8.
|
|
5744
5788
|
*
|
|
5745
|
-
*
|
|
5746
|
-
* an array, a number with a decimal part, and a value outside [-128, 127]. A text string
|
|
5747
|
-
* that last check as the number its bytes spell, so `'ab'` is refused for being out of
|
|
5789
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
5790
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [-128, 127]. A text string
|
|
5791
|
+
* reaches that last check as the number its bytes spell, so `'ab'` is refused for being out of
|
|
5792
|
+
* range.
|
|
5748
5793
|
* @param {BigNumberish | boolean} data the value to check
|
|
5749
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5794
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5750
5795
|
* @example
|
|
5751
5796
|
* ```typescript
|
|
5752
5797
|
* CairoInt8.validate(5); // passes
|
|
@@ -5809,6 +5854,10 @@ declare class CairoInt8 {
|
|
|
5809
5854
|
* `'24930'` and `'0x6162'` give the same i16. A string that reads as text rather than as a
|
|
5810
5855
|
* number is taken for its UTF-8 bytes, which is why `'ab'` is 24930 and not a rejected input.
|
|
5811
5856
|
*
|
|
5857
|
+
* A minus sign in front of a number is read as a sign, not as text : `'-5'` is -5, as `-5` and
|
|
5858
|
+
* `-5n` are. Only the signed integers read a string this way — for every other type, `'-5'` is
|
|
5859
|
+
* text, encoded or refused as such.
|
|
5860
|
+
*
|
|
5812
5861
|
* An already built instance is **not** an accepted input : handed back to the constructor it is
|
|
5813
5862
|
* seen as an object and refused. Inside the library it is `unwrapCairoScalar` that reduces an
|
|
5814
5863
|
* instance to its number before an abi slot receives it.
|
|
@@ -5819,6 +5868,11 @@ declare class CairoInt8 {
|
|
|
5819
5868
|
* new CairoInt16('24930').toBigInt(); // 24930n
|
|
5820
5869
|
* new CairoInt16('0x6162').toBigInt(); // 24930n
|
|
5821
5870
|
* new CairoInt16('ab').toBigInt(); // 24930n the UTF-8 bytes of the text
|
|
5871
|
+
*
|
|
5872
|
+
* // a negative value, reached three ways
|
|
5873
|
+
* new CairoInt16(-5).toBigInt(); // -5n
|
|
5874
|
+
* new CairoInt16('-5').toBigInt(); // -5n
|
|
5875
|
+
* new CairoInt16('-0x5').toBigInt(); // -5n a sign, not the text "-0x5"
|
|
5822
5876
|
* ```
|
|
5823
5877
|
*/
|
|
5824
5878
|
declare class CairoInt16 {
|
|
@@ -5843,15 +5897,17 @@ declare class CairoInt16 {
|
|
|
5843
5897
|
/**
|
|
5844
5898
|
* Build from a number, a string or a boolean, refusing anything out of the i16 range.
|
|
5845
5899
|
*
|
|
5846
|
-
* A string is read as a number when it spells one — decimal or hexadecimal
|
|
5847
|
-
* otherwise. Text therefore only fits here up to 2 ASCII
|
|
5848
|
-
* makes a number past 32767.
|
|
5900
|
+
* A string is read as a number when it spells one — decimal or hexadecimal, with or without a
|
|
5901
|
+
* leading minus sign — and as UTF-8 text otherwise. Text therefore only fits here up to 2 ASCII
|
|
5902
|
+
* characters : one more already makes a number past 32767.
|
|
5849
5903
|
* @param {BigNumberish | boolean} data the value to carry, within [-32768, 32767]
|
|
5850
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5904
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5851
5905
|
* @example
|
|
5852
5906
|
* ```typescript
|
|
5853
5907
|
* const result = new CairoInt16('ab').toApiRequest();
|
|
5854
5908
|
* // result = ["24930"]
|
|
5909
|
+
* const result2 = new CairoInt16('-5').toApiRequest();
|
|
5910
|
+
* // result2 = ["3618502788666131213697322783095070105623107215331596699973092056135872020476"]
|
|
5855
5911
|
* ```
|
|
5856
5912
|
*/
|
|
5857
5913
|
constructor(data: BigNumberish | boolean | unknown);
|
|
@@ -5860,6 +5916,9 @@ declare class CairoInt16 {
|
|
|
5860
5916
|
*
|
|
5861
5917
|
* Nothing here refuses a value : `validate` is what reads this number and decides. So an input
|
|
5862
5918
|
* far outside the i16 range comes back untouched rather than raising.
|
|
5919
|
+
*
|
|
5920
|
+
* A minus sign in front of a number makes it negative rather than text : `'-5'` and `'-0x5'` are
|
|
5921
|
+
* both -5. This holds for the signed integers only — for any other type, such a string is text.
|
|
5863
5922
|
* @param {BigNumberish | boolean} data the value to convert
|
|
5864
5923
|
* @returns {bigint} the number the input spells, of whatever size
|
|
5865
5924
|
* @example
|
|
@@ -5868,6 +5927,8 @@ declare class CairoInt16 {
|
|
|
5868
5927
|
* // result = 24930n
|
|
5869
5928
|
* const result2 = CairoInt16.__processData('abc');
|
|
5870
5929
|
* // result2 = 6382179n (past the i16 range, and returned all the same)
|
|
5930
|
+
* const result3 = CairoInt16.__processData('-0x5');
|
|
5931
|
+
* // result3 = -5n (a negative number, not the text "-0x5")
|
|
5871
5932
|
* ```
|
|
5872
5933
|
*/
|
|
5873
5934
|
static __processData(data: BigNumberish | boolean | unknown): bigint;
|
|
@@ -5929,11 +5990,11 @@ declare class CairoInt16 {
|
|
|
5929
5990
|
/**
|
|
5930
5991
|
* Throw unless the value can be carried by an i16.
|
|
5931
5992
|
*
|
|
5932
|
-
*
|
|
5933
|
-
* an array, a number with a decimal part, and a value outside [-32768, 32767]. A text string reaches
|
|
5993
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
5994
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [-32768, 32767]. A text string reaches
|
|
5934
5995
|
* that last check as the number its bytes spell, so `'abc'` is refused for being out of range.
|
|
5935
5996
|
* @param {BigNumberish | boolean} data the value to check
|
|
5936
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
5997
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
5937
5998
|
* @example
|
|
5938
5999
|
* ```typescript
|
|
5939
6000
|
* CairoInt16.validate(300); // passes
|
|
@@ -5996,6 +6057,10 @@ declare class CairoInt16 {
|
|
|
5996
6057
|
* `'1633837924'` and `'0x61626364'` give the same i32. A string that reads as text rather than as a
|
|
5997
6058
|
* number is taken for its UTF-8 bytes, which is why `'abcd'` is 1633837924 and not a rejected input.
|
|
5998
6059
|
*
|
|
6060
|
+
* A minus sign in front of a number is read as a sign, not as text : `'-5'` is -5, as `-5` and
|
|
6061
|
+
* `-5n` are. Only the signed integers read a string this way — for every other type, `'-5'` is
|
|
6062
|
+
* text, encoded or refused as such.
|
|
6063
|
+
*
|
|
5999
6064
|
* An already built instance is **not** an accepted input : handed back to the constructor it is
|
|
6000
6065
|
* seen as an object and refused. Inside the library it is `unwrapCairoScalar` that reduces an
|
|
6001
6066
|
* instance to its number before an abi slot receives it.
|
|
@@ -6006,6 +6071,11 @@ declare class CairoInt16 {
|
|
|
6006
6071
|
* new CairoInt32('1633837924').toBigInt(); // 1633837924n
|
|
6007
6072
|
* new CairoInt32('0x61626364').toBigInt(); // 1633837924n
|
|
6008
6073
|
* new CairoInt32('abcd').toBigInt(); // 1633837924n the UTF-8 bytes of the text
|
|
6074
|
+
*
|
|
6075
|
+
* // a negative value, reached three ways
|
|
6076
|
+
* new CairoInt32(-5).toBigInt(); // -5n
|
|
6077
|
+
* new CairoInt32('-5').toBigInt(); // -5n
|
|
6078
|
+
* new CairoInt32('-0x5').toBigInt(); // -5n a sign, not the text "-0x5"
|
|
6009
6079
|
* ```
|
|
6010
6080
|
*/
|
|
6011
6081
|
declare class CairoInt32 {
|
|
@@ -6030,15 +6100,17 @@ declare class CairoInt32 {
|
|
|
6030
6100
|
/**
|
|
6031
6101
|
* Build from a number, a string or a boolean, refusing anything out of the i32 range.
|
|
6032
6102
|
*
|
|
6033
|
-
* A string is read as a number when it spells one — decimal or hexadecimal
|
|
6034
|
-
* otherwise. Text therefore only fits here up to 4 ASCII
|
|
6035
|
-
* makes a number past 2147483647.
|
|
6103
|
+
* A string is read as a number when it spells one — decimal or hexadecimal, with or without a
|
|
6104
|
+
* leading minus sign — and as UTF-8 text otherwise. Text therefore only fits here up to 4 ASCII
|
|
6105
|
+
* characters : one more already makes a number past 2147483647.
|
|
6036
6106
|
* @param {BigNumberish | boolean} data the value to carry, within [-2147483648, 2147483647]
|
|
6037
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
6107
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
6038
6108
|
* @example
|
|
6039
6109
|
* ```typescript
|
|
6040
6110
|
* const result = new CairoInt32('abcd').toApiRequest();
|
|
6041
6111
|
* // result = ["1633837924"]
|
|
6112
|
+
* const result2 = new CairoInt32('-5').toApiRequest();
|
|
6113
|
+
* // result2 = ["3618502788666131213697322783095070105623107215331596699973092056135872020476"]
|
|
6042
6114
|
* ```
|
|
6043
6115
|
*/
|
|
6044
6116
|
constructor(data: BigNumberish | boolean | unknown);
|
|
@@ -6047,6 +6119,9 @@ declare class CairoInt32 {
|
|
|
6047
6119
|
*
|
|
6048
6120
|
* Nothing here refuses a value : `validate` is what reads this number and decides. So an input
|
|
6049
6121
|
* far outside the i32 range comes back untouched rather than raising.
|
|
6122
|
+
*
|
|
6123
|
+
* A minus sign in front of a number makes it negative rather than text : `'-5'` and `'-0x5'` are
|
|
6124
|
+
* both -5. This holds for the signed integers only — for any other type, such a string is text.
|
|
6050
6125
|
* @param {BigNumberish | boolean} data the value to convert
|
|
6051
6126
|
* @returns {bigint} the number the input spells, of whatever size
|
|
6052
6127
|
* @example
|
|
@@ -6055,6 +6130,8 @@ declare class CairoInt32 {
|
|
|
6055
6130
|
* // result = 1633837924n
|
|
6056
6131
|
* const result2 = CairoInt32.__processData('abcde');
|
|
6057
6132
|
* // result2 = 418262508645n (past the i32 range, and returned all the same)
|
|
6133
|
+
* const result3 = CairoInt32.__processData('-0x5');
|
|
6134
|
+
* // result3 = -5n (a negative number, not the text "-0x5")
|
|
6058
6135
|
* ```
|
|
6059
6136
|
*/
|
|
6060
6137
|
static __processData(data: BigNumberish | boolean | unknown): bigint;
|
|
@@ -6116,11 +6193,11 @@ declare class CairoInt32 {
|
|
|
6116
6193
|
/**
|
|
6117
6194
|
* Throw unless the value can be carried by an i32.
|
|
6118
6195
|
*
|
|
6119
|
-
*
|
|
6120
|
-
* an array, a number with a decimal part, and a value outside [-2147483648, 2147483647]. A text string reaches
|
|
6196
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
6197
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [-2147483648, 2147483647]. A text string reaches
|
|
6121
6198
|
* that last check as the number its bytes spell, so `'abcde'` is refused for being out of range.
|
|
6122
6199
|
* @param {BigNumberish | boolean} data the value to check
|
|
6123
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
6200
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
6124
6201
|
* @example
|
|
6125
6202
|
* ```typescript
|
|
6126
6203
|
* CairoInt32.validate(70000); // passes
|
|
@@ -6183,6 +6260,10 @@ declare class CairoInt32 {
|
|
|
6183
6260
|
* `'7017280452245743464'` and `'0x6162636465666768'` give the same i64. A string that reads as text rather than as a
|
|
6184
6261
|
* number is taken for its UTF-8 bytes, which is why `'abcdefgh'` is 7017280452245743464 and not a rejected input.
|
|
6185
6262
|
*
|
|
6263
|
+
* A minus sign in front of a number is read as a sign, not as text : `'-5'` is -5, as `-5` and
|
|
6264
|
+
* `-5n` are. Only the signed integers read a string this way — for every other type, `'-5'` is
|
|
6265
|
+
* text, encoded or refused as such.
|
|
6266
|
+
*
|
|
6186
6267
|
* An already built instance is **not** an accepted input : handed back to the constructor it is
|
|
6187
6268
|
* seen as an object and refused. Inside the library it is `unwrapCairoScalar` that reduces an
|
|
6188
6269
|
* instance to its number before an abi slot receives it.
|
|
@@ -6193,6 +6274,11 @@ declare class CairoInt32 {
|
|
|
6193
6274
|
* new CairoInt64('7017280452245743464').toBigInt(); // 7017280452245743464n
|
|
6194
6275
|
* new CairoInt64('0x6162636465666768').toBigInt(); // 7017280452245743464n
|
|
6195
6276
|
* new CairoInt64('abcdefgh').toBigInt(); // 7017280452245743464n the UTF-8 bytes of the text
|
|
6277
|
+
*
|
|
6278
|
+
* // a negative value, reached three ways
|
|
6279
|
+
* new CairoInt64(-5).toBigInt(); // -5n
|
|
6280
|
+
* new CairoInt64('-5').toBigInt(); // -5n
|
|
6281
|
+
* new CairoInt64('-0x5').toBigInt(); // -5n a sign, not the text "-0x5"
|
|
6196
6282
|
* ```
|
|
6197
6283
|
*/
|
|
6198
6284
|
declare class CairoInt64 {
|
|
@@ -6217,15 +6303,17 @@ declare class CairoInt64 {
|
|
|
6217
6303
|
/**
|
|
6218
6304
|
* Build from a number, a string or a boolean, refusing anything out of the i64 range.
|
|
6219
6305
|
*
|
|
6220
|
-
* A string is read as a number when it spells one — decimal or hexadecimal
|
|
6221
|
-
* otherwise. Text therefore only fits here up to 8 ASCII
|
|
6222
|
-
* makes a number past 9223372036854775807.
|
|
6306
|
+
* A string is read as a number when it spells one — decimal or hexadecimal, with or without a
|
|
6307
|
+
* leading minus sign — and as UTF-8 text otherwise. Text therefore only fits here up to 8 ASCII
|
|
6308
|
+
* characters : one more already makes a number past 9223372036854775807.
|
|
6223
6309
|
* @param {BigNumberish | boolean} data the value to carry, within [-9223372036854775808, 9223372036854775807]
|
|
6224
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
6310
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
6225
6311
|
* @example
|
|
6226
6312
|
* ```typescript
|
|
6227
6313
|
* const result = new CairoInt64('abcdefgh').toApiRequest();
|
|
6228
6314
|
* // result = ["7017280452245743464"]
|
|
6315
|
+
* const result2 = new CairoInt64('-5').toApiRequest();
|
|
6316
|
+
* // result2 = ["3618502788666131213697322783095070105623107215331596699973092056135872020476"]
|
|
6229
6317
|
* ```
|
|
6230
6318
|
*/
|
|
6231
6319
|
constructor(data: BigNumberish | boolean | unknown);
|
|
@@ -6234,6 +6322,9 @@ declare class CairoInt64 {
|
|
|
6234
6322
|
*
|
|
6235
6323
|
* Nothing here refuses a value : `validate` is what reads this number and decides. So an input
|
|
6236
6324
|
* far outside the i64 range comes back untouched rather than raising.
|
|
6325
|
+
*
|
|
6326
|
+
* A minus sign in front of a number makes it negative rather than text : `'-5'` and `'-0x5'` are
|
|
6327
|
+
* both -5. This holds for the signed integers only — for any other type, such a string is text.
|
|
6237
6328
|
* @param {BigNumberish | boolean} data the value to convert
|
|
6238
6329
|
* @returns {bigint} the number the input spells, of whatever size
|
|
6239
6330
|
* @example
|
|
@@ -6242,6 +6333,8 @@ declare class CairoInt64 {
|
|
|
6242
6333
|
* // result = 7017280452245743464n
|
|
6243
6334
|
* const result2 = CairoInt64.__processData('abcdefghi');
|
|
6244
6335
|
* // result2 = 1796423795774910326889n (past the i64 range, and returned all the same)
|
|
6336
|
+
* const result3 = CairoInt64.__processData('-0x5');
|
|
6337
|
+
* // result3 = -5n (a negative number, not the text "-0x5")
|
|
6245
6338
|
* ```
|
|
6246
6339
|
*/
|
|
6247
6340
|
static __processData(data: BigNumberish | boolean | unknown): bigint;
|
|
@@ -6303,11 +6396,11 @@ declare class CairoInt64 {
|
|
|
6303
6396
|
/**
|
|
6304
6397
|
* Throw unless the value can be carried by an i64.
|
|
6305
6398
|
*
|
|
6306
|
-
*
|
|
6307
|
-
* an array, a number with a decimal part, and a value outside [-9223372036854775808, 9223372036854775807]. A text string reaches
|
|
6399
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
6400
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [-9223372036854775808, 9223372036854775807]. A text string reaches
|
|
6308
6401
|
* that last check as the number its bytes spell, so `'abcdefghi'` is refused for being out of range.
|
|
6309
6402
|
* @param {BigNumberish | boolean} data the value to check
|
|
6310
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
6403
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
6311
6404
|
* @example
|
|
6312
6405
|
* ```typescript
|
|
6313
6406
|
* CairoInt64.validate(5000000000); // passes
|
|
@@ -6370,6 +6463,10 @@ declare class CairoInt64 {
|
|
|
6370
6463
|
* `'129445976596022050476432668810952994672'` and `'0x6162636465666768696a6b6c6d6e6f70'` give the same i128. A string that reads as text rather than as a
|
|
6371
6464
|
* number is taken for its UTF-8 bytes, which is why `'abcdefghijklmnop'` is 129445976596022050476432668810952994672 and not a rejected input.
|
|
6372
6465
|
*
|
|
6466
|
+
* A minus sign in front of a number is read as a sign, not as text : `'-5'` is -5, as `-5` and
|
|
6467
|
+
* `-5n` are. Only the signed integers read a string this way — for every other type, `'-5'` is
|
|
6468
|
+
* text, encoded or refused as such.
|
|
6469
|
+
*
|
|
6373
6470
|
* An already built instance is **not** an accepted input : handed back to the constructor it is
|
|
6374
6471
|
* seen as an object and refused. Inside the library it is `unwrapCairoScalar` that reduces an
|
|
6375
6472
|
* instance to its number before an abi slot receives it.
|
|
@@ -6380,6 +6477,11 @@ declare class CairoInt64 {
|
|
|
6380
6477
|
* new CairoInt128('129445976596022050476432668810952994672').toBigInt(); // 129445976596022050476432668810952994672n
|
|
6381
6478
|
* new CairoInt128('0x6162636465666768696a6b6c6d6e6f70').toBigInt(); // 129445976596022050476432668810952994672n
|
|
6382
6479
|
* new CairoInt128('abcdefghijklmnop').toBigInt(); // 129445976596022050476432668810952994672n the UTF-8 bytes of the text
|
|
6480
|
+
*
|
|
6481
|
+
* // a negative value, reached three ways
|
|
6482
|
+
* new CairoInt128(-5).toBigInt(); // -5n
|
|
6483
|
+
* new CairoInt128('-5').toBigInt(); // -5n
|
|
6484
|
+
* new CairoInt128('-0x5').toBigInt(); // -5n a sign, not the text "-0x5"
|
|
6383
6485
|
* ```
|
|
6384
6486
|
*/
|
|
6385
6487
|
declare class CairoInt128 {
|
|
@@ -6404,15 +6506,17 @@ declare class CairoInt128 {
|
|
|
6404
6506
|
/**
|
|
6405
6507
|
* Build from a number, a string or a boolean, refusing anything out of the i128 range.
|
|
6406
6508
|
*
|
|
6407
|
-
* A string is read as a number when it spells one — decimal or hexadecimal
|
|
6408
|
-
* otherwise. Text therefore only fits here up to 16 ASCII
|
|
6409
|
-
* makes a number past 170141183460469231731687303715884105727.
|
|
6509
|
+
* A string is read as a number when it spells one — decimal or hexadecimal, with or without a
|
|
6510
|
+
* leading minus sign — and as UTF-8 text otherwise. Text therefore only fits here up to 16 ASCII
|
|
6511
|
+
* characters : one more already makes a number past 170141183460469231731687303715884105727.
|
|
6410
6512
|
* @param {BigNumberish | boolean} data the value to carry, within [-170141183460469231731687303715884105728, 170141183460469231731687303715884105727]
|
|
6411
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
6513
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
6412
6514
|
* @example
|
|
6413
6515
|
* ```typescript
|
|
6414
6516
|
* const result = new CairoInt128('abcdefghijklmnop').toApiRequest();
|
|
6415
6517
|
* // result = ["129445976596022050476432668810952994672"]
|
|
6518
|
+
* const result2 = new CairoInt128('-5').toApiRequest();
|
|
6519
|
+
* // result2 = ["3618502788666131213697322783095070105623107215331596699973092056135872020476"]
|
|
6416
6520
|
* ```
|
|
6417
6521
|
*/
|
|
6418
6522
|
constructor(data: BigNumberish | boolean | unknown);
|
|
@@ -6421,6 +6525,9 @@ declare class CairoInt128 {
|
|
|
6421
6525
|
*
|
|
6422
6526
|
* Nothing here refuses a value : `validate` is what reads this number and decides. So an input
|
|
6423
6527
|
* far outside the i128 range comes back untouched rather than raising.
|
|
6528
|
+
*
|
|
6529
|
+
* A minus sign in front of a number makes it negative rather than text : `'-5'` and `'-0x5'` are
|
|
6530
|
+
* both -5. This holds for the signed integers only — for any other type, such a string is text.
|
|
6424
6531
|
* @param {BigNumberish | boolean} data the value to convert
|
|
6425
6532
|
* @returns {bigint} the number the input spells, of whatever size
|
|
6426
6533
|
* @example
|
|
@@ -6429,6 +6536,8 @@ declare class CairoInt128 {
|
|
|
6429
6536
|
* // result = 129445976596022050476432668810952994672n
|
|
6430
6537
|
* const result2 = CairoInt128.__processData('abcdefghijklmnopq');
|
|
6431
6538
|
* // result2 = 33138170008581644921966763215603966636145n (past the i128 range, and returned all the same)
|
|
6539
|
+
* const result3 = CairoInt128.__processData('-0x5');
|
|
6540
|
+
* // result3 = -5n (a negative number, not the text "-0x5")
|
|
6432
6541
|
* ```
|
|
6433
6542
|
*/
|
|
6434
6543
|
static __processData(data: BigNumberish | boolean | unknown): bigint;
|
|
@@ -6490,11 +6599,11 @@ declare class CairoInt128 {
|
|
|
6490
6599
|
/**
|
|
6491
6600
|
* Throw unless the value can be carried by an i128.
|
|
6492
6601
|
*
|
|
6493
|
-
*
|
|
6494
|
-
* an array, a number with a decimal part, and a value outside [-170141183460469231731687303715884105728, 170141183460469231731687303715884105727]. A text string reaches
|
|
6602
|
+
* Five things are refused, each with its own message : a null or undefined value, an object or
|
|
6603
|
+
* an array, a number with a decimal part, `'0x'`, and a value outside [-170141183460469231731687303715884105728, 170141183460469231731687303715884105727]. A text string reaches
|
|
6495
6604
|
* that last check as the number its bytes spell, so `'abcdefghijklmnopq'` is refused for being out of range.
|
|
6496
6605
|
* @param {BigNumberish | boolean} data the value to check
|
|
6497
|
-
* @throws {Error} when the value is null, undefined, an object, a decimal number, or out of range
|
|
6606
|
+
* @throws {Error} when the value is null, undefined, an object, a decimal number, `'0x'`, or out of range
|
|
6498
6607
|
* @example
|
|
6499
6608
|
* ```typescript
|
|
6500
6609
|
* CairoInt128.validate(5000000000); // passes
|
|
@@ -7973,6 +8082,10 @@ declare const RANGE_CONTRACT_ADDRESS: {
|
|
|
7973
8082
|
readonly min: bigint;
|
|
7974
8083
|
readonly max: bigint;
|
|
7975
8084
|
};
|
|
8085
|
+
declare const RANGE_CLASS_HASH: {
|
|
8086
|
+
readonly min: bigint;
|
|
8087
|
+
readonly max: bigint;
|
|
8088
|
+
};
|
|
7976
8089
|
declare const LegacyUDC: {
|
|
7977
8090
|
readonly ADDRESS: "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf";
|
|
7978
8091
|
readonly ENTRYPOINT: "deployContract";
|
|
@@ -8113,6 +8226,7 @@ declare const constants_MAX_STORAGE_ITEM_SIZE: typeof MAX_STORAGE_ITEM_SIZE;
|
|
|
8113
8226
|
declare const constants_OutsideExecutionCallerAny: typeof OutsideExecutionCallerAny;
|
|
8114
8227
|
declare const constants_PAYMASTER_RPC_NODES: typeof PAYMASTER_RPC_NODES;
|
|
8115
8228
|
declare const constants_PRIME: typeof PRIME;
|
|
8229
|
+
declare const constants_RANGE_CLASS_HASH: typeof RANGE_CLASS_HASH;
|
|
8116
8230
|
declare const constants_RANGE_CONTRACT_ADDRESS: typeof RANGE_CONTRACT_ADDRESS;
|
|
8117
8231
|
declare const constants_RANGE_ETH_ADDRESS: typeof RANGE_ETH_ADDRESS;
|
|
8118
8232
|
declare const constants_RANGE_FELT: typeof RANGE_FELT;
|
|
@@ -8139,7 +8253,7 @@ declare const constants_TEXT_TO_FELT_MAX_LEN: typeof TEXT_TO_FELT_MAX_LEN;
|
|
|
8139
8253
|
declare const constants_UDC: typeof UDC;
|
|
8140
8254
|
declare const constants_ZERO: typeof ZERO;
|
|
8141
8255
|
declare namespace constants {
|
|
8142
|
-
export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, type constants_ChannelDefaultOptions as ChannelDefaultOptions, type constants_ChannelDefaults as ChannelDefaults, type constants_ChannelMethodOptions as ChannelMethodOptions, constants_DEFAULT_GLOBAL_CONFIG as DEFAULT_GLOBAL_CONFIG, constants_HARDENING_4BYTES as HARDENING_4BYTES, constants_HARDENING_BYTE as HARDENING_BYTE, constants_IS_BROWSER as IS_BROWSER, constants_LegacyUDC as LegacyUDC, constants_MASK_250 as MASK_250, constants_MASK_31 as MASK_31, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, _NetworkName as NetworkName, constants_OutsideExecutionCallerAny as OutsideExecutionCallerAny, constants_PAYMASTER_RPC_NODES as PAYMASTER_RPC_NODES, constants_PRIME as PRIME, constants_RANGE_CONTRACT_ADDRESS as RANGE_CONTRACT_ADDRESS, constants_RANGE_ETH_ADDRESS as RANGE_ETH_ADDRESS, constants_RANGE_FELT as RANGE_FELT, constants_RANGE_I128 as RANGE_I128, constants_RANGE_I16 as RANGE_I16, constants_RANGE_I32 as RANGE_I32, constants_RANGE_I64 as RANGE_I64, constants_RANGE_I8 as RANGE_I8, constants_RANGE_U128 as RANGE_U128, constants_RANGE_U16 as RANGE_U16, constants_RANGE_U32 as RANGE_U32, constants_RANGE_U64 as RANGE_U64, constants_RANGE_U8 as RANGE_U8, constants_RANGE_U96 as RANGE_U96, constants_RPC_DEFAULT_NODES as RPC_DEFAULT_NODES, constants_SNIP9_V1_INTERFACE_ID as SNIP9_V1_INTERFACE_ID, constants_SNIP9_V2_INTERFACE_ID as SNIP9_V2_INTERFACE_ID, constants_SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS as SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS, constants_SYSTEM_MESSAGES as SYSTEM_MESSAGES, _StarknetChainId as StarknetChainId, type constants_SupportedCairoVersion as SupportedCairoVersion, _SupportedRpcVersion as SupportedRpcVersion, type constants_SupportedRpcVersion0_10 as SupportedRpcVersion0_10, type constants_SupportedTransactionVersion as SupportedTransactionVersion, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, _TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO };
|
|
8256
|
+
export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, type constants_ChannelDefaultOptions as ChannelDefaultOptions, type constants_ChannelDefaults as ChannelDefaults, type constants_ChannelMethodOptions as ChannelMethodOptions, constants_DEFAULT_GLOBAL_CONFIG as DEFAULT_GLOBAL_CONFIG, constants_HARDENING_4BYTES as HARDENING_4BYTES, constants_HARDENING_BYTE as HARDENING_BYTE, constants_IS_BROWSER as IS_BROWSER, constants_LegacyUDC as LegacyUDC, constants_MASK_250 as MASK_250, constants_MASK_31 as MASK_31, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, _NetworkName as NetworkName, constants_OutsideExecutionCallerAny as OutsideExecutionCallerAny, constants_PAYMASTER_RPC_NODES as PAYMASTER_RPC_NODES, constants_PRIME as PRIME, constants_RANGE_CLASS_HASH as RANGE_CLASS_HASH, constants_RANGE_CONTRACT_ADDRESS as RANGE_CONTRACT_ADDRESS, constants_RANGE_ETH_ADDRESS as RANGE_ETH_ADDRESS, constants_RANGE_FELT as RANGE_FELT, constants_RANGE_I128 as RANGE_I128, constants_RANGE_I16 as RANGE_I16, constants_RANGE_I32 as RANGE_I32, constants_RANGE_I64 as RANGE_I64, constants_RANGE_I8 as RANGE_I8, constants_RANGE_U128 as RANGE_U128, constants_RANGE_U16 as RANGE_U16, constants_RANGE_U32 as RANGE_U32, constants_RANGE_U64 as RANGE_U64, constants_RANGE_U8 as RANGE_U8, constants_RANGE_U96 as RANGE_U96, constants_RPC_DEFAULT_NODES as RPC_DEFAULT_NODES, constants_SNIP9_V1_INTERFACE_ID as SNIP9_V1_INTERFACE_ID, constants_SNIP9_V2_INTERFACE_ID as SNIP9_V2_INTERFACE_ID, constants_SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS as SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS, constants_SYSTEM_MESSAGES as SYSTEM_MESSAGES, _StarknetChainId as StarknetChainId, type constants_SupportedCairoVersion as SupportedCairoVersion, _SupportedRpcVersion as SupportedRpcVersion, type constants_SupportedRpcVersion0_10 as SupportedRpcVersion0_10, type constants_SupportedTransactionVersion as SupportedTransactionVersion, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, _TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO };
|
|
8143
8257
|
}
|
|
8144
8258
|
|
|
8145
8259
|
/** What a {@link SubscriptionChannel} needs: a socket to borrow, and how much to buffer. */
|
|
@@ -9801,15 +9915,25 @@ declare class WalletAccountV6 extends WalletAccountV5 {
|
|
|
9801
9915
|
executeWithProof(calls: AllowArray<Call>, proof?: STRK20_PROOF): Promise<RPCSPEC0104.AddInvokeTransactionResult>;
|
|
9802
9916
|
/**
|
|
9803
9917
|
* Get the private balances held by the user inside the STRK20 privacy pool.
|
|
9918
|
+
*
|
|
9919
|
+
* Reading a shielded balance requires the user approval, and this approval is time
|
|
9920
|
+
* limited : `validUntil` requests when it expires. When it is omitted, the wallet applies
|
|
9921
|
+
* its own default window.
|
|
9804
9922
|
* @param {Address[]} tokens - The tokens to get the private balance of. An empty array returns every shielded token.
|
|
9923
|
+
* @param {number} [validUntil] - Requested expiry of the balance read authorization, as a Unix timestamp in seconds. Omit it to let the wallet apply its default window.
|
|
9805
9924
|
* @returns {Promise<STRK20_BALANCE_ENTRY[]>} One entry per token.
|
|
9806
9925
|
* @example
|
|
9807
9926
|
* ```typescript
|
|
9808
9927
|
* const balances = await myWalletAccount.strk20Balances([strkAddress]);
|
|
9809
|
-
* // balances = [{ token: '0x4718...',
|
|
9928
|
+
* // balances = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]
|
|
9929
|
+
*
|
|
9930
|
+
* // Asking for a 5 minutes authorization window :
|
|
9931
|
+
* const expiry = Math.floor(Date.now() / 1000) + 300;
|
|
9932
|
+
* const fresh = await myWalletAccount.strk20Balances([strkAddress], expiry);
|
|
9933
|
+
* // fresh = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]
|
|
9810
9934
|
* ```
|
|
9811
9935
|
*/
|
|
9812
|
-
strk20Balances(tokens: Address[]): Promise<STRK20_BALANCE_ENTRY[]>;
|
|
9936
|
+
strk20Balances(tokens: Address[], validUntil?: number): Promise<STRK20_BALANCE_ENTRY[]>;
|
|
9813
9937
|
/**
|
|
9814
9938
|
* Build the Starknet call and the SNIP-36 zero-knowledge proof of a STRK20 transaction,
|
|
9815
9939
|
* without submitting it : the DAPP submits the returned call itself, and therefore pays
|
|
@@ -11296,13 +11420,17 @@ declare const isHexString: typeof isHex;
|
|
|
11296
11420
|
/**
|
|
11297
11421
|
* Convert BigNumberish to bigint
|
|
11298
11422
|
*
|
|
11423
|
+
* `'0x'`, which holds no digit, is refused with its own message rather than with `BigInt`'s.
|
|
11299
11424
|
* @param {BigNumberish} value value to convert
|
|
11300
11425
|
* @returns {BigInt} converted value
|
|
11426
|
+
* @throws {Error} when the value is `'0x'`, or anything else `BigInt` cannot read
|
|
11301
11427
|
* @example
|
|
11302
11428
|
* ```typescript
|
|
11303
11429
|
* const str = '123';
|
|
11304
11430
|
* const result = toBigInt(str);
|
|
11305
11431
|
* // result = 123n
|
|
11432
|
+
* toBigInt('0x');
|
|
11433
|
+
* // throws Error("Invalid input: '0x' holds no hexadecimal digit")
|
|
11306
11434
|
* ```
|
|
11307
11435
|
*/
|
|
11308
11436
|
declare function toBigInt(value: BigNumberish): bigint;
|
|
@@ -11380,22 +11508,22 @@ declare function toHex64(number: BigNumberish): string;
|
|
|
11380
11508
|
*/
|
|
11381
11509
|
declare function hexToDecimalString(hex: string): string;
|
|
11382
11510
|
/**
|
|
11383
|
-
* Asserts input is
|
|
11511
|
+
* Asserts input is within [lowerBound, upperBound], both bounds included.
|
|
11384
11512
|
*
|
|
11385
|
-
* The `inputName` parameter
|
|
11513
|
+
* The `inputName` parameter names the input in the assertion message.
|
|
11386
11514
|
* @param input Value to check
|
|
11387
|
-
* @param lowerBound Lower bound value
|
|
11388
|
-
* @param upperBound Upper bound value
|
|
11515
|
+
* @param lowerBound Lower bound value, included
|
|
11516
|
+
* @param upperBound Upper bound value, included
|
|
11389
11517
|
* @param inputName Name of the input for error message
|
|
11390
11518
|
* @throws Error if input is out of range
|
|
11391
11519
|
* @example
|
|
11392
11520
|
* ```typescript
|
|
11393
11521
|
* const input1:BigNumberish = 10;
|
|
11394
|
-
* assertInRange(input1, 5, 20, '
|
|
11522
|
+
* assertInRange(input1, 5, 20, 'amount')
|
|
11395
11523
|
*
|
|
11396
11524
|
* const input2: BigNumberish = 25;
|
|
11397
|
-
* assertInRange(input2, 5, 20, '
|
|
11398
|
-
* // throws Error:
|
|
11525
|
+
* assertInRange(input2, 5, 20, 'amount');
|
|
11526
|
+
* // throws Error: Value is out of amount range [5, 20]
|
|
11399
11527
|
* ```
|
|
11400
11528
|
*/
|
|
11401
11529
|
declare function assertInRange(input: BigNumberish, lowerBound: BigNumberish, upperBound: BigNumberish, inputName?: string): void;
|
|
@@ -11547,16 +11675,48 @@ declare function addPercent(number: BigNumberish, percent: number): bigint;
|
|
|
11547
11675
|
* ```
|
|
11548
11676
|
*/
|
|
11549
11677
|
declare function stringToSha256ToArrayBuff4(str: string): Uint8Array;
|
|
11678
|
+
/**
|
|
11679
|
+
* Test if a value is a `0x` prefix with no digit after it.
|
|
11680
|
+
*
|
|
11681
|
+
* `'0x'` is hexadecimal in form — it is how an EVM tool writes empty data — but it spells no
|
|
11682
|
+
* number : `BigInt('0x')` throws, `isBigNumberish` refuses it, and so does every Cairo type.
|
|
11683
|
+
* @param {unknown} value the value to test
|
|
11684
|
+
* @returns {boolean} true for `'0x'` and `'0X'`, false for anything else
|
|
11685
|
+
* @example
|
|
11686
|
+
* ```typescript
|
|
11687
|
+
* const result = num.isEmptyHex('0x');
|
|
11688
|
+
* // result = true
|
|
11689
|
+
* const result2 = num.isEmptyHex('0x0');
|
|
11690
|
+
* // result2 = false
|
|
11691
|
+
* ```
|
|
11692
|
+
*/
|
|
11693
|
+
declare function isEmptyHex(value: unknown): boolean;
|
|
11550
11694
|
/**
|
|
11551
11695
|
* Checks if a given value is of BigNumberish type.
|
|
11552
|
-
* 234, 234n, "234"
|
|
11696
|
+
* 234, 234n, "234" and "0xea" are valid ; a boolean is not, nor a string that spells no number —
|
|
11697
|
+
* `'0x'` included, which holds no digit.
|
|
11698
|
+
*
|
|
11699
|
+
* A number or a bigint passes whatever its sign, and a number whatever its decimal part : `-1`,
|
|
11700
|
+
* `-1n` and `1.5` are all accepted here, and it is the Cairo type receiving the value that refuses
|
|
11701
|
+
* what it cannot hold. A string is unsigned : it passes as decimal digits or as `0x` hexadecimal
|
|
11702
|
+
* only, so `'-1'` and `'1.5'` do not — to the library, such a string is text. The signed integer
|
|
11703
|
+
* classes, `CairoInt8` to `CairoInt128`, are the one place where a leading minus sign is read as a
|
|
11704
|
+
* sign.
|
|
11553
11705
|
* @param {unknown} input a value
|
|
11554
11706
|
* @returns {boolean} true if type of input is `BigNumberish`
|
|
11555
11707
|
* @example
|
|
11556
11708
|
* ```typescript
|
|
11557
11709
|
* const res = num.isBigNumberish("ZERO");
|
|
11558
11710
|
* // res = false
|
|
11559
|
-
*
|
|
11711
|
+
* const res2 = num.isBigNumberish(-1);
|
|
11712
|
+
* // res2 = true
|
|
11713
|
+
* const res3 = num.isBigNumberish('-1');
|
|
11714
|
+
* // res3 = false (a string is unsigned : this one is text)
|
|
11715
|
+
* const res4 = num.isBigNumberish(1.5);
|
|
11716
|
+
* // res4 = true (a number is not checked for a decimal part)
|
|
11717
|
+
* const res5 = num.isBigNumberish('0x');
|
|
11718
|
+
* // res5 = false (hexadecimal in form, but no digit)
|
|
11719
|
+
* ```
|
|
11560
11720
|
*/
|
|
11561
11721
|
declare function isBigNumberish(input: unknown): input is BigNumberish;
|
|
11562
11722
|
/**
|
|
@@ -11580,6 +11740,7 @@ declare const num_getNext: typeof getNext;
|
|
|
11580
11740
|
declare const num_hexToBytes: typeof hexToBytes;
|
|
11581
11741
|
declare const num_hexToDecimalString: typeof hexToDecimalString;
|
|
11582
11742
|
declare const num_isBigNumberish: typeof isBigNumberish;
|
|
11743
|
+
declare const num_isEmptyHex: typeof isEmptyHex;
|
|
11583
11744
|
declare const num_isHex: typeof isHex;
|
|
11584
11745
|
declare const num_isHexString: typeof isHexString;
|
|
11585
11746
|
declare const num_isStringWholeNumber: typeof isStringWholeNumber;
|
|
@@ -11592,7 +11753,7 @@ declare const num_toHexString: typeof toHexString;
|
|
|
11592
11753
|
declare const num_toStorageKey: typeof toStorageKey;
|
|
11593
11754
|
declare const num_tryToBigInt: typeof tryToBigInt;
|
|
11594
11755
|
declare namespace num {
|
|
11595
|
-
export { num_addPercent as addPercent, num_assertInRange as assertInRange, num_bigNumberishArrayToDecimalStringArray as bigNumberishArrayToDecimalStringArray, num_bigNumberishArrayToHexadecimalStringArray as bigNumberishArrayToHexadecimalStringArray, num_cleanHex as cleanHex, num_getDecimalString as getDecimalString, num_getHexString as getHexString, num_getHexStringArray as getHexStringArray, num_getNext as getNext, num_hexToBytes as hexToBytes, num_hexToDecimalString as hexToDecimalString, num_isBigNumberish as isBigNumberish, num_isHex as isHex, num_isHexString as isHexString, num_isStringWholeNumber as isStringWholeNumber, num_stringToSha256ToArrayBuff4 as stringToSha256ToArrayBuff4, num_toBigInt as toBigInt, num_toCairoBool as toCairoBool, num_toHex as toHex, num_toHex64 as toHex64, num_toHexString as toHexString, num_toStorageKey as toStorageKey, num_tryToBigInt as tryToBigInt };
|
|
11756
|
+
export { num_addPercent as addPercent, num_assertInRange as assertInRange, num_bigNumberishArrayToDecimalStringArray as bigNumberishArrayToDecimalStringArray, num_bigNumberishArrayToHexadecimalStringArray as bigNumberishArrayToHexadecimalStringArray, num_cleanHex as cleanHex, num_getDecimalString as getDecimalString, num_getHexString as getHexString, num_getHexStringArray as getHexStringArray, num_getNext as getNext, num_hexToBytes as hexToBytes, num_hexToDecimalString as hexToDecimalString, num_isBigNumberish as isBigNumberish, num_isEmptyHex as isEmptyHex, num_isHex as isHex, num_isHexString as isHexString, num_isStringWholeNumber as isStringWholeNumber, num_stringToSha256ToArrayBuff4 as stringToSha256ToArrayBuff4, num_toBigInt as toBigInt, num_toCairoBool as toCairoBool, num_toHex as toHex, num_toHex64 as toHex64, num_toHexString as toHexString, num_toStorageKey as toStorageKey, num_tryToBigInt as tryToBigInt };
|
|
11596
11757
|
}
|
|
11597
11758
|
|
|
11598
11759
|
/**
|
|
@@ -13634,7 +13795,7 @@ declare class CairoUint256 {
|
|
|
13634
13795
|
* A `Uint256` object is accepted here too : it already carries `low` and `high`, and both are
|
|
13635
13796
|
* checked as u128 rather than the whole being cut again.
|
|
13636
13797
|
* @param {BigNumberish | Uint256} data the value to carry, within [0, 2^256 - 1]
|
|
13637
|
-
* @throws {Error} when the value is null, undefined, of an unread type, or out of range
|
|
13798
|
+
* @throws {Error} when the value is null, undefined, text, `'0x'`, of an unread type, a decimal number, or out of range
|
|
13638
13799
|
* @example
|
|
13639
13800
|
* ```typescript
|
|
13640
13801
|
* const result = new CairoUint256(2n ** 130n + 5n).toApiRequest();
|
|
@@ -13646,7 +13807,7 @@ declare class CairoUint256 {
|
|
|
13646
13807
|
* Build from the two halves as they arrive, already cut (Api response).
|
|
13647
13808
|
* @param {BigNumberish} low the bottom 128 bits
|
|
13648
13809
|
* @param {BigNumberish} high the top 128 bits
|
|
13649
|
-
* @throws {Error} when either half is
|
|
13810
|
+
* @throws {Error} when either half is null, undefined, text, `'0x'`, not a number, a decimal number, or outside the u128 range
|
|
13650
13811
|
* @example
|
|
13651
13812
|
* ```typescript
|
|
13652
13813
|
* const result = new CairoUint256(5, 4).toBigInt();
|
|
@@ -13658,16 +13819,22 @@ declare class CairoUint256 {
|
|
|
13658
13819
|
* Throw unless a whole value can be represented as a u256, and give back its number.
|
|
13659
13820
|
*
|
|
13660
13821
|
* A string is only accepted while it spells a number, in base 10 or 16 : one that does not is
|
|
13661
|
-
* refused
|
|
13822
|
+
* refused as text, and `'0x'`, which holds no digit, is refused too. So is an object, a `Uint256`
|
|
13823
|
+
* one included : its two halves are checked by {@link CairoUint256.validateProps}, which is what
|
|
13824
|
+
* the constructor calls for it.
|
|
13662
13825
|
* @param {BigNumberish} bigNumberish the value to check
|
|
13663
13826
|
* @returns {bigint} the value as a number, once accepted
|
|
13664
|
-
* @throws {Error} when the value is null, undefined, of an unread type, or out of range
|
|
13827
|
+
* @throws {Error} when the value is null, undefined, text, `'0x'`, of an unread type, a decimal number, or out of range
|
|
13665
13828
|
* @example
|
|
13666
13829
|
* ```typescript
|
|
13667
13830
|
* const result = CairoUint256.validate(255);
|
|
13668
13831
|
* // result = 255n
|
|
13669
13832
|
* CairoUint256.validate(-1);
|
|
13670
13833
|
* // throws Error("bigNumberish is smaller than UINT_256_MIN")
|
|
13834
|
+
* CairoUint256.validate('abc');
|
|
13835
|
+
* // throws Error("Invalid input: a u256 cannot be built from text")
|
|
13836
|
+
* CairoUint256.validate(1.5);
|
|
13837
|
+
* // throws Error("Invalid input: decimal numbers are not supported, only integers")
|
|
13671
13838
|
* ```
|
|
13672
13839
|
*/
|
|
13673
13840
|
static validate(bigNumberish: BigNumberish | unknown): bigint;
|
|
@@ -13679,13 +13846,17 @@ declare class CairoUint256 {
|
|
|
13679
13846
|
* @param {BigNumberish} low the bottom 128 bits
|
|
13680
13847
|
* @param {BigNumberish} high the top 128 bits
|
|
13681
13848
|
* @returns {{low: bigint, high: bigint}} the two halves as numbers
|
|
13682
|
-
* @throws {Error} when either half is outside the u128 range
|
|
13849
|
+
* @throws {Error} when either half is null, undefined, text, `'0x'`, not a number, a decimal number, or outside the u128 range
|
|
13683
13850
|
* @example
|
|
13684
13851
|
* ```typescript
|
|
13685
13852
|
* const result = CairoUint256.validateProps(5, 4);
|
|
13686
13853
|
* // result = { low: 5n, high: 4n }
|
|
13687
13854
|
* CairoUint256.validateProps(-1, 4);
|
|
13688
13855
|
* // throws Error("low is out of range UINT_256_LOW_MIN - UINT_256_LOW_MAX")
|
|
13856
|
+
* CairoUint256.validateProps(1.5, 4);
|
|
13857
|
+
* // throws Error("low must be an integer")
|
|
13858
|
+
* CairoUint256.validateProps('abc', 4);
|
|
13859
|
+
* // throws Error("low cannot be built from text")
|
|
13689
13860
|
* ```
|
|
13690
13861
|
*/
|
|
13691
13862
|
static validateProps(low: BigNumberish, high: BigNumberish): {
|
|
@@ -14097,11 +14268,19 @@ declare class CairoFixedArray {
|
|
|
14097
14268
|
* The bytes are held right-aligned in a fixed 31-byte buffer, so the length of the input is not
|
|
14098
14269
|
* recoverable from the value — `'0x41'` and `'0x0041'` give the same bytes31. Reach for
|
|
14099
14270
|
* `CairoByteArray` when the byte count has to survive.
|
|
14271
|
+
*
|
|
14272
|
+
* `'0x'` holds no byte at all, and is the same bytes31 as the empty string `''`. Where a number
|
|
14273
|
+
* type refuses `'0x'`, a type made of bytes reads it as empty bytes, which is how an EVM tool
|
|
14274
|
+
* writes them.
|
|
14100
14275
|
* @example
|
|
14101
14276
|
* ```typescript
|
|
14102
14277
|
* // the same five characters, read two ways
|
|
14103
14278
|
* new CairoBytes31('12345').toHexString(); // "0x3039" the number 12345
|
|
14104
14279
|
* CairoBytes31.fromText('12345').toHexString(); // "0x3132333435" the text '12345'
|
|
14280
|
+
*
|
|
14281
|
+
* // no byte at all, written two ways
|
|
14282
|
+
* new CairoBytes31('').toApiRequest(); // ["0"]
|
|
14283
|
+
* new CairoBytes31('0x').toApiRequest(); // ["0"]
|
|
14105
14284
|
* ```
|
|
14106
14285
|
*/
|
|
14107
14286
|
declare class CairoBytes31 {
|
|
@@ -14432,16 +14611,18 @@ declare class CairoFelt252 {
|
|
|
14432
14611
|
/**
|
|
14433
14612
|
* Throw unless the value can be carried by a felt252.
|
|
14434
14613
|
*
|
|
14435
|
-
* Null, undefined
|
|
14436
|
-
* message, then the value is converted and its range checked. A negative number does not
|
|
14437
|
-
* that range check : converting it fails earlier, and the message comes from the conversion.
|
|
14614
|
+
* Null, undefined, any type this class does not read, and `'0x'` are refused first, each with its
|
|
14615
|
+
* own message, then the value is converted and its range checked. A negative number does not
|
|
14616
|
+
* reach that range check : converting it fails earlier, and the message comes from the conversion.
|
|
14438
14617
|
* @param {BigNumberish | boolean} data the value to check
|
|
14439
|
-
* @throws {Error} when the value is null, undefined, of an unread type, or outside [0, P)
|
|
14618
|
+
* @throws {Error} when the value is null, undefined, of an unread type, `'0x'`, or outside [0, P)
|
|
14440
14619
|
* @example
|
|
14441
14620
|
* ```typescript
|
|
14442
14621
|
* CairoFelt252.validate('Hello'); // passes
|
|
14443
14622
|
* CairoFelt252.validate({});
|
|
14444
14623
|
* // throws Error("Unsupported data type 'object' for felt252. Expected string, number, bigint, or boolean")
|
|
14624
|
+
* CairoFelt252.validate('0x');
|
|
14625
|
+
* // throws Error("Invalid input: '0x' holds no hexadecimal digit")
|
|
14445
14626
|
* CairoFelt252.validate(-1);
|
|
14446
14627
|
* // throws Error("Cannot convert negative bigint -1 to Uint8Array")
|
|
14447
14628
|
* ```
|
|
@@ -14499,6 +14680,10 @@ declare class CairoFelt252 {
|
|
|
14499
14680
|
* A ByteArray is **not** Cairo's string type. It carries bytes, and text is only one of the things
|
|
14500
14681
|
* those bytes can mean — which is why the constructor reads a string the way calldata does, and why
|
|
14501
14682
|
* text has a door of its own, {@link CairoByteArray.fromText}.
|
|
14683
|
+
*
|
|
14684
|
+
* `'0x'` holds no byte at all, and is the same ByteArray as the empty string `''`. Where a number
|
|
14685
|
+
* type refuses `'0x'`, a type made of bytes reads it as empty bytes, which is how an EVM tool
|
|
14686
|
+
* writes them.
|
|
14502
14687
|
* @example
|
|
14503
14688
|
* ```typescript
|
|
14504
14689
|
* // the same four characters, read four ways
|
|
@@ -14506,6 +14691,10 @@ declare class CairoFelt252 {
|
|
|
14506
14691
|
* new CairoByteArray('12345').toHexString(); // "0x3039" the number 12345
|
|
14507
14692
|
* new CairoByteArray('0x4142').toHexString(); // "0x4142" the bytes 0x41 0x42
|
|
14508
14693
|
* CairoByteArray.fromText('12345').toHexString(); // "0x3132333435" the text '12345'
|
|
14694
|
+
*
|
|
14695
|
+
* // no byte at all, written two ways
|
|
14696
|
+
* new CairoByteArray('').toApiRequest(); // ["0", "0", "0"]
|
|
14697
|
+
* new CairoByteArray('0x').toApiRequest(); // ["0", "0", "0"]
|
|
14509
14698
|
* ```
|
|
14510
14699
|
*/
|
|
14511
14700
|
declare class CairoByteArray {
|
|
@@ -14841,7 +15030,7 @@ declare class CairoEthAddress {
|
|
|
14841
15030
|
/**
|
|
14842
15031
|
* Build from a number or a numeric string, refusing text and anything wider than 160 bits.
|
|
14843
15032
|
* @param {BigNumberish | boolean} data the address to carry, within [0, 2^160 - 1]
|
|
14844
|
-
* @throws {Error} when the value is text,
|
|
15033
|
+
* @throws {Error} when the value is text, a decimal number, not a felt252 input, or out of the EthAddress range
|
|
14845
15034
|
* @example
|
|
14846
15035
|
* ```typescript
|
|
14847
15036
|
* const result = new CairoEthAddress('0x1234').toApiRequest();
|
|
@@ -14888,10 +15077,12 @@ declare class CairoEthAddress {
|
|
|
14888
15077
|
* Throw unless the value can be carried by an EthAddress.
|
|
14889
15078
|
*
|
|
14890
15079
|
* Text is refused first, since an address spelled as words is a mistake rather than a value to
|
|
14891
|
-
* encode
|
|
14892
|
-
*
|
|
15080
|
+
* encode, then a number with a decimal part. A number or a bigint is read as it is, so that a
|
|
15081
|
+
* negative one reaches the range check below. Anything else is read as a felt252 — which is what
|
|
15082
|
+
* refuses a null, an object or an unsupported type. The value is finally checked against the 160
|
|
15083
|
+
* bits an Ethereum address occupies.
|
|
14893
15084
|
* @param {BigNumberish | boolean} data the value to check
|
|
14894
|
-
* @throws {Error} when the value is text,
|
|
15085
|
+
* @throws {Error} when the value is text, a decimal number, not a felt252 input, or out of the EthAddress range
|
|
14895
15086
|
* @example
|
|
14896
15087
|
* ```typescript
|
|
14897
15088
|
* CairoEthAddress.validate('0x1234'); // passes
|
|
@@ -14899,6 +15090,8 @@ declare class CairoEthAddress {
|
|
|
14899
15090
|
* // throws Error("Invalid input: an EthAddress cannot be built from text")
|
|
14900
15091
|
* CairoEthAddress.validate(2n ** 160n);
|
|
14901
15092
|
* // throws Error("Value is out of EthAddress range [0, 1461501637330902918203684832716283019655932542975]")
|
|
15093
|
+
* CairoEthAddress.validate(-1);
|
|
15094
|
+
* // throws Error("Value is out of EthAddress range [0, 1461501637330902918203684832716283019655932542975]")
|
|
14902
15095
|
* ```
|
|
14903
15096
|
*/
|
|
14904
15097
|
static validate(data: BigNumberish | boolean | unknown): void;
|
|
@@ -15060,13 +15253,17 @@ declare class CairoSecp256k1Point {
|
|
|
15060
15253
|
* the constructor needs it, and computing it twice would mean splitting a 512-bit value twice.
|
|
15061
15254
|
* @param {BigNumberish} input the 512-bit value to check
|
|
15062
15255
|
* @returns {bigint} the value, once checked
|
|
15063
|
-
* @throws {Error} when the value is null, undefined, of an unread type, or outside [0, 2^512 - 1]
|
|
15256
|
+
* @throws {Error} when the value is null, undefined, text, `'0x'`, of an unread type, a decimal number, or outside [0, 2^512 - 1]
|
|
15064
15257
|
* @example
|
|
15065
15258
|
* ```typescript
|
|
15066
15259
|
* const result = CairoSecp256k1Point.validate('0x1234');
|
|
15067
15260
|
* // result = 4660n
|
|
15068
15261
|
* CairoSecp256k1Point.validate(SECP256K1_POINT_MAX + 1n);
|
|
15069
15262
|
* // throws Error("input is bigger than SECP256K1_POINT_MAX")
|
|
15263
|
+
* CairoSecp256k1Point.validate('abc');
|
|
15264
|
+
* // throws Error("Invalid input: a Secp256k1Point cannot be built from text")
|
|
15265
|
+
* CairoSecp256k1Point.validate(1.5);
|
|
15266
|
+
* // throws Error("Invalid input: decimal numbers are not supported, only integers")
|
|
15070
15267
|
* ```
|
|
15071
15268
|
*/
|
|
15072
15269
|
static validate(input: BigNumberish | unknown): bigint;
|
|
@@ -15077,13 +15274,17 @@ declare class CairoSecp256k1Point {
|
|
|
15077
15274
|
* @param {BigNumberish} yLow the low 128 bits of y
|
|
15078
15275
|
* @param {BigNumberish} yHigh the high 128 bits of y
|
|
15079
15276
|
* @returns {{xLow: bigint, xHigh: bigint, yLow: bigint, yHigh: bigint}} the four limbs, checked
|
|
15080
|
-
* @throws {Error} when a limb is null, undefined, not a number, negative, or wider than 128 bits
|
|
15277
|
+
* @throws {Error} when a limb is null, undefined, text, `'0x'`, not a number, a decimal number, negative, or wider than 128 bits
|
|
15081
15278
|
* @example
|
|
15082
15279
|
* ```typescript
|
|
15083
15280
|
* const result = CairoSecp256k1Point.validateProps(1, 2, 3, 4);
|
|
15084
15281
|
* // result = { xLow: 1n, xHigh: 2n, yLow: 3n, yHigh: 4n }
|
|
15085
15282
|
* CairoSecp256k1Point.validateProps(1, 2, 3, 2n ** 128n);
|
|
15086
15283
|
* // throws Error("yHigh must fit in 128 bits")
|
|
15284
|
+
* CairoSecp256k1Point.validateProps(1.5, 2, 3, 4);
|
|
15285
|
+
* // throws Error("xLow must be an integer")
|
|
15286
|
+
* CairoSecp256k1Point.validateProps('abc', 2, 3, 4);
|
|
15287
|
+
* // throws Error("xLow cannot be built from text")
|
|
15087
15288
|
* ```
|
|
15088
15289
|
*/
|
|
15089
15290
|
static validateProps(xLow: BigNumberish, xHigh: BigNumberish, yLow: BigNumberish, yHigh: BigNumberish): {
|
|
@@ -15199,9 +15400,9 @@ declare class CairoSecp256k1Point {
|
|
|
15199
15400
|
* A Cairo `core::starknet::class_hash::ClassHash` : the hash identifying a declared class.
|
|
15200
15401
|
*
|
|
15201
15402
|
* On the wire it is a field element like any other, so what this class adds over
|
|
15202
|
-
* {@link CairoFelt252} is the bound the
|
|
15203
|
-
*
|
|
15204
|
-
* the
|
|
15403
|
+
* {@link CairoFelt252} is the bound of the Cairo `ClassHash` type : [0, 2^251), the same range as
|
|
15404
|
+
* the Cairo type of an address, and narrower than the field. The 252-bit bound the RPC spec states
|
|
15405
|
+
* is looser, and never the one that binds.
|
|
15205
15406
|
*
|
|
15206
15407
|
* A number, a bigint, a decimal string and a hexadecimal string are all read as the same number.
|
|
15207
15408
|
* Text is **not** an accepted input : a class hash spelled as words is a mistake, not a value.
|
|
@@ -15233,9 +15434,9 @@ declare class CairoClassHash {
|
|
|
15233
15434
|
*/
|
|
15234
15435
|
static abiSelector: "core::starknet::class_hash::ClassHash";
|
|
15235
15436
|
/**
|
|
15236
|
-
* Build from a number or a numeric string, refusing text and anything
|
|
15237
|
-
* @param {BigNumberish | boolean} data the hash to carry, within [0, 2^
|
|
15238
|
-
* @throws {Error} when the value is text,
|
|
15437
|
+
* Build from a number or a numeric string, refusing text and anything outside the ClassHash range.
|
|
15438
|
+
* @param {BigNumberish | boolean} data the hash to carry, within [0, 2^251 - 1]
|
|
15439
|
+
* @throws {Error} when the value is text, a decimal number, not a felt252 input, or out of the ClassHash range
|
|
15239
15440
|
* @example
|
|
15240
15441
|
* ```typescript
|
|
15241
15442
|
* const result = new CairoClassHash('0x1234').toApiRequest();
|
|
@@ -15281,16 +15482,21 @@ declare class CairoClassHash {
|
|
|
15281
15482
|
/**
|
|
15282
15483
|
* Throw unless the value can be carried by a ClassHash.
|
|
15283
15484
|
*
|
|
15284
|
-
* Text is refused first, then
|
|
15285
|
-
*
|
|
15286
|
-
* a
|
|
15485
|
+
* Text is refused first, then a number with a decimal part. A number or a bigint is read as it
|
|
15486
|
+
* is, so that a negative one reaches the range check. Anything else is read as a felt252 — which
|
|
15487
|
+
* is what refuses a null, an object or an unsupported type. The value is finally checked against
|
|
15488
|
+
* the range of the Cairo `ClassHash` type, [0, 2^251), which is narrower than the field.
|
|
15287
15489
|
* @param {BigNumberish | boolean} data the value to check
|
|
15288
|
-
* @throws {Error} when the value is text,
|
|
15490
|
+
* @throws {Error} when the value is text, a decimal number, not a felt252 input, or out of the ClassHash range
|
|
15289
15491
|
* @example
|
|
15290
15492
|
* ```typescript
|
|
15291
15493
|
* CairoClassHash.validate('0x1234'); // passes
|
|
15292
15494
|
* CairoClassHash.validate('abc');
|
|
15293
15495
|
* // throws Error("Invalid input: a ClassHash cannot be built from text")
|
|
15496
|
+
* CairoClassHash.validate(2n ** 251n);
|
|
15497
|
+
* // throws Error("Value is out of ClassHash range [0, 3618502788666131106986593281521497120414687020801267626233049500247285301247]")
|
|
15498
|
+
* CairoClassHash.validate(-1);
|
|
15499
|
+
* // throws Error("Value is out of ClassHash range [0, 3618502788666131106986593281521497120414687020801267626233049500247285301247]")
|
|
15294
15500
|
* ```
|
|
15295
15501
|
*/
|
|
15296
15502
|
static validate(data: BigNumberish | boolean | unknown): void;
|
|
@@ -15377,7 +15583,7 @@ declare class CairoContractAddress {
|
|
|
15377
15583
|
/**
|
|
15378
15584
|
* Build from a number or a numeric string, refusing text and anything wider than 252 bits.
|
|
15379
15585
|
* @param {BigNumberish | boolean} data the address to carry, within [0, 2^252 - 1]
|
|
15380
|
-
* @throws {Error} when the value is text,
|
|
15586
|
+
* @throws {Error} when the value is text, a decimal number, not a felt252 input, or out of range
|
|
15381
15587
|
* @example
|
|
15382
15588
|
* ```typescript
|
|
15383
15589
|
* const result = new CairoContractAddress('0x1234').toApiRequest();
|
|
@@ -15423,11 +15629,12 @@ declare class CairoContractAddress {
|
|
|
15423
15629
|
/**
|
|
15424
15630
|
* Throw unless the value can be carried by a ContractAddress.
|
|
15425
15631
|
*
|
|
15426
|
-
* Text is refused first, then
|
|
15427
|
-
*
|
|
15428
|
-
* is
|
|
15632
|
+
* Text is refused first, then a number with a decimal part. A number or a bigint is read as it
|
|
15633
|
+
* is, so that a negative one reaches the range check. Anything else is read as a felt252 — which
|
|
15634
|
+
* is what refuses a null, an object or an unsupported type. The value is finally checked against
|
|
15635
|
+
* the bound an address has, which is narrower than the field.
|
|
15429
15636
|
* @param {BigNumberish | boolean} data the value to check
|
|
15430
|
-
* @throws {Error} when the value is text,
|
|
15637
|
+
* @throws {Error} when the value is text, a decimal number, not a felt252 input, or out of range
|
|
15431
15638
|
* @example
|
|
15432
15639
|
* ```typescript
|
|
15433
15640
|
* CairoContractAddress.validate('0x1234'); // passes
|
|
@@ -15435,6 +15642,8 @@ declare class CairoContractAddress {
|
|
|
15435
15642
|
* // throws Error("Invalid input: a ContractAddress cannot be built from text")
|
|
15436
15643
|
* CairoContractAddress.validate(2n ** 251n);
|
|
15437
15644
|
* // throws Error("Value is out of ContractAddress range [0, 3618502788666131106986593281521497120414687020801267626233049500247285300991]")
|
|
15645
|
+
* CairoContractAddress.validate(-1);
|
|
15646
|
+
* // throws Error("Value is out of ContractAddress range [0, 3618502788666131106986593281521497120414687020801267626233049500247285300991]")
|
|
15438
15647
|
* ```
|
|
15439
15648
|
*/
|
|
15440
15649
|
static validate(data: BigNumberish | boolean | unknown): void;
|
|
@@ -17056,12 +17265,14 @@ declare function addAddressPadding(address: BigNumberish): string;
|
|
|
17056
17265
|
/**
|
|
17057
17266
|
* Check the validity of a Starknet address, and format it as a hex number: '0x' and 64 characters, adding leading zeros if necessary.
|
|
17058
17267
|
*
|
|
17268
|
+
* A string is read as hexadecimal, with or without its `0x` prefix — so `'31'` is 0x31 — and one
|
|
17269
|
+
* holding anything but hexadecimal digits, `'0x'` included, is refused as a malformed address.
|
|
17059
17270
|
* @param {BigNumberish} address
|
|
17060
17271
|
* @returns {string} Hex string: 0x followed by 64 characters. No upper case characters in the response.
|
|
17061
17272
|
* @throws address argument must be a valid address inside the address range bound
|
|
17062
17273
|
* @example
|
|
17063
17274
|
* ```typescript
|
|
17064
|
-
* const result = [31, 0x1f, '31', '0x1f', '0x90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf'].map(
|
|
17275
|
+
* const result = [31, 0x1f, '31', '0x1f', '0x90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf'].map(validateAndParseAddress);
|
|
17065
17276
|
* // result = [
|
|
17066
17277
|
* // '0x000000000000000000000000000000000000000000000000000000000000001f',
|
|
17067
17278
|
* // '0x000000000000000000000000000000000000000000000000000000000000001f',
|
|
@@ -17069,6 +17280,8 @@ declare function addAddressPadding(address: BigNumberish): string;
|
|
|
17069
17280
|
* // '0x000000000000000000000000000000000000000000000000000000000000001f',
|
|
17070
17281
|
* // '0x0000090591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf'
|
|
17071
17282
|
* // ]
|
|
17283
|
+
* validateAndParseAddress('test');
|
|
17284
|
+
* // throws Error("Invalid Address Format")
|
|
17072
17285
|
* ```
|
|
17073
17286
|
*/
|
|
17074
17287
|
declare function validateAndParseAddress(address: BigNumberish): string;
|
|
@@ -17437,7 +17650,23 @@ declare function signMessage(walletWSF: WalletWithStarknetFeatures$1, typedData:
|
|
|
17437
17650
|
declare function supportedSpecs(walletWSF: WalletWithStarknetFeatures$1): Promise<SpecVersion[]>;
|
|
17438
17651
|
declare function supportedWalletApi(walletWSF: WalletWithStarknetFeatures$1): Promise<API_VERSION$1[]>;
|
|
17439
17652
|
declare function subscribeWalletEvent(walletWSF: WalletWithStarknetFeatures$1, callback: (change: StandardEventsChangeProperties$1) => void): () => void;
|
|
17440
|
-
|
|
17653
|
+
/**
|
|
17654
|
+
* Get the private balances held by the user inside the STRK20 privacy pool.
|
|
17655
|
+
*
|
|
17656
|
+
* Reading a shielded balance requires the user approval, and this approval is time limited :
|
|
17657
|
+
* `valid_until` requests when it expires. When it is omitted, the wallet applies its own
|
|
17658
|
+
* default window.
|
|
17659
|
+
* @param {WalletWithStarknetFeaturesV6} walletWSF - The get-starknet V6 wallet object to use.
|
|
17660
|
+
* @param {Address[]} tokens - The tokens to get the private balance of. An empty array returns every shielded token.
|
|
17661
|
+
* @param {number} [valid_until] - Requested expiry of the balance read authorization, as a Unix timestamp in seconds. Omit it to let the wallet apply its default window.
|
|
17662
|
+
* @returns {Promise<STRK20_BALANCE_ENTRY[]>} One entry per token.
|
|
17663
|
+
* @example
|
|
17664
|
+
* ```typescript
|
|
17665
|
+
* const balances = await strk20Balances(walletWSF, [strkAddress]);
|
|
17666
|
+
* // balances = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]
|
|
17667
|
+
* ```
|
|
17668
|
+
*/
|
|
17669
|
+
declare function strk20Balances(walletWSF: WalletWithStarknetFeatures$1, tokens: Address[], valid_until?: number): Promise<STRK20_BALANCE_ENTRY[]>;
|
|
17441
17670
|
declare function strk20PrepareInvoke(walletWSF: WalletWithStarknetFeatures$1, actions: STRK20_ACTION$1[], simulate?: boolean): Promise<STRK20_CALL_AND_PROOF$1>;
|
|
17442
17671
|
declare function strk20InvokeTransaction(walletWSF: WalletWithStarknetFeatures$1, actions: STRK20_ACTION$1[]): Promise<{
|
|
17443
17672
|
transaction_hash: string;
|