> ## 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.

# BrandedWei

> Auto-generated API documentation

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

***

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

# BrandedWei

## Type Aliases

### BrandedWei

> **BrandedWei** = [`WeiType`](#weitype)

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

***

### WeiType

> **WeiType** = `bigint` & `object`

Defined in: [src/primitives/Denomination/WeiType.ts:6](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/WeiType.ts#L6)

Branded Wei type - represents Ethereum amounts in wei (smallest unit: 10^-18 ETH)

#### Type Declaration

##### \[brand]

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

## Variables

### Wei

> `const` **Wei**: `object`

Defined in: [src/primitives/Denomination/wei-index.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/wei-index.ts#L19)

#### Type Declaration

##### from()

> **from**: (`value`) => [`WeiType`](#weitype)

Create Wei from bigint, number, or string

###### Parameters

###### value

Value to convert (bigint, number, or string)

`string` | `number` | `bigint`

###### Returns

[`WeiType`](#weitype)

Wei amount

###### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

###### Since

0.0.0

###### Throws

###### Example

```typescript theme={null}
const wei1 = Wei.from(1000000000n);
const wei2 = Wei.from(1000000000);
const wei3 = Wei.from("1000000000");
const wei4 = Wei.from("0x3b9aca00");
```

##### fromEther()

> **fromEther**: (`ether`) => [`WeiType`](#weitype)

Convert Ether to Wei

Parses decimal ether string and converts to bigint wei value.
Alias for Ether.toWei().

###### Parameters

###### ether

[`EtherType`](BrandedEther.mdx#ethertype)

Amount in Ether (string, supports decimals like "1.5")

###### Returns

[`WeiType`](#weitype)

Amount in Wei (bigint)

###### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

###### Since

0.0.0

###### Throws

If ether value has more than 18 decimal places

###### Example

```typescript theme={null}
const wei1 = Wei.fromEther(Ether.from("1"));     // 1000000000000000000n
const wei2 = Wei.fromEther(Ether.from("1.5"));   // 1500000000000000000n
```

##### fromGwei()

> **fromGwei**: (`gwei`) => [`WeiType`](#weitype)

Convert Gwei to Wei

Parses decimal gwei string and converts to bigint wei value.
Alias for Gwei.toWei().

###### Parameters

###### gwei

[`GweiType`](BrandedGwei.mdx#gweitype)

Amount in Gwei (string, supports decimals like "1.5")

###### Returns

[`WeiType`](#weitype)

Amount in Wei (bigint)

###### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

###### Since

0.0.0

###### Throws

If gwei value has more than 9 decimal places

###### Example

```typescript theme={null}
const wei1 = Wei.fromGwei(Gwei.from("5"));     // 5000000000n
const wei2 = Wei.fromGwei(Gwei.from("1.5"));   // 1500000000n
```

##### toEther()

> **toEther**: (`wei`) => [`EtherType`](BrandedEther.mdx#ethertype)

Convert Wei to Ether

Converts bigint wei to decimal string ether value.

###### Parameters

###### wei

[`WeiType`](#weitype)

Amount in Wei (bigint)

###### Returns

[`EtherType`](BrandedEther.mdx#ethertype)

Amount in Ether (string with decimal precision)

###### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

###### Since

0.0.0

###### Throws

###### Example

```typescript theme={null}
const ether1 = Wei.toEther(Wei.from(1000000000000000000n)); // "1"
const ether2 = Wei.toEther(Wei.from(1500000000000000000n)); // "1.5"
const ether3 = Wei.toEther(Wei.from(1000000000000000n));    // "0.001"
```

##### toGwei()

> **toGwei**: (`wei`) => [`GweiType`](BrandedGwei.mdx#gweitype)

Convert Wei to Gwei

Converts bigint wei to decimal string gwei value.

###### Parameters

###### wei

[`WeiType`](#weitype)

Amount in Wei (bigint)

###### Returns

[`GweiType`](BrandedGwei.mdx#gweitype)

Amount in Gwei (string with decimal precision)

###### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

###### Since

0.0.0

###### Throws

###### Example

```typescript theme={null}
const gwei1 = Wei.toGwei(Wei.from(5000000000n)); // "5"
const gwei2 = Wei.toGwei(Wei.from(1500000000n)); // "1.5"
const gwei3 = Wei.toGwei(Wei.from(1000000n));    // "0.001"
```

##### toU256()

> **toU256**: (`wei`) => [`Type`](../../primitives/Uint.mdx#type)

Convert Wei to base Uint256 type

###### Parameters

###### wei

[`WeiType`](#weitype)

Amount in Wei

###### Returns

[`Type`](../../primitives/Uint.mdx#type)

Uint256 value (type cast, no conversion)

###### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

###### Since

0.0.0

###### Throws

###### Example

```typescript theme={null}
const wei = Wei.from(1000000000n);
const u256 = Wei.toU256(wei);
// u256 = 1000000000n (as Uint256)
```

***

### WEI\_PER\_ETHER

> `const` **WEI\_PER\_ETHER**: `1000000000000000000n` = `1_000_000_000_000_000_000n`

Defined in: [src/primitives/Denomination/wei-constants.ts:15](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/wei-constants.ts#L15)

Conversion constant: Wei per Ether (10^18)

#### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

#### Since

0.0.0

***

### WEI\_PER\_GWEI

> `const` **WEI\_PER\_GWEI**: `1000000000n` = `1_000_000_000n`

Defined in: [src/primitives/Denomination/wei-constants.ts:7](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/wei-constants.ts#L7)

Conversion constant: Wei per Gwei (10^9)

#### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

#### Since

0.0.0

## Functions

### from()

> **from**(`value`): [`WeiType`](#weitype)

Defined in: [src/primitives/Denomination/wei-from.ts:20](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/wei-from.ts#L20)

Create Wei from bigint, number, or string

#### Parameters

##### value

Value to convert (bigint, number, or string)

`string` | `number` | `bigint`

#### Returns

[`WeiType`](#weitype)

Wei amount

#### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

#### Since

0.0.0

#### Throws

#### Example

```typescript theme={null}
const wei1 = Wei.from(1000000000n);
const wei2 = Wei.from(1000000000);
const wei3 = Wei.from("1000000000");
const wei4 = Wei.from("0x3b9aca00");
```

***

### fromEther()

> **fromEther**(`ether`): [`WeiType`](#weitype)

Defined in: [src/primitives/Denomination/wei-fromEther.ts:22](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/wei-fromEther.ts#L22)

Convert Ether to Wei

Parses decimal ether string and converts to bigint wei value.
Alias for Ether.toWei().

#### Parameters

##### ether

[`EtherType`](BrandedEther.mdx#ethertype)

Amount in Ether (string, supports decimals like "1.5")

#### Returns

[`WeiType`](#weitype)

Amount in Wei (bigint)

#### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

#### Since

0.0.0

#### Throws

If ether value has more than 18 decimal places

#### Example

```typescript theme={null}
const wei1 = Wei.fromEther(Ether.from("1"));     // 1000000000000000000n
const wei2 = Wei.fromEther(Ether.from("1.5"));   // 1500000000000000000n
```

***

### fromGwei()

> **fromGwei**(`gwei`): [`WeiType`](#weitype)

Defined in: [src/primitives/Denomination/wei-fromGwei.ts:22](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/wei-fromGwei.ts#L22)

Convert Gwei to Wei

Parses decimal gwei string and converts to bigint wei value.
Alias for Gwei.toWei().

#### Parameters

##### gwei

[`GweiType`](BrandedGwei.mdx#gweitype)

Amount in Gwei (string, supports decimals like "1.5")

#### Returns

[`WeiType`](#weitype)

Amount in Wei (bigint)

#### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

#### Since

0.0.0

#### Throws

If gwei value has more than 9 decimal places

#### Example

```typescript theme={null}
const wei1 = Wei.fromGwei(Gwei.from("5"));     // 5000000000n
const wei2 = Wei.fromGwei(Gwei.from("1.5"));   // 1500000000n
```

***

### toEther()

> **toEther**(`wei`): [`EtherType`](BrandedEther.mdx#ethertype)

Defined in: [src/primitives/Denomination/wei-toEther.ts:23](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/wei-toEther.ts#L23)

Convert Wei to Ether

Converts bigint wei to decimal string ether value.

#### Parameters

##### wei

[`WeiType`](#weitype)

Amount in Wei (bigint)

#### Returns

[`EtherType`](BrandedEther.mdx#ethertype)

Amount in Ether (string with decimal precision)

#### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

#### Since

0.0.0

#### Throws

#### Example

```typescript theme={null}
const ether1 = Wei.toEther(Wei.from(1000000000000000000n)); // "1"
const ether2 = Wei.toEther(Wei.from(1500000000000000000n)); // "1.5"
const ether3 = Wei.toEther(Wei.from(1000000000000000n));    // "0.001"
```

***

### toGwei()

> **toGwei**(`wei`): [`GweiType`](BrandedGwei.mdx#gweitype)

Defined in: [src/primitives/Denomination/wei-toGwei.ts:23](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/wei-toGwei.ts#L23)

Convert Wei to Gwei

Converts bigint wei to decimal string gwei value.

#### Parameters

##### wei

[`WeiType`](#weitype)

Amount in Wei (bigint)

#### Returns

[`GweiType`](BrandedGwei.mdx#gweitype)

Amount in Gwei (string with decimal precision)

#### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

#### Since

0.0.0

#### Throws

#### Example

```typescript theme={null}
const gwei1 = Wei.toGwei(Wei.from(5000000000n)); // "5"
const gwei2 = Wei.toGwei(Wei.from(1500000000n)); // "1.5"
const gwei3 = Wei.toGwei(Wei.from(1000000n));    // "0.001"
```

***

### toU256()

> **toU256**(`wei`): [`Type`](../../primitives/Uint.mdx#type)

Defined in: [src/primitives/Denomination/wei-toU256.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Denomination/wei-toU256.ts#L19)

Convert Wei to base Uint256 type

#### Parameters

##### wei

[`WeiType`](#weitype)

Amount in Wei

#### Returns

[`Type`](../../primitives/Uint.mdx#type)

Uint256 value (type cast, no conversion)

#### See

[https://voltaire.tevm.sh/primitives/denomination](https://voltaire.tevm.sh/primitives/denomination) for Denomination documentation

#### Since

0.0.0

#### Throws

#### Example

```typescript theme={null}
const wei = Wei.from(1000000000n);
const u256 = Wei.toU256(wei);
// u256 = 1000000000n (as Uint256)
```
