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​
Name | Type | Description |
---|---|---|
uint256 | Uint256 | Uint256 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​
isUint256​
â–¸ isUint256(bn
): boolean
Test BigNumberish is in the range[0, 2**256-1] Legacy support Export
Parameters​
Name | Type | Description |
---|---|---|
bn | BigNumberish | value 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​
bnToUint256​
â–¸ bnToUint256(bn
): Uint256
Convert BigNumberish (string | number | bigint) to Uint256 Legacy support Export
Parameters​
Name | Type | Description |
---|---|---|
bn | BigNumberish | value to convert to Uint256 |
Returns​
Uint256 object representing the BigNumberish value
Example
const result = uint256.bnToUint256(1000000000n);
// result = {"low": "0x3b9aca00", "high": "0x0"}