> ## 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/Gas

> Auto-generated API documentation

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

***

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

# primitives/Gas

## Type Aliases

### GasLimitType

> **GasLimitType** = `bigint` & `object`

Defined in: [src/primitives/Gas/GasLimitType.ts:7](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/GasLimitType.ts#L7)

Branded GasLimit type - prevents gas parameter confusion
Represents maximum gas units for a transaction as a branded bigint

#### Type Declaration

##### \[brand]

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

***

### GasPriceType

> **GasPriceType** = `bigint` & `object`

Defined in: [src/primitives/Gas/GasPriceType.ts:7](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/GasPriceType.ts#L7)

Branded GasPrice type - prevents gas parameter confusion
Represents gas price in wei per gas unit as a branded bigint

#### Type Declaration

##### \[brand]

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

## Variables

### DEFAULT\_LIMIT

> `const` **DEFAULT\_LIMIT**: [`Type`](Uint.mdx#type)

Defined in: [src/primitives/Gas/gasLimitConstants.js:6](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/gasLimitConstants.js#L6)

***

### ERC20\_TRANSFER

> `const` **ERC20\_TRANSFER**: [`Type`](Uint.mdx#type)

Defined in: [src/primitives/Gas/gasLimitConstants.js:5](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/gasLimitConstants.js#L5)

***

### GasLimit

> `const` **GasLimit**: `object`

Defined in: [src/primitives/Gas/index.ts:54](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/index.ts#L54)

#### Type Declaration

##### from()

> **from**: (`value`) => [`GasLimitType`](#gaslimittype) = `gasLimitFrom`

Create GasLimit from number, bigint, or hex string

###### Parameters

###### value

Value to convert

`string` | `number` | `bigint`

###### Returns

[`GasLimitType`](#gaslimittype)

Gas limit

###### Example

```typescript theme={null}
const limit1 = GasLimit.from(21000);
const limit2 = GasLimit.from(21000n);
const limit3 = GasLimit.from("0x5208");
```

##### toBigInt()

> **toBigInt**: (`value`) => `bigint` = `gasLimitToBigInt`

###### Parameters

###### value

`string` | `number` | `bigint`

###### Returns

`bigint`

##### toNumber()

> **toNumber**: (`value`) => `number` = `gasLimitToNumber`

###### Parameters

###### value

`string` | `number` | `bigint`

###### Returns

`number`

***

### GasPrice

> `const` **GasPrice**: `object`

Defined in: [src/primitives/Gas/index.ts:60](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/index.ts#L60)

#### Type Declaration

##### from()

> **from**: (`value`) => [`GasPriceType`](#gaspricetype) = `gasPriceFrom`

Create GasPrice from number, bigint, or hex string

###### Parameters

###### value

Value in wei

`string` | `number` | `bigint`

###### Returns

[`GasPriceType`](#gaspricetype)

Gas price

###### Example

```typescript theme={null}
const price1 = GasPrice.from(20_000_000_000); // 20 gwei
const price2 = GasPrice.from(20_000_000_000n);
const price3 = GasPrice.from("0x4a817c800");
```

##### fromGwei()

> **fromGwei**: (`gwei`) => [`GasPriceType`](#gaspricetype) = `gasPriceFromGwei`

Create GasPrice from gwei

###### Parameters

###### gwei

Value in gwei

`number` | `bigint`

###### Returns

[`GasPriceType`](#gaspricetype)

Gas price in wei

###### Example

```typescript theme={null}
const price = GasPrice.fromGwei(20); // 20 gwei = 20000000000 wei
```

##### toBigInt()

> **toBigInt**: (`value`) => `bigint` = `gasPriceToBigInt`

###### Parameters

###### value

`string` | `number` | `bigint`

###### Returns

`bigint`

##### toGwei()

> **toGwei**: (`value`) => `bigint` = `gasPriceToGwei`

###### Parameters

###### value

`string` | `number` | `bigint`

###### Returns

`bigint`

***

### SIMPLE\_TRANSFER

> `const` **SIMPLE\_TRANSFER**: [`Type`](Uint.mdx#type)

Defined in: [src/primitives/Gas/gasLimitConstants.js:4](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/gasLimitConstants.js#L4)

## Functions

### \_gasLimitToBigInt()

> **\_gasLimitToBigInt**(`this`): `bigint`

Defined in: [src/primitives/Gas/gasLimitToBigInt.js:14](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/gasLimitToBigInt.js#L14)

Convert GasLimit to bigint

#### Parameters

##### this

[`GasLimitType`](#gaslimittype)

#### Returns

`bigint`

BigInt

#### Example

```typescript theme={null}
const n = GasLimit._toBigInt.call(limit);
```

***

### \_gasLimitToNumber()

> **\_gasLimitToNumber**(`this`): `number`

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

Convert GasLimit to number

#### Parameters

##### this

[`GasLimitType`](#gaslimittype)

#### Returns

`number`

Number

#### Throws

If value exceeds safe integer range

#### Example

```typescript theme={null}
const n = GasLimit._toNumber.call(limit);
```

***

### \_gasPriceToBigInt()

> **\_gasPriceToBigInt**(`this`): `bigint`

Defined in: [src/primitives/Gas/gasPriceToBigInt.js:14](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/gasPriceToBigInt.js#L14)

Convert GasPrice to bigint

#### Parameters

##### this

[`GasPriceType`](#gaspricetype)

#### Returns

`bigint`

BigInt in wei

#### Example

```typescript theme={null}
const n = GasPrice._toBigInt.call(price);
```

***

### \_gasPriceToGwei()

> **\_gasPriceToGwei**(`this`): `bigint`

Defined in: [src/primitives/Gas/gasPriceToGwei.js:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/gasPriceToGwei.js#L16)

Convert GasPrice to gwei

#### Parameters

##### this

[`GasPriceType`](#gaspricetype)

#### Returns

`bigint`

Value in gwei

#### Example

```typescript theme={null}
const gwei = GasPrice._toGwei.call(price);
```

***

### gasLimitFrom()

> **gasLimitFrom**(`value`): [`GasLimitType`](#gaslimittype)

Defined in: [src/primitives/Gas/gasLimitFrom.js:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/gasLimitFrom.js#L16)

Create GasLimit from number, bigint, or hex string

#### Parameters

##### value

Value to convert

`string` | `number` | `bigint`

#### Returns

[`GasLimitType`](#gaslimittype)

Gas limit

#### Example

```typescript theme={null}
const limit1 = GasLimit.from(21000);
const limit2 = GasLimit.from(21000n);
const limit3 = GasLimit.from("0x5208");
```

***

### gasLimitToBigInt()

> **gasLimitToBigInt**(`value`): `bigint`

Defined in: [src/primitives/Gas/index.ts:27](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/index.ts#L27)

#### Parameters

##### value

`string` | `number` | `bigint`

#### Returns

`bigint`

***

### gasLimitToNumber()

> **gasLimitToNumber**(`value`): `number`

Defined in: [src/primitives/Gas/index.ts:31](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/index.ts#L31)

#### Parameters

##### value

`string` | `number` | `bigint`

#### Returns

`number`

***

### gasPriceFrom()

> **gasPriceFrom**(`value`): [`GasPriceType`](#gaspricetype)

Defined in: [src/primitives/Gas/gasPriceFrom.js:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/gasPriceFrom.js#L16)

Create GasPrice from number, bigint, or hex string

#### Parameters

##### value

Value in wei

`string` | `number` | `bigint`

#### Returns

[`GasPriceType`](#gaspricetype)

Gas price

#### Example

```typescript theme={null}
const price1 = GasPrice.from(20_000_000_000); // 20 gwei
const price2 = GasPrice.from(20_000_000_000n);
const price3 = GasPrice.from("0x4a817c800");
```

***

### gasPriceFromGwei()

> **gasPriceFromGwei**(`gwei`): [`GasPriceType`](#gaspricetype)

Defined in: [src/primitives/Gas/gasPriceFromGwei.js:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/gasPriceFromGwei.js#L16)

Create GasPrice from gwei

#### Parameters

##### gwei

Value in gwei

`number` | `bigint`

#### Returns

[`GasPriceType`](#gaspricetype)

Gas price in wei

#### Example

```typescript theme={null}
const price = GasPrice.fromGwei(20); // 20 gwei = 20000000000 wei
```

***

### gasPriceToBigInt()

> **gasPriceToBigInt**(`value`): `bigint`

Defined in: [src/primitives/Gas/index.ts:42](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/index.ts#L42)

#### Parameters

##### value

`string` | `number` | `bigint`

#### Returns

`bigint`

***

### gasPriceToGwei()

> **gasPriceToGwei**(`value`): `bigint`

Defined in: [src/primitives/Gas/index.ts:46](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/Gas/index.ts#L46)

#### Parameters

##### value

`string` | `number` | `bigint`

#### Returns

`bigint`
