Namespace: num
References​
BigNumberish​
Re-exports BigNumberish
Functions​
isHex​
â–¸ isHex(hex
): boolean
Test if string is hex-string
Parameters​
Name | Type | Description |
---|---|---|
hex | string | hex-string |
Returns​
boolean
Defined in​
toBigInt​
â–¸ toBigInt(value
): bigint
Convert BigNumberish to bigint
Parameters​
Name | Type |
---|---|
value | BigNumberish |
Returns​
bigint
Defined in​
isBigInt​
â–¸ isBigInt(value
): value is bigint
Test if value is bigint
Parameters​
Name | Type |
---|---|
value | any |
Returns​
value is bigint
Defined in​
toHex​
â–¸ toHex(number
): string
Convert BigNumberish to hex-string
Parameters​
Name | Type |
---|---|
number | BigNumberish |
Returns​
string
format: hex-string
Defined in​
toStorageKey​
â–¸ toStorageKey(number
): string
Convert BigNumberish to storage-key-string
Same as toHex but conforming to the STORAGE_KEY pattern ^0x0[0-7]{1}[a-fA-F0-9]{0,62}$
.
A storage key is represented as up to 62 hex digits, 3 bits, and 5 leading zeroes:
0x0 + [0-7] + 62 hex = 0x + 64 hex
Parameters​
Name | Type |
---|---|
number | BigNumberish |
Returns​
string
format: storage-key-string
Defined in​
hexToDecimalString​
â–¸ hexToDecimalString(hex
): string
Convert hexadecimal string to decimal string
Parameters​
Name | Type | Description |
---|---|---|
hex | string | hex-string |
Returns​
string
format: decimal string
Defined in​
assertInRange​
â–¸ assertInRange(input
, lowerBound
, upperBound
, inputName?
): void
Asserts input is equal to or greater then lowerBound and lower then upperBound.
The inputName
parameter is used in the assertion message.
Parameters​
Name | Type | Default value |
---|---|---|
input | BigNumberish | undefined |
lowerBound | BigNumberish | undefined |
upperBound | BigNumberish | undefined |
inputName | string | '' |
Returns​
void
Defined in​
bigNumberishArrayToDecimalStringArray​
â–¸ bigNumberishArrayToDecimalStringArray(rawCalldata
): string
[]
Convert BigNumberish array to decimal string array
Parameters​
Name | Type |
---|---|
rawCalldata | BigNumberish [] |
Returns​
string
[]
format: decimal string array
Defined in​
bigNumberishArrayToHexadecimalStringArray​
â–¸ bigNumberishArrayToHexadecimalStringArray(rawCalldata
): string
[]
Convert BigNumberish array to hexadecimal string array
Parameters​
Name | Type |
---|---|
rawCalldata | BigNumberish [] |
Returns​
string
[]
format: hex-string array
Defined in​
getDecimalString​
â–¸ getDecimalString(value
): string
Convert string to decimal string
Parameters​
Name | Type |
---|---|
value | string |
Returns​
string
format: decimal string
Defined in​
getHexString​
â–¸ getHexString(value
): string
Convert string to hexadecimal string
Parameters​
Name | Type |
---|---|
value | string |
Returns​
string
format: hex-string
Defined in​
getHexStringArray​
â–¸ getHexStringArray(value
): string
[]
Convert string array to hex-string array
Parameters​
Name | Type |
---|---|
value | string [] |
Returns​
string
[]
format: hex-string array
Defined in​
hexToBytes​
â–¸ hexToBytes(value
): Uint8Array
Convert hex-string to an array of Bytes (Uint8Array)
Parameters​
Name | Type | Description |
---|---|---|
value | string | hex-string |
Returns​
Uint8Array
Defined in​
toHexString​
â–¸ toHexString(number
): string
Alias of ToHex
Parameters​
Name | Type |
---|---|
number | BigNumberish |
Returns​
string
Defined in​
cleanHex​
â–¸ cleanHex(hex
): string
Remove hex string leading zero and lowercase it
Example
'0x01A...' -> '0x1a..'
Parameters​
Name | Type | Description |
---|---|---|
hex | string | hex-string |
Returns​
string
format: hex-string
Defined in​
isStringWholeNumber​
â–¸ isStringWholeNumber(value
): boolean
Test if string is whole number (0, 1, 2, 3...)
Parameters​
Name | Type |
---|---|
value | string |
Returns​
boolean
Defined in​
toCairoBool​
â–¸ toCairoBool(value
): string
Convert boolean to "0" or "1"
Parameters​
Name | Type |
---|---|
value | boolean |
Returns​
string