@tevm/voltaire / primitives/Gas
primitives/Gas
Type Aliases
GasLimitType
GasLimitType =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 bigintbigint&object
Type Declaration
[brand]
readonly[brand]:"GasLimit"
GasPriceType
GasPriceType =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 bigintbigint&object
Type Declaration
[brand]
readonly[brand]:"GasPrice"
Variables
DEFAULT_LIMIT
Defined in: src/primitives/Gas/gasLimitConstants.js:6constDEFAULT_LIMIT:Type
ERC20_TRANSFER
Defined in: src/primitives/Gas/gasLimitConstants.js:5constERC20_TRANSFER:Type
GasLimit
Defined in: src/primitives/Gas/index.ts:54constGasLimit:object
Type Declaration
from()
from: (Create GasLimit from number, bigint, or hex stringvalue) =>GasLimitType=gasLimitFrom
Parameters
value
Value to convertstring | 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
Defined in: src/primitives/Gas/index.ts:60constGasPrice:object
Type Declaration
from()
from: (Create GasPrice from number, bigint, or hex stringvalue) =>GasPriceType=gasPriceFrom
Parameters
value
Value in weistring | number | bigint
Returns
GasPriceType
Gas price
Example
fromGwei()
fromGwei: (Create GasPrice from gweigwei) =>GasPriceType=gasPriceFromGwei
Parameters
gwei
Value in gweinumber | 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
Defined in: src/primitives/Gas/gasLimitConstants.js:4constSIMPLE_TRANSFER:Type
Functions
_gasLimitToBigInt()
_gasLimitToBigInt(Defined in: src/primitives/Gas/gasLimitToBigInt.js:14 Convert GasLimit to bigintthis):bigint
Parameters
this
GasLimitType
Returns
bigint
BigInt
Example
_gasLimitToNumber()
_gasLimitToNumber(Defined in: src/primitives/Gas/gasLimitToNumber.js:15 Convert GasLimit to numberthis):number
Parameters
this
GasLimitType
Returns
number
Number
Throws
If value exceeds safe integer rangeExample
_gasPriceToBigInt()
_gasPriceToBigInt(Defined in: src/primitives/Gas/gasPriceToBigInt.js:14 Convert GasPrice to bigintthis):bigint
Parameters
this
GasPriceType
Returns
bigint
BigInt in wei
Example
_gasPriceToGwei()
_gasPriceToGwei(Defined in: src/primitives/Gas/gasPriceToGwei.js:16 Convert GasPrice to gweithis):bigint
Parameters
this
GasPriceType
Returns
bigint
Value in gwei
Example
gasLimitFrom()
gasLimitFrom(Defined in: src/primitives/Gas/gasLimitFrom.js:16 Create GasLimit from number, bigint, or hex stringvalue):GasLimitType
Parameters
value
Value to convertstring | number | bigint
Returns
GasLimitType
Gas limit
Example
gasLimitToBigInt()
gasLimitToBigInt(Defined in: src/primitives/Gas/index.ts:27value):bigint
Parameters
value
string | number | bigint
Returns
bigint
gasLimitToNumber()
gasLimitToNumber(Defined in: src/primitives/Gas/index.ts:31value):number
Parameters
value
string | number | bigint
Returns
number
gasPriceFrom()
gasPriceFrom(Defined in: src/primitives/Gas/gasPriceFrom.js:16 Create GasPrice from number, bigint, or hex stringvalue):GasPriceType
Parameters
value
Value in weistring | number | bigint
Returns
GasPriceType
Gas price
Example
gasPriceFromGwei()
gasPriceFromGwei(Defined in: src/primitives/Gas/gasPriceFromGwei.js:16 Create GasPrice from gweigwei):GasPriceType
Parameters
gwei
Value in gweinumber | bigint
Returns
GasPriceType
Gas price in wei
Example
gasPriceToBigInt()
gasPriceToBigInt(Defined in: src/primitives/Gas/index.ts:42value):bigint
Parameters
value
string | number | bigint
Returns
bigint
gasPriceToGwei()
gasPriceToGwei(Defined in: src/primitives/Gas/index.ts:46value):bigint
Parameters
value
string | number | bigint
Returns
bigint
