Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/Gas

primitives/Gas

Type Aliases

GasLimitType

GasLimitType = bigint & object
Defined in: src/primitives/Gas/GasLimitType.ts:7 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 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
Defined in: src/primitives/Gas/gasLimitConstants.js:6

ERC20_TRANSFER

const ERC20_TRANSFER: Type
Defined in: src/primitives/Gas/gasLimitConstants.js:5

GasLimit

const GasLimit: object
Defined in: src/primitives/Gas/index.ts:54

Type Declaration

from()
from: (value) => GasLimitType = gasLimitFrom
Create GasLimit from number, bigint, or hex string
Parameters
value
Value to convert string | number | bigint
Returns
GasLimitType Gas limit
Example
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

Type Declaration

from()
from: (value) => GasPriceType = gasPriceFrom
Create GasPrice from number, bigint, or hex string
Parameters
value
Value in wei string | number | bigint
Returns
GasPriceType Gas price
Example
fromGwei()
fromGwei: (gwei) => GasPriceType = gasPriceFromGwei
Create GasPrice from gwei
Parameters
gwei
Value in gwei number | bigint
Returns
GasPriceType Gas price in wei
Example
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
Defined in: src/primitives/Gas/gasLimitConstants.js:4

Functions

_gasLimitToBigInt()

_gasLimitToBigInt(this): bigint
Defined in: src/primitives/Gas/gasLimitToBigInt.js:14 Convert GasLimit to bigint

Parameters

this
GasLimitType

Returns

bigint BigInt

Example


_gasLimitToNumber()

_gasLimitToNumber(this): number
Defined in: src/primitives/Gas/gasLimitToNumber.js:15 Convert GasLimit to number

Parameters

this
GasLimitType

Returns

number Number

Throws

If value exceeds safe integer range

Example


_gasPriceToBigInt()

_gasPriceToBigInt(this): bigint
Defined in: src/primitives/Gas/gasPriceToBigInt.js:14 Convert GasPrice to bigint

Parameters

this
GasPriceType

Returns

bigint BigInt in wei

Example


_gasPriceToGwei()

_gasPriceToGwei(this): bigint
Defined in: src/primitives/Gas/gasPriceToGwei.js:16 Convert GasPrice to gwei

Parameters

this
GasPriceType

Returns

bigint Value in gwei

Example


gasLimitFrom()

gasLimitFrom(value): GasLimitType
Defined in: src/primitives/Gas/gasLimitFrom.js:16 Create GasLimit from number, bigint, or hex string

Parameters

value
Value to convert string | number | bigint

Returns

GasLimitType Gas limit

Example


gasLimitToBigInt()

gasLimitToBigInt(value): bigint
Defined in: src/primitives/Gas/index.ts:27

Parameters

value
string | number | bigint

Returns

bigint

gasLimitToNumber()

gasLimitToNumber(value): number
Defined in: src/primitives/Gas/index.ts:31

Parameters

value
string | number | bigint

Returns

number

gasPriceFrom()

gasPriceFrom(value): GasPriceType
Defined in: src/primitives/Gas/gasPriceFrom.js:16 Create GasPrice from number, bigint, or hex string

Parameters

value
Value in wei string | number | bigint

Returns

GasPriceType Gas price

Example


gasPriceFromGwei()

gasPriceFromGwei(gwei): GasPriceType
Defined in: src/primitives/Gas/gasPriceFromGwei.js:16 Create GasPrice from gwei

Parameters

gwei
Value in gwei number | bigint

Returns

GasPriceType Gas price in wei

Example


gasPriceToBigInt()

gasPriceToBigInt(value): bigint
Defined in: src/primitives/Gas/index.ts:42

Parameters

value
string | number | bigint

Returns

bigint

gasPriceToGwei()

gasPriceToGwei(value): bigint
Defined in: src/primitives/Gas/index.ts:46

Parameters

value
string | number | bigint

Returns

bigint