Skip to main content
Version: 6.11.0

Namespace: uint256

Variables​

UINT_128_MAX​

• Const UINT_128_MAX: bigint

Defined in​

src/utils/cairoDataTypes/uint256.ts:10


UINT_256_MAX​

• Const UINT_256_MAX: bigint

Defined in​

src/utils/cairoDataTypes/uint256.ts:11

Functions​

uint256ToBN​

â–¸ uint256ToBN(uint256): bigint

Convert Uint256 to bigint Legacy support Export

Parameters​

NameTypeDescription
uint256Uint256Uint256 value to convert to bigint

Returns​

bigint

BigInt representation of the input Uint256

Example

const uint256Value: Uint256 = { low: 1234567890, high: 1 };
const result = uint256.uint256ToBN(uint256Value);
// result = 340282366920938463463374607433002779346n

Defined in​

src/utils/uint256.ts:22


isUint256​

â–¸ isUint256(bn): boolean

Test BigNumberish is in the range[0, 2**256-1] Legacy support Export

Parameters​

NameTypeDescription
bnBigNumberishvalue to test

Returns​

boolean

True if the input value is in the range[0, 2**256-1], false otherwise

Example

const result = uint256.isUint256(12345n);
// result = true
const result1 = uint256.isUint256(-1);
// result1 = false

Defined in​

src/utils/uint256.ts:39


bnToUint256​

â–¸ bnToUint256(bn): Uint256

Convert BigNumberish (string | number | bigint) to Uint256 Legacy support Export

Parameters​

NameTypeDescription
bnBigNumberishvalue to convert to Uint256

Returns​

Uint256

Uint256 object representing the BigNumberish value

Example

const result = uint256.bnToUint256(1000000000n);
// result = {"low": "0x3b9aca00", "high": "0x0"}

Defined in​

src/utils/uint256.ts:54