> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# primitives/Uint

> Auto-generated API documentation

[**@tevm/voltaire**](../index.mdx)

***

[@tevm/voltaire](../index.mdx) / primitives/Uint

# primitives/Uint

## Interfaces

### UintConstructor()

Defined in: [src/primitives/Uint/UintConstructor.ts:69](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L69)

> **UintConstructor**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:70](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L70)

#### Parameters

##### value

`string` | `number` | `bigint`

#### Returns

[`Type`](#type)

#### Properties

##### bitLength()

> **bitLength**: (`uint`) => `number`

Defined in: [src/primitives/Uint/UintConstructor.ts:112](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L112)

Get number of bits required to represent value

###### Parameters

###### uint

[`Type`](#type)

Value to check

###### Returns

`number`

Number of bits (0-256)

###### Example

```typescript theme={null}
const a = Uint(255n);
const bits1 = Uint.bitLength(a); // 8
const bits2 = a.bitLength(); // 8
```

##### bitwiseAnd()

> **bitwiseAnd**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:97](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L97)

Bitwise AND

###### Parameters

###### uint

[`Type`](#type)

First operand

###### b

[`Type`](#type)

Second operand

###### Returns

[`Type`](#type)

uint & b

###### Example

```typescript theme={null}
const a = Uint(0xffn);
const b = Uint(0x0fn);
const result1 = Uint.bitwiseAnd(a, b); // 0x0f
const result2 = a.bitwiseAnd(b); // 0x0f
```

##### bitwiseNot()

> **bitwiseNot**: (`uint`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:100](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L100)

Bitwise NOT

###### Parameters

###### uint

[`Type`](#type)

Operand

###### Returns

[`Type`](#type)

\~uint & MAX

###### Example

```typescript theme={null}
const a = Uint(0n);
const result1 = Uint.bitwiseNot(a); // MAX
const result2 = a.bitwiseNot(); // MAX
```

##### bitwiseOr()

> **bitwiseOr**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:98](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L98)

Bitwise OR

###### Parameters

###### uint

[`Type`](#type)

First operand

###### b

[`Type`](#type)

Second operand

###### Returns

[`Type`](#type)

uint | b

###### Example

```typescript theme={null}
const a = Uint(0xf0n);
const b = Uint(0x0fn);
const result1 = Uint.bitwiseOr(a, b); // 0xff
const result2 = a.bitwiseOr(b); // 0xff
```

##### bitwiseXor()

> **bitwiseXor**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:99](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L99)

Bitwise XOR

###### Parameters

###### uint

[`Type`](#type)

First operand

###### b

[`Type`](#type)

Second operand

###### Returns

[`Type`](#type)

uint ^ b

###### Example

```typescript theme={null}
const a = Uint(0xffn);
const b = Uint(0x0fn);
const result1 = Uint.bitwiseXor(a, b); // 0xf0
const result2 = a.bitwiseXor(b); // 0xf0
```

##### dividedBy()

> **dividedBy**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:94](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L94)

Divide Uint256 value

###### Parameters

###### uint

[`Type`](#type)

Dividend

###### b

[`Type`](#type)

Divisor

###### Returns

[`Type`](#type)

Quotient (uint / b), floor division

###### Throws

Error if divisor is zero

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(10n);
const quotient1 = Uint.dividedBy(a, b); // 10
const quotient2 = a.dividedBy(b); // 10
```

##### equals()

> **equals**: (`uint`, `b`) => `boolean`

Defined in: [src/primitives/Uint/UintConstructor.ts:103](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L103)

Check equality

###### Parameters

###### uint

[`Type`](#type)

First value

###### b

[`Type`](#type)

Second value

###### Returns

`boolean`

true if uint === b

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(100n);
const eq1 = Uint.equals(a, b); // true
const eq2 = a.equals(b); // true
```

##### greaterThan()

> **greaterThan**: (`uint`, `b`) => `boolean`

Defined in: [src/primitives/Uint/UintConstructor.ts:107](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L107)

Check greater than

###### Parameters

###### uint

[`Type`](#type)

First value

###### b

[`Type`](#type)

Second value

###### Returns

`boolean`

true if uint > b

###### Example

```typescript theme={null}
const a = Uint(200n);
const b = Uint(100n);
const isGreater1 = Uint.greaterThan(a, b); // true
const isGreater2 = a.greaterThan(b); // true
```

##### greaterThanOrEqual()

> **greaterThanOrEqual**: (`uint`, `b`) => `boolean`

Defined in: [src/primitives/Uint/UintConstructor.ts:108](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L108)

Check greater than or equal

###### Parameters

###### uint

[`Type`](#type)

First value

###### b

[`Type`](#type)

Second value

###### Returns

`boolean`

true if uint >= b

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(100n);
const isGte1 = Uint.greaterThanOrEqual(a, b); // true
const isGte2 = a.greaterThanOrEqual(b); // true
```

##### isValid()

> **isValid**: (`value`) => `value is Type`

Defined in: [src/primitives/Uint/UintConstructor.ts:84](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L84)

Check if value is a valid Uint256

###### Parameters

###### value

`unknown`

Value to check

###### Returns

`value is Type`

true if value is valid Uint256

###### Example

```typescript theme={null}
const isValid = Uint.isValid(100n); // true
const isInvalid = Uint.isValid(-1n); // false
```

##### isZero()

> **isZero**: (`uint`) => `boolean`

Defined in: [src/primitives/Uint/UintConstructor.ts:109](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L109)

Check if value is zero

###### Parameters

###### uint

[`Type`](#type)

Value to check

###### Returns

`boolean`

true if uint === 0

###### Example

```typescript theme={null}
const a = Uint(0n);
const isZero1 = Uint.isZero(a); // true
const isZero2 = a.isZero(); // true
```

##### leadingZeros()

> **leadingZeros**: (`uint`) => `number`

Defined in: [src/primitives/Uint/UintConstructor.ts:113](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L113)

Get number of leading zero bits

###### Parameters

###### uint

[`Type`](#type)

Value to check

###### Returns

`number`

Number of leading zeros (0-256)

###### Example

```typescript theme={null}
const a = Uint(1n);
const zeros1 = Uint.leadingZeros(a); // 255
const zeros2 = a.leadingZeros(); // 255
```

##### lessThan()

> **lessThan**: (`uint`, `b`) => `boolean`

Defined in: [src/primitives/Uint/UintConstructor.ts:105](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L105)

Check less than

###### Parameters

###### uint

[`Type`](#type)

First value

###### b

[`Type`](#type)

Second value

###### Returns

`boolean`

true if uint \< b

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(200n);
const isLess1 = Uint.lessThan(a, b); // true
const isLess2 = a.lessThan(b); // true
```

##### lessThanOrEqual()

> **lessThanOrEqual**: (`uint`, `b`) => `boolean`

Defined in: [src/primitives/Uint/UintConstructor.ts:106](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L106)

Check less than or equal

###### Parameters

###### uint

[`Type`](#type)

First value

###### b

[`Type`](#type)

Second value

###### Returns

`boolean`

true if uint is less than or equal to b

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(100n);
const isLte1 = Uint.lessThanOrEqual(a, b); // true
const isLte2 = a.lessThanOrEqual(b); // true
```

##### MAX

> **MAX**: [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:72](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L72)

##### maximum()

> **maximum**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:111](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L111)

Get maximum of two values

###### Parameters

###### uint

[`Type`](#type)

First value

###### b

[`Type`](#type)

Second value

###### Returns

[`Type`](#type)

max(uint, b)

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(200n);
const max1 = Uint.maximum(a, b); // 200
const max2 = a.maximum(b); // 200
```

##### MIN

> **MIN**: [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:73](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L73)

##### minimum()

> **minimum**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:110](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L110)

Get minimum of two values

###### Parameters

###### uint

[`Type`](#type)

First value

###### b

[`Type`](#type)

Second value

###### Returns

[`Type`](#type)

min(uint, b)

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(200n);
const min1 = Uint.minimum(a, b); // 100
const min2 = a.minimum(b); // 100
```

##### minus()

> **minus**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:92](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L92)

Subtract Uint256 value with wrapping

###### Parameters

###### uint

[`Type`](#type)

First operand

###### b

[`Type`](#type)

Second operand

###### Returns

[`Type`](#type)

Difference (uint - b) mod 2^256

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(50n);
const diff1 = Uint.minus(a, b); // 50
const diff2 = a.minus(b); // 50
```

##### modulo()

> **modulo**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:95](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L95)

Modulo operation

###### Parameters

###### uint

[`Type`](#type)

Dividend

###### b

[`Type`](#type)

Divisor

###### Returns

[`Type`](#type)

Remainder (uint % b)

###### Throws

Error if divisor is zero

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(30n);
const remainder1 = Uint.modulo(a, b); // 10
const remainder2 = a.modulo(b); // 10
```

##### notEquals()

> **notEquals**: (`uint`, `b`) => `boolean`

Defined in: [src/primitives/Uint/UintConstructor.ts:104](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L104)

Check inequality

###### Parameters

###### uint

[`Type`](#type)

First value

###### b

[`Type`](#type)

Second value

###### Returns

`boolean`

true if uint !== b

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(200n);
const isNotEq1 = Uint.notEquals(a, b); // true
const isNotEq2 = a.notEquals(b); // true
```

##### ONE

> **ONE**: [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:75](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L75)

##### plus()

> **plus**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:91](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L91)

Add Uint256 value with wrapping

###### Parameters

###### uint

[`Type`](#type)

First operand

###### b

[`Type`](#type)

Second operand

###### Returns

[`Type`](#type)

Sum (uint + b) mod 2^256

###### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(50n);
const sum1 = Uint.plus(a, b); // 150
const sum2 = a.plus(b); // 150
```

##### popCount()

> **popCount**: (`uint`) => `number`

Defined in: [src/primitives/Uint/UintConstructor.ts:114](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L114)

Count number of set bits (population count)

###### Parameters

###### uint

[`Type`](#type)

Value to check

###### Returns

`number`

Number of 1 bits

###### Example

```typescript theme={null}
const a = Uint(0xffn);
const count1 = Uint.popCount(a); // 8
const count2 = a.popCount(); // 8
```

##### prototype

> **prototype**: `UintPrototype`

Defined in: [src/primitives/Uint/UintConstructor.ts:71](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L71)

##### shiftLeft()

> **shiftLeft**: (`uint`, `bits`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:101](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L101)

Left shift

###### Parameters

###### uint

[`Type`](#type)

Value to shift

###### bits

[`Type`](#type)

Number of bits to shift

###### Returns

[`Type`](#type)

uint shifted left by bits (mod 2^256)

###### Example

```typescript theme={null}
const a = Uint(1n);
const b = Uint(8n);
const result1 = Uint.shiftLeft(a, b); // 256
const result2 = a.shiftLeft(b); // 256
```

##### shiftRight()

> **shiftRight**: (`uint`, `bits`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:102](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L102)

Right shift

###### Parameters

###### uint

[`Type`](#type)

Value to shift

###### bits

[`Type`](#type)

Number of bits to shift

###### Returns

[`Type`](#type)

uint shifted right by bits

###### Example

```typescript theme={null}
const a = Uint(256n);
const b = Uint(8n);
const result1 = Uint.shiftRight(a, b); // 1
const result2 = a.shiftRight(b); // 1
```

##### SIZE

> **SIZE**: `number`

Defined in: [src/primitives/Uint/UintConstructor.ts:76](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L76)

##### times()

> **times**: (`uint`, `b`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:93](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L93)

Multiply Uint256 value with wrapping

###### Parameters

###### uint

[`Type`](#type)

First operand

###### b

[`Type`](#type)

Second operand

###### Returns

[`Type`](#type)

Product (uint \* b) mod 2^256

###### Example

```typescript theme={null}
const a = Uint(10n);
const b = Uint(5n);
const product1 = Uint.times(a, b); // 50
const product2 = a.times(b); // 50
```

##### toAbiEncoded()

> **toAbiEncoded**: (`uint`) => `Uint8Array`

Defined in: [src/primitives/Uint/UintConstructor.ts:89](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L89)

Convert Uint256 to ABI-encoded bytes (32 bytes, big-endian)

This is identical to toBytes() - all Uint256 values in ABI encoding
are represented as 32-byte big-endian values.

###### Parameters

###### uint

[`Type`](#type)

Uint256 value to encode

###### Returns

`Uint8Array`

32-byte ABI-encoded Uint8Array

###### Example

```typescript theme={null}
const value = Uint(255n);
const encoded1 = Uint.toAbiEncoded(value);
const encoded2 = value.toAbiEncoded();
```

##### toBigInt()

> **toBigInt**: (`uint`) => `bigint`

Defined in: [src/primitives/Uint/UintConstructor.ts:86](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L86)

Convert Uint256 to bigint

###### Parameters

###### uint

[`Type`](#type)

Uint256 value to convert

###### Returns

`bigint`

bigint value

###### Example

```typescript theme={null}
const value = Uint(255n);
const bigint1 = Uint.toBigInt(value);
const bigint2 = value.toBigInt();
```

##### toBytes()

> **toBytes**: (`uint`) => `Uint8Array`

Defined in: [src/primitives/Uint/UintConstructor.ts:88](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L88)

Convert Uint256 to bytes (big-endian, 32 bytes)

###### Parameters

###### uint

[`Type`](#type)

Uint256 value to convert

###### Returns

`Uint8Array`

32-byte Uint8Array

###### Example

```typescript theme={null}
const value = Uint(255n);
const bytes1 = Uint.toBytes(value);
const bytes2 = value.toBytes();
```

##### toHex()

> **toHex**: (`uint`, `padded`) => `string`

Defined in: [src/primitives/Uint/UintConstructor.ts:85](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L85)

Convert Uint256 to hex string

###### Parameters

###### uint

[`Type`](#type)

Uint256 value to convert

###### padded

`boolean` = `true`

Whether to pad to 64 characters (32 bytes)

###### Returns

`string`

Hex string with 0x prefix

###### Example

```typescript theme={null}
const value = Uint(255n);
const hex1 = Uint.toHex(value); // "0x00...ff"
const hex2 = value.toHex(); // "0x00...ff"
const hex3 = value.toHex(false); // "0xff"
```

##### toNumber()

> **toNumber**: (`uint`) => `number`

Defined in: [src/primitives/Uint/UintConstructor.ts:87](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L87)

Convert Uint256 to number

###### Parameters

###### uint

[`Type`](#type)

Uint256 value to convert

###### Returns

`number`

number value

###### Throws

Error if value exceeds MAX\_SAFE\_INTEGER

###### Example

```typescript theme={null}
const value = Uint(255n);
const num1 = Uint.toNumber(value);
const num2 = value.toNumber();
```

##### toPower()

> **toPower**: (`uint`, `exponent`) => [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:96](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L96)

Exponentiation

###### Parameters

###### uint

[`Type`](#type)

Base value

###### exponent

[`Type`](#type)

Exponent value

###### Returns

[`Type`](#type)

uint^exponent mod 2^256

###### Example

```typescript theme={null}
const base = Uint(2n);
const exp = Uint(8n);
const result1 = Uint.toPower(base, exp); // 256
const result2 = base.toPower(exp); // 256
```

##### toString()

> **toString**: (`uint`, `radix`) => `string`

Defined in: [src/primitives/Uint/UintConstructor.ts:90](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L90)

Convert Uint256 to string representation

###### Parameters

###### uint

[`Type`](#type)

Uint256 value to convert

###### radix

`number` = `10`

Base for string conversion (2, 10, 16, etc.)

###### Returns

`string`

String representation

###### Example

```typescript theme={null}
const value = Uint(255n);
const dec1 = Uint.toString(value, 10); // "255"
const dec2 = value.toString(10); // "255"
const hex = value.toString(16); // "ff"
```

##### tryFrom()

> **tryFrom**: (`value`) => [`Type`](#type) | `undefined`

Defined in: [src/primitives/Uint/UintConstructor.ts:83](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L83)

Try to create Uint256, returns undefined if invalid (standard form)

###### Parameters

###### value

bigint, number, or string

`string` | `number` | `bigint`

###### Returns

[`Type`](#type) | `undefined`

Uint256 value or undefined

###### Example

```typescript theme={null}
const a = Uint.tryFrom(100n); // Uint256
const b = Uint.tryFrom(-1n); // undefined
const c = Uint.tryFrom("invalid"); // undefined
```

##### ZERO

> **ZERO**: [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:74](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L74)

#### Methods

##### from()

> **from**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:77](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L77)

###### Parameters

###### value

`string` | `number` | `bigint`

###### Returns

[`Type`](#type)

##### fromAbiEncoded()

> **fromAbiEncoded**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:82](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L82)

###### Parameters

###### value

`Uint8Array`

###### Returns

[`Type`](#type)

##### fromBigInt()

> **fromBigInt**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:79](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L79)

###### Parameters

###### value

`bigint`

###### Returns

[`Type`](#type)

##### fromBytes()

> **fromBytes**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:81](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L81)

###### Parameters

###### value

`Uint8Array`

###### Returns

[`Type`](#type)

##### fromHex()

> **fromHex**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:78](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L78)

###### Parameters

###### value

`string`

###### Returns

[`Type`](#type)

##### fromNumber()

> **fromNumber**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/UintConstructor.ts:80](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/UintConstructor.ts#L80)

###### Parameters

###### value

`number` | `bigint`

###### Returns

[`Type`](#type)

## Type Aliases

### ~~BrandedUint~~

> **BrandedUint** = [`Type`](#type)

Defined in: [src/primitives/Uint/Uint256Type.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/Uint256Type.ts#L19)

#### Deprecated

Use Uint256Type instead

***

### ~~BrandedUint256~~

> **BrandedUint256** = [`Type`](#type)

Defined in: [src/primitives/Uint/Uint256Type.ts:14](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/Uint256Type.ts#L14)

#### Deprecated

Use Uint256Type instead

***

### Type

> **Type** = `bigint` & `object`

Defined in: [src/primitives/Uint/Uint256Type.ts:9](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/Uint256Type.ts#L9)

Uint256 type

#### Type Declaration

##### \[brand]

> `readonly` **\[brand]**: `"Uint256"`

#### See

[https://voltaire.tevm.sh/primitives/uint256](https://voltaire.tevm.sh/primitives/uint256) for Uint256 documentation

#### Since

0.0.0

## Variables

### MAX

> `const` **MAX**: [`Type`](#type)

Defined in: [src/primitives/Uint/constants.ts:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/constants.ts#L17)

Maximum Uint256 value: 2^256 - 1

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

***

### MIN

> `const` **MIN**: [`Type`](#type)

Defined in: [src/primitives/Uint/constants.ts:25](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/constants.ts#L25)

Minimum Uint256 value: 0

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

***

### ONE

> `const` **ONE**: [`Type`](#type)

Defined in: [src/primitives/Uint/constants.ts:41](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/constants.ts#L41)

One value

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

***

### SIZE

> `const` **SIZE**: `32` = `32`

Defined in: [src/primitives/Uint/constants.ts:9](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/constants.ts#L9)

Size in bytes (32 bytes for Uint256)

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

***

### Uint256Type

> `const` **Uint256Type**: `object`

Defined in: [src/primitives/Uint/index.ts:105](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/index.ts#L105)

#### Type Declaration

##### bitLength()

> **bitLength**: (`uint`) => `number`

###### Parameters

###### uint

[`Type`](#type)

###### Returns

`number`

##### bitwiseAnd()

> **bitwiseAnd**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### bitwiseNot()

> **bitwiseNot**: (`uint`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### Returns

[`Type`](#type)

##### bitwiseOr()

> **bitwiseOr**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### bitwiseXor()

> **bitwiseXor**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### clone()

> **clone**: (`uint`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### Returns

[`Type`](#type)

##### dividedBy()

> **dividedBy**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### equals()

> **equals**: (`uint`, `b`) => `boolean`

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

`boolean`

##### from()

> **from**: (`value`) => [`Type`](#type)

###### Parameters

###### value

`bigint` | `number` | `string`

###### Returns

[`Type`](#type)

##### fromAbiEncoded()

> **fromAbiEncoded**: (`data`) => [`Type`](#type)

###### Parameters

###### data

`Uint8Array`

###### Returns

[`Type`](#type)

##### fromBigInt()

> **fromBigInt**: (`value`) => [`Type`](#type)

###### Parameters

###### value

`bigint`

###### Returns

[`Type`](#type)

##### fromBytes()

> **fromBytes**: (`bytes`) => [`Type`](#type)

###### Parameters

###### bytes

`Uint8Array`

###### Returns

[`Type`](#type)

##### fromHex()

> **fromHex**: (`hex`) => [`Type`](#type)

###### Parameters

###### hex

`string`

###### Returns

[`Type`](#type)

##### fromNumber()

> **fromNumber**: (`value`) => [`Type`](#type)

###### Parameters

###### value

`number`

###### Returns

[`Type`](#type)

##### gcd()

> **gcd**: (`a`, `b`) => [`Type`](#type)

###### Parameters

###### a

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### greaterThan()

> **greaterThan**: (`uint`, `b`) => `boolean`

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

`boolean`

##### greaterThanOrEqual()

> **greaterThanOrEqual**: (`uint`, `b`) => `boolean`

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

`boolean`

##### isPowerOf2()

> **isPowerOf2**: (`uint`) => `boolean`

###### Parameters

###### uint

[`Type`](#type)

###### Returns

`boolean`

##### isValid()

> **isValid**: (`value`) => `value is Type`

###### Parameters

###### value

`unknown`

###### Returns

`value is Type`

##### isZero()

> **isZero**: (`uint`) => `boolean`

###### Parameters

###### uint

[`Type`](#type)

###### Returns

`boolean`

##### lcm()

> **lcm**: (`a`, `b`) => [`Type`](#type)

###### Parameters

###### a

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### leadingZeros()

> **leadingZeros**: (`uint`) => `number`

###### Parameters

###### uint

[`Type`](#type)

###### Returns

`number`

##### lessThan()

> **lessThan**: (`uint`, `b`) => `boolean`

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

`boolean`

##### lessThanOrEqual()

> **lessThanOrEqual**: (`uint`, `b`) => `boolean`

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

`boolean`

##### max()

> **max**: (...`values`) => [`Type`](#type)

###### Parameters

###### values

...[`Type`](#type)\[]

###### Returns

[`Type`](#type)

##### MAX

> **MAX**: [`Type`](#type)

##### maximum()

> **maximum**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### min()

> **min**: (...`values`) => [`Type`](#type)

###### Parameters

###### values

...[`Type`](#type)\[]

###### Returns

[`Type`](#type)

##### MIN

> **MIN**: [`Type`](#type)

##### minimum()

> **minimum**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### minus()

> **minus**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### modulo()

> **modulo**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### notEquals()

> **notEquals**: (`uint`, `b`) => `boolean`

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

`boolean`

##### ONE

> **ONE**: [`Type`](#type)

##### plus()

> **plus**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### popCount()

> **popCount**: (`uint`) => `number`

###### Parameters

###### uint

[`Type`](#type)

###### Returns

`number`

##### product()

> **product**: (...`values`) => [`Type`](#type)

###### Parameters

###### values

...[`Type`](#type)\[]

###### Returns

[`Type`](#type)

##### shiftLeft()

> **shiftLeft**: (`uint`, `bits`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### bits

[`Type`](#type)

###### Returns

[`Type`](#type)

##### shiftRight()

> **shiftRight**: (`uint`, `bits`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### bits

[`Type`](#type)

###### Returns

[`Type`](#type)

##### SIZE

> **SIZE**: `32`

##### sum()

> **sum**: (...`values`) => [`Type`](#type)

###### Parameters

###### values

...[`Type`](#type)\[]

###### Returns

[`Type`](#type)

##### times()

> **times**: (`uint`, `b`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### b

[`Type`](#type)

###### Returns

[`Type`](#type)

##### toAbiEncoded()

> **toAbiEncoded**: (`uint`) => `Uint8Array`

###### Parameters

###### uint

[`Type`](#type)

###### Returns

`Uint8Array`

##### toBigInt()

> **toBigInt**: (`uint`) => `bigint`

###### Parameters

###### uint

[`Type`](#type)

###### Returns

`bigint`

##### toBytes()

> **toBytes**: (`uint`, `size?`) => `Uint8Array`

###### Parameters

###### uint

[`Type`](#type)

###### size?

`number`

###### Returns

`Uint8Array`

##### toHex()

> **toHex**: (`uint`, `padded?`) => `string`

###### Parameters

###### uint

[`Type`](#type)

###### padded?

`boolean`

###### Returns

`string`

##### toNumber()

> **toNumber**: (`uint`) => `number`

###### Parameters

###### uint

[`Type`](#type)

###### Returns

`number`

##### toPower()

> **toPower**: (`uint`, `exponent`) => [`Type`](#type)

###### Parameters

###### uint

[`Type`](#type)

###### exponent

[`Type`](#type)

###### Returns

[`Type`](#type)

##### toString()

> **toString**: (`uint`, `radix?`) => `string`

###### Parameters

###### uint

[`Type`](#type)

###### radix?

`number`

###### Returns

`string`

##### tryFrom()

> **tryFrom**: (`value`) => [`Type`](#type) | `undefined`

###### Parameters

###### value

`bigint` | `number` | `string`

###### Returns

[`Type`](#type) | `undefined`

##### ZERO

> **ZERO**: [`Type`](#type)

***

### ZERO

> `const` **ZERO**: [`Type`](#type)

Defined in: [src/primitives/Uint/constants.ts:33](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/constants.ts#L33)

Zero value

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

## Functions

### bitLength()

> **bitLength**(`uint`): `number`

Defined in: [src/primitives/Uint/bitLength.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/bitLength.ts#L16)

Get number of bits required to represent value

#### Parameters

##### uint

[`Type`](#type)

Value to check

#### Returns

`number`

Number of bits (0-256)

#### Example

```typescript theme={null}
const a = Uint(255n);
const bits1 = Uint.bitLength(a); // 8
const bits2 = a.bitLength(); // 8
```

***

### bitwiseAnd()

> **bitwiseAnd**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/bitwiseAnd.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/bitwiseAnd.ts#L18)

Bitwise AND

#### Parameters

##### uint

[`Type`](#type)

First operand

##### b

[`Type`](#type)

Second operand

#### Returns

[`Type`](#type)

uint & b

#### Example

```typescript theme={null}
const a = Uint(0xffn);
const b = Uint(0x0fn);
const result1 = Uint.bitwiseAnd(a, b); // 0x0f
const result2 = a.bitwiseAnd(b); // 0x0f
```

***

### bitwiseNot()

> **bitwiseNot**(`uint`): [`Type`](#type)

Defined in: [src/primitives/Uint/bitwiseNot.ts:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/bitwiseNot.ts#L17)

Bitwise NOT

#### Parameters

##### uint

[`Type`](#type)

Operand

#### Returns

[`Type`](#type)

\~uint & MAX

#### Example

```typescript theme={null}
const a = Uint(0n);
const result1 = Uint.bitwiseNot(a); // MAX
const result2 = a.bitwiseNot(); // MAX
```

***

### bitwiseOr()

> **bitwiseOr**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/bitwiseOr.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/bitwiseOr.ts#L18)

Bitwise OR

#### Parameters

##### uint

[`Type`](#type)

First operand

##### b

[`Type`](#type)

Second operand

#### Returns

[`Type`](#type)

uint | b

#### Example

```typescript theme={null}
const a = Uint(0xf0n);
const b = Uint(0x0fn);
const result1 = Uint.bitwiseOr(a, b); // 0xff
const result2 = a.bitwiseOr(b); // 0xff
```

***

### bitwiseXor()

> **bitwiseXor**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/bitwiseXor.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/bitwiseXor.ts#L18)

Bitwise XOR

#### Parameters

##### uint

[`Type`](#type)

First operand

##### b

[`Type`](#type)

Second operand

#### Returns

[`Type`](#type)

uint ^ b

#### Example

```typescript theme={null}
const a = Uint(0xffn);
const b = Uint(0x0fn);
const result1 = Uint.bitwiseXor(a, b); // 0xf0
const result2 = a.bitwiseXor(b); // 0xf0
```

***

### clone()

> **clone**(`uint`): [`Type`](#type)

Defined in: [src/primitives/Uint/clone.js:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/clone.js#L17)

Create a copy of a Uint256 value

#### Parameters

##### uint

[`Type`](#type)

Uint256 value to clone

#### Returns

[`Type`](#type)

Copy of the value

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

#### Throws

#### Example

```javascript theme={null}
import * as Uint256 from './primitives/Uint/index.js';
const n1 = Uint256.from(100n);
const n2 = Uint256.clone(n1);
console.log(Uint256.equals(n1, n2)); // true
```

***

### dividedBy()

> **dividedBy**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/dividedBy.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/dividedBy.ts#L19)

Divide Uint256 value

#### Parameters

##### uint

[`Type`](#type)

Dividend

##### b

[`Type`](#type)

Divisor

#### Returns

[`Type`](#type)

Quotient (uint / b), floor division

#### Throws

Error if divisor is zero

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(10n);
const quotient1 = Uint.dividedBy(a, b); // 10
const quotient2 = a.dividedBy(b); // 10
```

***

### equals()

> **equals**(`uint`, `b`): `boolean`

Defined in: [src/primitives/Uint/equals.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/equals.ts#L18)

Check equality

#### Parameters

##### uint

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

`boolean`

true if uint === b

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(100n);
const eq1 = Uint.equals(a, b); // true
const eq2 = a.equals(b); // true
```

***

### from()

> **from**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/from.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/from.ts#L18)

Create Uint256 from bigint or string (standard form)

#### Parameters

##### value

bigint or decimal/hex string

`string` | `number` | `bigint`

#### Returns

[`Type`](#type)

Uint256 value

#### Throws

Error if value is out of range or invalid

#### Example

```typescript theme={null}
const a = Uint.from(100n);
const b = Uint.from("255");
const c = Uint.from("0xff");
```

***

### fromAbiEncoded()

> **fromAbiEncoded**(`bytes`): [`Type`](#type)

Defined in: [src/primitives/Uint/fromAbiEncoded.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/fromAbiEncoded.ts#L18)

Decode Uint256 from ABI-encoded bytes (32 bytes, big-endian)

#### Parameters

##### bytes

`Uint8Array`

32-byte ABI-encoded data

#### Returns

[`Type`](#type)

Decoded Uint256 value

#### Throws

Error if bytes length is not 32

#### Example

```typescript theme={null}
const encoded = new Uint8Array(32);
encoded[31] = 255;
const value = Uint.fromAbiEncoded(encoded); // 255n
```

***

### fromBigInt()

> **fromBigInt**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/fromBigInt.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/fromBigInt.ts#L16)

Create Uint256 from bigint

#### Parameters

##### value

`bigint`

bigint to convert

#### Returns

[`Type`](#type)

Uint256 value

#### Throws

Error if value out of range

#### Example

```typescript theme={null}
const value = Uint.fromBigInt(100n);
```

***

### fromBytes()

> **fromBytes**(`bytes`): [`Type`](#type)

Defined in: [src/primitives/Uint/fromBytes.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/fromBytes.ts#L16)

Create Uint256 from bytes (big-endian)

#### Parameters

##### bytes

`Uint8Array`

bytes to convert

#### Returns

[`Type`](#type)

Uint256 value

#### Throws

Error if bytes length exceeds 32

#### Example

```typescript theme={null}
const bytes = new Uint8Array([0xff, 0x00]);
const value = Uint.fromBytes(bytes);
```

***

### fromHex()

> **fromHex**(`hex`): [`Type`](#type)

Defined in: [src/primitives/Uint/fromHex.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/fromHex.ts#L19)

Create Uint256 from hex string

#### Parameters

##### hex

`string`

Hex string to convert

#### Returns

[`Type`](#type)

Uint256 value

#### Throws

If value is negative

#### Throws

If value exceeds maximum

#### Example

```typescript theme={null}
const value = Uint.fromHex("0xff");
const value2 = Uint.fromHex("ff");
```

***

### fromNumber()

> **fromNumber**(`value`): [`Type`](#type)

Defined in: [src/primitives/Uint/fromNumber.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/fromNumber.ts#L16)

Create Uint256 from number

#### Parameters

##### value

`number`

number to convert

#### Returns

[`Type`](#type)

Uint256 value

#### Throws

Error if value is not an integer or out of range

#### Example

```typescript theme={null}
const value = Uint.fromNumber(255);
```

***

### gcd()

> **gcd**(`a`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/gcd.js:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/gcd.js#L18)

Calculate greatest common divisor using Euclidean algorithm

#### Parameters

##### a

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

[`Type`](#type)

GCD of a and b

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

#### Throws

#### Example

```javascript theme={null}
import * as Uint256 from './primitives/Uint/index.js';
const result = Uint256.gcd(Uint256.from(48n), Uint256.from(18n)); // 6n
```

***

### greaterThan()

> **greaterThan**(`uint`, `b`): `boolean`

Defined in: [src/primitives/Uint/greaterThan.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/greaterThan.ts#L18)

Check greater than

#### Parameters

##### uint

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

`boolean`

true if uint > b

#### Example

```typescript theme={null}
const a = Uint(200n);
const b = Uint(100n);
const isGreater1 = Uint.greaterThan(a, b); // true
const isGreater2 = a.greaterThan(b); // true
```

***

### greaterThanOrEqual()

> **greaterThanOrEqual**(`uint`, `b`): `boolean`

Defined in: [src/primitives/Uint/greaterThanOrEqual.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/greaterThanOrEqual.ts#L18)

Check greater than or equal

#### Parameters

##### uint

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

`boolean`

true if uint >= b

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(100n);
const isGte1 = Uint.greaterThanOrEqual(a, b); // true
const isGte2 = a.greaterThanOrEqual(b); // true
```

***

### isPowerOf2()

> **isPowerOf2**(`value`): `boolean`

Defined in: [src/primitives/Uint/isPowerOf2.js:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/isPowerOf2.js#L18)

Check if value is a power of 2

#### Parameters

##### value

[`Type`](#type)

Value to check

#### Returns

`boolean`

True if value is power of 2

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

#### Throws

#### Example

```javascript theme={null}
import * as Uint256 from './primitives/Uint/index.js';
Uint256.isPowerOf2(Uint256.from(16n)); // true
Uint256.isPowerOf2(Uint256.from(15n)); // false
```

***

### isValid()

> **isValid**(`value`): `value is Type`

Defined in: [src/primitives/Uint/isValid.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/isValid.ts#L16)

Check if value is a valid Uint256

#### Parameters

##### value

`unknown`

Value to check

#### Returns

`value is Type`

true if value is valid Uint256

#### Example

```typescript theme={null}
const isValid = Uint.isValid(100n); // true
const isInvalid = Uint.isValid(-1n); // false
```

***

### isZero()

> **isZero**(`uint`): `boolean`

Defined in: [src/primitives/Uint/isZero.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/isZero.ts#L16)

Check if value is zero

#### Parameters

##### uint

[`Type`](#type)

Value to check

#### Returns

`boolean`

true if uint === 0

#### Example

```typescript theme={null}
const a = Uint(0n);
const isZero1 = Uint.isZero(a); // true
const isZero2 = a.isZero(); // true
```

***

### lcm()

> **lcm**(`a`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/lcm.js:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/lcm.js#L19)

Calculate least common multiple

#### Parameters

##### a

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

[`Type`](#type)

LCM of a and b

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

#### Throws

#### Example

```javascript theme={null}
import * as Uint256 from './primitives/Uint/index.js';
const result = Uint256.lcm(Uint256.from(12n), Uint256.from(18n)); // 36n
```

***

### leadingZeros()

> **leadingZeros**(`uint`): `number`

Defined in: [src/primitives/Uint/leadingZeros.ts:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/leadingZeros.ts#L17)

Get number of leading zero bits

#### Parameters

##### uint

[`Type`](#type)

Value to check

#### Returns

`number`

Number of leading zeros (0-256)

#### Example

```typescript theme={null}
const a = Uint(1n);
const zeros1 = Uint.leadingZeros(a); // 255
const zeros2 = a.leadingZeros(); // 255
```

***

### lessThan()

> **lessThan**(`uint`, `b`): `boolean`

Defined in: [src/primitives/Uint/lessThan.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/lessThan.ts#L18)

Check less than

#### Parameters

##### uint

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

`boolean`

true if uint \< b

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(200n);
const isLess1 = Uint.lessThan(a, b); // true
const isLess2 = a.lessThan(b); // true
```

***

### lessThanOrEqual()

> **lessThanOrEqual**(`uint`, `b`): `boolean`

Defined in: [src/primitives/Uint/lessThanOrEqual.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/lessThanOrEqual.ts#L18)

Check less than or equal

#### Parameters

##### uint

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

`boolean`

true if uint is less than or equal to b

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(100n);
const isLte1 = Uint.lessThanOrEqual(a, b); // true
const isLte2 = a.lessThanOrEqual(b); // true
```

***

### max()

> **max**(...`values`): [`Type`](#type)

Defined in: [src/primitives/Uint/max.js:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/max.js#L17)

Find maximum of multiple Uint256 values

#### Parameters

##### values

...[`Type`](#type)\[]

Values to compare

#### Returns

[`Type`](#type)

Maximum value

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

#### Throws

If no values provided

#### Example

```javascript theme={null}
import * as Uint256 from './primitives/Uint/index.js';
const result = Uint256.max(Uint256.from(100n), Uint256.from(50n), Uint256.from(75n)); // 100n
```

***

### maximum()

> **maximum**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/maximum.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/maximum.ts#L18)

Get maximum of two values

#### Parameters

##### uint

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

[`Type`](#type)

max(uint, b)

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(200n);
const max1 = Uint.maximum(a, b); // 200
const max2 = a.maximum(b); // 200
```

***

### min()

> **min**(...`values`): [`Type`](#type)

Defined in: [src/primitives/Uint/min.js:15](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/min.js#L15)

Find minimum of multiple Uint256 values

#### Parameters

##### values

...[`Type`](#type)\[]

Values to compare

#### Returns

[`Type`](#type)

Minimum value

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

#### Throws

If no values provided

#### Example

```javascript theme={null}
import * as Uint256 from './primitives/Uint/index.js';
const result = Uint256.min(Uint256.from(100n), Uint256.from(50n), Uint256.from(75n)); // 50n
```

***

### minimum()

> **minimum**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/minimum.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/minimum.ts#L18)

Get minimum of two values

#### Parameters

##### uint

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

[`Type`](#type)

min(uint, b)

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(200n);
const min1 = Uint.minimum(a, b); // 100
const min2 = a.minimum(b); // 100
```

***

### minus()

> **minus**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/minus.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/minus.ts#L19)

Subtract Uint256 value with wrapping

#### Parameters

##### uint

[`Type`](#type)

First operand

##### b

[`Type`](#type)

Second operand

#### Returns

[`Type`](#type)

Difference (uint - b) mod 2^256

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(50n);
const diff1 = Uint.minus(a, b); // 50
const diff2 = a.minus(b); // 50
```

***

### modulo()

> **modulo**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/modulo.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/modulo.ts#L19)

Modulo operation

#### Parameters

##### uint

[`Type`](#type)

Dividend

##### b

[`Type`](#type)

Divisor

#### Returns

[`Type`](#type)

Remainder (uint % b)

#### Throws

Error if divisor is zero

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(30n);
const remainder1 = Uint.modulo(a, b); // 10
const remainder2 = a.modulo(b); // 10
```

***

### notEquals()

> **notEquals**(`uint`, `b`): `boolean`

Defined in: [src/primitives/Uint/notEquals.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/notEquals.ts#L18)

Check inequality

#### Parameters

##### uint

[`Type`](#type)

First value

##### b

[`Type`](#type)

Second value

#### Returns

`boolean`

true if uint !== b

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(200n);
const isNotEq1 = Uint.notEquals(a, b); // true
const isNotEq2 = a.notEquals(b); // true
```

***

### plus()

> **plus**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/plus.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/plus.ts#L19)

Add Uint256 value with wrapping

#### Parameters

##### uint

[`Type`](#type)

First operand

##### b

[`Type`](#type)

Second operand

#### Returns

[`Type`](#type)

Sum (uint + b) mod 2^256

#### Example

```typescript theme={null}
const a = Uint(100n);
const b = Uint(50n);
const sum1 = Uint.plus(a, b); // 150
const sum2 = a.plus(b); // 150
```

***

### popCount()

> **popCount**(`uint`): `number`

Defined in: [src/primitives/Uint/popCount.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/popCount.ts#L16)

Count number of set bits (population count)

#### Parameters

##### uint

[`Type`](#type)

Value to check

#### Returns

`number`

Number of 1 bits

#### Example

```typescript theme={null}
const a = Uint(0xffn);
const count1 = Uint.popCount(a); // 8
const count2 = a.popCount(); // 8
```

***

### product()

> **product**(...`values`): [`Type`](#type)

Defined in: [src/primitives/Uint/product.js:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/product.js#L17)

Multiply multiple Uint256 values with wrapping

#### Parameters

##### values

...[`Type`](#type)\[]

Values to multiply

#### Returns

[`Type`](#type)

Product of all values mod 2^256

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

#### Throws

#### Example

```javascript theme={null}
import * as Uint256 from './primitives/Uint/index.js';
const result = Uint256.product(Uint256.from(10n), Uint256.from(5n), Uint256.from(2n)); // 100n
```

***

### shiftLeft()

> **shiftLeft**(`uint`, `bits`): [`Type`](#type)

Defined in: [src/primitives/Uint/shiftLeft.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/shiftLeft.ts#L19)

Left shift

#### Parameters

##### uint

[`Type`](#type)

Value to shift

##### bits

[`Type`](#type)

Number of bits to shift

#### Returns

[`Type`](#type)

uint shifted left by bits (mod 2^256)

#### Example

```typescript theme={null}
const a = Uint(1n);
const b = Uint(8n);
const result1 = Uint.shiftLeft(a, b); // 256
const result2 = a.shiftLeft(b); // 256
```

***

### shiftRight()

> **shiftRight**(`uint`, `bits`): [`Type`](#type)

Defined in: [src/primitives/Uint/shiftRight.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/shiftRight.ts#L18)

Right shift

#### Parameters

##### uint

[`Type`](#type)

Value to shift

##### bits

[`Type`](#type)

Number of bits to shift

#### Returns

[`Type`](#type)

uint shifted right by bits

#### Example

```typescript theme={null}
const a = Uint(256n);
const b = Uint(8n);
const result1 = Uint.shiftRight(a, b); // 1
const result2 = a.shiftRight(b); // 1
```

***

### sum()

> **sum**(...`values`): [`Type`](#type)

Defined in: [src/primitives/Uint/sum.js:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/sum.js#L17)

Sum multiple Uint256 values with wrapping

#### Parameters

##### values

...[`Type`](#type)\[]

Values to sum

#### Returns

[`Type`](#type)

Sum of all values mod 2^256

#### See

[https://voltaire.tevm.sh/primitives/uint](https://voltaire.tevm.sh/primitives/uint) for Uint documentation

#### Since

0.0.0

#### Throws

#### Example

```javascript theme={null}
import * as Uint256 from './primitives/Uint/index.js';
const result = Uint256.sum(Uint256.from(100n), Uint256.from(50n), Uint256.from(25n)); // 175n
```

***

### times()

> **times**(`uint`, `b`): [`Type`](#type)

Defined in: [src/primitives/Uint/times.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/times.ts#L19)

Multiply Uint256 value with wrapping

#### Parameters

##### uint

[`Type`](#type)

First operand

##### b

[`Type`](#type)

Second operand

#### Returns

[`Type`](#type)

Product (uint \* b) mod 2^256

#### Example

```typescript theme={null}
const a = Uint(10n);
const b = Uint(5n);
const product1 = Uint.times(a, b); // 50
const product2 = a.times(b); // 50
```

***

### toAbiEncoded()

> **toAbiEncoded**(`uint`): `Uint8Array`

Defined in: [src/primitives/Uint/toAbiEncoded.ts:20](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/toAbiEncoded.ts#L20)

Convert Uint256 to ABI-encoded bytes (32 bytes, big-endian)

This is identical to toBytes() - all Uint256 values in ABI encoding
are represented as 32-byte big-endian values.

#### Parameters

##### uint

[`Type`](#type)

Uint256 value to encode

#### Returns

`Uint8Array`

32-byte ABI-encoded Uint8Array

#### Example

```typescript theme={null}
const value = Uint(255n);
const encoded1 = Uint.toAbiEncoded(value);
const encoded2 = value.toAbiEncoded();
```

***

### toBigInt()

> **toBigInt**(`uint`): `bigint`

Defined in: [src/primitives/Uint/toBigInt.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/toBigInt.ts#L16)

Convert Uint256 to bigint

#### Parameters

##### uint

[`Type`](#type)

Uint256 value to convert

#### Returns

`bigint`

bigint value

#### Example

```typescript theme={null}
const value = Uint(255n);
const bigint1 = Uint.toBigInt(value);
const bigint2 = value.toBigInt();
```

***

### toBytes()

> **toBytes**(`uint`): `Uint8Array`

Defined in: [src/primitives/Uint/toBytes.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/toBytes.ts#L16)

Convert Uint256 to bytes (big-endian, 32 bytes)

#### Parameters

##### uint

[`Type`](#type)

Uint256 value to convert

#### Returns

`Uint8Array`

32-byte Uint8Array

#### Example

```typescript theme={null}
const value = Uint(255n);
const bytes1 = Uint.toBytes(value);
const bytes2 = value.toBytes();
```

***

### toHex()

> **toHex**(`uint`, `padded`): `string`

Defined in: [src/primitives/Uint/toHex.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/toHex.ts#L18)

Convert Uint256 to hex string

#### Parameters

##### uint

[`Type`](#type)

Uint256 value to convert

##### padded

`boolean` = `true`

Whether to pad to 64 characters (32 bytes)

#### Returns

`string`

Hex string with 0x prefix

#### Example

```typescript theme={null}
const value = Uint(255n);
const hex1 = Uint.toHex(value); // "0x00...ff"
const hex2 = value.toHex(); // "0x00...ff"
const hex3 = value.toHex(false); // "0xff"
```

***

### toNumber()

> **toNumber**(`uint`): `number`

Defined in: [src/primitives/Uint/toNumber.ts:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/toNumber.ts#L17)

Convert Uint256 to number

#### Parameters

##### uint

[`Type`](#type)

Uint256 value to convert

#### Returns

`number`

number value

#### Throws

Error if value exceeds MAX\_SAFE\_INTEGER

#### Example

```typescript theme={null}
const value = Uint(255n);
const num1 = Uint.toNumber(value);
const num2 = value.toNumber();
```

***

### toPower()

> **toPower**(`uint`, `exponent`): [`Type`](#type)

Defined in: [src/primitives/Uint/toPower.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/toPower.ts#L19)

Exponentiation

#### Parameters

##### uint

[`Type`](#type)

Base value

##### exponent

[`Type`](#type)

Exponent value

#### Returns

[`Type`](#type)

uint^exponent mod 2^256

#### Example

```typescript theme={null}
const base = Uint(2n);
const exp = Uint(8n);
const result1 = Uint.toPower(base, exp); // 256
const result2 = base.toPower(exp); // 256
```

***

### toString()

> **toString**(`uint`, `radix`): `string`

Defined in: [src/primitives/Uint/toString.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/toString.ts#L19)

Convert Uint256 to string representation

#### Parameters

##### uint

[`Type`](#type)

Uint256 value to convert

##### radix

`number` = `10`

Base for string conversion (2, 10, 16, etc.)

#### Returns

`string`

String representation

#### Example

```typescript theme={null}
const value = Uint(255n);
const dec1 = Uint.toString(value, 10); // "255"
const dec2 = value.toString(10); // "255"
const hex = value.toString(16); // "ff"
```

***

### tryFrom()

> **tryFrom**(`value`): [`Type`](#type) | `undefined`

Defined in: [src/primitives/Uint/tryFrom.ts:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Uint/tryFrom.ts#L17)

Try to create Uint256, returns undefined if invalid (standard form)

#### Parameters

##### value

bigint, number, or string

`string` | `number` | `bigint`

#### Returns

[`Type`](#type) | `undefined`

Uint256 value or undefined

#### Example

```typescript theme={null}
const a = Uint.tryFrom(100n); // Uint256
const b = Uint.tryFrom(-1n); // undefined
const c = Uint.tryFrom("invalid"); // undefined
```

## References

### Uint256

Renames and re-exports [Uint256Type](#uint256type)
