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

primitives/GasEstimate

Type Aliases

GasEstimateType

GasEstimateType = bigint & object
Defined in: src/primitives/GasEstimate/GasEstimateType.ts:8 Branded GasEstimate type - estimated gas for transaction Returned by eth_estimateGas RPC method Should add buffer (20-30%) for actual transaction

Type Declaration

[brand]
readonly [brand]: "GasEstimate"

Variables

GasEstimate

const GasEstimate: object
Defined in: src/primitives/GasEstimate/index.ts:67

Type Declaration

compare()
compare: (value1, value2) => number
Parameters
value1
string | number | bigint
value2
string | number | bigint
Returns
number
equals()
equals: (value1, value2) => boolean
Parameters
value1
string | number | bigint
value2
string | number | bigint
Returns
boolean
from()
from: (value) => GasEstimateType
Create GasEstimate from number, bigint, or string
Parameters
value
Gas estimate value string | number | bigint
Returns
GasEstimateType Branded gas estimate
Throws
If value is negative
Example
toBigInt()
toBigInt: (value) => bigint
Parameters
value
string | number | bigint
Returns
bigint
toGasLimit()
toGasLimit: (estimate) => bigint
Parameters
estimate
string | number | bigint
Returns
bigint
toHex()
toHex: (value) => string
Parameters
value
string | number | bigint
Returns
string
toNumber()
toNumber: (value) => number
Parameters
value
string | number | bigint
Returns
number
withBuffer()
withBuffer: (estimate, percentageBuffer) => GasEstimateType
Parameters
estimate
string | number | bigint
percentageBuffer
number
Returns
GasEstimateType

Functions

_compare()

_compare(this, other): number
Defined in: src/primitives/GasEstimate/compare.js:15 Compare two GasEstimate values

Parameters

this
GasEstimateType
other
GasEstimateType Other gas estimate value

Returns

number -1 if this < other, 0 if equal, 1 if this > other

Example


_equals()

_equals(this, other): boolean
Defined in: src/primitives/GasEstimate/equals.js:15 Check if two GasEstimate values are equal

Parameters

this
GasEstimateType
other
GasEstimateType Other gas estimate value

Returns

boolean True if equal

Example


_toBigInt()

_toBigInt(this): bigint
Defined in: src/primitives/GasEstimate/toBigInt.js:13 Convert GasEstimate to bigint (identity, for compatibility)

Parameters

this
GasEstimateType

Returns

bigint Gas estimate as bigint

Example


_toGasLimit()

_toGasLimit(this): bigint
Defined in: src/primitives/GasEstimate/toGasLimit.js:15 Convert GasEstimate to GasLimit type Typically used after adding buffer with withBuffer()

Parameters

this
GasEstimateType

Returns

bigint Gas limit value (unbranded bigint)

Example


_toHex()

_toHex(this): string
Defined in: src/primitives/GasEstimate/toHex.js:13 Convert GasEstimate to hex string

Parameters

this
GasEstimateType

Returns

string Gas estimate as hex string (0x prefixed)

Example


_toNumber()

_toNumber(this): number
Defined in: src/primitives/GasEstimate/toNumber.js:13 Convert GasEstimate to number

Parameters

this
GasEstimateType

Returns

number Gas estimate as number

Example


_withBuffer()

_withBuffer(this, percentageBuffer): GasEstimateType
Defined in: src/primitives/GasEstimate/withBuffer.js:18 Add percentage buffer to gas estimate Recommended: 20-30% to account for variability

Parameters

this
GasEstimateType
percentageBuffer
number Padding percentage (e.g., 20 for 20%)

Returns

GasEstimateType Estimate with buffer

Example


compare()

compare(value1, value2): number
Defined in: src/primitives/GasEstimate/index.ts:37

Parameters

value1
string | number | bigint
value2
string | number | bigint

Returns

number

equals()

equals(value1, value2): boolean
Defined in: src/primitives/GasEstimate/index.ts:30

Parameters

value1
string | number | bigint
value2
string | number | bigint

Returns

boolean

from()

from(value): GasEstimateType
Defined in: src/primitives/GasEstimate/from.js:16 Create GasEstimate from number, bigint, or string

Parameters

value
Gas estimate value string | number | bigint

Returns

GasEstimateType Branded gas estimate

Throws

If value is negative

Example


toBigInt()

toBigInt(value): bigint
Defined in: src/primitives/GasEstimate/index.ts:22

Parameters

value
string | number | bigint

Returns

bigint

toGasLimit()

toGasLimit(estimate): bigint
Defined in: src/primitives/GasEstimate/index.ts:51

Parameters

estimate
string | number | bigint

Returns

bigint

toHex()

toHex(value): string
Defined in: src/primitives/GasEstimate/index.ts:26

Parameters

value
string | number | bigint

Returns

string

toNumber()

toNumber(value): number
Defined in: src/primitives/GasEstimate/index.ts:18

Parameters

value
string | number | bigint

Returns

number

withBuffer()

withBuffer(estimate, percentageBuffer): GasEstimateType
Defined in: src/primitives/GasEstimate/index.ts:44

Parameters

estimate
string | number | bigint
percentageBuffer
number

Returns

GasEstimateType