Skip to main content
Version: 5.14.1

Namespace: num

References​

BigNumberish​

Re-exports BigNumberish

Functions​

isHex​

â–¸ isHex(hex): boolean

Parameters​

NameType
hexstring

Returns​

boolean

Defined in​

src/utils/num.ts:10


toBigInt​

â–¸ toBigInt(value): bigint

Parameters​

NameType
valueBigNumberish

Returns​

bigint

Defined in​

src/utils/num.ts:14


isBigInt​

â–¸ isBigInt(value): value is bigint

Parameters​

NameType
valueany

Returns​

value is bigint

Defined in​

src/utils/num.ts:18


toHex​

â–¸ toHex(number): string

Parameters​

NameType
numberBigNumberish

Returns​

string

Defined in​

src/utils/num.ts:22


toStorageKey​

â–¸ toStorageKey(number): string

Convert BigNumberish to STORAGE_KEY Same as toHex but conforming pattern STORAGE_KEY pattern ^0x0[0-7]{1}[a-fA-F0-9]{0,62}$ A storage key. Represented as up to 62 hex digits, 3 bits, and 5 leading zeroes. 0x0 + [0-7] + 62 hex = 0x + 64 hex

Parameters​

NameTypeDescription
numberBigNumberishBigNumberish

Returns​

string

Defined in​

src/utils/num.ts:33


hexToDecimalString​

â–¸ hexToDecimalString(hex): string

Parameters​

NameType
hexstring

Returns​

string

Defined in​

src/utils/num.ts:38


assertInRange​

â–¸ assertInRange(input, lowerBound, upperBound, inputName?): void

Parameters​

NameTypeDefault value
inputBigNumberishundefined
lowerBoundBigNumberishundefined
upperBoundBigNumberishundefined
inputNamestring''

Returns​

void

Defined in​

src/utils/num.ts:54


bigNumberishArrayToDecimalStringArray​

â–¸ bigNumberishArrayToDecimalStringArray(rawCalldata): string[]

Parameters​

NameType
rawCalldataBigNumberish[]

Returns​

string[]

Defined in​

src/utils/num.ts:71


bigNumberishArrayToHexadecimalStringArray​

â–¸ bigNumberishArrayToHexadecimalStringArray(rawCalldata): string[]

Parameters​

NameType
rawCalldataBigNumberish[]

Returns​

string[]

Defined in​

src/utils/num.ts:75


getDecimalString​

â–¸ getDecimalString(value): string

Parameters​

NameType
valuestring

Returns​

string

Defined in​

src/utils/num.ts:82


getHexString​

â–¸ getHexString(value): string

Parameters​

NameType
valuestring

Returns​

string

Defined in​

src/utils/num.ts:92


getHexStringArray​

â–¸ getHexStringArray(value): string[]

Parameters​

NameType
valuestring[]

Returns​

string[]

Defined in​

src/utils/num.ts:102


hexToBytes​

â–¸ hexToBytes(value): Uint8Array

Convert a hex string to an array of Bytes (Uint8Array)

Parameters​

NameTypeDescription
valuestringhex string

Returns​

Uint8Array

an array of Bytes

Defined in​

src/utils/num.ts:113


cleanHex​

â–¸ cleanHex(hex): string

Remove hex string leading zero and lower case '0x01A'.. -> '0x1a..'

Parameters​

NameTypeDescription
hexstringstring

Returns​

string

Defined in​

src/utils/num.ts:46


isStringWholeNumber​

â–¸ isStringWholeNumber(value): boolean

Parameters​

NameType
valuestring

Returns​

boolean

Defined in​

src/utils/num.ts:79


toHexString​

â–¸ toHexString(value): string

Parameters​

NameType
valuestring

Returns​

string

Defined in​

src/utils/num.ts:80


toCairoBool​

â–¸ toCairoBool(value): string

Parameters​

NameType
valueboolean

Returns​

string

Defined in​

src/utils/num.ts:106