Skip to main content
Version: 5.19.5

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